# if there are events on this day... if (mysql_num_rows($result) > 0) { # Generate a nice human-readable version of the date $daylabel = date("l", strtotime($tomorrow)); if (mysql_num_rows($result) == 1) { $record = mysql_fetch_array($result); mysql_data_seek($result, 0); $daylabel .= ": " . htmlspecialchars($record["tinytitle"]); } else { $daylabel .= ": " . mysql_num_rows($result) . " events"; } # Start the entry for this date print " <item>\n"; print " <title>{$daylabel}</title>\n"; print " <link>" . datelink($tomorrow) . "</link>\n"; print " <pubDate>" . pubdate($tomorrow) . "</pubDate>\r\n"; print " <description>"; # The description consists of a list of entries for that date. while ($record = mysql_fetch_array($result)) { print "\n" . hmmpm($record["eventtime"]) . " " . htmlspecialchars($record["tinytitle"]) . "\n"; print " "; if ($record["locname"]) { print htmlspecialchars($record["locname"]) . ", "; } print htmlspecialchars($record["address"]); if ($record["locdetails"]) { print " (" . htmlspecialchars($record["locdetails"]) . ")"; } print "\n " . htmlspecialchars($record["printdescr"]) . "\n"; if ($record["newsflash"]) { print " " . htmlspecialchars($record["newsflash"]) . "\n";
return CALURL . "{$view}#" . substr($sqldate, 8, 2) . "-{$id}"; } function pubdate($sqldate) { $date = strtotime($sqldate); return date("D, d M Y", $date) . " 00:00:00 GMT"; } # Generate the XML for all recent entries. $result = mysql_query("SELECT calevent.id as id, newsflash, tinytitle, eventdate, eventtime, timedetails, locname, address, locdetails, printdescr FROM calevent, caldaily WHERE caldaily.id = calevent.id AND eventstatus != \"C\" AND eventstatus != \"E\" AND eventstatus != \"S\" ORDER BY calevent.modified DESC LIMIT 1, 10", $conn) or die(mysql_error()); $date = ""; while ($record = mysql_fetch_array($result)) { # Output an event print " <item>\r\n"; print " <title>" . date("D, M d ", strtotime($record['eventdate'])) . hmmpm($record["eventtime"]) . " " . ($record["newsflash"] ? "[!] " : "") . htmlspecialchars($record["tinytitle"]) . "</title>\r\n"; print " <link>" . eventlink($record["eventdate"], $record["id"]) . "</link>\r\n"; print " <pubDate>" . pubdate($record["eventdate"]) . "</pubDate>\r\n"; print " <description>"; date("D, d M Y ", strtotime($record['eventdate'])); print hmmpm($record["eventtime"]); if ($record["timedetails"]) { print ' (' . htmlspecialchars($record[timedetails]) . ')'; } print "\r\n "; if ($record["locname"]) { print htmlspecialchars($record["locname"]) . ", "; } print htmlspecialchars($record["address"]); if ($record["locdetails"]) { print " (" . htmlspecialchars($record["locdetails"]) . ")"; } print "\r\n ";
$daylabel = $record["eventdate"]; } } print " <item>\n"; print " <title>{$daylabel} ------------</title>\n"; print " <link>" . datelink($record["eventdate"]) . "</link>\n"; print " <pubDate>" . pubdate($record["eventdate"]) . "</pubDate>\r\n"; print " <description>Whole day's events</description>\n"; print " </item>\n"; $date = $record["eventdate"]; } # Output an event print " <item>\r\n"; print " <title>" . ($record['newsflash'] ? "[!] " : "") . hmmpm($record['eventtime']) . " " . htmlspecialchars($record['tinytitle']) . "</title>\r\n"; print " <link>" . eventlink($record['eventdate'], $record['id']) . "</link>\r\n"; print " <pubDate>" . pubdate($record['eventdate']) . "</pubDate>\r\n"; print " <description>"; print hmmpm($record['eventtime']); if ($record['timedetails']) { print " (" . htmlspecialchars($record['timedetails']) . ")"; } print "\r\n "; if ($record['locname']) { print htmlspecialchars($record['locname']) . ", "; } print htmlspecialchars($record['address']); if ($record['locdetails']) { print " (" . htmlspecialchars($record['locdetails']) . ")"; } print "\r\n "; print htmlspecialchars($record['printdescr']);
} else { $daylabel = date("l", strtotime($date)); } } if (mysql_num_rows($result) == 1) { $record = mysql_fetch_array($result); mysql_data_seek($result, 0); $daylabel .= ": " . htmlspecialchars($record["tinytitle"]); } else { $daylabel .= ": " . mysql_num_rows($result) . " events"; } # Start the entry for this date print " <item>\n"; print " <title>{$daylabel}</title>\n"; print " <link>" . datelink($date) . "</link>\n"; print " <pubDate>" . pubdate($date) . "</pubDate>\r\n"; print " <description>"; # The description consists of a list of entries for that date. while ($record = mysql_fetch_array($result)) { print "\n" . hmmpm($record["eventtime"]) . " " . htmlspecialchars($record["tinytitle"]) . "\n"; print " "; if ($record["locname"]) { print htmlspecialchars($record["locname"]) . ", "; } print htmlspecialchars($record["address"]); if ($record["locdetails"]) { print " (" . htmlspecialchars($record["locdetails"]) . ")"; } print "\n " . htmlspecialchars($record["printdescr"]) . "\n"; if ($record["newsflash"]) { print " " . htmlspecialchars($record["newsflash"]) . "\n";