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; } }
$badgealt = "[FF]"; $badgetitle = "Family Friendly"; $badgewidth = 22; $badgeheight = 21; } else { if ($record["audience"] == "A") { $badge = "beer.gif"; $badgealt = "[21+]"; $badgetitle = "Adults (21+) only"; $badgewidth = 14; $badgeheight = 24; } } print " <td>{$starttime}"; if ($record["eventduration"] > 0) { print "-" . endtime($starttime, $record["eventduration"]); } print " </td>\n"; print " <td>\n"; if ($badge != "") { print " <img border=0 src=\"" . IMAGES . "/{$badge}\" alt=\"{$badgealt}\" title=\"{$badgetitle}\" width={$badgewidth} height={$badgeheight}>\n"; } #print " <a href=\"viewpp2008.php#$htmlid\" target=\"pp\"$titlecolor title=\"".htmlspecialchars($record["title"])."\">\n"; print " <a href=\"viewpp2008.php#{$htmlid}\" target=\"pp\"{$titlecolor} title=\"" . htmlspecialchars($record["title"]) . "\">\n"; print " " . htmlspecialchars($record["tinytitle"]) . "\n"; print " </a>\n"; print " </td>\n"; print " <td>" . htmlspecialchars($record["address"]) . "</td>\n"; print " <td>\n"; print " " . htmlspecialchars($record["name"]) . "\n"; #print " <a href=\"calforum.php?id=".$record["id"]."\"><img border=0 src=\"images/forum.gif\" alt=\"[forum]\"></a>\n";
} ?> weekday dayofmonth datestype firstinstance time endtime timedetails venue address locdetails area audience title tinytitle printdescr contact <?php # For each event... $thisday = "ugly"; $result = mysql_query("SELECT * FROM calevent, caldaily WHERE eventdate >= '{$sqlstart}' AND eventdate <= '{$sqlend}' AND eventstatus <> 'C' AND eventstatus <> 'E' AND eventstatus <> 'S' AND review <> 'E' AND calevent.id = caldaily.id ORDER BY eventdate, eventtime", $conn) or die(mysql_error()); while ($record = mysql_fetch_array($result)) { if ($record["eventdate"] != $thisday) { $thisday = $record["eventdate"]; $prettydate = date("l, F j", strtotime($thisday)); } $again = repeatfirstinstance($record, $prettydate); $starttime = hmmpm($record["eventtime"]); if ($record["eventduration"] > 0) { $endtime = endtime($starttime, $record["eventduration"]); } else { $endtime = ""; } $contact = $record["name"]; if ($record["printemail"] && $record["email"] != "") { $contact .= ", {$record[email]}"; } if ($record["printphone"] && strlen($record["phone"]) >= 7) { #$contact .= ", ".substr($record["phone"], 0, 3)."-".substr($record["phone"], 3, 3)."-".substr($record["phone"],6,4); $contact .= ", {$record[phone]}"; } if ($record["printweburl"] && $record["weburl"] != "") { $contact .= ", {$record[weburl]}"; } if ($record["printcontact"] && $record["contact"] != "") {
$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"] != "") { $who .= ", {$record[email]}"; }
$enddate = "2008-06-28"; include "include/common.php"; include "include/view.php"; header("Content-type: text/plain"); header("Cache-control: private"); $conn = mysql_connect(DBHOST, DBUSER, DBPASSWORD) or die(mysql_error()); mysql_select_db(DBDATABASE, $conn); ?> weekday,dayofmonth,datestype,time,endtime,timedetails,venue,address,locdetails,area,audience,title,tinytitle,printdescr <?php # For each event... $result = mysql_query("SELECT * FROM calevent, caldaily WHERE eventdate >= '{$startdate}' AND eventdate <= '{$enddate}' AND eventstatus <> 'C' AND eventstatus <> 'E' AND eventstatus <> 'S' AND calevent.id = caldaily.id ORDER BY eventdate, eventtime", $conn) or die(mysql_error()); while ($record = mysql_fetch_array($result)) { $starttime = hmmpm($record["eventtime"]); if ($record["eventduration"] > 0) { $endtime = "\"" . endtime($starttime, $record["eventduration"]) . "\""; } else { $endtime = ""; } $contact = $record["name"]; if ($record["printemail"] && $record["email"] != "") { $contact .= ", {$record[email]}"; } if ($record["printphone"] && strlen($record["phone"]) >= 7) { #$contact .= ", ".substr($record["phone"], 0, 3)."-".substr($record["phone"], 3, 3)."-".substr($record["phone"],6,4); $contact .= ", {$record[phone]}"; } if ($record["printweburl"] && $record["weburl"] != "") { $contact .= ", {$record[weburl]}"; } if ($record["printcontact"] && $record["contact"] != "") {
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 . ":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."; } } print " " . htmlspecialchars($record[name]); if ($record[printphone] && $record[phone] != "") {