author | Dan |
Tue, 20 Jan 2009 22:08:07 -0500 | |
changeset 51 | 508400fc5282 |
parent 44 | 73f74d395f95 |
permissions | -rw-r--r-- |
8 | 1 |
<?php |
2 |
require('../timezone.php'); |
|
44
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
3 |
require('../stats-fe.php'); |
8 | 4 |
$set_zone = false; |
5 |
if ( isset($_POST['tz']) ) |
|
6 |
{ |
|
7 |
if ( in_array($_POST['tz'], $zones) ) |
|
8 |
{ |
|
9 |
setcookie(COOKIE_NAME, $_POST['tz'], time() + ( 365 * 24 * 60 * 60 )); |
|
10 |
$tz = $_POST['tz']; |
|
11 |
date_default_timezone_set($_POST['tz']); |
|
12 |
$set_zone = str_replace('_', ' ', str_replace('/', ': ', $tz)); |
|
13 |
} |
|
14 |
} |
|
44
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
15 |
|
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
16 |
$title = "$nick - set time zone"; |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
17 |
require("./themes/$webtheme/header.php"); |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
18 |
|
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
19 |
echo '<br />'; |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
20 |
|
8 | 21 |
if ( $set_zone ) |
22 |
{ |
|
10 | 23 |
$target = rtrim(dirname($_SERVER['REQUEST_URI']), '/') . '/'; |
8 | 24 |
echo '<div class="success">' . "Successfully set time zone to <b>{$set_zone}</b>. <a href=\"$target\">Return to the stats page</a>." . '</div>'; |
25 |
} |
|
26 |
?> |
|
10 | 27 |
<form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post"> |
8 | 28 |
Select time zone: |
29 |
<select name="tz"> |
|
30 |
<?php |
|
31 |
$zones = get_timezone_list(); |
|
32 |
foreach ( $zones as $region => $areas ) |
|
33 |
{ |
|
34 |
if ( is_string($areas) ) |
|
35 |
{ |
|
36 |
echo '<option value="' . $areas . '" class="other">' . $areas . '</option>' . "\n "; |
|
37 |
continue; |
|
38 |
} |
|
39 |
echo '<option disabled="disabled" class="region">' . $region . '</option>' . "\n "; |
|
40 |
foreach ( $areas as $aid => $area ) |
|
41 |
{ |
|
42 |
if ( is_array($area) ) |
|
43 |
{ |
|
44 |
echo ' <option disabled="disabled" class="country">' . str_replace('_', ' ', $aid) . '</option>' . "\n "; |
|
45 |
foreach ( $area as $city ) |
|
46 |
{ |
|
47 |
$zoneid = "$region/$aid/$city"; |
|
48 |
$sel = ( $zoneid == $tz ) ? ' selected="selected"' : ''; |
|
49 |
echo ' <option value="' . $zoneid . '" class="city"' . $sel . '>' . str_replace('_', ' ', $city) . '</option>' . "\n "; |
|
50 |
} |
|
51 |
} |
|
52 |
else |
|
53 |
{ |
|
54 |
$zoneid = "$region/$area"; |
|
55 |
$sel = ( $zoneid == $tz ) ? ' selected="selected"' : ''; |
|
56 |
echo ' <option value="' . $zoneid . '" class="area"' . $sel . '>' . str_replace('_', ' ', $area) . '</option>' . "\n "; |
|
57 |
} |
|
58 |
} |
|
59 |
} |
|
60 |
?> |
|
61 |
</select> |
|
62 |
<input type="submit" value="Save" /><br /> |
|
63 |
<small>Make sure you have cookies enabled.</small> |
|
64 |
</form> |
|
44
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
65 |
|
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
66 |
<?php |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
67 |
require("./themes/$webtheme/footer.php"); |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
10
diff
changeset
|
68 |
?> |