($1::date + '1 day'::interval) ORDER by valid ASC limit 1"); $q = $stname2; if ($offset == "-1") { $q = $stname1; } else if ($offset == "+1") { $q = $stname3; } $result = pg_execute($dbconn, $q, array($day->format("Y-m-d"))); if (pg_num_rows($result) == 0) { http_response_code(422); die("Feature Not Found"); } $row = pg_fetch_assoc($result, 0); $valid = strtotime($row["valid"]); if (is_null($row["fbid"])) { $row["fbid"] = $valid; } $day = $row["d"]; $prettyday = date("l, d F Y", $valid); $big = sprintf("/onsite/features/%s.%s", $row["imageref"], $row["mediasuffix"]); $linktext = ""; if ($row["appurl"] != "") { $linktext = "
Generate This Chart on Website"; } $t->title = "$day Feature - " . $row["title"]; if ($row["mediasuffix"] == 'mp4') { // Get the video size and width $t->twitter_video = $big; $t->twitter_video_height = $row["media_height"]; $t->twitter_video_width = $row["media_width"]; $iso = date('c', $valid); $alt = htmlspecialchars($row["title"], ENT_QUOTES); $media = <<
{$row["caption"]}
EOM; } else { $t->twitter_image = $big; $iso = date('c', $valid); $alt = htmlspecialchars($row["title"], ENT_QUOTES); $media = << {$alt}
View larger image — {$row["caption"]}
EOM; } $content = <<
← Previous

IEM Daily Feature
{$prettyday}

{$row["title"]}

Posted:

{$media} {$linktext}
{$row["story"]} EOM; if ($row["voting"] == 't' && (intval($row["good"]) > 0 || intval($row["bad"]) > 0)) { $content .= "

Voting:
Good = " . $row["good"] . "
Bad = " . $row["bad"]; if ($row["abstain"] > 0) $content .= "
Abstain = " . $row["abstain"]; } $content .= "
" . printTags(is_null($row["tags"]) ? Array(): explode(",", $row["tags"])); $content .= <<
EOM; $t->content = $content; $t->render('single.phtml');