2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2008 */
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
13 // $Id: tac_edit.php 8319 2009-03-03 16:38:19Z hwong $
14 define('AT_INCLUDE_PATH', '../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
17 admin_authenticate(AT_ADMIN_TERMS_AND_CONDITIONS);
20 if (isset($_POST['submit'])){
21 $_POST['enable_terms_and_conditions'] = intval($_POST['enable_terms_and_conditions']);
22 $_POST['formatting'] = intval($_POST['formatting']);
23 $_POST['body_text'] = trim($addslashes($_POST['body_text']));
24 $_POST['tac_link'] = (trim($addslashes($_POST['tac_link']))=='')?AT_BASE_HREF.'about.php':trim($addslashes($_POST['tac_link']));
25 if ($_POST['body_text']!=''){
26 $sql = 'REPLACE INTO '.TABLE_PREFIX."config VALUES ('tac_link', '$_POST[tac_link]')";
27 mysql_query($sql, $db);
29 $sql = 'REPLACE INTO '.TABLE_PREFIX."config VALUES ('tac_body', '$_POST[body_text]')";
30 mysql_query($sql, $db);
32 $sql = 'REPLACE INTO '.TABLE_PREFIX."config VALUES ('enable_terms_and_conditions', $_POST[enable_terms_and_conditions])";
33 mysql_query($sql, $db);
35 $msg->addFeedback('TAC_SAVED');
37 header('Location: tac_edit.php');
41 //get config preferences
42 $_POST['body_text'] = htmlentities($_config['tac_body']);
43 $_POST['tac_link'] = htmlentities($_config['tac_link']);
45 if (!isset($_REQUEST['setvisual']) && !isset($_REQUEST['settext'])) {
46 if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 1) {
47 $_POST['formatting'] = 1;
48 $_REQUEST['settext'] = 0;
49 $_REQUEST['setvisual'] = 0;
51 } else if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
52 $_POST['formatting'] = 1;
53 $_POST['settext'] = 0;
54 $_POST['setvisual'] = 1;
56 } else { // else if == 0
57 $_POST['formatting'] = 0;
58 $_REQUEST['settext'] = 0;
59 $_REQUEST['setvisual'] = 0;
64 include(AT_INCLUDE_PATH.'header.inc.php');
65 if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']) {
69 <div class="input-form">
70 <form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>" name="form" >
73 <?php echo _AT('enable_terms_and_conditions'); ?> <br />
74 <input type="radio" name="enable_terms_and_conditions" value="1" id="terms_and_conditions_y" <?php if($_config['enable_terms_and_conditions']) { echo 'checked="checked"'; }?> /><label for="terms_and_conditions_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="enable_terms_and_conditions" value="0" id="terms_and_conditions_n" <?php if(!$_config['enable_terms_and_conditions']) { echo 'checked="checked"'; }?> /><label for="terms_and_conditions_n"><?php echo _AT('disable'); ?></label>
77 <label for="tac_link"><?php echo _AT('tac_link'); ?></label><br/>
78 <input id="tac_link" type="text" name="tac_link" value="<?php echo $_POST['tac_link']; ?>" size="80"/>
81 <?php echo _AT('formatting'); ?><br />
82 <input type="radio" name="formatting" value="0" id="text" <?php if ($_POST['formatting'] == 0) { echo 'checked="checked"'; } ?> onclick="javascript: document.form.setvisual.disabled=true;" <?php if ($_POST['setvisual'] && !$_POST['settext']) { echo 'disabled="disabled"'; } ?> />
84 <label for="text"><?php echo _AT('plain_text'); ?></label>
85 <input type="radio" name="formatting" value="1" id="html" <?php if ($_POST['formatting'] == 1 || $_POST['setvisual']) { echo 'checked="checked"'; } ?> onclick="javascript: document.form.setvisual.disabled=false;"/>
87 <label for="html"><?php echo _AT('html'); ?></label>
88 <?php //Button for enabling/disabling visual editor
89 if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']){
90 echo '<input type="hidden" name="setvisual" value="'.$_POST['setvisual'].'" />';
91 echo '<input type="submit" name="settext" value="'._AT('switch_text').'" />';
93 echo '<input type="submit" name="setvisual" value="'._AT('switch_visual').'" ';
94 if ($_POST['formatting']==0) { echo 'disabled="disabled"'; }
101 <label for='body_text'><?php echo _AT('terms_and_conditions');?></label><br/>
102 <textarea name="body_text" cols="55" rows="15" id="body_text"><?php echo $_POST['body_text']; ?></textarea>
105 <div class="row buttons">
106 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
107 <input type="reset" name="reset" value="<?php echo _AT('reset'); ?> " />
112 <?php include(AT_INCLUDE_PATH.'footer.inc.php'); ?>