File: timezone.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (44 lines) | stat: -rw-r--r-- 1,279 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php   // $Id: timezone.php,v 1.5 2006/03/07 09:01:48 skodak Exp $

    require_once('../config.php');

    $zone = optional_param('zone', '', PARAM_PATH); //not a path, but it looks like it anyway

    require_login();

    if (!isadmin()) {
        error("You must be an admin");
    }

    $strtimezone = get_string("timezone");
    $strsavechanges = get_string("savechanges");
    $strusers = get_string("users");
    $strall = get_string("all");

    print_header($strtimezone, $strtimezone, $strtimezone);

    print_heading("");

    if (!empty($zone) and confirm_sesskey()) {
        $db->debug = true;
        echo "<center>";
        execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'");
        $db->debug = false;
        echo "</center>";

        $USER->timezone = $zone;
    }

    require_once($CFG->dirroot.'/calendar/lib.php');
    $timezones = get_list_of_timezones();

    echo '<center><form action="timezone.php" method="get">';
    echo "$strusers ($strall): ";
    choose_from_menu ($timezones, "zone", 99, get_string("serverlocaltime"), "", "99");
    echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
    echo "<input type=\"submit\" value=\"$strsavechanges\">";
    echo "</form></center>";

    print_footer();

?>