[Openfirst-cvscommit] members/phpicalendar/functions admin_functions.php,NONE,1.1 date_functions.php
Brought to you by:
xtimg
Update of /cvsroot/openfirst/members/phpicalendar/functions In directory sc8-pr-cvs1:/tmp/cvs-serv24602 Added Files: admin_functions.php date_functions.php draw_functions.php error.php ical_parser.php init.inc.php list_icals.php list_languages.php list_months.php list_weeks.php list_years.php overlapping_events.php timezones.php todo.js upload_functions.php Log Message: Add functions from PHP iCalendar to the repository. --- NEW FILE: admin_functions.php --- <?php // Is the user logged in // // returns boolean is the user logged in function is_loggedin () { global $HTTP_SESSION_VARS; if (!isset($HTTP_SESSION_VARS['phpical_loggedin']) || $HTTP_SESSION_VARS['phpical_loggedin'] == FALSE) { return FALSE; } else return TRUE; } // Attempt to login. If login is valid, set the session variable 'phpical_loggedin' to TRUE and store the username and password in the session // // arg0: string username // arg1: string password // returns boolean was the login successful function login ($username, $password) { global $HTTP_SESSION_VARS; global $auth_method; switch ($auth_method) { case 'ftp': $loggedin = login_ftp($username, $password); break; case 'internal': $loggedin = login_internal($username, $password); break; default: $loggedin = FALSE; } $HTTP_SESSION_VARS['phpical_loggedin'] = $loggedin; if ($loggedin) { $HTTP_SESSION_VARS['phpical_username'] = $username; $HTTP_SESSION_VARS['phpical_password'] = $password; } return $loggedin; } // Attempt to login to the ftp server // // arg0: string username // arg1: string password // returns boolean was login successful function login_ftp ($username, $password) { global $ftp_server; // set up basic connection $conn_id = @ftp_connect($ftp_server); // login with username and password $login_result = @ftp_login($conn_id, $username, $password); // check connection if ((!$conn_id) || (!$login_result)) { return FALSE; } // close the FTP stream @ftp_close($conn_id); return TRUE; } // Attempt to login using username and password defined in config.inc.php // // arg0: string username // arg1: string password // returns boolean was login successful function login_internal ($username, $password) { global $auth_internal_username; global $auth_internal_password; if ($auth_internal_username == $username && $auth_internal_password == $password) return TRUE; else return FALSE; } // Delete a calendar. If using ftp for authentication, use ftp to delete. Otherwise, use file system functions. // // arg0: string calendar file - not the full path // returns boolean was delete successful function delete_cal ($filename) { global $HTTP_SESSION_VARS; global $auth_method; global $ftp_server; global $calendar_path; global $ftp_calendar_path; if ($auth_method == 'ftp') { $filename = get_ftp_calendar_path() . "/" . $filename; // set up basic connection $conn_id = @ftp_connect($ftp_server); // login with username and password $login_result = @ftp_login($conn_id, $HTTP_SESSION_VARS['phpical_username'], $HTTP_SESSION_VARS['phpical_password']); // check connection if ((!$conn_id) || (!$login_result)) return FALSE; // delete the file $delete = @ftp_delete($conn_id, $filename); // check delete status if (!$delete) return FALSE; // close the FTP stream @ftp_close($conn_id); return TRUE; } else { $filename = $calendar_path . "/" . $filename; $delete = @unlink($filename); clearstatcache(); if (@file_exists($filename)) { $filesys = eregi_replace("/","\\", $filename); $delete = @system("del $filesys"); clearstatcache(); if (@file_exists($filename)) { $delete = @chmod ($filename, 0775); $delete = @unlink($filename); $delete = @system("del $filesys"); } } clearstatcache(); if (@file_exists($filename)) { return FALSE; } else { return TRUE; } return TRUE; } } // Copy the uploaded calendar. If using ftp for authentication, use ftp to copy. Otherwise, use file system functions. // // arg0: string full path to calendar file // arg1: string destination filename // returns boolean was copy successful function copy_cal ($source, $destination) { global $HTTP_SESSION_VARS; global $auth_method; global $ftp_server; global $calendar_path; if ($auth_method == 'ftp') { $destination = get_ftp_calendar_path() . "/" . basename($destination); $destination = str_replace ("\\", "/", realpath($destination)); // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $HTTP_SESSION_VARS['phpical_username'], $HTTP_SESSION_VARS['phpical_password']); // check connection if ((!$conn_id) || (!$login_result)) return FALSE; // upload the file $upload = ftp_put($conn_id, $destination, $source, FTP_ASCII); // check upload status if (!$upload) return FALSE; // close the FTP stream ftp_close($conn_id); return TRUE; } else { $destination = $calendar_path . "/" . basename($destination); if (check_php_version('4.0.3')) { return move_uploaded_file($source, $destination); } else { return copy($source, $destination); } } } // Find the full path to the caledar directory for use with ftp // if $ftp_calendar_path == '', sends back the full path to the $calendar_path - this may not work depending // on ftp server config, but would be a best guess // // return string path to calendar directory for ftp operations function get_ftp_calendar_path() { global $ftp_calendar_path; global $calendar_path; if ($ftp_calendar_path != '') return $ftp_calendar_path; else { return str_replace ("\\", "/", realpath($calendar_path)); } } // Check to see if the current version of php is >= to the arguement // // arg0: string version of php to check against // return boolean true if $version is >= current php version function check_php_version($version) { // intval used for version like "4.0.4pl1" $testVer=intval(str_replace(".", "",$version)); $curVer=intval(str_replace(".", "",phpversion())); if( $curVer < $testVer ) return FALSE; return TRUE; } // Is the file uploaded truly a file via HTTP POST - used to thwart a user from trying to trick the script from working on other files // // arg0: string filename // returns boolean is the uploaded a file function is_uploaded_file_v4 ($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', '')); } $tmp_file .= '/' . basename($filename); // For Windows compat $filename = str_replace ("\\", "/", $filename); $tmp_file = str_replace ("\\", "/", $tmp_file); // User might have trailing slash in php.ini... return (ereg_replace('/+', '/', $tmp_file) == $filename); } // return the appropriate error message if the file upload had an error // // arg0: array error number from $HTTP_POST_FILES[file]['error'] // returns string error message function get_upload_error ($upload_error) { global $php_error_lang; global $upload_error_lang; global $upload_error_gen_lang; if (isset($upload_error)) { // This is only available in PHP >= 4.2.0 $error = $php_error_lang . " "; switch($upload_error) { case 0: //no error; possible file attack! case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form case 3: //uploaded file was only partially uploaded case 4: //no file was uploaded $error = $error . $upload_error . ": " . $upload_error_lang[$upload_error]; break; default: //a default error, just in case! :) $error = $error . $upload_error . ": " . $upload_error_gen_lang; break; } } else { $error = $upload_error_gen_lang; } return $error; } // Check to see that the file has an .ics extension // // arg0: string filename // returns booloean does the filename end in .ics function is_uploaded_ics ($filename) { // Check the file extension for .ics. Can also check the the mime type, but it's not reliable so why bother... if(preg_match("/.ics$/i", $filename)) { return TRUE; } else { return FALSE; } } // Get all calendar filenames (not including path) // // argo: string path to calendar files // returns array filenames (not including path) function get_calendar_files($calendar_path) { global $error_path_lang; $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path))); $filelist = array(); while ($file = readdir($dir_handle)) { if (preg_match("/^[^.].+\.ics$/", $file)) { array_push($filelist, $file); } } closedir($dir_handle); natcasesort($filelist); return $filelist; } ?> --- NEW FILE: date_functions.php --- <?php // date_functions.php // functions for returning or comparing dates // not a date function, but I didn't know where to put it // for backwards compatibility if (phpversion() < '4.1') { function array_key_exists($key, $arr) { if (!is_array($arr)) return false; foreach (array_keys($arr) as $k) { if ("$k" == "$key") return true; } return false; } } // takes iCalendar 2 day format and makes it into 3 characters // if $txt is true, it returns the 3 letters, otherwise it returns the // integer of that day; 0=Sun, 1=Mon, etc. function two2threeCharDays($day, $txt=true) { switch($day) { case 'SU': return ($txt ? 'sun' : '0'); case 'MO': return ($txt ? 'mon' : '1'); case 'TU': return ($txt ? 'tue' : '2'); case 'WE': return ($txt ? 'wed' : '3'); case 'TH': return ($txt ? 'thu' : '4'); case 'FR': return ($txt ? 'fri' : '5'); case 'SA': return ($txt ? 'sat' : '6'); } } // dateOfWeek() takes a date in Ymd and a day of week in 3 letters or more // and returns the date of that day. (ie: "sun" or "sunday" would be acceptable values of $day but not "su") function dateOfWeek($Ymd, $day) { global $week_start_day; if (!isset($week_start_day)) $week_start_day = 'Sunday'; $timestamp = strtotime($Ymd); $num = date('w', strtotime($week_start_day)); $start_day_time = strtotime((date('w',$timestamp)==$num ? "$week_start_day" : "last $week_start_day"), $timestamp); $ret_unixtime = strtotime($day,$start_day_time); $ret_unixtime = strtotime('+12 hours', $ret_unixtime); $ret = date('Ymd',$ret_unixtime); return $ret; } // function to compare to dates in Ymd and return the number of weeks // that differ between them. requires dateOfWeek() function weekCompare($now, $then) { global $week_start_day; $sun_now = dateOfWeek($now, $week_start_day); $sun_then = dateOfWeek($then, $week_start_day); $seconds_now = strtotime($sun_now); $seconds_then = strtotime($sun_then); $diff_seconds = $seconds_now - $seconds_then; $diff_minutes = $diff_seconds/60; $diff_hours = $diff_minutes/60; $diff_days = round($diff_hours/24); $diff_weeks = $diff_days/7; return $diff_weeks; } // function to compare to dates in Ymd and return the number of days // that differ between them. function dayCompare($now, $then) { $seconds_now = strtotime($now); $seconds_then = strtotime($then); $diff_seconds = $seconds_now - $seconds_then; $diff_minutes = $diff_seconds/60; $diff_hours = $diff_minutes/60; $diff_days = round($diff_hours/24); return $diff_days; } // function to compare to dates in Ymd and return the number of months // that differ between them. function monthCompare($now, $then) { ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then); $diff_years = $date_now[1] - $date_then[1]; $diff_months = $date_now[2] - $date_then[2]; if ($date_now[2] < $date_then[2]) { $diff_years -= 1; $diff_months = ($diff_months + 12) % 12; } $diff_months = ($diff_years * 12) + $diff_months; return $diff_months; } function yearCompare($now, $then) { ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then); $diff_years = $date_now[1] - $date_then[1]; return $diff_years; } // localizeDate() - similar to strftime but uses our preset arrays of localized // months and week days and only supports %A, %a, %B, %b, %e, and %Y // more can be added as needed but trying to keep it small while we can function localizeDate($format, $timestamp) { global $daysofweek_lang, $daysofweekshort_lang, $daysofweekreallyshort_lang, $monthsofyear_lang, $monthsofyear_lang, $monthsofyearshort_lang; $year = date("Y", $timestamp); $month = date("n", $timestamp)-1; $day = date("j", $timestamp); $dayofweek = date("w", $timestamp); $date = str_replace('%Y', $year, $format); $date = str_replace('%e', $day, $date); $date = str_replace('%B', $monthsofyear_lang[$month], $date); $date = str_replace('%b', $monthsofyearshort_lang[$month], $date); $date = str_replace('%A', $daysofweek_lang[$dayofweek], $date); $date = str_replace('%a', $daysofweekshort_lang[$dayofweek], $date); return $date; } // calcOffset takes an offset (ie, -0500) and returns it in the number of seconds function calcOffset($offset_str) { $sign = substr($offset_str, 0, 1); $hours = substr($offset_str, 1, 2); $mins = substr($offset_str, 3, 2); $secs = ((int)$hours * 3600) + ((int)$mins * 60); if ($sign == '-') $secs = 0 - $secs; return $secs; } // calcTime calculates the unixtime of a new offset by comparing it to the current offset // $have is the current offset (ie, '-0500') // $want is the wanted offset (ie, '-0700') // $time is the unixtime relative to $have function calcTime($have, $want, $time) { if ($have == 'none' || $want == 'none') return $time; $have_secs = calcOffset($have); $want_secs = calcOffset($want); $diff = $want_secs - $have_secs; $time += $diff; return $time; } function chooseOffset($time) { global $timezone, $tz_array; if (!isset($timezone)) $timezone = ''; switch ($timezone) { case '': $offset = 'none'; break; case 'Same as Server': $offset = date('O', $time); break; default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { $dlst = date('I', $time); $offset = $tz_array[$timezone][$dlst]; } else { $offset = '+0000'; } } return $offset; } function openevent($cal, $st, $end, $arr, $lines, $wrap, $clic, $fclic, $class) { $event_text = stripslashes(urldecode($arr["event_text"])); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$reg)) { $ev = $reg[1] . $reg[2]; $event_text = $reg[2]; } else { $ev = $arr["event_text"]; $event_text = strip_tags($event_text, '<b><i><u>'); } if (isset($arr["organizer"])) { $organizer = urlencode(addslashes($arr["organizer"])); } else { $organizer = ''; } if (isset($arr["attendee"])) { $attendee = urlencode(addslashes($arr["attendee"])); } else { $attendee = ''; } if (isset($arr["location"])) { $location = $arr["location"]; } else { $location = ''; } if (isset($arr["status"])) { $status = $arr["status"]; } else { $status = ''; } if ($event_text != "") { if ($lines) $event_text = word_wrap($event_text, $wrap, $lines); $dsc = urlencode(addslashes($arr["description"])); echo '<a class="'.$class.'" href="'; if ((!(ereg("([[:alpha:]]+://[^<>[:space:]]+)", $ev, $res))) || ($dsc)) { echo "javascript:w=window.open('"; echo "includes/event.php?event="; echo urlencode(addslashes($ev)); echo "&cal="; echo urlencode(addslashes($cal)); echo "&start=$st&end=$end&description=$dsc&status=$status&location=$location&organizer=$organizer&attendee=$attendee"; echo "','Popup','"; echo "scrollbars=yes,width=460,height=275"; echo "');w.focus()"; } else { echo $res[1]; } echo '">'.$clic.$event_text.$fclic.'</a>'; } } ?> --- NEW FILE: draw_functions.php --- <?php // function returns starttime and endtime and event length for drawing into a grid function drawEventTimes ($start, $end) { global $gridLength; ereg ("([0-9]{2})([0-9]{2})", $start, $time); $sta_h = $time[1]; $sta_min = $time[2]; $sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength); if ($sta_min == 60) { $sta_h = sprintf("%02d", ($sta_h + 1)); $sta_min = "00"; } ereg ("([0-9]{2})([0-9]{2})", $end, $time); $end_h = $time[1]; $end_min = $time[2]; $end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength); if ($end_min == 60) { $end_h = sprintf("%02d", ($end_h + 1)); $end_min = "00"; } if (($sta_h . $sta_min) == ($end_h . $end_min)) { $end_min += $gridLength; if ($end_min == 60) { $end_h = sprintf("%02d", ($end_h + 1)); $end_min = "00"; } } $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } // word wrap function that returns specified number of lines // when lines is 0, it returns the entire string as wordwrap() does it function word_wrap($str, $length, $lines=0) { if ($lines > 0) { $len = $length * $lines; if ($len < strlen($str)) { $str = substr($str,0,$len).'...'; } } return $str; } ?> --- NEW FILE: error.php --- <?php if (!defined('BASE')) define('BASE','../'); function error($error_msg='There was an error processing the request.', $file='NONE') { global $style_sheet, $powered_by_lang, $version_lang, $error_title_lang, $error_window_lang, $error_calendar_lang, $error_back_lang, $enable_rss, $this_site_is_lang; if (!isset($style_sheet)) $style_sheet = 'silver'; if (!isset($powered_by_lang)) $powered_by_lang = 'Powered by'; if (!isset($error_title_lang)) $error_title_lang = 'Error!'; if (!isset($error_window_lang)) $error_window_lang = 'There was an error!'; if (!isset($error_calendar_lang)) $error_calendar_lang = 'The calendar "%s" was being processed when this error occurred.'; if (!isset($error_back_lang)) $error_back_lang = 'Please use the "Back" button to return.'; if (!isset($enable_rss)) $enable_rss = 'no'; if (!isset($this_site_is_lang)) $this_site_is_lang = 'This site is'; $error_calendar = sprintf($error_calendar_lang, $file); $current_view = 'error'; $display_date = $error_title_lang; $calendar_name = $error_title_lang; include (BASE.'includes/header.inc.php'); ?> <center> <table border="0" width="700" cellspacing="0" cellpadding="0"> <tr> <td width="520" valign="top" align="center"> <table width="520" border="0" cellspacing="0" cellpadding="0" class="calborder"> <tr> <td align="center" valign="middle"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> <tr> <td align="left" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td> <td align="center" valign="middle" width="98%" class="sideback"><b><?php echo $error_window_lang; ?></b></td> <td class="sideback" width="1%"></td> </tr> </table> </td> </tr> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> <tr> <td align="center" valign="top"> <br> <?php echo $error_msg; ?> <br> <br> <?php echo $error_calendar; ?> <br> <br> <?php echo $error_back_lang; ?> <br> <br> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </center> <?php include (BASE.'includes/footer.inc.php'); } ?> --- NEW FILE: ical_parser.php --- <?php if (!defined('BASE')) define('BASE', './'); include(BASE.'functions/init.inc.php'); include(BASE.'functions/date_functions.php'); include(BASE.'functions/draw_functions.php'); include(BASE.'functions/overlapping_events.php'); include(BASE.'functions/timezones.php'); $fillTime = $day_start; $day_array = array (); while ($fillTime < $day_end) { array_push ($day_array, $fillTime); ereg ('([0-9]{2})([0-9]{2})', $fillTime, $dTime); $fill_h = $dTime[1]; $fill_min = $dTime[2]; $fill_min = sprintf('%02d', $fill_min + $gridLength); if ($fill_min == 60) { $fill_h = sprintf('%02d', ($fill_h + 1)); [...996 lines suppressed...] } //If you want to see the values in the arrays, uncomment below. //print '<pre>'; //print_r($master_array); //print_r($overlap_array); //print_r($day_array); //print_r($rrule_array); //print_r($recurrence_delete); //print '</pre>'; // Set a calender name for all calenders combined if ($cal == $ALL_CALENDARS_COMBINED) { $calendar_name = $all_cal_comb_lang; } ?> --- NEW FILE: init.inc.php --- <?php // jared-2002.10.30, I want to make sure my published calendars are world-read/writeable // so I have this making sure they all are. This should be commented out/deleted // for shipping versions. This is a convenience so when I commit, changes are made and // I don't get errors. //chmod(BASE.'calendars/School.ics',0666); // uncomment when developing, comment for shipping version //error_reporting (E_ALL); $ALL_CALENDARS_COMBINED = 'all_calendars_combined971'; if (!defined('BASE')) define('BASE', './'); include(BASE.'config.inc.php'); include(BASE.'functions/error.php'); if (isset($HTTP_COOKIE_VARS['phpicalendar'])) { $phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar'])); if (isset($phpicalendar['cookie_language'])) $language = $phpicalendar['cookie_language']; if (isset($phpicalendar['cookie_calendar'])) $default_cal_check = $phpicalendar['cookie_calendar']; if (isset($phpicalendar['cookie_view'])) $default_view = $phpicalendar['cookie_view']; if (isset($phpicalendar['cookie_style'])) $style_sheet = $phpicalendar['cookie_style']; if (isset($phpicalendar['cookie_startday'])) $week_start_day = $phpicalendar['cookie_startday']; if (isset($phpicalendar['cookie_time'])) $day_start = $phpicalendar['cookie_time']; } // language support $language = strtolower($language); $lang_file = BASE.'/languages/'.$language.'.inc.php'; if (file_exists($lang_file)) { include($lang_file); } else { exit(error('The requested language "'.$language.'" is not a supported language. Please use the configuration file to choose a supported language.')); } if (!isset($getdate)) { if (isset($HTTP_GET_VARS['getdate']) && ($HTTP_GET_VARS['getdate'] !== '')) { $getdate = $HTTP_GET_VARS['getdate']; } else { $getdate = date('Ymd', strtotime("now + $second_offset seconds")); } } if (ini_get('max_execution_time') < 60) { ini_set('max_execution_time', '60'); } if ($calendar_path == '') { $calendar_path = 'calendars'; $calendar_path_orig = $calendar_path; $calendar_path = BASE.$calendar_path; } $is_webcal = FALSE; if (isset($HTTP_GET_VARS['cal']) && $HTTP_GET_VARS['cal'] != '') { $cal_filename = urldecode($HTTP_GET_VARS['cal']); } else { if (isset($default_cal_check)) { if ($default_cal_check != $ALL_CALENDARS_COMBINED) { $calcheck = $calendar_path.'/'.$default_cal_check.'.ics'; $calcheckopen = @fopen($calcheck, "r"); if ($calcheckopen == FALSE) { $cal_filename = $default_cal; } else { $cal_filename = $default_cal_check; } } else { $cal_filename = $ALL_CALENDARS_COMBINED; } } else { $cal_filename = $default_cal; } } if (substr($cal_filename, 0, 7) == 'http://' || substr($cal_filename, 0, 9) == 'webcal://') { $is_webcal = TRUE; $cal_webcalPrefix = str_replace('http://','webcal://',$cal_filename); $cal_httpPrefix = str_replace('webcal://','http://',$cal_filename); $cal_filename = $cal_httpPrefix; } if ($is_webcal) { if ($allow_webcals == 'yes' || in_array($cal_webcalPrefix, $list_webcals) || in_array($cal_httpPrefix, $list_webcals)) { $cal_displayname = substr(str_replace('32', ' ', basename($cal_filename)), 0, -4); $cal = urlencode($cal_filename); $filename = $cal_filename; $subscribe_path = $cal_webcalPrefix; // empty the filelist array $cal_filelist = array(); array_push($cal_filelist,$filename); } else { exit(error($error_remotecal_lang, $HTTP_GET_VARS['cal'])); } } else { $cal_displayname = str_replace('32', ' ', $cal_filename); $cal = urlencode($cal_filename); if (in_array($cal_filename, $blacklisted_cals)) { exit(error($error_restrictedcal_lang, $cal_filename)); } else { if (!isset($filename)) { // empty the filelist array $cal_filelist = array(); if ($cal == $ALL_CALENDARS_COMBINED) { // Create an array with the paths to all files to be combined // Note: code here is similar to code in list_icals.php // open directory $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename)); // build the array while (false != ($file = readdir($dir_handle))) { if (preg_match("/^[^.].+\.ics$/", $file) && !in_array(substr($file, 0, -4), $blacklisted_cals)) { $file = $calendar_path.'/'.$file; array_push($cal_filelist, $file); } } // add webcals foreach ($list_webcals as $file) { if (preg_match("/^[^.].+\.ics$/", $file)) { array_push($cal_filelist, $file); } } natcasesort($cal_filelist); } else { // Handle a single file $filename = $calendar_path.'/'.$cal_filename.'.ics'; if (true == false) { $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename)); while ($file = readdir($dir_handle)) { if (substr($file, -4) == '.ics') { $cal = urlencode(substr($file, 0, -4)); $filename = $calendar_path.'/'.$file; break; } } } array_push($cal_filelist, $filename); } } // Sets the download and subscribe paths from the config if present. if ($download_uri == '') { $subscribe_path = 'webcal://'.$HTTP_SERVER_VARS['SERVER_NAME'].dirname($HTTP_SERVER_VARS['PHP_SELF']).'/'.$filename; $download_filename = $filename; } else { $newurl = eregi_replace("^(http://)", "", $download_uri); $subscribe_path = 'webcal://'.$newurl.'/'.$cal_filename.'.ics'; $download_filename = $download_uri.'/'.$cal_filename.'.ics'; } } } ?> --- NEW FILE: list_icals.php --- <?php if ($display_ical_list == "yes") { // start of <select> tag if (isset($getdate)) { $query="&getdate=$getdate"; } else { $query=""; } // open file $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename)); // empty the filelist array $filelist = array(); // build the <option> tags while (false != ($file = readdir($dir_handle))) { if (preg_match("/^[^.].+\.ics$/", $file)) { array_push($filelist, $file); } } natcasesort($filelist); foreach ($filelist as $file) { // $cal_filename is the filename of the calendar without .ics // $cal is a urlencoded version of $cal_filename // $cal_displayname is $cal_filename with occurrences of "32" replaced with " " $cal_filename_tmp = substr($file,0,-4); $cal_tmp = urlencode($cal_filename_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); if (!in_array($cal_filename_tmp, $blacklisted_cals)) { if ($cal_tmp == $cal) { print "<option value=\"$current_view.php?cal=$cal_tmp&getdate=$getdate\" selected>$cal_displayname_tmp $calendar_lang</option>"; } else { print "<option value=\"$current_view.php?cal=$cal_tmp&getdate=$getdate\">$cal_displayname_tmp $calendar_lang</option>"; } } } // option to open all (non-web) calenders together if ($cal == $ALL_CALENDARS_COMBINED) { print "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&getdate=$getdate\" selected>$all_cal_comb_lang</option>"; } else { print "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&getdate=$getdate\">$all_cal_comb_lang</option>"; } foreach($list_webcals as $cal_tmp) { if ($cal_tmp != '') { $cal_displayname_tmp = basename($cal_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp); $cal_displayname_tmp = substr($cal_displayname_tmp,0,-4); $cal_encoded_tmp = urlencode($cal_tmp); if ($cal_tmp == $cal_httpPrefix || $cal_tmp == $cal_webcalPrefix) { print "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\" selected>$cal_displayname_tmp Webcal</option>"; } else { print "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\">$cal_displayname_tmp Webcal</option>"; } } } // close file closedir($dir_handle); // finish <select> print "</select>"; } ?> --- NEW FILE: list_languages.php --- <?php print "<form>\n<select name=\"action\" class=\"query_style\">\n"; $dir_handle = @opendir(BASE.'languages/'); $tmp_pref_language = urlencode(ucfirst($language)); while ($file = readdir($dir_handle)) { if (substr($file, -8) == ".inc.php") { $language_tmp = urlencode(ucfirst(substr($file, 0, -8))); if ($language_tmp == $tmp_pref_language) { print "<option value=\"$current_view.php?chlang=$language_tmp\" selected>in $language_tmp</option>\n"; } else { print "<option value=\"$current_view.php?chlang=$language_tmp\">in $language_tmp</option>\n"; } } } closedir($dir_handle); print "</select>\n</form>\n"; ?> --- NEW FILE: list_months.php --- <?php print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n"; $month_time = strtotime("$this_year-01-01"); $getdate_month = date("m", strtotime($getdate)); // echo "$this_day, $this_year"; // build the <option> tags for ($i=0; $i<12; $i++) { $monthdate = date ("Ymd", $month_time); $month_month = date("m", $month_time); $select_month = localizeDate($dateFormat_month, $month_time); if ($month_month == $getdate_month) { print "<option value=\"month.php?cal=$cal&getdate=$monthdate\" selected>$select_month</option>\n"; } else { print "<option value=\"month.php?cal=$cal&getdate=$monthdate\">$select_month</option>\n"; } $month_time = strtotime ("+1 month", $month_time); } // finish <select> print "</select>"; ?> --- NEW FILE: list_weeks.php --- <?php ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; $check_week = strtotime($getdate); $start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("$this_year-01-01")), $week_start_day)); $end_week_time = $start_week_time + (6 * 25 * 60 * 60); print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n"; // build the <option> tags do { $weekdate = date ("Ymd", $start_week_time); $select_week1 = localizeDate($dateFormat_week_jump, $start_week_time); $select_week2 = localizeDate($dateFormat_week_jump, $end_week_time); if (($check_week >= $start_week_time) && ($check_week <= $end_week_time)) { print "<option value=\"week.php?cal=$cal&getdate=$weekdate\" selected>$select_week1 - $select_week2</option>\n"; } else { print "<option value=\"week.php?cal=$cal&getdate=$weekdate\">$select_week1 - $select_week2</option>\n"; } $start_week_time = strtotime ("+1 week", $start_week_time); $end_week_time = $start_week_time + (6 * 25 * 60 * 60); } while (date("Y", $start_week_time) <= $this_year); // finish <select> print "</select>"; ?> --- NEW FILE: list_years.php --- <?php $year_time = strtotime($getdate); print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n"; // Print the previous year options. for ($i=0; $i < $num_years; $i++) { $offset = $num_years - $i; $prev_time = strtotime("-$offset year", $year_time); $prev_date = date("Ymd", $prev_time); $prev_year = date("Y", $prev_time); print "<option value=\"year.php?cal=$cal&getdate=$prev_date\">$prev_year</option>\n"; } // Print the current year option. $getdate_date = date("Ymd", $year_time); $getdate_year = date("Y", $year_time); print "<option value=\"year.php?cal=$cal&getdate=$getdate_date\" selected>$getdate_year</option>\n"; // Print the next year options. for ($i=0; $i < $num_years; $i++) { $offset = $i + 1; $next_time = strtotime("+$offset year", $year_time); $next_date = date("Ymd", $next_time); $next_year = date("Y", $next_time); print "<option value=\"year.php?cal=$cal&getdate=$next_date\">$next_year</option>\n"; } // finish <select> print "</select>"; ?> --- NEW FILE: overlapping_events.php --- <?php // function to determine maximum necessary columns per day // actually an algorithm to get the smallest multiple for two numbers function kgv($a, $b) { $x = $a; $y = $b; while ($x != $y) { if ($x < $y) $x += $a; else $y += $b; } return $x; } // drei 20020921: function for checking and counting overlapping events // drei 20020212: added parameter uid to function call function checkOverlap($ol_start_date, $ol_start_time, $ol_end_time, $ol_uid) { global $master_array, $overlap_array; $drawTimes = drawEventTimes($ol_start_time, $ol_end_time); $newMasterTime = $drawTimes["draw_start"]; // if (isset($master_array[($ol_start_date)][($newMasterTime)])) $newMasterEventKey = sizeof($master_array[($ol_start_date)][($newMasterTime)]); // else $newMasterEventKey = 0; $maxOverlaps = 0; $newEventAdded = FALSE; if (isset($overlap_array[($ol_start_date)])) { foreach ($overlap_array[($ol_start_date)] as $loopBlockKey => $loopBlock) { // check for overlap with existing overlap block if (($loopBlock["blockStart"] < $drawTimes["draw_end"]) and ($loopBlock["blockEnd"] > $drawTimes["draw_start"])) { $newOverlapBlock = FALSE; // if necessary adjust start and end times of overlap block if ($loopBlock["blockStart"] > $drawTimes["draw_start"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["blockStart"] = $drawTimes["draw_start"]; if ($loopBlock["blockEnd"] < $drawTimes["draw_end"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["blockEnd"] = $drawTimes["draw_end"]; // add the new event to the array of events // $overlap_array[($ol_start_date)][($loopBlockKey)]["events"][] = array ("time" => $newMasterTime, "key" => $newMasterEventKey); $overlap_array[($ol_start_date)][($loopBlockKey)]["events"][] = array ("time" => $newMasterTime, "key" => $ol_uid); // check if the adjusted overlap block must be merged with an existing overlap block reset($overlap_array[($ol_start_date)]); do { $compBlockKey = key(current($overlap_array[($ol_start_date)])); // only compare with other blocks if ($compBlockKey != $loopBlockKey) { // check if blocks overlap if (($overlap_array[($ol_start_date)][($compBlockKey)]["blockStart"] < $overlap_array[($ol_start_date)][($loopBlockKey)]["blockEnd"]) and ($overlap_array[($ol_start_date)][($compBlockKey)]["blockEnd"] > $overlap_array[($ol_start_date)][($loopBlockKey)]["blockStart"])) { // define start and end of merged overlap block if ($loopBlock["blockStart"] > $overlap_array[($ol_start_date)][($compBlockKey)]["blockStart"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["blockStart"] = $overlap_array[($ol_start_date)][($compBlockKey)]["blockStart"]; if ($loopBlock["blockEnd"] < $overlap_array[($ol_start_date)][($compBlockKey)]["blockEnd"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["blockEnd"] = $overlap_array[($ol_start_date)][($compBlockKey)]["blockEnd"]; $overlap_array[($ol_start_date)][($loopBlockKey)]["events"] = array_merge($overlap_array[($ol_start_date)][($loopBlockKey)]["events"],$overlap_array[($ol_start_date)][($compBlockKey)]["events"]); $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"] = array_merge($overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"],$overlap_array[($ol_start_date)][($compBlockKey)]["overlapRanges"]); unset($overlap_array[($ol_start_date)][($compBlockKey)]); reset($overlap_array[($ol_start_date)]); } } } while (next($overlap_array[($ol_start_date)])); // insert new event to appropriate overlap range $newOverlapRange = TRUE; foreach ($overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"] as $keyOverlap => $overlapRange) { if (($overlapRange["start"] < $drawTimes["draw_end"]) and ($overlapRange["end"] > $drawTimes["draw_start"])) { $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["count"]++; if ($overlapRange["start"] < $drawTimes["draw_start"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["start"] = $drawTimes["draw_start"]; if ($overlapRange["end"] > $drawTimes["draw_end"]) $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["end"] = $drawTimes["draw_end"]; $newOverlapRange = FALSE; // break; } } if ($newOverlapRange) { foreach ($loopBlock["events"] as $blockEvents) { $eventDrawTimes = drawEventTimes($master_array[($ol_start_date)][($blockEvents["time"])][($blockEvents["key"])]["event_start"], $master_array[($ol_start_date)][($blockEvents["time"])][($blockEvents["key"])]["event_end"]); if ((isset($eventDrawTimes["draw_start"]) && isset($eventDrawTimes["draw_end"]) && isset($drawTimes["draw_end"]) && isset($drawTimes["draw_start"])) && ($eventDrawTimes["draw_start"] < $drawTimes["draw_end"]) and ($eventDrawTimes["draw_end"] > $drawTimes["draw_start"])) { // define start time of overlap range and overlap block if ($eventDrawTimes["draw_start"] < $drawTimes["draw_start"]) $overlap_start = $drawTimes["draw_start"]; else $overlap_start = $eventDrawTimes["draw_start"]; // define end time of overlap range and overlap block if ($eventDrawTimes["draw_end"] > $drawTimes["draw_end"]) $overlap_end = $drawTimes["draw_end"]; else $overlap_end = $eventDrawTimes["draw_end"]; $newOverlapRange2 = TRUE; foreach ($overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"] as $keyOverlap => $overlapRange) { if (($overlapRange["start"] < $overlap_end) and ($overlapRange["end"] > $overlap_start)) { $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["count"]++; if ($overlapRange["start"] < $overlap_start) $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["start"] = $overlap_start; if ($overlapRange["end"] > $overlap_end) $overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"][($keyOverlap)]["end"] = $overlap_end; $newOverlapRange2 = FALSE; // break; } } if ($newOverlapRange2) { array_push($overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"], array ("count" => 1,"start" => $overlap_start, "end" => $overlap_end)); } } } } // determine the maximum overlaps for the current overlap block foreach ($overlap_array[($ol_start_date)][($loopBlockKey)]["overlapRanges"] as $overlapRange) { if ($overlapRange["count"] > $maxOverlaps) $maxOverlaps = $overlapRange["count"]; } $overlap_array[($ol_start_date)][($loopBlockKey)]["maxOverlaps"] = $maxOverlaps; foreach ($overlap_array[($ol_start_date)][($loopBlockKey)]["events"] as $updMasterEvent) { //if (($updMasterEvent["time"] != $newMasterTime) or ($updMasterEvent["key"] != $newMasterEventKey)) { if (($updMasterEvent["time"] != $newMasterTime) or ($updMasterEvent["key"] != $ol_uid)) { $master_array[($ol_start_date)][($updMasterEvent["time"])][($updMasterEvent["key"])]["event_overlap"] = $maxOverlaps; } } $newEventAdded = TRUE; break; } } } if (!$newEventAdded) { if (isset($master_array[($ol_start_date)])) { foreach ($master_array[($ol_start_date)] as $keyTime => $eventTime) { foreach ($eventTime as $keyEvent => $event) { if ($keyTime != '-1') $entryDrawTimes = drawEventTimes($event["event_start"], $event["event_end"]); if ((isset($entryDrawTimes["draw_start"]) && isset($entryDrawTimes["draw_end"]) && isset($drawTimes["draw_end"]) && isset($drawTimes["draw_start"])) && ($entryDrawTimes["draw_start"] < $drawTimes["draw_end"]) and ($entryDrawTimes["draw_end"] > $drawTimes["draw_start"])) { // define start time of overlap range and overlap block if ($entryDrawTimes["draw_start"] < $drawTimes["draw_start"]) { $overlap_start = $drawTimes["draw_start"]; $overlapBlock_start = $entryDrawTimes["draw_start"]; } else { $overlap_start = $entryDrawTimes["draw_start"]; $overlapBlock_start = $drawTimes["draw_start"]; } // define end time of overlap range and overlap block if ($entryDrawTimes["draw_end"] > $drawTimes["draw_end"]) { $overlap_end = $drawTimes["draw_end"]; $overlapBlock_end = $entryDrawTimes["draw_end"]; } else { $overlap_end = $entryDrawTimes["draw_end"]; $overlapBlock_end = $drawTimes["draw_end"]; } if (!isset($newBlockKey)) { // $overlap_array[($ol_start_date)][] = array ("blockStart" => $overlapBlock_start, "blockEnd" => $overlapBlock_end, "maxOverlaps" => 1, "events" => array (array ("time" => $keyTime, "key" => $keyEvent), array ("time" => $newMasterTime, "key" => $newMasterEventKey)), "overlapRanges" => array (array ("count" => 1, "start" => $overlap_start, "end" => $overlap_end))); $overlap_array[($ol_start_date)][] = array ("blockStart" => $overlapBlock_start, "blockEnd" => $overlapBlock_end, "maxOverlaps" => 1, "events" => array (array ("time" => $keyTime, "key" => $keyEvent), array ("time" => $newMasterTime, "key" => $ol_uid)), "overlapRanges" => array (array ("count" => 1, "start" => $overlap_start, "end" => $overlap_end))); $maxOverlaps = 1; end($overlap_array[($ol_start_date)]); $newBlockKey = key($overlap_array[($ol_start_date)]); } else { if ($overlap_array[($ol_start_date)][($newBlockKey)]["blockStart"] > $overlapBlock_start) $overlap_array[($ol_start_date)][($newBlockKey)]["blockStart"] = $overlapBlock_start; if ($overlap_array[($ol_start_date)][($newBlockKey)]["blockEnd"] < $overlapBlock_end) $overlap_array[($ol_start_date)][($newBlockKey)]["blockEnd"] = $overlapBlock_end; $overlap_array[($ol_start_date)][($newBlockKey)]["events"][] = array ("time" => $keyTime, "key" => $keyEvent); $overlap_array[($ol_start_date)][($newBlockKey)]["overlapRanges"][] = array ("count" => 1, "start" => $overlap_start, "end" => $overlap_end); } // update master_array $master_array[($ol_start_date)][($keyTime)][($keyEvent)]["event_overlap"] = $maxOverlaps; } } } } } // for debugging the checkOverlap function //print 'Date: ' . $ol_start_date . ' / New Time: ' . $newMasterTime . ' / New Key: ' . $newMasterEventKey . '<br />'; //print '<pre>'; //print_r($overlap_array); //print '</pre>'; return $maxOverlaps; } // drei 20021126: function for checking and removing overlapping events //function removeOverlap($ol_start_date, $ol_start_time, $ol_key = 0) { function removeOverlap($ol_start_date, $ol_start_time, $ol_key) { global $master_array, $overlap_array; if (isset($overlap_array[$ol_start_date])) { if (sizeof($overlap_array[$ol_start_date]) > 0) { $ol_end_time = $master_array[$ol_start_date][$ol_start_time][$ol_key]["event_end"]; foreach ($overlap_array[$ol_start_date] as $keyBlock => $blockId) { // if (($blockId["blockStart"] <= $ol_start_time) or ($blockId["blockEnd"] >= $ol_start_time)) { if (($blockId["blockStart"] <= $ol_start_time) and ($blockId["blockEnd"] > $ol_start_time)) { foreach ($blockId["events"] as $keyEvent => $ol_event) { $master_array[$ol_start_date][$ol_event["time"]][$ol_event["key"]]["event_overlap"] -= 1; if (($ol_event["time"] == $ol_start_time) and ($ol_event["key"] == $ol_key)) { unset ($overlap_array[$ol_start_date][$keyBlock]["events"][$keyEvent]); } } if ($blockId["maxOverlaps"] == 1) { unset ($overlap_array[$ol_start_date][$keyBlock]); } else { $overlap_array[$ol_start_date][$keyBlock]["maxOverlaps"] -= 1; //$blockId["maxOverlaps"] -= 1; // SJBO: Shouldn't something be done with [overlapRanges] as well? } } } } } } ?> --- NEW FILE: timezones.php --- <?php $tz_array['Africa/Addis_Ababa'] = array('+0300', '+0300'); $tz_array['Africa/Algiers'] = array('+0100', '+0100'); $tz_array['Africa/Asmera'] = array('+0300', '+0300'); $tz_array['Africa/Bangui'] = array('+0100', '+0100'); $tz_array['Africa/Blantyre'] = array('+0200', '+0200'); $tz_array['Africa/Brazzaville'] = array('+0100', '+0100'); $tz_array['Africa/Bujumbura'] = array('+0200', '+0200'); $tz_array['Africa/Cairo'] = array('+0200', '+0300'); $tz_array['Africa/Ceuta'] = array('+0100', '+0200'); $tz_array['Africa/Dar_es_Salaam'] = array('+0300', '+0300'); $tz_array['Africa/Djibouti'] = array('+0300', '+0300'); $tz_array['Africa/Douala'] = array('+0100', '+0100'); $tz_array['Africa/Gaborone'] = array('+0200', '+0200'); $tz_array['Africa/Harare'] = array('+0200', '+0200'); $tz_array['Africa/Johannesburg'] = array('+0200', '+0200'); $tz_array['Africa/Kampala'] = array('+0300', '+0300'); $tz_array['Africa/Khartoum'] = array('+0300', '+0300'); $tz_array['Africa/Kigali'] = array('+0200', '+0200'); $tz_array['Africa/Kinshasa'] = array('+0100', '+0100'); $tz_array['Africa/Lagos'] = array('+0100', '+0100'); $tz_array['Africa/Libreville'] = array('+0100', '+0100'); $tz_array['Africa/Luanda'] = array('+0100', '+0100'); $tz_array['Africa/Lubumbashi'] = array('+0200', '+0200'); $tz_array['Africa/Lusaka'] = array('+0200', '+0200'); $tz_array['Africa/Malabo'] = array('+0100', '+0100'); $tz_array['Africa/Maputo'] = array('+0200', '+0200'); $tz_array['Africa/Maseru'] = array('+0200', '+0200'); $tz_array['Africa/Mbabane'] = array('+0200', '+0200'); $tz_array['Africa/Mogadishu'] = array('+0300', '+0300'); $tz_array['Africa/Nairobi'] = array('+0300', '+0300'); $tz_array['Africa/Ndjamena'] = array('+0100', '+0100'); $tz_array['Africa/Niamey'] = array('+0100', '+0100'); $tz_array['Africa/Porto-Novo'] = array('+0100', '+0100'); $tz_array['Africa/Tripoli'] = array('+0200', '+0200'); $tz_array['Africa/Tunis'] = array('+0100', '+0100'); $tz_array['Africa/Windhoek'] = array('+0200', '+0100'); $tz_array['America/Adak'] = array('-1000', '-0900'); $tz_array['America/Anchorage'] = array('-0900', '-0800'); $tz_array['America/Anguilla'] = array('-0400', '-0400'); $tz_array['America/Antigua'] = array('-0400', '-0400'); $tz_array['America/Araguaina'] = array('-0200', '-0300'); $tz_array['America/Aruba'] = array('-0400', '-0400'); $tz_array['America/Asuncion'] = array('-0300', '-0400'); $tz_array['America/Atka'] = array('-1000', '-0900'); $tz_array['America/Barbados'] = array('-0400', '-0400'); $tz_array['America/Belem'] = array('-0300', '-0300'); $tz_array['America/Belize'] = array('-0600', '-0600'); $tz_array['America/Boa_Vista'] = array('-0400', '-0400'); $tz_array['America/Bogota'] = array('-0500', '-0500'); $tz_array['America/Boise'] = array('-0700', '-0600'); $tz_array['America/Buenos_Aires'] = array('-0300', '-0300'); $tz_array['America/Cambridge_Bay'] = array('-0700', '-0600'); $tz_array['America/Cancun'] = array('-0600', '-0500'); $tz_array['America/Caracas'] = array('-0400', '-0400'); $tz_array['America/Catamarca'] = array('-0300', '-0300'); $tz_array['America/Cayenne'] = array('-0300', '-0300'); $tz_array['America/Cayman'] = array('-0500', '-0500'); $tz_array['America/Chicago'] = array('-0600', '-0500'); $tz_array['America/Chihuahua'] = array('-0700', '-0600'); $tz_array['America/Cordoba'] = array('-0300', '-0300'); $tz_array['America/Costa_Rica'] = array('-0600', '-0600'); $tz_array['America/Cuiaba'] = array('-0300', '-0400'); $tz_array['America/Curacao'] = array('-0400', '-0400'); $tz_array['America/Dawson'] = array('-0800', '-0700'); $tz_array['America/Dawson_Creek'] = array('-0700', '-0700'); $tz_array['America/Denver'] = array('-0700', '-0600'); $tz_array['America/Detroit'] = array('-0500', '-0400'); $tz_array['America/Dominica'] = array('-0400', '-0400'); $tz_array['America/Edmonton'] = array('-0700', '-0600'); $tz_array['America/Eirunepe'] = array('-0500', '-0500'); $tz_array['America/El_Salvador'] = array('-0600', '-0600'); $tz_array['America/Ensenada'] = array('-0800', '-0700'); $tz_array['America/Fort_Wayne'] = array('-0500', '-0500'); $tz_array['America/Fortaleza'] = array('-0300', '-0300'); $tz_array['America/Glace_Bay'] = array('-0400', '-0300'); $tz_array['America/Godthab'] = array('-0300', '-0200'); $tz_array['America/Goose_Bay'] = array('-0400', '-0300'); $tz_array['America/Grand_Turk'] = array('-0500', '-0400'); $tz_array['America/Grenada'] = array('-0400', '-0400'); $tz_array['America/Guadeloupe'] = array('-0400', '-0400'); $tz_array['America/Guatemala'] = array('-0600', '-0600'); $tz_array['America/Guayaquil'] = array('-0500', '-0500'); $tz_array['America/Guyana'] = array('-0400', '-0400'); $tz_array['America/Halifax'] = array('-0400', '-0300'); $tz_array['America/Havana'] = array('-0500', '-0400'); $tz_array['America/Hermosillo'] = array('-0700', '-0700'); $tz_array['America/Indiana/Indianapolis'] = array('-0500', '-0500'); $tz_array['America/Indiana/Knox'] = array('-0500', '-0500'); $tz_array['America/Indiana/Marengo'] = array('-0500', '-0500'); $tz_array['America/Indiana/Vevay'] = array('-0500', '-0500'); $tz_array['America/Indianapolis'] = array('-0500', '-0500'); $tz_array['America/Inuvik'] = array('-0700', '-0600'); $tz_array['America/Iqaluit'] = array('-0500', '-0400'); $tz_array['America/Jamaica'] = array('-0500', '-0500'); $tz_array['America/Jujuy'] = array('-0300', '-0300'); $tz_array['America/Juneau'] = array('-0900', '-0800'); $tz_array['America/Kentucky/Louisville'] = array('-0500', '-0400'); $tz_array['America/Kentucky/Monticello'] = array('-0500', '-0400'); $tz_array['America/Knox_IN'] = array('-0500', '-0500'); $tz_array['America/La_Paz'] = array('-0400', '-0400'); $tz_array['America/Lima'] = array('-0500', '-0500'); $tz_array['America/Los_Angeles'] = array('-0800', '-0700'); $tz_array['America/Louisville'] = array('-0500', '-0400'); $tz_array['America/Maceio'] = array('-0300', '-0300'); $tz_array['America/Managua'] = array('-0600', '-0600'); $tz_array['America/Manaus'] = array('-0400', '-0400'); $tz_array['America/Martinique'] = array('-0400', '-0400'); $tz_array['America/Mazatlan'] = array('-0700', '-0600'); $tz_array['America/Mendoza'] = array('-0300', '-0300'); $tz_array['America/Menominee'] = array('-0600', '-0500'); $tz_array['America/Merida'] = array('-0600', '-0500'); $tz_array['America/Mexico_City'] = array('-0600', '-0500'); $tz_array['America/Miquelon'] = array('-0300', '-0200'); $tz_array['America/Monterrey'] = array('-0600', '-0500'); $tz_array['America/Montevideo'] = array('-0300', '-0300'); $tz_array['America/Montreal'] = array('-0500', '-0400'); $tz_array['America/Montserrat'] = array('-0400', '-0400'); $tz_array['America/Nassau'] = array('-0500', '-0400'); $tz_array['America/New_York'] = array('-0500', '-0400'); $tz_array['America/Nipigon'] = array('-0500', '-0400'); $tz_array['America/Nome'] = array('-0900', '-0800'); $tz_array['America/Noronha'] = array('-0200', '-0200'); $tz_array['America/Panama'] = array('-0500', '-0500'); $tz_array['America/Pangnirtung'] = array('-0500', '-0400'); $tz_array['America/Paramaribo'] = array('-0300', '-0300'); $tz_array['America/Phoenix'] = array('-0700', '-0700'); $tz_array['America/Port-au-Prince'] = array('-0500', '-0500'); $tz_array['America/Port_of_Spain'] = array('-0400', '-0400'); $tz_array['America/Porto_Acre'] = array('-0500', '-0500'); $tz_array['America/Porto_Velho'] = array('-0400', '-0400'); $tz_array['America/Puerto_Rico'] = array('-0400', '-0400'); $tz_array['America/Rainy_River'] = array('-0600', '-0500'); $tz_array['America/Rankin_Inlet'] = array('-0600', '-0500'); $tz_array['America/Recife'] = array('-0300', '-0300'); $tz_array['America/Regina'] = array('-0600', '-0600'); $tz_array['America/Rio_Branco'] = array('-0500', '-0500'); $tz_array['America/Rosario'] = array('-0300', '-0300'); $tz_array['America/Santiago'] = array('-0300', '-0400'); $tz_array['America/Santo_Domingo'] = array('-0400', '-0400'); $tz_array['America/Sao_Paulo'] = array('-0200', '-0300'); $tz_array['America/Scoresbysund'] = array('-0100', '+0000'); $tz_array['America/Shiprock'] = array('-0700', '-0600'); $tz_array['America/St_Johns'] = array('-031800', '-021800'); $tz_array['America/St_Kitts'] = array('-0400', '-0400'); $tz_array['America/St_Lucia'] = array('-0400', '-0400'); $tz_array['America/St_Thomas'] = array('-0400', '-0400'); $tz_array['America/St_Vincent'] = array('-0400', '-0400'); $tz_array['America/Swift_Current'] = array('-0600', '-0600'); $tz_array['America/Tegucigalpa'] = array('-0600', '-0600'); $tz_array['America/Thule'] = array('-0400', '-0300'); $tz_array['America/Thunder_Bay'] = array('-0500', '-0400'); $tz_array['America/Tijuana'] = array('-0800', '-0700'); $tz_array['America/Tortola'] = array('-0400', '-0400'); $tz_array['America/Vancouver'] = array('-0800', '-0700'); $tz_array['America/Virgin'] = array('-0400', '-0400'); $tz_array['America/Whitehorse'] = array('-0800', '-0700'); $tz_array['America/Winnipeg'] = array('-0600', '-0500'); $tz_array['America/Yakutat'] = array('-0900', '-0800'); $tz_array['America/Yellowknife'] = array('-0700', '-0600'); $tz_array['Antarctica/Casey'] = array('+0800', '+0800'); $tz_array['Antarctica/Davis'] = array('+0700', '+0700'); $tz_array['Antarctica/DumontDUrville'] = array('+1000', '+1000'); $tz_array['Antarctica/Mawson'] = array('+0600', '+0600'); $tz_array['Antarctica/McMurdo'] = array('+1300', '+1200'); $tz_array['Antarctica/Palmer'] = array('-0300', '-0400'); $tz_array['Antarctica/South_Pole'] = array('+1300', '+1200'); $tz_array['Antarctica/Syowa'] = array('+0300', '+0300'); $tz_array['Antarctica/Vostok'] = array('+0600', '+0600'); $tz_array['Arctic/Longyearbyen'] = array('+0100', '+0200'); $tz_array['Asia/Aden'] = array('+0300', '+0300'); $tz_array['Asia/Almaty'] = array('+0600', '+0700'); $tz_array['Asia/Amman'] = array('+0200', '+0300'); $tz_array['Asia/Anadyr'] = array('+1200', '+1300'); $tz_array['Asia/Aqtau'] = array('+0400', '+0500'); $tz_array['Asia/Aqtobe'] = array('+0500', '+0600'); $tz_array['Asia/Ashgabat'] = array('+0500', '+0500'); $tz_array['Asia/Ashkhabad'] = array('+0500', '+0500'); $tz_array['Asia/Baghdad'] = array('+0300', '+0400'); $tz_array['Asia/Bahrain'] = array('+0300', '+0300'); $tz_array['Asia/Baku'] = array('+0400', '+0500'); $tz_array['Asia/Bangkok'] = array('+0700', '+0700'); $tz_array['Asia/Beirut'] = array('+0200', '+0300'); $tz_array['Asia/Bishkek'] = array('+0500', '+0600'); $tz_array['Asia/Brunei'] = array('+0800', '+0800'); $tz_array['Asia/Calcutta'] = array('+051800', '+051800'); $tz_array['Asia/Chungking'] = array('+0800', '+0800'); $tz_array['Asia/Colombo'] = array('+0600', '+0600'); $tz_array['Asia/Dacca'] = array('+0600', '+0600'); $tz_array['Asia/Damascus'] = array('+0200', '+0300'); $tz_array['Asia/Dhaka'] = array('+0600', '+0600'); $tz_array['Asia/Dili'] = array('+0900', '+0900'); $tz_array['Asia/Dubai'] = array('+0400', '+0400'); $tz_array['Asia/Dushanbe'] = array('+0500', '+0500'); $tz_array['Asia/Gaza'] = array('+0200', '+0300'); $tz_array['Asia/Harbin'] = array('+0800', '+0800'); $tz_array['Asia/Hong_Kong'] = array('+0800', '+0800'); $tz_array['Asia/Hovd'] = array('+0700', '+0700'); $tz_array['Asia/Irkutsk'] = array('+0800', '+0900'); $tz_array['Asia/Istanbul'] = array('+0200', '+0300'); $tz_array['Asia/Jakarta'] = array('+0700', '+0700'); $tz_array['Asia/Jayapura'] = array('+0900', '+0900'); $tz_array['Asia/Jerusalem'] = array('+0200', '+0300'); $tz_array['Asia/Kabul'] = array('+041800', '+041800'); $tz_array['Asia/Kamchatka'] = array('+1200', '+1300'); $tz_array['Asia/Karachi'] = array('+0500', '+0500'); $tz_array['Asia/Kashgar'] = array('+0800', '+0800'); $tz_array['Asia/Katmandu'] = array('+052700', '+052700'); $tz_array['Asia/Krasnoyarsk'] = array('+0700', '+0800'); $tz_array['Asia/Kuala_Lumpur'] = array('+0800', '+0800'); $tz_array['Asia/Kuching'] = array('+0800', '+0800'); $tz_array['Asia/Kuwait'] = array('+0300', '+0300'); $tz_array['Asia/Macao'] = array('+0800', '+0800'); $tz_array['Asia/Magadan'] = array('+1100', '+1200'); $tz_array['Asia/Manila'] = array('+0800', '+0800'); $tz_array['Asia/Muscat'] = array('+0400', '+0400'); $tz_array['Asia/Nicosia'] = array('+0200', '+0300'); $tz_array['Asia/Novosibirsk'] = array('+0600', '+0700'); $tz_array['Asia/Omsk'] = array('+0600', '+0700'); $tz_array['Asia/Phnom_Penh'] = array('+0700', '+0700'); $tz_array['Asia/Pyongyang'] = array('+0900', '+0900'); $tz_array['Asia/Qatar'] = array('+0300', '+0300'); $tz_array['Asia/Rangoon'] = array('+061800', '+061800'); $tz_array['Asia/Riyadh'] = array('+0300', '+0300'); $tz_array['Asia/Riyadh87'] = array('+03424', '+03424'); $tz_array['Asia/Riyadh88'] = array('+03424', '+03424'); $tz_array['Asia/Riyadh89'] = array('+03424', '+03424'); $tz_array['Asia/Saigon'] = array('+0700', '+0700'); $tz_array['Asia/Samarkand'] = array('+0500', '+0500'); $tz_array['Asia/Seoul'] = array('+0900', '+0900'); $tz_array['Asia/Shanghai'] = array('+0800', '+0800'); $tz_array['Asia/Singapore'] = array('+0800', '+0800'); $tz_array['Asia/Taipei'] = array('+0800', '+0800'); $tz_array['Asia/Tashkent'] = array('+0500', '+0500'); $tz_array['Asia/Tbilisi'] = array('+0400', '+0500'); $tz_array['Asia/Tehran'] = array('+031800', '+041800'); $tz_array['Asia/Tel_Aviv'] = array('+0200', '+0300'); $tz_array['Asia/Thimbu'] = array('+0600', '+0600'); $tz_array['Asia/Thimphu'] = array('+0600', '+0600'); $tz_array['Asia/Tokyo'] = array('+0900', '+0900'); $tz_array['Asia/Ujung_Pandang'] = array('+0800', '+0800'); $tz_array['Asia/Ulaanbaatar'] = array('+0800', '+0800'); $tz_array['Asia/Ulan_Bator'] = array('+0800', '+0800'); $tz_array['Asia/Urumqi'] = array('+0800', '+0800'); $tz_array['Asia/Vientiane'] = array('+0700', '+0700'); $tz_array['Asia/Vladivostok'] = array('+1000', '+1100'); $tz_array['Asia/Yakutsk'] = array('+0900', '+1000'); $tz_array['Asia/Yekaterinburg'] = array('+0500', '+0600'); $tz_array['Asia/Yerevan'] = array('+0400', '+0500'); $tz_array['Atlantic/Azores'] = array('-0100', '+0000'); $tz_array['Atlantic/Bermuda'] = array('-0400', '-0300'); $tz_array['Atlantic/Canary'] = array('+0000', '+0100'); $tz_array['Atlantic/Cape_Verde'] = array('-0100', '-0100'); $tz_array['Atlantic/Faeroe'] = array('+0000', '+0100'); $tz_array['Atlantic/Jan_Mayen'] = array('-0100', '-0100'); $tz_array['Atlantic/Madeira'] = array('+0000', '+0100'); $tz_array['Atlantic/South_Georgia'] = array('-0200', '-0200'); $tz_array['Atlantic/Stanley'] = array('-0300', '-0400'); $tz_array['Australia/ACT'] = array('+1100', '+1000'); $tz_array['Australia/Adelaide'] = array('+101800', '+091800'); $tz_array['Australia/Brisbane'] = array('+1000', '+1000'); $tz_array['Australia/Broken_Hill'] = array('+101800', '+091800'); $tz_array['Australia/Canberra'] = array('+1100', '+1000'); $tz_array['Australia/Darwin'] = array('+091800', '+091800'); $tz_array['Australia/Hobart'] = array('+1100', '+1000'); $tz_array['Australia/LHI'] = array('+1100', '+101800'); $tz_array['Australia/Lindeman'] = array('+1000', '+1000'); $tz_array['Australia/Lord_Howe'] = array('+1100', '+101800'); $tz_array['Australia/Melbourne'] = array('+1100', '+1000'); $tz_array['Australia/NSW'] = array('+1100', '+1000'); $tz_array['Australia/North'] = array('+091800', '+091800'); $tz_array['Australia/Perth'] = array('+0800', '+0800'); $tz_array['Australia/Queensland'] = array('+1000', '+1000'); $tz_array['Australia/South'] = array('+101800', '+091800'); $tz_array['Australia/Sydney'] = array('+1100', '+1000'); $tz_array['Australia/Tasmania'] = array('+1100', '+1000'); $tz_array['Australia/Victoria'] = array('+1100', '+1000'); $tz_array['Australia/West'] = array('+0800', '+0800'); $tz_array['Australia/Yancowinna'] = array('+101800', '+091800'); $tz_array['Brazil/Acre'] = array('-0500', '-0500'); $tz_array['Brazil/DeNoronha'] = array('-0200', '-0200'); $tz_array['Brazil/East'] = array('-0200', '-0300'); $tz_array['Brazil/West'] = array('-0400', '-0400'); $tz_array['CET'] = array('+0100', '+0200'); $tz_array['CST6CDT'] = array('-0600', '-0500'); $tz_array['Canada/Atlantic'] = array('-0400', '-0300'); $tz_array['Canada/Central'] = array('-0600', '-0500'); $tz_array['Canada/East-Saskatchewan'] = array('-0600', '-0600'); $tz_array['Canada/Eastern'] = array('-0500', '-0400'); $tz_arra... [truncated message content] |