made a copy
[atutor.git] / admin / config_edit.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
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$
14
15 define('AT_INCLUDE_PATH', '../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18
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 (!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,6}$", $_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                 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><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                 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><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                 // If PHP 5+ generate a list of timezones
182
183
184
185
186                 echo '<input type="text" name="time_zone" value="'.$_config['time_zone'].'" size="5" maxlength="5"/> ';
187
188
189 /*
190                 if(phpversion() >= 5){
191                         $timezone_names = timezone_identifiers_list();
192                 }else{
193                 // if less than PHP version 5, read a text file to generate the menu
194                         $timezone_names = file("timezones.txt");
195                 }
196
197                 echo '<select name="time_zone">';
198                 foreach($timezone_names as $timezone_name){
199                         if($timezone_name == $_config{'time_zone'}){
200                                 $selected = ' selected="selected"';
201                         }
202                         echo '<option'.$selected.'>'.$timezone_name.'</option>';
203                         $selected = '';
204                 }
205                 echo '</select>';
206 */
207 echo AT_date(_AT('server_date_format'), '', AT_DATE_MYSQL_DATETIME);
208 ?>
209         </div>
210
211         <div class="row">
212                 <label for="maxfile"><?php echo _AT('maximum_file_size'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_file_size']; ?>)<br />
213                 <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'); ?>
214         </div>
215
216         <div class="row">
217                 <label for="maxcourse"><?php echo _AT('maximum_course_size'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_course_size']; ?>)<br />
218                 <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'); ?>
219         </div>
220
221         <div class="row">
222                 <label for="float"><?php echo _AT('maximum_course_float'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_course_float']; ?>)<br />
223                 <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'); ?>
224         </div>
225
226         <div class="row">
227                 <label for="maximum_login_attempt"><?php echo _AT('maximum_login_attempt'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_login']; ?>)<br />
228                 <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'); ?>
229         </div>
230         
231         <div class="row">
232                 <?php echo _AT('display_name_format'); ?> (<?php echo _AT('default'); ?>: <em><?php echo _AT($display_name_formats[$_config_defaults['display_name_format']], _AT('login_name'), _AT('first_name'), _AT('second_name'), _AT('last_name')); ?></em>)<br />
233                 <?php foreach ($display_name_formats as $key => $value): ?>
234                         <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; ?>"><em><?php echo _AT($value, _AT('login_name'), _AT('first_name'), _AT('second_name'), _AT('last_name')); ?></em></label><br />
235                 <?php endforeach; ?>
236         </div>
237
238         <div class="row">
239                 <?php echo _AT('master_list_authentication'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['master_list'] ? _AT('enable') : _AT('disable')); ?>)<br />
240                 <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> 
241
242                 <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 $disable_on . _AT('disable') . $disable_off; ?></label>
243         </div>
244         <div class="row">
245                 <?php echo _AT('allow_registration'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_registration'] ? _AT('enable') : _AT('disable')); ?>)<br />
246                 <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>
247         </div>
248         <div class="row">
249                 <?php echo _AT('allow_browse'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_browse'] ? _AT('enable') : _AT('disable')); ?>)<br />
250                 <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>
251         </div>
252
253         <div class="row">
254                 <?php echo _AT('allow_instructor_registration'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_instructor_registration'] ? _AT('enable') : _AT('disable')); ?>)<br />
255                 <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>
256         </div>
257         <div class="row">               
258                 <?php echo _AT('use_captcha'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['use_captcha'] ? _AT('enable') : _AT('disable')); ?>)<br />
259                 <?php if (extension_loaded('gd')): ?>
260                 <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>
261                 <?php else: ?>
262                 <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>
263                 <?php endif; ?>
264         </div>
265         <div class="row">
266                 <?php echo _AT('allow_unenroll'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_unenroll'] ? _AT('enable') : _AT('disable')); ?>)<br />
267                 <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>
268         </div>
269
270         <div class="row">
271                 <?php echo _AT('require_email_confirmation'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['require_email_confirmation'] ? _AT('enable') : _AT('disable')); ?>)<br />
272                 <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>
273         </div>
274                 
275         <div class="row">
276                 <?php echo _AT('allow_instructor_requests'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['allow_instructor_requests'] ? _AT('enable') : _AT('disable')); ?>)<br />
277                 <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>
278         </div>
279
280         <div class="row">
281                 <?php echo _AT('instructor_request_email_notification'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['email_notification'] ? _AT('enable') : _AT('disable')); ?>)<br />
282                 <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>
283         </div>
284
285         <div class="row">
286                 <?php echo _AT('auto_approve_instructors'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['auto_approve_instructors'] ? _AT('enable') : _AT('disable')); ?>)<br />
287                 <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>
288         </div>
289
290         <div class="row">
291                 <?php echo _AT('theme_specific_categories'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['theme_categories'] ? _AT('enable') : _AT('disable')); ?>)<br />
292                 <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>
293         </div>
294
295         <div class="row">
296                 <?php echo _AT('user_contributed_notes'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['user_notes'] ? _AT('enable') : _AT('disable')); ?>)<br />
297                 <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>
298         </div>
299
300         <div class="row">
301                 <label for="ext"><?php echo _AT('illegal_file_extensions'); ?></label><br />
302                 <textarea name="illegal_extentions" cols="24" id="ext" rows="2" class="formfield" ><?php if ($_config['illegal_extentions']) { echo str_replace('|',' ',$_config['illegal_extentions']); }?></textarea>
303         </div>
304
305         <div class="row">
306                 <label for="cache"><?php echo _AT('cache_directory'); ?></label><br />
307                 <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']; } ?>"  />
308         </div>
309
310         <div class="row">
311                 <label for="cache"><?php echo _AT('latex_server'); ?></label><br />
312                 <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']; } ?>"  />
313         </div>
314
315         <div class="row">
316                 <label for="course_backups"><?php echo _AT('course_backups'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['course_backups']; ?>)<br />
317                 <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']; } ?>"  />
318         </div>
319
320         <div class="row">
321                 <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 />
322                 <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']; } ?>"  />
323         </div>
324
325         <div class="row">
326                 <?php echo _AT('auto_check_new_version'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['check_version'] ? _AT('enable') : _AT('disable')); ?>)<br />
327                 <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>
328         </div>
329
330         <div class="row">
331                 <?php echo _AT('file_storage_version_control'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['fs_versioning'] ? _AT('enable') : _AT('disable')); ?>)<br />
332                 <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>
333         </div>
334
335         <div class="row">
336                 <input type="hidden" name="old_enable_mail_queue" value="<?php echo $_config['enable_mail_queue']; ?>" />
337                 <?php echo _AT('enable_mail_queue'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['enable_mail_queue'] ? _AT('enable') : _AT('disable')); ?>)<br />
338                 <?php echo _AT('mail_queue_cron'); ?><br />
339                 <?php if (!$_config['last_cron'] || (time() - (int) $_config['last_cron'] > 2 * 60 * 60)): ?>
340                         <input type="radio" name="enable_mail_queue" value="1" disabled="disabled" /><?php echo _AT('enable'); ?> <input type="radio" name="enable_mail_queue" value="0" id="mq_n" checked="checked" /><label for="mq_n"><?php echo _AT('disable'); ?></label>
341                 <?php else: ?>
342                         <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>
343                 <?php endif; ?>
344         </div>
345
346         <div class="row">
347                 <?php echo _AT('auto_install_languages'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['auto_install_languages'] ? _AT('enable') : _AT('disable')); ?>)<br />
348                 <?php echo _AT('auto_install_languages_cron'); ?><br />
349                 <?php if (!$_config['last_cron'] || (time() - (int) $_config['last_cron'] > 2 * 60 * 60)): ?>
350                         <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>
351                 <?php else: ?>
352                         <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>
353                 <?php endif; ?>
354         </div>
355
356         <div class="row">
357                 <?php echo _AT('pretty_url'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['pretty_url'] ? _AT('enable') : _AT('disable')); ?>)<br />
358                 <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>
359         </div>
360
361         <div class="row">
362                 <?php echo _AT('course_dir_name'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['course_dir_name'] ? _AT('enable') : _AT('disable')); ?>)<br />
363                 <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>
364         </div>
365
366         <div class="row">
367                 <?php echo _AT('apache_mod_rewrite'); ?><br />
368                 <?php if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())): ?>
369                         <?php echo _AT('mod_rewrite'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['apache_mod_rewrite'] ? _AT('enable') : _AT('disable')); ?>)<br />
370                         <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>
371                 <?php else: ?>
372                         <?php echo _AT('mod_rewrite'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['apache_mod_rewrite'] ? _AT('enable') : _AT('disable')); ?>)<br />
373                         <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>
374                 <?php endif; ?>
375         </div>
376
377         <div class="row buttons">
378                         <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s"  />
379                 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>"  />
380         </div>
381 </div>
382 </form>
383
384
385 <script type="text/javascript">
386         function apache_mod_rewrite_toggler(enabled){
387                 var obj_y = document.getElementById('mr_y');
388                 var obj_n = document.getElementById('mr_n');
389                 if(enabled==true) {
390                         obj_y.disabled = "";    
391                 } else if (enabled==false){
392                         obj_y.disabled = "disabled";
393                         obj_n.checked = "checked";
394                 }
395         }
396
397         //Validate apache_mod data
398         var pu_n = document.getElementById('pu_n');
399         var obj_y = document.getElementById('mr_y');
400         var obj_n = document.getElementById('mr_n');
401         if (pu_n.checked == true){
402                 obj_y.disabled = "disabled";
403                 obj_n.checked = "checked";
404         }
405 </script>
406
407
408 <?php 
409 require(AT_INCLUDE_PATH.'footer.inc.php'); 
410 ?>