Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6700/functions Modified Files: calendar_functions.php date_functions.php ical_parser.php list_functions.php template.php Log Message: Added support for recursively searching for calendars in your $calendar_path and the new iCal calendar repository structure. The calendars are still referenced by calendar name, so all URLs are unchanged. Refactored the date parsing code out of ical_parser.php and into date_functions.php. Minor logic changes to the parser to correctly populate the TODO date and time values. Refactored the calendar name code into a new getCalendarName() function, since calendar names may no longer be determined solely by filename if using an iCal repository. Template code updated to match. Added calls to stripslashes() for calendar text data, such as the summaries and descriptions. Also put stripslashes() into people data, since people's names may contain escaped characters. Index: calendar_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** calendar_functions.php 27 Oct 2005 17:41:24 -0000 1.10 --- calendar_functions.php 30 Oct 2005 01:32:44 -0000 1.11 *************** *** 15,19 **** 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; // Create the list of available calendars. --- 15,19 ---- function availableCalendars($username, $password, $cal_filename, $admin = false) { // Import globals. ! 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. *************** *** 31,67 **** $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; ! // 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"); ! } ! // Add web calendars. if (!isset($http_user) && !$admin) { foreach ($list_webcals as $file) { --- 31,48 ---- $unlocked_cals = $locked_map["$username:$password"]; } ! // 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; ! // 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. ! if ($cal_filename == $ALL_CALENDARS_COMBINED || $admin) { if (!isset($http_user) && !$admin) { foreach ($list_webcals as $file) { *************** *** 75,119 **** } ! // 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)); } } ! // 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)); ! } ! // Add this calendar. ! array_push($calendars, "$calendar_path/$c.ics"); } } ! // Return the sorted calendar list. natcasesort($calendars); --- 56,138 ---- } ! // 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"); } } ! // 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; ! } ! // 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); *************** *** 122,127 **** // This function returns the result of the availableCalendars function ! // but only includes the calendar filename (including the .ics) and not ! // the entire path. // // $username = The username. Empty if no username provided. --- 141,145 ---- // This function returns the result of the availableCalendars function ! // but only includes the calendar names. // // $username = The username. Empty if no username provided. *************** *** 137,141 **** // Strip the paths off the calendars. foreach (array_keys($calendars) as $key) { ! $calendars[$key] = basename($calendars[$key]); } --- 155,159 ---- // Strip the paths off the calendars. foreach (array_keys($calendars) as $key) { ! $calendars[$key] = getCalendarName($key); } *************** *** 145,148 **** --- 163,194 ---- } + // 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 *************** *** 159,165 **** // 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 = 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. --- 205,210 ---- // Only display the calendar name, replace all instances of "32" with " ", // and remove the .ics suffix. ! $cal_displayname_tmp = getCalendarName($cal_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp); // If this is a webcal, add 'Webcal' to the display name. *************** *** 173,178 **** else { // Strip path and .ics suffix. ! $cal_tmp = basename($cal_tmp); ! $cal_tmp = substr($cal_tmp, 0, -4); // Add calendar label. --- 218,222 ---- else { // Strip path and .ics suffix. ! $cal_tmp = getCalendarName($cal_tmp); // Add calendar label. *************** *** 213,215 **** } return $return; ! } \ No newline at end of file --- 257,259 ---- } return $return; ! } Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** date_functions.php 15 Sep 2005 22:51:27 -0000 1.29 --- date_functions.php 30 Oct 2005 01:32:44 -0000 1.30 *************** *** 207,209 **** --- 207,296 ---- 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); + } ?> Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** ical_parser.php 14 Sep 2005 00:42:32 -0000 1.196 --- ical_parser.php 30 Oct 2005 01:32:44 -0000 1.197 *************** *** 100,105 **** // Find the real name of the calendar. ! $actual_calname = str_replace($calendar_path, '', $filename); ! $actual_calname = str_replace('/', '', str_replace('.ics', '', $actual_calname)); if ($parse_file) { --- 100,104 ---- // Find the real name of the calendar. ! $actual_calname = getCalendarName($filename); if ($parse_file) { *************** *** 806,904 **** // 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); ! } 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; ! case 'PRIORITY': $vtodo_priority = "$data"; --- 805,819 ---- // case 'DUE': ! $datetime = extractDateTime($data, $property, $field); ! $due_date = $datetime[1]; ! $due_time = $datetime[2]; break; case 'COMPLETED': ! $datetime = extractDateTime($data, $property, $field); ! $completed_date = $datetime[1]; ! $completed_time = $datetime[2]; ! break; ! case 'PRIORITY': $vtodo_priority = "$data"; *************** *** 915,1023 **** case 'CATEGORIES': $vtodo_categories = "$data"; ! 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); ! } 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); ! ! } break; --- 830,851 ---- case 'CATEGORIES': $vtodo_categories = "$data"; ! break; // // End VTODO Parsing case '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': ! $datetime = extractDateTime($data, $property, $field); ! $end_unixtime = $datetime[0]; ! $end_date = $datetime[1]; ! $end_time = $datetime[2]; ! $allday_end = $datetime[3]; break; *************** *** 1043,1046 **** --- 871,875 ---- $data = str_replace("\\r", "<br />", $data); $data = str_replace('$', '$', $data); + $data = stripslashes($data); $data = htmlentities(urlencode($data)); if ($valarm_set == FALSE) { *************** *** 1056,1059 **** --- 885,889 ---- $data = str_replace("\\r", "<br />", $data); $data = str_replace('$', '$', $data); + $data = stripslashes($data); $data = htmlentities(urlencode($data)); if ($valarm_set == FALSE) { *************** *** 1142,1151 **** $field = str_replace("ATTENDEE;CN=", "", $field); $data = str_replace ("mailto:", "", $data); ! $attendee[] = array ('name' => $field, 'email' => $data); break; case 'ORGANIZER': $field = str_replace("ORGANIZER;CN=", "", $field); $data = str_replace ("mailto:", "", $data); ! $organizer[] = array ('name' => $field, 'email' => $data); break; case 'LOCATION': --- 972,981 ---- $field = str_replace("ATTENDEE;CN=", "", $field); $data = str_replace ("mailto:", "", $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' => stripslashes($field), 'email' => stripslashes($data)); break; case 'LOCATION': *************** *** 1153,1156 **** --- 983,987 ---- $data = str_replace("\\t", " ", $data); $data = str_replace("\\r", "<br />", $data); + $data = stripslashes($data); $location = $data; break; Index: list_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/list_functions.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** list_functions.php 21 Oct 2004 20:15:14 -0000 1.13 --- list_functions.php 30 Oct 2005 01:32:44 -0000 1.14 *************** *** 3,12 **** function list_jumps() { global $second_offset, $lang, $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 $return; } --- 3,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='.$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; } Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** template.php 15 Sep 2005 22:51:27 -0000 1.75 --- template.php 30 Oct 2005 01:32:44 -0000 1.76 *************** *** 22,26 **** $COLUMNS_TO_PRINT = 3; $column = 1; ! $filelist = availableCalendarNames('', '', '', true); foreach ($filelist as $file) { if ($column > $COLUMNS_TO_PRINT) { --- 22,26 ---- $COLUMNS_TO_PRINT = 3; $column = 1; ! $filelist = availableCalendars('', '', '', true); foreach ($filelist as $file) { if ($column > $COLUMNS_TO_PRINT) { *************** *** 32,36 **** } ! $cal_filename_tmp = substr($file,0,-4); $cal_tmp = urlencode($file); $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); --- 32,36 ---- } ! $cal_filename_tmp = getCalendarName($file); $cal_tmp = urlencode($file); $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); |