forked from szarkos/paradb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimezones.php
46 lines (33 loc) · 1.1 KB
/
timezones.php
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
45
46
<?php
//-------------------------------------------------------------------//
//
// AGHOST Paranormal Reporting Database (ParaDB)
// Copyright (c) 2007 Stephen A. Zarkos <[email protected]>
//
// See the file COPYING for terms of use and redistribution.
//
// File: timezone.php
// Functions to return timezone information.
//
//-------------------------------------------------------------------//
// Function: get_tz( [opt] )
// Returns the $tz array from include/timezones.inc.php, sorted by timezone name (default)
// or by UTC offset.
function get_tz( $opt="" ) {
include_once( 'include/timezones.inc.php' );
if ( $opt == 'sort_utc' ) {
uksort( $tz, 'tz_sort' );
}
return $tz;
}
// Function: tz_sort( [a], [b] )
// Callback function for use with get_tz() and uksort().
function tz_sort( $a="", $b="" ) {
include( 'include/timezones.inc.php' );
$tmp_a = preg_replace( '/:\d+/', '', $tz[$a]['utc'] );
$tmp_a = preg_replace( '/\+/', '', $tmp_a );
$tmp_b = preg_replace( '/:\d+/', '', $tz[$b]['utc'] );
$tmp_b = preg_replace( '/\+/', '', $tmp_b );
return ( $tmp_a > $tmp_b );
}
?>