function generatetime($time, $label) { global $thistime; $formatted = hmmpm($time); $selected = $time == $thistime ? "selected" : ""; print "<option value=\"{$time}\" {$selected}>{$formatted} {$label}</option>\n"; }
function printevent($record, $prettydate) { print "\n" . strtoupper($record["title"]) . "\n"; $again = repeatfirstinstance($record, $prettydate); if ($again) { print "See {$again[date]} for details\n"; } else { print hmmpm($record["eventtime"]) . "\n"; if ($record["locname"]) { print "{$record[locname]}, {$record[address]}\n"; } else { print "{$record[address]}\n"; } print wordwrap($record["printdescr"], 68) . "\n"; if (!$record["hideemail"]) { $email = preg_replace("/@/", " at ", $record["email"]); $email = preg_replace("/\\./", " dot ", $email); if ($record["weburl"] != "") { print "{$email}, {$record[weburl]}\n"; } else { print "{$email}\n"; } } else { if ($record["weburl"] != "") { print "{$record[weburl]}\n"; } } } }
print " <br><a title=\"Edit in the big form\" href=\"calform.php?edit=" . obscure($id) . "&reviewdates=" . $_REQUEST["dates"] . "\"><img src=\"images/edit.gif\" alt=\"[edit]\" border=0></a>\n"; print "\t <span class=\"button\" title=\"Inspect\" style=\"border-color: red; background: red;\" onClick=\"changereview({$id}, 'Inspect')\"> </span>\n"; print "\t <span class=\"button\" title=\"Approved\" style=\"border-color: green; background: green;\" onClick=\"changereview({$id}, 'Approved')\"> </span>\n"; print "\t <span class=\"button\" title=\"Exclude\" style=\"border-color: #c0c0c0; background: #c0c0c0;\" onClick=\"changereview({$id}, 'Exclude')\"> </span>\n"; if ($dollars != "" && $review != "Exclude") { if (strstr($record["printdescr"], "\$") == FALSE) { print "\t <br><span style=\"font-size: xx-large; font-weight: bold; color: red;\">{$dollars}</span>\n"; } else { print "\t <br><span style=\"font-size: xx-large; font-weight: bold;\">{$dollars}</span>\n"; } } print " </td>\n"; print " <td class=\"event\">\n"; print " <div id=\"title_{$id}\" class=\"title{$review}\" title=\"Click to edit\" onClick=\"qeshow({$id})\">" . $record["tinytitle"] . "</div>\n"; print " <div id=\"address_{$id}\" class=\"address{$review}\">" . $record["address"] . ($record["locname"] == "" ? "" : ", " . $record["locname"]) . ($record["locdetails"] == "" ? "" : " (" . $record["locdetails"] . ")") . "</div>\n"; print " <div id=\"time_{$id}\" class=\"time{$review}\">" . hmmpm($record["eventtime"]) . ($record["timedetails"] == "" ? "" : " (" . $record["timedetails"] . ")") . "{$audience}</div>\n"; print " <div id=\"desc_{$id}\" class=\"desc{$review}\" title=\"Click to edit\" onClick=\"qeshow({$id})\">" . $record["printdescr"] . "</div>\n"; print " <div id=\"contact_{$id}\" class=\"contact{$review}\">{$contact}</div>\n"; print " <span id=\"email_{$id}\" style=\"display: none; visibility: hidden;\">" . $record["email"] . "</span>"; print " <span id=\"editurl_{$id}\" style=\"display: none; visibility: hidden;\">" . CALURL . "calform.php?edit=" . obscure($record["id"]) . "</span>"; print " </td>\n"; print " </tr>\n"; } else { # Output a row that backreferences the original event print " <tr name=\"tr_{$id}\" class=\"{$review}\">\n"; print " <td onMouseOver=\"bigtipdelayed({$id}, '" . $record["eventdate"] . "');\" onMouseOut=\"bigtipclear();\"></td>\n"; print " <td>\n"; print " <div name=\"title_{$id}\" class=\"title{$review}\">" . $record["tinytitle"] . "</div>\n"; print " <div name=\"time_{$id}\">See <a href=\"#a_{$id}\">" . $firstinstance["date"] . "</a> for full details</div>\n"; print " </td>\n"; print " </tr>\n";
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"; } } print " </description>\n"; print " </item>\n";
} 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']); print "</description>\r\n"; print " </item>\r\n";
print "\"Date(s)\" list, and clicking on the \"Exception\"\n"; print "link there.\n"; print "<ul>\n"; print $exceptions; print "</ul>\n"; } } # send email if ($_REQUEST['minorchange'] != 'on') { if ($_COOKIE['havemore'] == 'bikefun') { $msgbody = "Your event has been {$action} by the Calendar Crew.\n"; } else { $msgbody = "Your event has been successfully {$action}.\n"; } if ($action != 'deleted') { $msgbody .= "It is scheduled for {$_REQUEST[dates]} at " . hmmpm($_REQUEST['eventtime']) . "\n"; if ($exceptions != "") { $exceptbody = 'with the following exceptions:'; $last = ""; for ($i = 1; $daylist[$i]; $i++) { if ($_REQUEST['status' . $daylist[$i]['suffix']] == 'Exception') { if ($last != "") { $exceptbody .= "{$last}, "; } $last = date('l F j', $daylist[$i]['timestamp']); } } if ($exceptbody == "") { $exceptbody = $last; } else { if ($last != "") {
if ($record["eventdate"] == $tomorrow) { $datename = "Tomorrow"; } else { $datename = $record["eventdate"]; } } print "<div class=daytitle>{$datename}</div>\n"; $date = $record["eventdate"]; } $id = $record["id"]; if ($record["eventstatus"] == "C") { $decor = "line-through"; $eventtime = "Cancel"; } else { $decor = "none"; $eventtime = hmmpm($record["eventtime"]); } $tinytitle = htmlspecialchars($record["tinytitle"]); if ($record["newsflash"] != "") { $title = $record["newsflash"]; } else { if ($record["locdetails"] != "") { $title = "{$record[address]}, {$record[locdetails]}"; } else { $title = $record["address"]; } } $address = htmlspecialchars($record["address"]); $locdetails = htmlspecialchars($record["locdetails"]); if ($record["audience"] == "F") { $timecolor = "green";
{ $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 "; print htmlspecialchars($record["printdescr"]); print "</description>\r\n"; print " </item>\r\n";
function fullentry($record) { global $conn; global $imageover; # 24 hours ago. We compare timestamps to this in order to # detect recently changed entries. $yesterday = date("Y-m-d H:i:s", strtotime("yesterday")); # extract info from the record $id = $record["id"]; $title = htmlspecialchars(strtoupper($record["title"])); if ($record["eventstatus"] == "C") { $eventtime = "CANCELED"; $eventduration = 0; } else { $eventtime = hmmpm($record["eventtime"]); $eventduration = $record["eventduration"]; } $dayofmonth = substr($record["eventdate"], -2); $timedetails = $record["timedetails"]; if ($record["audience"] == "F" && $record["area"] == "P") { $badge = "ff.gif"; $badgealt = "FF"; $badgehint = "Family Friendly"; } if ($record["audience"] == "G" && $record["area"] == "P") { $badge = ""; $badgealt = ""; $badgehint = ""; } if ($record["audience"] == "A" && $record["area"] == "P") { $badge = "beer.gif"; $badgealt = "21+"; $badgehint = "Adult Only (21+)"; } if ($record["audience"] == "F" && $record["area"] == "V") { $badge = "ffwa.gif"; $badgealt = "FF,WA"; $badgehint = "Family Friendly, Meet in/around Vancouver"; } if ($record["audience"] == "G" && $record["area"] == "V") { $badge = "washington.gif"; $badgealt = "WA"; $badgehint = "Meet in/around Vancouver"; } if ($record["audience"] == "A" && $record["area"] == "V") { $badge = "beerwa.gif"; $badgealt = "21+,WA"; $badgehint = "Adult Only (21+), Meet in/around Vancouver"; } $address = htmlspecialchars($record["address"]); if ($record["locname"]) { $address = htmlspecialchars($record["locname"]) . ", {$address}"; } $locdetails = htmlspecialchars($record["locdetails"]); $descr = htmldescription($record["descr"]); $newsflash = htmlspecialchars($record["newsflash"]); $name = htmlspecialchars(ucwords($record["name"])); $email = $record["hideemail"] ? "" : htmlspecialchars($record["email"]); $email = mangleemail($email); $phone = $record["hidephone"] ? "" : htmlspecialchars($record["phone"]); $contact = $record["hidecontact"] ? "" : htmlspecialchars($record["contact"]); $weburl = $record["weburl"]; $webname = $record["webname"]; if ($webname == "" || array_key_exists('p', $_REQUEST)) { $webname = $weburl; } $webname = htmlspecialchars($webname); $forum = mysql_query("SELECT modified FROM calforum WHERE id={$id} ORDER BY modified DESC", $conn) or die(mysql_error()); $forumimg = "images/forum.gif"; $forumqty = mysql_num_rows($forum); $forumtitle = "{$forumqty} message" . ($forumqty == 1 ? "" : "s"); if ($forumqty > 0) { $msg = mysql_fetch_array($forum); $msgmod = $msg["modified"]; # Format the timestamp -- varies with SQL ver. if (strlen($msgmod) == 14) { # older MySQL uses YYYYMMDDhhmmss format $msgmod = substr($msgmod, 0, 4) . "-" . substr($msgmod, 4, 2) . "-" . substr($msgmod, 6, 2) . " " . substr($msgmod, 8, 2) . ":" . substr($msgmod, 10, 2) . ":" . substr($msgmod, 12, 2); } $forumtitle = "{$forumtitle}, newest " . substr($msgmod, 0, 10); if (strcmp($msgmod, $yesterday) > 0) { $forumimg = "images/forumflash.gif"; } } # get the image info $image = ""; if ($record["image"] && !isset($_REQUEST["i"])) { $t = pathinfo($record["image"]); $t = $t["extension"]; $image = "eventimages/{$id}.{$t}"; $imageheight = $record["imageheight"]; $imagewidth = $record["imagewidth"]; # Defend against obnoxiously wide banners or zero-height images. if ($imagewidth > 300) { $imageheight = $imageheight * 300 / $imagewidth; $imagewidth = 300; } if ($imageheight < 1) { $imagehight = 1; } } if ($eventtime == "CANCELED") { $style = "text-decoration: line-through;"; } else { $style = ""; } print "<dt style=\"{$style}\">"; if ($image && $imageover <= 0 && $imageheight > RIGHTHEIGHT / 2) { if ($imageheight > RIGHTHEIGHT) { $imagewidth = $imagewidth * RIGHTHEIGHT / $imageheight; $imageheight = RIGHTHEIGHT; } print "\n<img src=\"{$image}\" height={$imageheight} width={$imagewidth} align=\"right\" alt=\"\">\n"; } print "<a name=\"{$dayofmonth}-{$id}\" style=\"{$style}\">{$title}</a>\n"; print "<a href=\"#{$dayofmonth}-{$id}\"><img border=0 src=\"images/chain.gif\" alt=\"Link\" title=\"Link to this event\"></a>\n"; if (isset($_COOKIE['havemore']) && $_COOKIE['havemore'] == 'bikefun') { print "<a href=\"calform.php?edit=" . obscure($id) . "\"><img src=\"images/edit.gif\" alt=\"[edit]\" border=0></a>\n"; } if ($badge != "") { print "<img align=left src=\"" . IMAGES . "/{$badge}\" alt=\"{$badgealt}\" title=\"{$badgehint}\">\n"; } if ($image && ($imageover > 0 || $imageheight <= RIGHTHEIGHT / 2)) { if ($imageheight > LEFTHEIGHT) { $imagewidth = $imagewidth * LEFTHEIGHT / $imageheight; $imageheight = LEFTHEIGHT; } print "</dt><dd><img src=\"{$image}\" height={$imageheight} width={$imagewidth} align=\"left\" alt=\"\">\n"; } else { print "</dt><dd>"; } print "<div style=\"{$style}\">"; if (TRUE || $record["addressverified"] == "Y") { #print '<a href="http://tripplanner.bycycle.org/?region=portlandor&q='.urlencode($record["address"]).'" target="_BLANK">'.$address.'</a>'; print '<a href="http://maps.google.com/?bounds=45.389771,-122.829208|45.659647,-122.404175&q=' . urlencode($record["address"]) . '" target="_BLANK">' . $address . '</a>'; } else { print $address; } if (!isset($_REQUEST['p']) || $_REQUEST['p'] == '') { print " <a href=\"" . trimeturl($record["eventdate"], $record["eventtime"], $record["address"]) . "\" target=\"_BLANK\" title=\"TriMet trip planner\"><img alt=\"Take Trimet\" src=\"images/trimetrose.gif\" border=0></a>"; } if ($locdetails != "") { print " ({$locdetails})"; } print "</div>\n"; print "{$eventtime}"; if ($eventtime == "CANCELED" && $newsflash != "") { print " <font color=magenta>{$newsflash}</font>"; } if ($eventtime != "CANCELED") { if ($eventduration != 0) { print " - " . endtime($eventtime, $eventduration); } if ($timedetails != "") { print ", {$timedetails}"; } if ($record["datestype"] == "C" || $record["datestype"] == "S") { print ", {$record[dates]}"; } } print "<div style=\"{$style}\">\n"; print "<em>{$descr}</em>\n"; if ($newsflash != "" && $eventtime != "CANCELED") { print "<font color=magenta>{$newsflash}</font>"; } print '<br>'; if (strstr($name, '@')) { print mangleemail($name); } else { print $name; } if ($email != "") { print ", {$email}"; } if ($weburl != "") { print ", <a href=\"{$weburl}\">{$webname}</a>"; } if ($contact != "") { print ", " . mangleemail($contact); } if ($phone != "") { print ", {$phone}"; } if (!isset($_REQUEST['p'])) { print " <a href=\"calforum.php?id={$id}\" title=\"{$forumtitle}\"><img border=0 src=\"{$forumimg}\" alt=\"[forum]\"></a>\n"; } print "</div></dd>\n"; # if this event has no image, then the next event's # image can be left-aligned. if ($image == "" || $imageover > 0 || $imageheight <= RIGHTHEIGHT / 2) { $imageover = 0; } else { $imageover = $imageheight - RIGHTHEIGHT / 2; } }
if ($startpg == $pdf->_sect) { $pdf->_lastx = $startx; $pdf->_lasty = $starty + ($_REQUEST["micro"] == "" ? 0.005 : 0.003); $pdf->add_text($record["tinytitle"]); } # Output the location $where = $record["address"]; if ($record["locname"] != "") { $where = $record["locname"] . ", " . $where; } if ($record["locdetails"] != "") { $where = $where . " (" . $record["locdetails"] . ")"; } $pdf->add_text($where); # Output the time $when = hmmpm($record["eventtime"]); if ($record["duration"] != 0) { $when .= " - " . endtime($when, $record["duration"]); } if ($record["timedetails"] != "") { $when .= ", " . $record["timedetails"]; } $pdf->add_text($when); # If description is desired, then output that too if ($_REQUEST["printdescr"] != "") { $pdf->add_text($record["printdescr"]); } # If contact info is desired, then output that too if ($_REQUEST["contact"] != "") { $who = $record["name"]; if ($record["printemail"] && $record["email"] != "") {
function listevents($events) { if (mysql_num_rows($events) == 0) { print '<em>No events</em>'; } else { while ($record = mysql_fetch_array($events)) { $eventid = substr($record["eventdate"], -2) . '-' . $record['id']; print '<div class="event">'; print "<a class=\"timetitle\" href=\"#\" onClick='return clickevent(\"{$eventid}\")'>" . hmmpm($record['eventtime']) . ' ' . htmlspecialchars($record['title']) . '</a>'; print "<div class=\"detail\" id=\"{$eventid}\">"; #time if ($record['eventduration'] || $record['timedetails']) { if ($record['eventduration']) { print hmmpm($record['eventtime']) . '-' . endtime($record['eventtime'], $record['eventduration']); if ($record['timedetails']) { print ', '; } } if ($record['timedetails']) { print htmlspecialchars($record['timedetails']); } print '<br />'; } #place if ($record['locname']) { print htmlspecialchars($record['locname']) . ', '; } print htmlspecialchars($record['address']); if ($record['locdetails']) { print ', ' . htmlspecialchars($record['locdetails']); } print '<br />'; #description print htmlspecialchars($record['printdescr']); print '<br />'; #contact $name = htmlspecialchars(ucwords($record["name"])); $email = $record["hideemail"] ? "" : htmlspecialchars($record["email"]); $email = mangleemail($email); $phone = $record["hidephone"] ? "" : htmlspecialchars($record["phone"]); $contact = $record["hidecontact"] ? "" : htmlspecialchars($record["contact"]); $weburl = $record["weburl"]; $webname = $record["webname"]; if ($webname == "" || $_REQUEST["p"] != "") { $webname = $weburl; } $webname = htmlspecialchars($webname); print "{$name}"; if ($email) { print ", {$email}"; } if ($phone) { print ", <a href=\"tel:{$phone}\">{$phone}</a>"; } if ($contact) { print ", {$contact}"; } if ($weburl) { print ", <a href=\"{$weburl}\">{$webname}</a>"; } print '</div>'; # class="detail" print '</div>'; # class="event" } } }
$time = $time - 12; } if ($record[minute] >= 1 && $record[minute] <= 9) { $time = $time . ":0" . $record[minute]; } else { if ($record[minute] >= 10) { $time = $time . ":" . $record[minute]; } } if ($record[hour] >= 12) { $time = $time . "pm"; } else { $time = $time . "am"; } } $time = hmmpm($record[eventtime]); print $time; if ($record[eventduration] != 0) { print " - " . endtime($time, $record[eventduration]); } if ($record[timedetails]) { print ", " . htmlspecialchars($record[timedetails]); } print "</em> \n"; print htmlspecialchars($record[printdescr]); if ($record[audience] == "F") { print "\nFamily Friendly."; } else { if ($record[audience] == "A") { print "\n21+ Only."; }
} //alert("name="+form.name.value+"\nsubject="+form.subject.value+"\nmsg="+form.msg.value); // Compute the checksum of the body form.checksum.value = checksum(form.msg.value); return true; } </script> <div id="content" class="content"> <?php # Output the basic information about the event print "<h1>Forum for " . htmlspecialchars($event["tinytitle"]) . "</h1>\n"; print "<center>\n"; print "<div class=event>\n"; print " <span style=\"font-size:large; font-weight: bolder;\">" . htmlspecialchars($event["title"]) . "</span></br>\n"; print " <strong> {$event[dates]}, " . hmmpm($event["eventtime"]) . "</strong>\n"; print " <br>" . htmldescription($event["descr"]) . "\n"; print "</div>\n"; print "</center>\n"; ?> <center> <?php print "<button onClick=\"window.location.replace('" . viewurl($date, $id) . "');\">View Calendar</button>\n"; if ($organizer || $admin) { print "<button onClick=\"window.location.replace('calform.php?edit=" . obscure($id) . "');\">Edit Event</button>\n"; } if ($admin) { print "<button onClick=\"window.location.replace('admin.php');\">Administration Menu</button>\n"; } ?> </center>