4 * SquirrelMail Time zone functions
6 * Function load time zone array selected in SquirrelMail
9 * Time zone array must consist of key name that matches key in
10 * standard time zone array and 'NAME' and 'TZ' subkeys. 'NAME'
11 * key should store translatable key name. 'TZ' key should store
12 * time zone name that will be used in TZ environment variable.
13 * Both subkeys are optional. If they are not present, time zone
16 * @copyright © 1999-2006 The SquirrelMail Project Team
17 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
19 * @package squirrelmail
20 * @subpackage timezones
24 * Returns time zone array set in SquirrelMail configuration
25 * @return array time zone array
28 function sq_get_tz_array() {
29 global $time_zone_type;
31 // variable is not set or empty
32 if (! isset($time_zone_type) ||
empty($time_zone_type)) {
35 // make sure that it is integer
36 $time_zone_type = (int) $time_zone_type;
40 * TODO: which one is better (global + include_once) or (include)
42 switch ($time_zone_type) {
45 // custom time zone set
46 $aTimeZones = array();
47 if (file_exists(SM_PATH
. 'config/timezones.php')) {
48 include(SM_PATH
. 'config/timezones.php');
55 // standard (default) time zone set
56 include(SM_PATH
. 'include/timezones/standard.php');
65 * @param string time zone string
66 * @return string time zone name used for TZ env
67 * (false, if timezone does not exists and server's TZ should be used)
70 function sq_get_tz_key($sTZ) {
71 $aTZs=sq_get_tz_array();
73 // get real time zone from link
74 if (isset($aTZs[$sTZ]['LINK'])) {
75 $sTZ = $aTZs[$sTZ]['LINK'];
78 if (isset($aTZs[$sTZ])) {
79 if (isset($aTZs[$sTZ]['TZ'])) {
81 return $aTZs[$sTZ]['TZ'];
83 // array does not have TZ entry. bad thing