diff options
-rw-r--r-- | config.inc.php | 2 | ||||
-rw-r--r-- | functions/calendar_functions.php | 194 | ||||
-rw-r--r-- | functions/date_functions.php | 87 | ||||
-rw-r--r-- | functions/ical_parser.php | 219 | ||||
-rw-r--r-- | functions/list_functions.php | 9 | ||||
-rw-r--r-- | functions/template.php | 4 | ||||
-rw-r--r-- | rss/index.php | 6 |
7 files changed, 243 insertions, 278 deletions
diff --git a/config.inc.php b/config.inc.php index 048b18b..a3c7517 100644 --- a/config.inc.php +++ b/config.inc.php @@ -39,6 +39,8 @@ $show_todos = 'yes'; // Show your todo list on the side of day and week vie $show_completed = 'yes'; // Show completed todos on your todo list. $allow_login = 'no'; // Set to yes to prompt for login to unlock calendars. $login_cookies = 'no'; // Set to yes to store authentication information via (unencrypted) cookies. Set to no to use sessions. +$support_ical = 'no'; // Set to yes to support the Apple iCal calendar database structure. +$recursive_path = 'no'; // Set to yes to recurse into subdirectories of the calendar path. // Calendar Caching (decreases page load times) $save_parsed_cals = 'no'; // Saves a copy of the cal in /tmp after it's been parsed. Improves performence. diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index 7a5d88e..a345259 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -14,7 +14,7 @@ // returned. function availableCalendars($username, $password, $cal_filename, $admin = false) { // Import globals. - global $allow_login, $calendar_path, $blacklisted_cals, $list_webcals, $locked_cals, $locked_map, $apache_map, $lang, $ALL_CALENDARS_COMBINED, $_SERVER; + global $allow_login, $calendar_path, $recursive_path, $support_ical, $blacklisted_cals, $list_webcals, $locked_cals, $locked_map, $apache_map, $lang, $ALL_CALENDARS_COMBINED, $_SERVER; // Create the list of available calendars. $calendars = array(); @@ -30,39 +30,20 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) if (isset($locked_map["$username:$password"])) { $unlocked_cals = $locked_map["$username:$password"]; } - - // Include all local and web calendars if asking for all calendars - // combined. - if ($cal_filename == $ALL_CALENDARS_COMBINED || $admin) { - // Add local calendars. - $dir_handle = @opendir($calendar_path) - or die(error(sprintf($lang['l_error_path'], $calendar_path), $cal_filename)); - while (($file = readdir($dir_handle)) != false) { - // Make sure this is not a dot file and it ends with .ics, - // and that it is not blacklisted. - if (!preg_match("/^[^.].*\.ics$/i", $file)) continue; - $cal_name = substr($file, 0, -4); - if (in_array($cal_name, $blacklisted_cals)) continue; + // Make a local copy of the requested calendars. + if (!is_array($cal_filename)) + $cal_filename_local = array($cal_filename); + else + $cal_filename_local = $cal_filename; - // If HTTP authenticated, make sure this calendar is available - // to the user. - if (isset($http_user)) { - if (!in_array($cal_name, $apache_map[$http_user])) continue; - } - - // Otherwise exclude locked calendars. - else if (!$admin && - in_array($cal_name, $locked_cals) && - !in_array($cal_name, $unlocked_cals)) - { - continue; - } - - // Add this calendar. - array_push($calendars, "$calendar_path/$file"); - } + // Create the list of available calendars. + $calendars = array(); + + // This array keeps track of paths we need to search. + $search_paths = array($calendar_path); - // Add web calendars. + // Add web calendars. + if ($cal_filename == $ALL_CALENDARS_COMBINED || $admin) { if (!isset($http_user) && !$admin) { foreach ($list_webcals as $file) { // Make sure the URL ends with .ics. @@ -74,55 +55,92 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) } } - // Otherwise just include the requested calendar. - else { - if(!is_array($cal_filename)) { - $cal_filename_local = array($cal_filename); - } - else { - $cal_filename_local = $cal_filename; - } - - foreach($cal_filename_local as $c) { - - // Make sure this is not a blacklisted calendar. We don't have - // to remove a .ics suffix because it would not have been passed - // in the argument. - if (in_array($c, $blacklisted_cals)) - exit(error($lang['l_error_restrictedcal'], $c)); - - // If HTTP authenticated, make sure this calendar is available - // to the user. - if (isset($http_user)) { - if (!in_array($c, $apache_map[$http_user])) { - // Use the invalid calendar message so that the user is - // not made aware of locked calendars. - exit(error($lang['l_error_invalidcal'], $c)); + // Set some booleans that will dictate our search. + $find_all = ($cal_filename == $ALL_CALENDARS_COMBINED || $admin); + + // Process all search paths. + while (!empty($search_paths)) { + // Read the next search path. + $search_path = array_pop($search_paths); + + // This array keeps track of filenames we need to look at. + $files = array(); + + // Build the list of files we need to check. + if ($find_all || $recursive_path == 'yes') { + // Open the directory. + $dir_handle = @opendir($search_path) + or die(error(sprintf($lang['l_error_path'], $search_path), $cal_filename)); + if ($dir_handle === false) + die(error(sprintf($lang['l_error_path'], $search_path), $cal_filename)); + + // Add each file in the directory that does not begin with a dot. + while (false !== ($file = readdir($dir_handle))) { + // Make sure this is not a dot file. + if (preg_match("/^\./", $file)) continue; + array_push($files, "$search_path/$file"); + } + } else { + foreach ($cal_filename_local as $filename) { + array_push($files, "$search_path/$filename"); } } - // Otherwise make sure this calendar is not locked. - else if (in_array($c, $locked_cals) && - !in_array($c, $unlocked_cals)) - { - // Use the invalid calendar message so that the user is - // not made aware of locked calendars. - exit(error($lang['l_error_invalidcal'], $c)); - } + // Process files. + foreach ($files as $file) { + // Push directories onto the search paths if recursive paths is + // turned on. + if (is_dir($file)) { + if ($recursive_path == 'yes') { + array_push($search_paths, $file); + } + continue; + } + + // Make sure the file is real. + if (!is_file($file)) continue; + + // Make sure the file ends in .ics. + if (!preg_match("/^.*\.ics$/i", $file)) continue; + + // Make sure this is not a blacklisted calendar. + $cal_name = getCalendarName($file); + if (in_array($cal_name, $blacklisted_cals)) continue; + + // If HTTP authenticated, make sure this calendar is available + // to the user. + if (isset($http_user)) { + if (!in_array($cal_name, $apache_map[$http_user])) continue; + } - // Add this calendar. - array_push($calendars, "$calendar_path/$c.ics"); + // Make sure this calendar is not locked. + if (!$admin && + in_array($cal_name, $locked_cals) && + !in_array($cal_name, $unlocked_cals)) + { + continue; + } + + // Add this calendar if we're looking for it, and remove it's name + // from the local list because we've found it. + if ($find_all || in_array($cal_name, $cal_filename_local)) { + array_push($calendars, $file); + $cal_filename_local = array_diff($cal_filename_local, array($cal_name)); + + // If the local list is empty, we're done. + if (empty($cal_filename_local)) + break 2; + } } } - + // Return the sorted calendar list. natcasesort($calendars); return $calendars; } // This function returns the result of the availableCalendars function -// but only includes the calendar filename (including the .ics) and not -// the entire path. +// but only includes the calendar names. // // $username = The username. Empty if no username provided. // $password = The password. Empty if no password provided. @@ -136,7 +154,7 @@ function availableCalendarNames($username, $password, $cal_filename, $admin = fa // Strip the paths off the calendars. foreach (array_keys($calendars) as $key) { - $calendars[$key] = basename($calendars[$key]); + $calendars[$key] = getCalendarName($key); } // Return the sorted calendar names. @@ -144,6 +162,34 @@ function availableCalendarNames($username, $password, $cal_filename, $admin = fa return $calendars; } +// This function returns the calendar name for the specified calendar +// path. +// +// $cal_path = The path to the calendar file. +function getCalendarName($cal_path) { + global $support_ical; + + // If iCal is supported, check the directory for an Info.plist. + if ($support_ical == 'yes') { + // Look for the Info.plist file. + $plist_filename = dirname($cal_path)."/Info.plist"; + if (is_file($plist_filename)) { + // Read the Info.plist. + $handle = fopen($plist_filename, 'r'); + $contents = fread($handle, filesize($plist_filename)); + fclose($handle); + + // Pull out the calendar name. + $num_matches = preg_match("/<key>Title<\/key>\s*?<string>(.+?)<\/string>/i", $contents, $matches); + if ($num_matches > 0) + return $matches[1]; + } + } + + // At this point, just pull the name off the file. + return substr(basename($cal_path), 0, -4); +} + // This function prints out the calendars available to the user, for // selection. Should be enclosed within a <select>...</select>, which // is not printed out by this function. @@ -158,9 +204,8 @@ function display_ical_list($cals, $pick=FALSE) { // // Only display the calendar name, replace all instances of "32" with " ", // and remove the .ics suffix. - $cal_displayname_tmp = basename($cal_tmp); + $cal_displayname_tmp = getCalendarName($cal_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp); - $cal_displayname_tmp = substr($cal_displayname_tmp, 0, -4); // If this is a webcal, add 'Webcal' to the display name. if (preg_match("/^(https?|webcal):\/\//i", $cal_tmp)) { @@ -172,8 +217,7 @@ function display_ical_list($cals, $pick=FALSE) { // label to the display name. else { // Strip path and .ics suffix. - $cal_tmp = basename($cal_tmp); - $cal_tmp = substr($cal_tmp, 0, -4); + $cal_tmp = getCalendarName($cal_tmp); // Add calendar label. $cal_displayname_tmp .= " $calendar_lang"; @@ -212,4 +256,4 @@ function display_ical_list($cals, $pick=FALSE) { } } return $return; -}
\ No newline at end of file +} diff --git a/functions/date_functions.php b/functions/date_functions.php index a541a99..f6bfd53 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -206,4 +206,91 @@ $return = " return $return; } + +// Returns an array of the date and time extracted from the data +// passed in. This array contains (unixtime, date, time, allday). +// +// $data = A string representing a date-time per RFC2445. +// $property = The property being examined, e.g. DTSTART, DTEND. +// $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific +function extractDateTime($data, $property, $field) { + global $tz_array; + + // Initialize values. + unset($unixtime, $date, $time, $allday); + + // What the heck is this doing in here? + $data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); + + // Check for zulu time. + $zulu_time = false; + if (substr($data,-1) == 'Z') $zulu_time = true; + $data = str_replace('Z', '', $data); + + // Remove some substrings we don't want to look at. + $data = str_replace('T', '', $data); + $field = str_replace(';VALUE=DATE-TIME', '', $field); + + // Extract date-only values. + if ((preg_match('/^'.$property.';VALUE=DATE/i', $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) { + // Pull out the date value. Minimum year is 1970. + ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dt_check); + if ($dt_check[1] < 1970) { + $data = '1971'.$dt_check[2].$dt_check[3]; + } + + // Set the values. + $unixtime = strtotime($data); + $date = date('Ymd', $unixtime); + $allday = $data; + } + + // Extract date-time values. + else { + // Pull out the timezone, or use GMT if zulu time was indicated. + if (preg_match('/^'.$property.';TZID=/i', $field)) { + $tz_tmp = explode('=', $field); + $tz_dt = $tz_tmp[1]; + unset($tz_tmp); + } elseif ($zulu_time) { + $tz_dt = 'GMT'; + } + + // Pull out the date and time values. Minimum year is 1970. + preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs); + if ($regs[1] < 1970) { + $regs[1] = '1971'; + } + $date = $regs[1] . $regs[2] . $regs[3]; + $time = $regs[4] . $regs[5]; + $unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); + + // Check for daylight savings time. + $dlst = date('I', $unixtime); + $server_offset_tmp = chooseOffset($unixtime); + if (isset($tz_dt)) { + if (array_key_exists($tz_dt, $tz_array)) { + $offset_tmp = $tz_array[$tz_dt][$dlst]; + } else { + $offset_tmp = '+0000'; + } + } elseif (isset($calendar_tz)) { + if (array_key_exists($calendar_tz, $tz_array)) { + $offset_tmp = $tz_array[$calendar_tz][$dlst]; + } else { + $offset_tmp = '+0000'; + } + } else { + $offset_tmp = $server_offset_tmp; + } + + // Set the values. + $unixtime = calcTime($offset_tmp, $server_offset_tmp, $unixtime); + $date = date('Ymd', $unixtime); + $time = date('Hi', $unixtime); + } + + // Return the results. + return array($unixtime, $date, $time, $allday); +} ?> diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 5086e07..60ca5c9 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -99,8 +99,7 @@ $calnumber = 1; foreach ($cal_filelist as $filename) { // Find the real name of the calendar. - $actual_calname = str_replace($calendar_path, '', $filename); - $actual_calname = str_replace('/', '', str_replace('.ics', '', $actual_calname)); + $actual_calname = getCalendarName($filename); if ($parse_file) { @@ -805,101 +804,17 @@ foreach ($cal_filelist as $filename) { // Start VTODO Parsing // case 'DUE': - $data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); - $zulu_time = false; - if (substr($data,-1) == 'Z') $zulu_time = true; - $data = str_replace('T', '', $data); - $data = str_replace('Z', '', $data); - if (preg_match("/^DUE;VALUE=DATE/i", $field)) { - $allday_start = $data; - $start_date = $allday_start; - $start_unixtime = strtotime($data); - $due_date = date('Ymd', $start_unixtime); - } else { - if (preg_match("/^DUE;TZID=/i", $field)) { - $tz_tmp = explode('=', $field); - $tz_due = $tz_tmp[1]; - unset($tz_tmp); - } elseif ($zulu_time) { - $tz_due = 'GMT'; - } - - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs); - $due_date = $regs[1] . $regs[2] . $regs[3]; - $due_time = $regs[4] . $regs[5]; - $start_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - - $dlst = date('I', $start_unixtime); - $server_offset_tmp = chooseOffset($start_unixtime); - if (isset($tz_due)) { - if (array_key_exists($tz_due, $tz_array)) { - $offset_tmp = $tz_array[$tz_due][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } elseif (isset($calendar_tz)) { - if (array_key_exists($calendar_tz, $tz_array)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } else { - $offset_tmp = $server_offset_tmp; - } - $start_unixtime = calcTime($offset_tmp, $server_offset_tmp, $start_unixtime); - $due_date = date('Ymd', $start_unixtime); - $due_time = date('Hi', $start_unixtime); - unset($server_offset_tmp); - } + $datetime = extractDateTime($data, $property, $field); + $due_date = $datetime[1]; + $due_time = $datetime[2]; break; case 'COMPLETED': - $data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); - $zulu_time = false; - if (substr($data,-1) == 'Z') $zulu_time = true; - $data = str_replace('T', '', $data); - $data = str_replace('Z', '', $data); - if (preg_match("/^COMPLETED;VALUE=DATE/i", $field)) { - $allday_start = $data; - $start_date = $allday_start; - } else { - if (preg_match("/^COMPLETED;TZID=/i", $field)) { - $tz_tmp = explode('=', $field); - $tz_completed = $tz_tmp[1]; - unset($tz_tmp); - } elseif ($zulu_time) { - $tz_completed = 'GMT'; - } - - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs); - $completed_date = $regs[1] . $regs[2] . $regs[3]; - $completed_time = $regs[4] . $regs[5]; - $start_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - - $dlst = date('I', $start_unixtime); - $server_offset_tmp = chooseOffset($start_unixtime); - if (isset($tz_completed)) { - if (array_key_exists($tz_completed, $tz_array)) { - $offset_tmp = $tz_array[$tz_completed][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } elseif (isset($calendar_tz)) { - if (array_key_exists($calendar_tz, $tz_array)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } else { - $offset_tmp = $server_offset_tmp; - } - $start_unixtime = calcTime($offset_tmp, $server_offset_tmp, $start_unixtime); - $completed_date = date('Ymd', $start_unixtime); - $completed_time = date('Hi', $start_unixtime); - unset($server_offset_tmp); - } - break; - + $datetime = extractDateTime($data, $property, $field); + $completed_date = $datetime[1]; + $completed_time = $datetime[2]; + break; + case 'PRIORITY': $vtodo_priority = "$data"; break; @@ -914,111 +829,24 @@ foreach ($cal_filelist as $filename) { case 'CATEGORIES': $vtodo_categories = "$data"; - break; + break; // // End VTODO Parsing case 'DTSTART': - $data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); - $zulu_time = false; - if (substr($data,-1) == 'Z') $zulu_time = true; - $data = str_replace('T', '', $data); - $data = str_replace('Z', '', $data); - $field = str_replace(';VALUE=DATE-TIME', '', $field); - if ((preg_match("/^DTSTART;VALUE=DATE/i", $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) { - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dtstart_check); - if ($dtstart_check[1] < 1970) { - $data = '1971'.$dtstart_check[2].$dtstart_check[3]; - } - $allday_start = $data; - $start_date = $allday_start; - $start_unixtime = strtotime($data); - } else { - if (preg_match("/^DTSTART;TZID=/i", $field)) { - $tz_tmp = explode('=', $field); - $tz_dtstart = $tz_tmp[1]; - unset($tz_tmp); - } elseif ($zulu_time) { - $tz_dtstart = 'GMT'; - } - - preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs); - if ($regs[1] < 1970) { - $regs[1] = '1971'; - } - $start_date = $regs[1] . $regs[2] . $regs[3]; - $start_time = $regs[4] . $regs[5]; - $start_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - - $dlst = date('I', $start_unixtime); - $server_offset_tmp = chooseOffset($start_unixtime); - if (isset($tz_dtstart)) { - if (array_key_exists($tz_dtstart, $tz_array)) { - $offset_tmp = $tz_array[$tz_dtstart][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } elseif (isset($calendar_tz)) { - if (array_key_exists($calendar_tz, $tz_array)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; - } else { - $offset_tmp = '+0000'; - } - } else { - $offset_tmp = $server_offset_tmp; - } - $start_unixtime = calcTime($offset_tmp, $server_offset_tmp, $start_unixtime); - $start_date = date('Ymd', $start_unixtime); - $start_time = date('Hi', $start_unixtime); - unset($server_offset_tmp, $offset_tmp, $tz_dtstart); - } + $datetime = extractDateTime($data, $property, $field); + $start_unixtime = $datetime[0]; + $start_date = $datetime[1]; + $start_time = $datetime[2]; + $allday_start = $datetime[3]; break; case 'DTEND': - $data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); - $zulu_time = false; - if (substr($data,-1) == 'Z') $zulu_time = true; - $data = str_replace('T', '', $data); - $data = str_replace('Z', '', $data); - $field = str_replace(';VALUE=DATE-TIME', '', $field); - if (preg_match("/^DTEND;VALUE=DATE/i", $field)) { - preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})/', $data, $dtend_check); - if ($dtend_check[1] < 1970) { - $data = '1971'.$dtend_check[2].$dtend_check[3]; - } - $allday_end = $data; - } else { - if (preg_match("/^DTEND;TZID=/i", $field)) { - $tz_tmp = explode('=', $field); - $tz_dtend = $tz_tmp[1]; - unset($tz_tmp); - } elseif ($zulu_time) { - $tz_dtend = 'GMT'; - } - - preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs); - if ($regs[1] < 1970) { - $regs[1] = '1971'; - } - $end_date = $regs[1] . $regs[2] . $regs[3]; - $end_time = $regs[4] . $regs[5]; - $end_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - - $dlst = date('I', $end_unixtime); - $server_offset_tmp = chooseOffset($end_unixtime); - if (isset($tz_dtend)) { - $offset_tmp = $tz_array[$tz_dtend][$dlst]; - } elseif (isset($calendar_tz)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; - } else { - $offset_tmp = $server_offset_tmp; - } - $end_unixtime = calcTime($offset_tmp, $server_offset_tmp, $end_unixtime); - $end_date = date('Ymd', $end_unixtime); - $end_time = date('Hi', $end_unixtime); - unset($server_offset_tmp, $offset_tmp, $tz_dtend); - - } + $datetime = extractDateTime($data, $property, $field); + $end_unixtime = $datetime[0]; + $end_date = $datetime[1]; + $end_time = $datetime[2]; + $allday_end = $datetime[3]; break; case 'EXDATE': @@ -1042,6 +870,7 @@ foreach ($cal_filelist as $filename) { $data = str_replace("\\t", " ", $data); $data = str_replace("\\r", "<br />", $data); $data = str_replace('$', '$', $data); + $data = stripslashes($data); $data = htmlentities(urlencode($data)); if ($valarm_set == FALSE) { $summary = $data; @@ -1055,6 +884,7 @@ foreach ($cal_filelist as $filename) { $data = str_replace("\\t", " ", $data); $data = str_replace("\\r", "<br />", $data); $data = str_replace('$', '$', $data); + $data = stripslashes($data); $data = htmlentities(urlencode($data)); if ($valarm_set == FALSE) { $description = $data; @@ -1141,17 +971,18 @@ foreach ($cal_filelist as $filename) { case 'ATTENDEE': $field = str_replace("ATTENDEE;CN=", "", $field); $data = str_replace ("mailto:", "", $data); - $attendee[] = array ('name' => $field, 'email' => $data); + $attendee[] = array ('name' => stripslashes($field), 'email' => stripslashes($data)); break; case 'ORGANIZER': $field = str_replace("ORGANIZER;CN=", "", $field); $data = str_replace ("mailto:", "", $data); - $organizer[] = array ('name' => $field, 'email' => $data); + $organizer[] = array ('name' => stripslashes($field), 'email' => stripslashes($data)); break; case 'LOCATION': $data = str_replace("\\n", "<br />", $data); $data = str_replace("\\t", " ", $data); $data = str_replace("\\r", "<br />", $data); + $data = stripslashes($data); $location = $data; break; case 'URL': diff --git a/functions/list_functions.php b/functions/list_functions.php index 85a4ebd..5d62fb7 100644 --- a/functions/list_functions.php +++ b/functions/list_functions.php @@ -2,12 +2,13 @@ function list_jumps() { global $second_offset, $lang, $cal; + $calName = getCalendarName($cal); $today = date('Ymd', strtotime("now + $second_offset seconds")); $return = '<option value="#">'.$lang['l_jump'].'</option>'; - $return .= '<option value="day.php?cal='.$cal.'&getdate='.$today.'">'.$lang['l_goday'].'</option>'; - $return .= '<option value="week.php?cal='.$cal.'&getdate='.$today.'">'.$lang['l_goweek'].'</option>'; - $return .= '<option value="month.php?cal='.$cal.'&getdate='.$today.'">'.$lang['l_gomonth'].'</option>'; - $return .= '<option value="year.php?cal='.$cal.'&getdate='.$today.'">'.$lang['l_goyear'].'</option>'; + $return .= '<option value="day.php?cal='.$calName.'&getdate='.$today.'">'.$lang['l_goday'].'</option>'; + $return .= '<option value="week.php?cal='.$calName.'&getdate='.$today.'">'.$lang['l_goweek'].'</option>'; + $return .= '<option value="month.php?cal='.$calName.'&getdate='.$today.'">'.$lang['l_gomonth'].'</option>'; + $return .= '<option value="year.php?cal='.$calName.'&getdate='.$today.'">'.$lang['l_goyear'].'</option>'; return $return; } diff --git a/functions/template.php b/functions/template.php index 0162938..e18b101 100644 --- a/functions/template.php +++ b/functions/template.php @@ -21,7 +21,7 @@ class Page { // Print Calendar Checkboxes $COLUMNS_TO_PRINT = 3; $column = 1; - $filelist = availableCalendarNames('', '', '', true); + $filelist = availableCalendars('', '', '', true); foreach ($filelist as $file) { if ($column > $COLUMNS_TO_PRINT) { $delete_table .= '</tr>'; @@ -31,7 +31,7 @@ class Page { $delete_table .= '<tr>'; } - $cal_filename_tmp = substr($file,0,-4); + $cal_filename_tmp = getCalendarName($file); $cal_tmp = urlencode($file); $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); diff --git a/rss/index.php b/rss/index.php index dc1c8d7..e888a1f 100644 --- a/rss/index.php +++ b/rss/index.php @@ -19,12 +19,12 @@ if (empty($default_path)) { $current_view = "rssindex"; $display_date = "RSS Info"; -$filelist = availableCalendarNames($username, $password, $ALL_CALENDARS_COMBINED); +$filelist = availableCalendars($username, $password, $ALL_CALENDARS_COMBINED); 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_filename_tmp = getCalendarName($file); $cal_tmp = urlencode($cal_filename_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); $rss_list .= '<font class="V12" color="blue"><b>'.$cal_displayname_tmp.' '. $calendar_lang.'</b></font><br />'; @@ -75,4 +75,4 @@ $page->replace_tags(array( $page->output(); -?>
\ No newline at end of file +?> |