コード例 #1
0
ファイル: view.php プロジェクト: kirkendall/shiftcal
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 "&nbsp;&nbsp;<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;
    }
}
コード例 #2
0
ファイル: admforum.php プロジェクト: kirkendall/shiftcal
            if ($hh >= TZTWEAK) {
                $hh -= TZTWEAK;
            }
            $modified = substr($record["modified"], 0, 11) . $hh . substr($record["modified"], 13);
        }
        print "<div class=hr></div>\n";
        if ($record["organizer"]) {
            print "<div class=organizer>\n<dt class=organizer>";
        } else {
            print "<div class=msg>\n<dt>";
        }
        print "<font size=\"-2\">" . htmlspecialchars($record["name"]) . " ({$modified}) " . htmlspecialchars($record["title"]) . "</font><br>\n";
        print htmlspecialchars($record["subject"]) . "\n";
        print "<a onClick=\"return confirm('Do you really want to delete this message?');\" href=\"admforum.php?edit=" . obscure($record["id"]) . "&delmsg=" . $record["msgid"] . "\">\n";
        print "  <img border=0 src=\"images/forumdel.gif\" alt=\"Delete\" title=\"Delete this message\">\n";
        print "</a>\n";
        print "</dt>\n";
        if ($record["organizer"]) {
            print "<dd class=organizer>";
        } else {
            print "<dd>";
        }
        print htmldescription($record["msg"]) . "</dd>\n";
        print "</div>\n";
    }
    print "</dl></div>\n";
    print "<center>Newer messages at top, older messages at bottom</center>\n";
}
print "</center>\n";
include INCLUDES . "/footer.html";
#ex:set sw=4: