4837: Upgraded infusion library to 1.4 as of Sep 13, 2011.
[atutor.git] / docs / admin / config_edit.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id$
13
14 define('AT_INCLUDE_PATH', '../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
17
18 global $stripslashes;
19
20 if (isset($_POST['cancel'])) {
21         $msg->addFeedback('CANCELLED');
22         header('Location: index.php');
23         exit;
24 } else if (isset($_POST['submit'])) {
25         $missing_fields = array();
26
27         $_POST['site_name']          = trim($_POST['site_name']);
28         $_POST['home_url']           = trim($_POST['home_url']);
29         $_POST['default_language']   = trim($_POST['default_language']);
30         $_POST['contact_email']      = trim($_POST['contact_email']);
31         $_POST['max_file_size']      = intval($_POST['max_file_size']);
32         $_POST['max_file_size']      = max(0, $_POST['max_file_size']);
33         $_POST['max_course_size']    = intval($_POST['max_course_size']);
34         $_POST['max_course_size']    = max(0, $_POST['max_course_size']);
35         $_POST['max_course_float']   = intval($_POST['max_course_float']);
36         $_POST['max_course_float']   = max(0, $_POST['max_course_float']);
37         $_POST['allow_registration']   = intval($_POST['allow_registration']);
38         $_POST['allow_browse']   = intval($_POST['allow_browse']);
39         $_POST['allow_instructor_registration']   = intval($_POST['allow_instructor_registration']);
40         $_POST['allow_unenroll']   = intval($_POST['allow_unenroll']);
41         $_POST['master_list']        = intval($_POST['master_list']);
42         $_POST['email_confirmation'] = intval($_POST['email_confirmation']);
43         $_POST['email_notification'] = intval($_POST['email_notification']);
44         $_POST['sent_msgs_ttl']      = intval($_POST['sent_msgs_ttl']);
45         $_POST['allow_instructor_requests'] = intval($_POST['allow_instructor_requests']);
46         $_POST['auto_approve_instructors']  = intval($_POST['auto_approve_instructors']);
47         $_POST['theme_categories']          = intval($_POST['theme_categories']);
48         $_POST['user_notes']                = intval($_POST['user_notes']);
49         $_POST['illegal_extentions']        = str_replace(array('  ', ' '), array(' ','|'), $_POST['illegal_extentions']);
50         $_POST['cache_dir']                 = trim($_POST['cache_dir']);
51         $_POST['latex_server']                          = (trim($_POST['latex_server'])==''?$_config['latex_server']:trim($_POST['latex_server']));
52         $_POST['course_backups']            = intval($_POST['course_backups']);
53         $_POST['course_backups']            = max(0, $_POST['course_backups']);
54         $_POST['check_version']             = $_POST['check_version'] ? 1 : 0;
55         $_POST['fs_versioning']             = $_POST['fs_versioning'] ? 1 : 0;
56         $_POST['enable_mail_queue']         = $_POST['enable_mail_queue'] ? 1 : 0;
57         $_POST['display_name_format']       = intval($_POST['display_name_format']);
58         $_POST['pretty_url']                            = intval($_POST['pretty_url']);
59         $_POST['course_dir_name']                       = intval($_POST['course_dir_name']);
60         $_POST['max_login']                                     = intval($_POST['max_login']);          //max login attempt
61         $_POST['use_captcha']                           = $_POST['use_captcha'] ? 1 : 0;
62
63         //apache_mod_rewrite can only be enabled if pretty_url is.
64         if ($_POST['pretty_url']==1){
65                 $_POST['apache_mod_rewrite']            = intval($_POST['apache_mod_rewrite']);
66         } else {
67                 $_POST['apache_mod_rewrite'] = 0;
68         }
69
70         if (!isset($display_name_formats[$_POST['display_name_format']])) {
71                 $_POST['display_name_format'] = $_config_defaults['display_name_format'];
72         }
73
74         //check that all values have been set   
75         if (!$_POST['site_name']) {
76                 $missing_fields[] = _AT('site_name');
77         }
78
79         /* email check */
80         if (!$_POST['contact_email']) {
81                 $missing_fields[] = _AT('contact_email');
82         } else if (!preg_match("/^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,6}$/i", $_POST['contact_email'])) {
83                 $msg->addError('EMAIL_INVALID');        
84         }
85
86         if ($_POST['cache_dir']) {
87                 if (!is_dir($_POST['cache_dir'])) {
88                         $msg->addError('CACHE_DIR_NOT_EXIST');
89                 } else if (!is_writable($_POST['cache_dir'])){
90                         $msg->addError('CACHE_DIR_NOT_WRITEABLE');
91                 }
92         }
93
94         if ($missing_fields) {
95                 $missing_fields = implode(', ', $missing_fields);
96                 $msg->addError(array('EMPTY_FIELDS', $missing_fields));
97         }
98
99         if (!$msg->containsErrors()) {
100                 $_POST['site_name']     = $addslashes($_POST['site_name']);
101                 $_POST['home_url']      = $addslashes($_POST['home_url']);
102                 $_POST['default_language']      = $addslashes($_POST['default_language']);
103                 $_POST['contact_email'] = $addslashes($_POST['contact_email']);
104                 $_POST['time_zone']     = floatval($_POST['time_zone']);
105
106                 foreach ($_config as $name => $value) {
107                         // the isset() is needed to avoid overridding settings that don't get set here (ie. modules)
108                         if (isset($_POST[$name]) && ($stripslashes($_POST[$name]) != $value) && ($stripslashes($_POST[$name]) != $_config_defaults[$name])) {
109                                 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('$name', '$_POST[$name]')";
110                                 mysql_query($sql, $db);
111                                 write_to_log(AT_ADMIN_LOG_REPLACE, 'config', mysql_affected_rows($db), $sql);
112                         } else if (isset($_POST[$name]) && ($stripslashes($_POST[$name]) == $_config_defaults[$name])) {
113                                 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='$name'";
114                                 mysql_query($sql, $db);
115                                 write_to_log(AT_ADMIN_LOG_DELETE, 'config', mysql_affected_rows($db), $sql);
116                         }
117                 }
118
119                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
120
121                 // special case: disabling the mail queue should flush all queued mail:
122                 if (!$_POST['enable_mail_queue'] && $_POST['old_enable_mail_queue']) {
123                         require_once(AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php');
124                         $mail = new ATutorMailer;
125                         $mail->SendQueue();
126                 }
127
128                 header('Location: '.$_SERVER['PHP_SELF']);
129                 exit;
130         }
131 }
132
133 $onload = 'document.form.sitename.focus();';
134
135 require(AT_INCLUDE_PATH.'header.inc.php');
136
137 if (!isset($_POST['submit'])) {
138
139 } else {
140         $defaults = $_POST;
141 }
142 ?>
143
144 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
145 <div class="input-form">
146         <div class="row">
147                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="sitename"><?php echo _AT('site_name'); ?></label><br />
148                 <input type="text" name="site_name" size="40" maxlength="60" id="sitename" value="<?php if (!empty($_POST['site_name'])) { echo $stripslashes(htmlspecialchars($_POST['site_name'])); } else { echo $_config['site_name']; } ?>" />
149         </div>
150
151         <div class="row">
152                 <label for="home_url"><?php echo _AT('home_url'); ?></label><br />
153
154                 <input type="text" name="home_url" size="50" maxlength="60" id="home_url" value="<?php if (!empty($_POST['home_url'])) { echo $stripslashes(htmlspecialchars($_POST['home_url'])); } else { echo $_config['home_url']; } ?>"  />
155         </div>
156
157         <div class="row">
158                 <label for="default_lang"><?php echo _AT('default_language'); ?></label><br />
159
160                 <?php if (!empty($_POST['default_language'])) { 
161                                 $select_lang = $_POST['default_language']; 
162                         } else { 
163                                 $select_lang = $_config['default_language'];
164                         } ?>
165                 <?php if ($disabled): ?>
166                         <select name="default_language" id="default_lang" disabled="disabled"><option><?php echo $select_lang; ?></option></select>
167                 <?php else: ?>
168                         <?php $languageManager->printDropdown($select_lang, 'default_language', 'default_lang'); ?>
169                 <?php endif; ?>
170         </div>
171
172         <div class="row">
173                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="cemail"><?php echo _AT('contact_email'); ?></label><br />
174                 <input type="text" name="contact_email" id="cemail" size="40" value="<?php if (!empty($_POST['email'])) { echo $stripslashes(htmlspecialchars($_POST['email'])); } else { echo $_config['contact_email']; } ?>"  />
175         </div>
176
177         <div class="row">
178                 <label for="time_zone"><?php echo _AT('time_zone'); ?></label><br />
179
180                 <?php
181
182
183                 // Replace this hack to use the PHP timezone functions when the PHP requirement is raised to 5.3
184                 global $utc_timezones; // set in include/lib/constants.inc.php
185                 $local_offset = ((date(Z)/3600));
186                 echo '<select name="time_zone" id="time_zone">';        
187                         echo '<option value="0">'._AT('none').'</option>';
188                 foreach ($utc_timezones as $zone => $offset){
189                         if(($offset[1]) == $_config['time_zone']){
190                         echo '<option value="'.($offset[1]).'" selected="selected">'.$offset[1].'</option>';
191                         }else{
192                         echo '<option value="'.($offset[1]).'">'.$offset[1].'</option>';
193
194                         }
195                 }
196                 echo "</select>";
197
198
199                 //echo '<input type="text" name="time_zone" value="'.$_config['time_zone'].'" size="5" maxlength="5"/> ';
200
201                 // If PHP 5+ generate a list of timezones
202 /*
203                 if(phpversion() >= 5){
204                         $timezone_names = timezone_identifiers_list();
205                 }else{
206                 // if less than PHP version 5, read a text file to generate the menu
207                         $timezone_names = file("timezones.txt");
208                 }
209
210                 echo '<select name="time_zone">';
211                 foreach($timezone_names as $timezone_name){
212                         if($timezone_name == $_config{'time_zone'}){
213                                 $selected = ' selected="selected"';
214                         }
215                         echo '<option'.$selected.'>'.$timezone_name.'</option>';
216                         $selected = '';
217                 }
218                 echo '</select>';
219 */
220 echo AT_date(_AT('server_date_format'), '', AT_DATE_MYSQL_DATETIME);
221 ?>
222         </div>
223
224         <div class="row">
225                 <label for="maxfile"><?php echo _AT('maximum_file_size'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_file_size']; ?>)<br />
226                 <input type="text" size="10" name="max_file_size" id="maxfile" value="<?php if (!empty($_POST['max_file_size'])) { echo $stripslashes(htmlspecialchars($_POST['max_file_size'])); } else { echo $_config['max_file_size']; } ?>"  /> <?php echo _AT('bytes'); ?>
227         </div>
228
229         <div class="row">
230                 <label for="maxcourse"><?php echo _AT('maximum_course_size'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_course_size']; ?>)<br />
231                 <input type="text" size="10" name="max_course_size" id="maxcourse" value="<?php if (!empty($_POST['max_course_size'])) { echo $stripslashes(htmlspecialchars($_POST['max_course_size'])); } else { echo $_config['max_course_size']; } ?>"  /> <?php echo _AT('bytes'); ?>
232         </div>
233
234         <div class="row">
235                 <label for="float"><?php echo _AT('maximum_course_float'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_course_float']; ?>)<br />
236                 <input type="text" size="10" name="max_course_float" id="float" value="<?php if (!empty($_POST['max_course_float'])) { echo $stripslashes(htmlspecialchars($_POST['max_course_float'])); } else { echo $_config['max_course_float']; } ?>"  /> <?php echo _AT('bytes'); ?>
237         </div>
238
239         <div class="row">
240                 <label for="maximum_login_attempt"><?php echo _AT('maximum_login_attempt'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_login']; ?>)<br />
241                 <input type="text" size="10" name="max_login" id="maximum_login_attempt" value="<?php if (!empty($_POST['max_login'])) { echo $stripslashes(htmlspecialchars($_POST['max_login'])); } else { echo $_config['max_login']; } ?>"  /> <?php echo _AT('times'); ?>
242         </div>
243         
244         <div class="row">
245                 <?php echo _AT('display_name_format'); ?> (<?php echo _AT('default'); ?>: <?php echo _AT($display_name_formats[$_config_defaults['display_name_format']], _AT('login_name'), _AT('first_name'), _AT('second_name'), _AT('last_name')); ?>)<br />
246                 <?php foreach ($display_name_formats as $key => $value): ?>
247                         <input type="radio" name="display_name_format" value="<?php echo $key; ?>" id="dnf<?php echo $key; ?>" <?php if ($_config['display_name_format'] == $key) { echo 'checked="checked"'; }?> /><label for="dnf<?php echo $key; ?>"><?php echo _AT($value, _AT('login_name'), _AT('first_name'), _AT('second_name'), _AT('last_name')); ?></label><br />
248                 <?php endforeach; ?>
249         </div>
250
251         <div class="row">
252                 <?php echo _AT('master_list_authentication'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['master_list'] ? _AT('enable') : _AT('disable')); ?>)<br />
253                 <input type="radio" name="master_list" value="1" id="ml_y" <?php if ($_config['master_list']) { echo 'checked="checked"'; }?>  /><label for="ml_y"><?php echo _AT('enable'); ?></label> 
254
255                 <input type="radio" name="master_list" value="0" id="ml_n" <?php if(!$_config['master_list']) { echo 'checked="checked"'; }?>  /><label for="ml_n"><?php echo  _AT('disable'); ?></label>
256         </div>
257         <div class="row">
258                 <?php echo _AT('allow_registration'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_registration'] ? _AT('enable') : _AT('disable')); ?>)<br />
259                 <input type="radio" name="allow_registration" value="1" id="reg_y" <?php if($_config['allow_registration']) { echo 'checked="checked"'; }?>  /><label for="reg_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="allow_registration" value="0" id="reg_n" <?php if(!$_config['allow_registration']) { echo 'checked="checked"'; }?>  /><label for="reg_n"><?php echo _AT('disable'); ?></label>
260         </div>
261         <div class="row">
262                 <?php echo _AT('allow_browse'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_browse'] ? _AT('enable') : _AT('disable')); ?>)<br />
263                 <input type="radio" name="allow_browse" value="1" id="browse_y" <?php if($_config['allow_browse']) { echo 'checked="checked"'; }?>  /><label for="browse_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="allow_browse" value="0" id="browse_n" <?php if(!$_config['allow_browse']) { echo 'checked="checked"'; }?>  /><label for="browse_n"><?php echo _AT('disable'); ?></label>
264         </div>
265
266         <div class="row">
267                 <?php echo _AT('allow_instructor_registration'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_instructor_registration'] ? _AT('enable') : _AT('disable')); ?>)<br />
268                 <input type="radio" name="allow_instructor_registration" value="1" id="enrollreg_y" <?php if($_config['allow_instructor_registration']) { echo 'checked="checked"'; }?>  /><label for="enrollreg_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="allow_instructor_registration" value="0" id="enrollreg_n" <?php if(!$_config['allow_instructor_registration']) { echo 'checked="checked"'; }?>  /><label for="enrollreg_n"><?php echo _AT('disable'); ?></label>
269         </div>
270         <div class="row">               
271                 <?php echo _AT('use_captcha'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['use_captcha'] ? _AT('enable') : _AT('disable')); ?>)<br />
272                 <?php if (extension_loaded('gd')): ?>
273                 <input type="radio" name="use_captcha" value="1" id="use_captcha_y" <?php if($_config['use_captcha']) { echo 'checked="checked"'; }?>  /><label for="use_captcha_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="use_captcha" value="0" id="use_captcha_n" <?php if(!$_config['use_captcha']) { echo 'checked="checked"'; }?>  /><label for="use_captcha_n"><?php echo _AT('disable'); ?></label>
274                 <?php else: ?>
275                 <input type="radio" name="use_captcha" value="1" id="use_captcha_y" disabled="disabled" /><label for="use_captcha_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="use_captcha" value="0" id="use_captcha_n" checked="checked" /><label for="use_captcha_n"><?php echo _AT('disable'); ?></label>
276                 <?php endif; ?>
277         </div>
278         <div class="row">
279                 <?php echo _AT('allow_unenroll'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_unenroll'] ? _AT('enable') : _AT('disable')); ?>)<br />
280                 <input type="radio" name="allow_unenroll" value="1" id="ene_y" <?php if($_config['allow_unenroll']) { echo 'checked="checked"'; }?>  /><label for="ene_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="allow_unenroll" value="0" id="ene_n" <?php if(!$_config['allow_unenroll']) { echo 'checked="checked"'; }?>  /><label for="ene_n"><?php echo _AT('disable'); ?></label>
281         </div>
282
283         <div class="row">
284                 <?php echo _AT('require_email_confirmation'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['email_confirmation'] ? _AT('enable') : _AT('disable')); ?>)<br />
285                 <input type="radio" name="email_confirmation" value="1" id="ec_y" <?php if ($_config['email_confirmation']) { echo 'checked="checked"'; }?>  /><label for="ec_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="email_confirmation" value="0" id="ec_n" <?php if(!$_config['email_confirmation']) { echo 'checked="checked"'; }?>  /><label for="ec_n"><?php echo _AT('disable'); ?></label>
286         </div>
287                 
288         <div class="row">
289                 <?php echo _AT('allow_instructor_requests'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_instructor_requests'] ? _AT('enable') : _AT('disable')); ?>)<br />
290                 <input type="radio" name="allow_instructor_requests" value="1" id="air_y" <?php if($_config['allow_instructor_requests']) { echo 'checked="checked"'; }?>  /><label for="air_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="allow_instructor_requests" value="0" id="air_n" <?php if(!$_config['allow_instructor_requests']) { echo 'checked="checked"'; }?>  /><label for="air_n"><?php echo _AT('disable'); ?></label>
291         </div>
292
293         <div class="row">
294                 <?php echo _AT('instructor_request_email_notification'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['email_notification'] ? _AT('enable') : _AT('disable')); ?>)<br />
295                 <input type="radio" name="email_notification" value="1" id="en_y" <?php if ($_config['email_notification']) { echo 'checked="checked"'; }?>  /><label for="en_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="email_notification" value="0" id="en_n" <?php if(!$_config['email_notification']) { echo 'checked="checked"'; }?>  /><label for="en_n"><?php echo _AT('disable'); ?></label>
296         </div>
297
298         <div class="row">
299                 <?php echo _AT('auto_approve_instructors'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['auto_approve_instructors'] ? _AT('enable') : _AT('disable')); ?>)<br />
300                 <input type="radio" name="auto_approve_instructors" value="1" id="aai_y" <?php if($_config['auto_approve_instructors']) { echo 'checked="checked"'; }?>  /><label for="aai_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="auto_approve_instructors" value="0" id="aai_n" <?php if(!$_config['auto_approve_instructors']) { echo 'checked="checked"'; }?>  /><label for="aai_n"><?php echo _AT('disable'); ?></label>
301         </div>
302
303         <div class="row">
304                 <?php echo _AT('theme_specific_categories'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['theme_categories'] ? _AT('enable') : _AT('disable')); ?>)<br />
305                 <input type="radio" name="theme_categories" value="1" id="tc_y" <?php if($_config['theme_categories']) { echo 'checked="checked"'; }?>  /><label for="tc_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="theme_categories" value="0" id="tc_n" <?php if(!$_config['theme_categories']) { echo 'checked="checked"'; }?>  /><label for="tc_n"><?php echo _AT('disable'); ?></label>
306         </div>
307
308         <div class="row">
309                 <?php echo _AT('user_contributed_notes'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['user_notes'] ? _AT('enable') : _AT('disable')); ?>)<br />
310                 <input type="radio" name="user_notes" value="1" id="un_y" <?php if($_config['user_notes']) { echo 'checked="checked"'; }?>  /><label for="un_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="user_notes" value="0" id="un_n" <?php if(!$_config['user_notes']) { echo 'checked="checked"'; }?>  /><label for="un_n"><?php echo _AT('disable'); ?></label>
311         </div>
312
313         <div class="row">
314                 <label for="ext"><?php echo _AT('illegal_file_extensions'); ?></label><br />
315                 <textarea name="illegal_extentions" cols="24" id="ext" rows="2" class="formfield" ><?php if ($_config['illegal_extentions']) { echo str_replace('|',' ',$_config['illegal_extentions']); }?></textarea>
316         </div>
317
318         <div class="row">
319                 <label for="cache"><?php echo _AT('cache_directory'); ?></label><br />
320                 <input type="text" name="cache_dir" id="cache" size="40" value="<?php if (!empty($_POST['cache_dir'])) { echo $stripslashes(htmlspecialchars($_POST['cache_dir'])); } else { echo $_config['cache_dir']; } ?>"  />
321         </div>
322
323         <div class="row">
324                 <label for="latex_server"><?php echo _AT('latex_server'); ?></label><br />
325                 <input type="text" name="latex_server" id="latex_server" size="40" value="<?php if (!empty($_POST['latex_server'])) { echo $stripslashes(htmlspecialchars($_POST['latex_server'])); } else { echo $_config['latex_server']; } ?>"  />
326         </div>
327
328         <div class="row">
329                 <label for="course_backups"><?php echo _AT('course_backups'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['course_backups']; ?>)<br />
330                 <input type="text" size="2" name="course_backups" id="course_backups" value="<?php if (!empty($_POST['course_backups'])) { echo $stripslashes(htmlspecialchars($_POST['course_backups'])); } else { echo $_config['course_backups']; } ?>"  />
331         </div>
332
333         <div class="row">
334                 <label for="sent_msgs_ttl"><?php echo _AT('sent_msgs_ttl_text'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['sent_msgs_ttl']; ?>)<br />
335                 <input type="text" size="3" name="sent_msgs_ttl" id="sent_msgs_ttl" value="<?php if (!empty($_POST['sent_msgs_ttl'])) { echo intval($_POST['sent_msgs_ttl']); } else { echo $_config['sent_msgs_ttl']; } ?>"  />
336         </div>
337
338         <div class="row">
339                 <?php echo _AT('auto_check_new_version'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['check_version'] ? _AT('enable') : _AT('disable')); ?>)<br />
340                 <input type="radio" name="check_version" value="1" id="cv_y" <?php if($_config['check_version']) { echo 'checked="checked"'; }?>  /><label for="cv_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="check_version" value="0" id="cv_n" <?php if(!$_config['check_version']) { echo 'checked="checked"'; }?>  /><label for="cv_n"><?php echo _AT('disable'); ?></label>
341         </div>
342
343         <div class="row">
344                 <?php echo _AT('file_storage_version_control'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['fs_versioning'] ? _AT('enable') : _AT('disable')); ?>)<br />
345                 <input type="radio" name="fs_versioning" value="1" id="cf_y" <?php if($_config['fs_versioning']) { echo 'checked="checked"'; }?>  /><label for="cf_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="fs_versioning" value="0" id="cf_n" <?php if(!$_config['fs_versioning']) { echo 'checked="checked"'; }?>  /><label for="cf_n"><?php echo _AT('disable'); ?></label>
346         </div>
347
348         <div class="row">
349                 <input type="hidden" name="old_enable_mail_queue" value="<?php echo $_config['enable_mail_queue']; ?>" />
350                 <?php echo _AT('enable_mail_queue'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['enable_mail_queue'] ? _AT('enable') : _AT('disable')); ?>)<br />
351                 <?php echo _AT('mail_queue_cron'); ?><br />
352                 <?php if (!$_config['last_cron'] || (time() - (int) $_config['last_cron'] > 2 * 60 * 60)): ?>
353                         <input type="radio" name="enable_mail_queue" value="1" disabled="disabled" id="mq_y"  /><label for="mq_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="enable_mail_queue" value="0" id="mq_n" checked="checked" /><label for="mq_n"><?php echo _AT('disable'); ?></label>
354                 <?php else: ?>
355                         <input type="radio" name="enable_mail_queue" value="1" id="mq_y" <?php if($_config['enable_mail_queue']) { echo 'checked="checked"'; }?>  /><label for="mq_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="enable_mail_queue" value="0" id="mq_n" <?php if(!$_config['enable_mail_queue']) { echo 'checked="checked"'; }?>  /><label for="mq_n"><?php echo _AT('disable'); ?></label>
356                 <?php endif; ?>
357         </div>
358
359         <div class="row">
360                 <?php echo _AT('auto_install_languages'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['auto_install_languages'] ? _AT('enable') : _AT('disable')); ?>)<br />
361                 <?php echo _AT('auto_install_languages_cron'); ?><br />
362                 <?php if (!$_config['last_cron'] || (time() - (int) $_config['last_cron'] > 2 * 60 * 60)): ?>
363                         <input type="radio" name="auto_install_languages" value="1" disabled="disabled" /><?php echo _AT('enable'); ?> <input type="radio" name="auto_install_languages" value="0" id="ai_n" checked="checked" /><label for="ai_n"><?php echo _AT('disable'); ?></label>
364                 <?php else: ?>
365                         <input type="radio" name="auto_install_languages" value="1" id="ai_y" <?php if($_config['auto_install_languages']) { echo 'checked="checked"'; }?>  /><label for="ai_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="auto_install_languages" value="0" id="ai_n" <?php if(!$_config['auto_install_languages']) { echo 'checked="checked"'; }?>  /><label for="ai_n"><?php echo _AT('disable'); ?></label>
366                 <?php endif; ?>
367         </div>
368
369         <div class="row">
370                 <?php echo _AT('pretty_url'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['pretty_url'] ? _AT('enable') : _AT('disable')); ?>)<br />
371                 <input type="radio" name="pretty_url" value="1" id="pu_y" <?php if($_config['pretty_url']) { echo 'checked="checked"'; }?> onclick="apache_mod_rewrite_toggler(true);"/><label for="pu_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="pretty_url" value="0" id="pu_n" <?php if(!$_config['pretty_url']) { echo 'checked="checked"'; }?> onclick="apache_mod_rewrite_toggler(false);"/><label for="pu_n"><?php echo _AT('disable'); ?></label>
372         </div>
373
374         <div class="row">
375                 <?php echo _AT('course_dir_name'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['course_dir_name'] ? _AT('enable') : _AT('disable')); ?>)<br />
376                 <input type="radio" name="course_dir_name" value="1" id="cdn_y" <?php if($_config['course_dir_name']) { echo 'checked="checked"'; }?> /><label for="cdn_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="course_dir_name" value="0" id="cdn_n" <?php if(!$_config['course_dir_name']) { echo 'checked="checked"'; }?>  /><label for="cdn_n"><?php echo _AT('disable'); ?></label>
377         </div>
378
379         <div class="row">
380                 <?php echo _AT('apache_mod_rewrite'); ?><br />
381                 <?php if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())): ?>
382                         <?php echo _AT('mod_rewrite'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['apache_mod_rewrite'] ? _AT('enable') : _AT('disable')); ?>)<br />
383                         <input type="radio" name="apache_mod_rewrite" value="1" id="mr_y" <?php if($_config['apache_mod_rewrite']) { echo 'checked="checked"'; }?> /><label for="mr_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="apache_mod_rewrite" value="0" id="mr_n" <?php if(!$_config['apache_mod_rewrite']) { echo 'checked="checked"'; }?>  /><label for="mr_n"><?php echo _AT('disable'); ?></label>
384                 <?php else: ?>
385                         <?php echo _AT('mod_rewrite'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['apache_mod_rewrite'] ? _AT('enable') : _AT('disable')); ?>)<br />
386                         <input type="radio" name="apache_mod_rewrite" value="1" id="mr_y" disabled="disabled" /><label for="mr_y"><?php echo _AT('enable'); ?></label> <input type="radio" name="apache_mod_rewrite" value="0" id="mr_n" checked="checked" /><label for="mr_n"><?php echo _AT('disable'); ?></label>
387                 <?php endif; ?>
388         </div>
389
390         <div class="row buttons">
391                         <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s"  />
392                 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>"  />
393         </div>
394 </div>
395 </form>
396
397
398 <script type="text/javascript">
399         function apache_mod_rewrite_toggler(enabled){
400                 var obj_y = document.getElementById('mr_y');
401                 var obj_n = document.getElementById('mr_n');
402                 if(enabled==true) {
403                         obj_y.disabled = "";    
404                 } else if (enabled==false){
405                         obj_y.disabled = "disabled";
406                         obj_n.checked = "checked";
407                 }
408         }
409
410         //Validate apache_mod data
411         var pu_n = document.getElementById('pu_n');
412         var obj_y = document.getElementById('mr_y');
413         var obj_n = document.getElementById('mr_n');
414         if (pu_n.checked == true){
415                 obj_y.disabled = "disabled";
416                 obj_n.checked = "checked";
417         }
418 </script>
419
420
421 <?php 
422 require(AT_INCLUDE_PATH.'footer.inc.php'); 
423 ?>