"; $theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate)); break; case 'daysto': $todate = $getdate; $fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24); #print "from:$fromdate to: $todate
"; $theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate)); break; case 'range': $fromdate = $_GET['from']; $todate = $_GET['to']; $theview = date('n/d/Y',strtotime($fromdate)).'-'.date('n/d/Y',strtotime($todate)); break; default: #default to week $fromdate = dateOfWeek($getdate, $week_start_day); $todate = $fromdate + 6; $theview = ""; } #need to give ical_parser the most distant date to correctly set up master_array. $getdate = $todate; #echo "from:$fromdate to:$todate"; include(BASE.'functions/ical_parser.php'); if ($enable_rss != 'yes') { die ("RSS feeds are not enabled on this site."); } //Set calendar or calendar directory name for feed //Note that this depends on other modifications I've made to //allow phpicalendar to use calendar subdirectories - see bbs $cal_displayname = str_replace("32", " ", $cal); if ($cal == $ALL_CALENDARS_COMBINED) { $temp = explode("/",$calendar_path); $cal_displayname = str_replace("32"," ",ucfirst(array_pop($temp))); } $events_count = 0; // calculate a value for Last Modified and ETag if ($cal == $ALL_CALENDARS_COMBINED) { $filemod = filemtime("$calendar_path"); }else{ $filemod = filemtime("$calendar_path/$cal.ics"); } $filemodtime = date("r", $filemod); //send relevant headers header ("Last-Modified: $filemodtime"); header ("ETag:\"$filemodtime\""); // checks the user agents headers to see if they kept track of our // stuff, if so be nice and send back a 304 and exit. if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime)) { header ("HTTP/1.1 304 Not Modified"); exit; } //If client needs new feed - make the header $rss = ""."\n"; $rss .= ''."\n"; $rss .= ''."\n"; $rss .= ''."\n"; $rss .= ''.$cal_displayname; if ($theview !=""){$rss .= ' - '.$theview;} $rss .= "\n"; $rss .= ''.htmlspecialchars ("$default_path").''."\n"; $rss .= ''.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.''."\n"; $rss .= ''.$rss_language.''."\n"; $rss .= 'Copyright '.date(Y).', '.htmlspecialchars ("$default_path").''."\n"; //generate the items $numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24)-1); $thisdate = $fromdate; # start at beginning of date range, # note that usage of $thisdate is different from distribution # I use it as a date, dist uses it as a time $i = 0; #day counter $uid_arr = array(); do { $thisdate=date('Ymd', strtotime($thisdate)); #echo "Date: $thisdate
\n"; $dayofweek = localizeDate ("%a %b %e %Y", strtotime($thisdate)); if (isset($master_array[($thisdate)]) && sizeof($master_array[($thisdate)]) > 0) { foreach ($master_array[("$thisdate")] as $event_times) { foreach ($event_times as $uid=>$val) { if(!$val["event_start"]){ if (isset($uid_arr[$uid])){ $uid_arr[$uid] .= "+$dayofweek" ; continue; }else{ $uid_arr[$uid] = "$dayofweek" ; } $event_start = "All Day"; }else{ $event_start = @$val["event_start"]; $event_start = date ($timeFormat, @strtotime ("$event_start")); } $event_text = stripslashes(urldecode($val["event_text"])); $event_text = strip_tags($event_text, ''); $event_text = str_replace('&','&',$event_text); $event_text = str_replace('&amp;','&',$event_text); $event_text = urlencode($event_text); #uncomment for shorter event text with ... # $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); $description = stripslashes(urldecode($val["description"])); $description = strip_tags($description, ''); $description = str_replace('&','&',$description); $description = str_replace('&amp;','&',$description); $rss_title = htmlspecialchars ("$dayofweek: $event_text"); $rss_link = htmlspecialchars ("$default_path/day.php?getdate=$thisdate&cal=$cal&cpath=$cpath"); $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); $rss .= ''."\n"; $rss .= ''.$uid.''."\n"; $rss .= ''.$event_start.''."\n"; $rss .= ''.$rss_title.''."\n"; /* $rss .= ''.$event_start.''."\n"; $rss .= ''.$dayofweek.''."\n"; $rss .= ''.$event_text.''."\n"; $rss .= ''.$description.''."\n"; $rss .= ''.$val["description"].''."\n"; $rss .= ''.$val['attendee'].''."\n"; $rss .= ''.$val['organizer'].''."\n"; $rss .= ''.$val['status'].''."\n"; $location = str_replace('&','&',$val['location']); $location = str_replace('&amp;','&',$location); $rss .= ''.$location.''; */ $rss .= ''.$rss_link.''."\n"; $rss .= ''.$rss_description.''."\n"; $rss .= ''."\n"; $events_count++; } } } if (($events_count < 1) && ($i == $numdays)) { $rss .= ''."\n"; $rss .= 'No events found'."\n"; $rss .= ''.htmlspecialchars ("$default_path").''."\n"; $rss .= ''."\n"; } $thisdate++; $i++; } while ($i <= $numdays); $rss .= '
'."\n"; $rss .= '
'."\n"; foreach ($uid_arr as $uid=>$date_range){ #echo "date_range:$date_range
"; if(strpos($date_range,"+")>0){ #echo "+ in date_range
"; $temp = explode("+",$date_range); $date_range = $temp[0].'-'.array_pop($temp); } $rss = str_replace("$uid\nall day","$uid\n$date_range", $rss); } header ("Content-Type: text/xml"); echo "$rss"; ?>