http://www.atutor.ca/atutor/mantis/view.php?id=996
authorjoel kronenberg <joel.kronenberg@utoronto.ca>
Wed, 1 Nov 2006 18:15:51 +0000 (18:15 -0000)
committerjoel kronenberg <joel.kronenberg@utoronto.ca>
Wed, 1 Nov 2006 18:15:51 +0000 (18:15 -0000)
docs/admin/config_edit.php
docs/documentation/admin/system_preferences.php
docs/include/vitals.inc.php

index a22e6d3..614378a 100644 (file)
@@ -48,7 +48,7 @@ if (isset($_POST['cancel'])) {
        $_POST['check_version']             = $_POST['check_version'] ? 1 : 0;
        $_POST['fs_versioning']             = $_POST['fs_versioning'] ? 1 : 0;
        $_POST['enable_mail_queue']         = $_POST['enable_mail_queue'] ? 1 : 0;
-       $_POST['display_name_format']       = $_POST['display_name_format'];
+       $_POST['display_name_format']       = intval($_POST['display_name_format']);
 
        if (!isset($display_name_formats[$_POST['display_name_format']])) {
                $_POST['display_name_format'] = $_config_defaults['display_name_format'];
@@ -84,6 +84,7 @@ if (isset($_POST['cancel'])) {
                $_POST['home_url']      = $addslashes($_POST['home_url']);
                $_POST['default_language']      = $addslashes($_POST['default_language']);
                $_POST['contact_email'] = $addslashes($_POST['contact_email']);
+               $_POST['time_zone']     = $addslashes($_POST['time_zone']);
 
                foreach ($_config as $name => $value) {
                        // the isset() is needed to avoid overridding settings that don't get set here (ie. modules)
@@ -156,6 +157,31 @@ if (!isset($_POST['submit'])) {
                <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']; } ?>"  />
        </div>
 
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="time_zone"><?php echo _AT('time_zone'); ?></label><br />
+                       <?php
+                               @putenv("TZ=UTC");
+                               $before = date('O');
+                               @putenv("TZ=US/Eastern");
+                               $after = date('O');
+                               @putenv("TZ={$_config['time_zone']}");
+
+                               $sql = "SELECT Name FROM mysql.time_zone_name ORDER BY Name";
+                               $result = mysql_query($sql, $db);
+                       ?>
+                       <?php if ($result && mysql_num_rows($result) && ($before != $after)): ?>
+                               <select name="time_zone" id="time_zone">
+                                       <option value="" <?php if (!$_config['time_zone']) { echo 'selected="selected"'; } ?>><?php echo _AT('use_system_time'); ?></option>
+                                       <option value=""></option>
+                                       <?php while ($row = mysql_fetch_assoc($result)): ?>
+                                               <option <?php if ($_config['time_zone'] == $row['Name']) { echo 'selected="selected"'; } ?>><?php echo $row['Name']; ?></option>
+                                       <?php endwhile; ?>
+                               </select>
+                       <?php else: ?>
+                               <?php echo _AT('time_zones_not_supported'); ?>
+                       <?php endif; ?>
+       </div>
+
        <div class="row">
                <label for="maxfile"><?php echo _AT('maximum_file_size'); ?></label> (<?php echo _AT('default'); ?>: <?php echo $_config_defaults['max_file_size']; ?>)<br />
                <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'); ?>
index 8fd8eb1..db0db3e 100644 (file)
@@ -14,6 +14,9 @@
                        <dt>Contact Email</dt>
                        <dd>The reply address used for emails sent for instructor requests and other system emails.</dd>
 
+                       <dt>Time Zone</dt>
+                       <dd>Changing ATutor's time zone to one other than that specific by the server requires MySQL 4.1.3+ and PHP's <kbd>putenv</kbd> command must be allowed. Additionally MySQL's time zone tables must be loaded; see <a href="http://dev.mysql.com/doc/refman/4.1/en/time-zone-support.html" target="_new">MySQL Server Time Zone Support</a> for additional details. This option is available in ATutor 1.5.3.3+.</dd>
+
                        <dt>Maximum File Size</dt>
                        <dd>Maximum allowable file size in Bytes that can be uploaded to the course's File Manager. This does not override the value set for <kbd>upload_max_filesize</kbd> in <kbd>php.ini</kbd>.</dd>
 
index 7469eb0..e52fef2 100644 (file)
@@ -171,13 +171,11 @@ define('AT_DEFAULT_PREFS',  $_config['prefs_default']);
 $_config['home_defaults'] .= (isset($_config['home_defaults_2']) ? $_config['home_defaults_2'] : '');
 $_config['main_defaults'] .= (isset($_config['main_defaults_2']) ? $_config['main_defaults_2'] : '');
 
-$_config['time_zone'] = 'America/Toronto';
-
 if ($_config['time_zone']) {
        $sql = "SET time_zone='{$_config['time_zone']}'";
        mysql_query($sql, $db);
 
-       putenv("TZ={$_config['time_zone']}");
+       @putenv("TZ={$_config['time_zone']}");
 }
 
 /***** 7. start language block *****/