2dda0e96df623d5139e181ab98ecbf3167a80a8d
3 * SquirrelMail Time zone functions
5 * Function load time zone array selected in SquirrelMail
8 * Time zone array must consist of key name that matches key in
9 * standard time zone array and 'NAME' and 'TZ' subkeys. 'NAME'
10 * key should store translatable key name. 'TZ' key should store
11 * time zone name that will be used in TZ environment variable.
12 * Both subkeys are optional. If they are not present, time zone
15 * @package squirrelmail
16 * @subpackage timezone
20 * Returns time zone array set in SquirrelMail configuration
21 * @return array time zone array
24 function sq_get_tz_array() {
25 global $time_zone_type;
27 // variable is not set or empty
28 if (! isset($time_zone_type) ||
empty($time_zone_type)) {
31 // make sure that it is integer
32 $time_zone_type = (int) $time_zone_type;
36 * TODO: which one is better (global + include_once) or (include)
38 switch ($time_zone_type) {
41 // custom time zone set
42 $aTimeZones = array();
43 if (file_exists(SM_PATH
. 'config/timezones.php')) {
44 include(SM_PATH
. 'config/timezones.php');
51 // standard (default) time zone set
52 include(SM_PATH
. 'include/timezones/standard.php');
61 * @param string time zone string
62 * @return string time zone name used for TZ env
63 * (false, if timezone does not exists and server's TZ should be used)
66 function sq_get_tz_key($sTZ) {
67 $aTZs=sq_get_tz_array();
69 // get real time zone from link
70 if (isset($aTZs[$sTZ]['LINK'])) {
71 $sTZ = $aTZs[$sTZ]['LINK'];
74 if (isset($aTZs[$sTZ])) {
75 if (isset($aTZs[$sTZ]['TZ'])) {
77 return $aTZs[$sTZ]['TZ'];
79 // array does not have TZ entry. bad thing