index.php
537 lines
| 18.2 KiB
| text/x-php
|
PhpLexer
| r2 | <?php | |||
| include('frontend.inc.php'); | ||||
| /* Bring an end to that GET string and load the strip */ | ||||
| if(isset($_GET['strip_id']) && ctype_digit($_GET['strip_id'])) { | ||||
| $MAX_METHOD_ID = max_strip_id(); | ||||
| $EFFECTIVE_ID = $_GET['strip_id']; | ||||
| $METHOD = 'strip'; | ||||
| } elseif(isset($_GET['transcript_id']) && ctype_digit($_GET['transcript_id'])) { | ||||
| $MAX_METHOD_ID = max_transcript_strip_id(); | ||||
| $EFFECTIVE_ID = $_GET['transcript_id']; | ||||
| $METHOD = 'transcript'; | ||||
| } elseif(isset($_GET['rant_id']) && ctype_digit($_GET['rant_id'])) { | ||||
| if($_GET['rant_id'] < 0) | ||||
| term(404); | ||||
| $EFFECTIVE_ID = strip_id_from_rant_id($_GET['rant_id']); | ||||
| header('HTTP/1.0 301 Moved Permanently'); | ||||
| header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$EFFECTIVE_ID#rant".$_GET['rant_id']); | ||||
| exit(0); | ||||
| } else { | ||||
| $EFFECTIVE_ID = $MAX_METHOD_ID = max_strip_id(); | ||||
| $METHOD = 'strip'; | ||||
| } | ||||
| if($EFFECTIVE_ID < 0 || $EFFECTIVE_ID > $MAX_METHOD_ID) | ||||
| { | ||||
| header('HTTP/1.0 404 Not Found'); | ||||
| $EFFECTIVE_ID = $MAX_METHOD_ID; | ||||
| } | ||||
| #$MTIME = mysqli_query($link,"SELECT UNIX_TIMESTAMP(MAX(pd)) | ||||
| # FROM (SELECT MAX(pubdate) AS pd FROM fredart | ||||
| # UNION SELECT published AS pd FROM strip WHERE id = $EFFECTIVE_ID | ||||
| # UNION SELECT MAX(published) AS pd FROM rant) t") or die(mysqli_error($link)); | ||||
| #conditional_exit(current(mysqli_fetch_row($MTIME))); | ||||
| $STRIP = load_strip($EFFECTIVE_ID) or term(410); | ||||
| $TRANSCRIPT = load_transcript($EFFECTIVE_ID); | ||||
| $HAS_TRANSCRIPT = mysqli_num_rows($TRANSCRIPT) > 0; | ||||
| $CONTROLS = load_nav_controls(); | ||||
| #$STATUS = load_status(); | ||||
| $FREDART = load_fredart(); | ||||
| $RANT['left'] = load_rant($EFFECTIVE_ID, 'left'); | ||||
| $RANT['right'] = load_rant($EFFECTIVE_ID, 'right'); | ||||
| header("XX-Powered-By: Taiyaki"); | ||||
| flock(fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'r'), LOCK_SH) or | ||||
| trigger_error('Down for maintenance. Try again in a moment. (Bad lock)', E_USER_ERROR); | ||||
| if(isset($_GET['strip_id']) || isset($_GET['transcript_id'])) | ||||
| pagehead('index', "[$EFFECTIVE_ID] " . numeric_entities(utfentities($STRIP['title']))); | ||||
| else | ||||
| pagehead('index'); | ||||
| ?> | ||||
| <div id="comic"> | ||||
| <div class="navpanel"> | ||||
| <div class="navcontrols top"> | ||||
| <ul class="prevnext"><?php | ||||
| if($EFFECTIVE_ID > 1) | ||||
| echo "<li class=\"prev\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID - 1) . '">Prev</a></li>'; | ||||
| else | ||||
| echo '<li class="prevoff"><span>Prev</span></li>'; | ||||
| if($EFFECTIVE_ID < $MAX_METHOD_ID) | ||||
| echo "<li class=\"next\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID + 1) . '">Next</a></li>'; | ||||
| else | ||||
| echo '<li class="nextoff"><span>Next</span></li>'; | ||||
| ?></ul> | ||||
| </div> | ||||
| r63 | <div id="title"> | |||
| "<?php echo numeric_entities(utfentities($STRIP['title'])); ?>" | ||||
| <span style="font-size: 10px"><?php echo $STRIP['pubdate'] ?> [<?php echo $EFFECTIVE_ID ?>]</span> | ||||
| </div> | ||||
| r2 | </div> | |||
| <?php | ||||
| switch($METHOD) { | ||||
| case 'strip': | ||||
| #construct tooltip | ||||
| $tooltip = "Comic ".$EFFECTIVE_ID; | ||||
| $tooltip .= ': "'; | ||||
| $tooltip .= $STRIP['title'].'", '; | ||||
| $result = mysqli_query($link,"SELECT strip_t.description, count(*) | ||||
| FROM strip_t JOIN strip ON strip_t.id = strip.type | ||||
| WHERE strip.id < $EFFECTIVE_ID+1 | ||||
| AND strip.type = $STRIP[type] | ||||
| GROUP BY strip.type"); | ||||
| if($result) | ||||
| { | ||||
| $qr = mysqli_fetch_row($result); | ||||
| $tmp = explode(':', $qr[0]); | ||||
| $tooltip .= $tmp[0].", Number ".$qr[1].", ".$STRIP['pubdate']; | ||||
| } | ||||
| r36 | ||||
| r2 | $alttext = "Strip ".$EFFECTIVE_ID; | |||
| if($STRIP['book']) | ||||
| $alttext .= ", Volume ".$STRIP['book']; | ||||
| r36 | ||||
| r2 | if($STRIP['page']) | |||
| $alttext .= ", Page ".$STRIP['page']; | ||||
| ?> | ||||
| <span id="strip"> | ||||
| <span id="strip-l"><span id="strip-r"> | ||||
| <span id="strip-t"><span id="strip-b"> | ||||
| <span id="strip-tr"><span id="strip-tl"> | ||||
| <span id="strip-br"><span id="strip-bl"> | ||||
| <?php | ||||
| /* With apologies, patching in support for the embedded Endgames: Persistence visual novel. */ | ||||
| if ($STRIP['type'] == 24 || $_GET['hidden_vn_test'] == 'yes_please') { | ||||
| /* TODO: Support more than just one of these. */ | ||||
| printf('<iframe src="endgames-vn/index.htm" scrolling="no"></iframe>'); | ||||
| } else { | ||||
| r62 | if($EFFECTIVE_ID < $MAX_METHOD_ID) { | |||
| printf('<a href="./strip/%d">', $EFFECTIVE_ID + 1); | ||||
| } | ||||
| printf('<img align="middle" src="%s/%04d.%s" alt="%s" title="%s" />', SITE_STRIP, $EFFECTIVE_ID, $STRIP['ext'], $alttext, utfentities($tooltip)); | ||||
| if($EFFECTIVE_ID < $MAX_METHOD_ID) { | ||||
| printf('</a>'); | ||||
| } | ||||
| r2 | } | |||
| r60 | if ($EFFECTIVE_ID == 1564) { | |||
| ?> | ||||
| <style> | ||||
| .bubble_pop { | ||||
| opacity: 0.01; | ||||
| visibility: visible; | ||||
| transition: all 0.2s ease-out; | ||||
| -webkit-transition: all 0.2s ease-out; | ||||
| -moz-transition: all 0.2s ease-out; | ||||
| -o-transition: all 0.2s ease-out; | ||||
| } | ||||
| .bubble_pop:hover { | ||||
| opacity: 1; | ||||
| visibility: visible; | ||||
| } | ||||
| .bubble_pop:active { | ||||
| -webkit-transition: opacity 0.2s ease-out; | ||||
| } | ||||
| </style> | ||||
| <?php | ||||
| $style = "position: absolute; left: 102px; top: 1047px;"; | ||||
| printf('<img src="%s/%04d_bubble.png" class="bubble_pop" style="%s"/>', SITE_STRIP, $EFFECTIVE_ID, $style); | ||||
| } | ||||
| r2 | ?> | |||
| </span></span> | ||||
| </span></span> | ||||
| </span></span> | ||||
| </span></span> | ||||
| </span> | ||||
| <?php | ||||
| break; | ||||
| case 'transcript': | ||||
| ?> | ||||
| <div id="strip"> | ||||
| <div id="strip-l"><div id="strip-r"> | ||||
| <div id="strip-t"><div id="strip-b"> | ||||
| <div id="strip-tr"><div id="strip-tl"> | ||||
| <div id="strip-br"><div id="strip-bl"> | ||||
| <ol class="transcript"> | ||||
| <?php | ||||
| $line = mysqli_fetch_row($TRANSCRIPT); | ||||
| while($line) { | ||||
| $panel = $line[0]; | ||||
| $has_speakers = false; | ||||
| echo "<li><span class=\"panelhead\">Panel $panel:</span> <dl>"; | ||||
| # Print out all speaking characters | ||||
| if(strlen($line[2]) > 0) { | ||||
| $has_speakers = true; | ||||
| do { | ||||
| echo "<dt>$line[1]:</dt><dd>".($line[2] ? utfentities($line[2]) : ' ').'</dd>'; | ||||
| } while(($line = mysqli_fetch_row($TRANSCRIPT)) && $line[0] == $panel && strlen($line[2]) > 0); | ||||
| } | ||||
| # Given an "also shown" list if there is at least one silent character | ||||
| if($line && $line[0] == $panel && strlen($line[2]) == 0) { | ||||
| echo '<dt>', ($has_speakers ? 'Also' : 'Characters'), ' shown:</dt>'; | ||||
| $also = Array(); | ||||
| do { | ||||
| array_push($also, $line[1]); | ||||
| } while(($line = mysqli_fetch_row($TRANSCRIPT)) && $line[0] == $panel); | ||||
| sort($also, SORT_STRING); | ||||
| echo '<dd>' . join(', ', $also) . '</dd>'; | ||||
| } | ||||
| echo '</dl></li>'; | ||||
| } ?> | ||||
| </ol> | ||||
| </div></div> | ||||
| </div></div> | ||||
| </div></div> | ||||
| </div></div> | ||||
| </div> | ||||
| <?php | ||||
| break; | ||||
| default: | ||||
| die("Unknown request method: $METHOD"); | ||||
| } | ||||
| ?> | ||||
| <form class="navpanel" method="get" action="search.php"> | ||||
| <div style="display:none"> | ||||
| <input type="hidden" name="current" value="<?php echo $EFFECTIVE_ID ?>" /> | ||||
| <input type="submit" /> | ||||
| </div> | ||||
| <div class="navcontrols bottom"> | ||||
| <ul id="normalprevnext" class="prevnext"><?php | ||||
| if($EFFECTIVE_ID > 1) | ||||
| echo "<li class=\"prev\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID - 1) . '">Prev</a></li>'; | ||||
| else | ||||
| echo '<li class="prevoff"><span>Prev</span></li>'; | ||||
| if($EFFECTIVE_ID < $MAX_METHOD_ID) | ||||
| echo "<li class=\"next\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID + 1) . '">Next</a></li>'; | ||||
| else | ||||
| echo '<li class="nextoff"><span>Next</span></li>'; | ||||
| ?></ul> | ||||
| <ul id="searchprevnext" class="prevnext"><?php | ||||
| if( $EFFECTIVE_ID > 1 ) | ||||
| echo '<li>', | ||||
| '<input class="iehide" type="image" src="parts/nav2-prevfind.png" alt="Find Previous" name="method-fp" value="Find Previous" />', | ||||
| '</li>'; | ||||
| else | ||||
| echo '<li class="findprevoff"><span>Find Next</span></li>'; | ||||
| if($EFFECTIVE_ID < $MAX_METHOD_ID) | ||||
| echo '<li>', | ||||
| '<input class="iehide" type="image" src="parts/nav2-nextfind.png" alt="Find Next" name="method-fn" value="Find Next" />', | ||||
| '</li>'; | ||||
| else | ||||
| echo '<li class="findnextoff"><span>Find Next</span></li>'; | ||||
| ?></ul> | ||||
| </div> | ||||
| <div class="search-field">Search: | ||||
| <input type="text" name="q" id="q" value="<?php if(isset($_REQUEST['q'])) {echo utfentities(trim($_REQUEST['q']));} ?>" /> | ||||
| <input class="iehide" id="go" type="image" src="parts/nav2-go.png" alt="Go Search" /> | ||||
| <a href="search_help"><img src="parts/nav2-help.png" alt="help" title="help" /></a> | ||||
| </div> | ||||
| <div class="search-filter" id="search-filters">Within: <?php | ||||
| foreach($CONTROLS as $name => $controls) { | ||||
| foreach($controls as $control) { | ||||
| printf('<label><input type="checkbox" name="%s[]" value="%s" />%s</label>', $name, $control, $control); | ||||
| } | ||||
| } | ||||
| ?></div> | ||||
| </form> | ||||
| <ul class="nl"> | ||||
| <li><a href="./strip/1">First Comic</a></li> | ||||
| <li>·</li> | ||||
| <li id="archivelink"><a href="archive.php<?php if(isset($_GET['strip_id'])) echo "#".$EFFECTIVE_ID; ?>">Archives</a></li> | ||||
| <?php | ||||
| if($METHOD == 'transcript') | ||||
| echo "<li>·</li><li><a href=\"./strip/$EFFECTIVE_ID\">Strip</a></li>"; | ||||
| elseif($HAS_TRANSCRIPT) | ||||
| echo "<li>·</li><li><a href=\"./transcript/$EFFECTIVE_ID\">Transcript</a></li>"; | ||||
| ?> | ||||
| <li>·</li> | ||||
| <li><a href="http://www.megatokyo.it/?id=<?php echo $EFFECTIVE_ID ?>">Translation</a></li> | ||||
| <li>·</li> | ||||
| <li><a href="index.php">Latest Comic</a></li> | ||||
| </ul> | ||||
| </div> | ||||
| <script type="text/javascript" src="rewrite_searchbox.js"></script> | ||||
| <script type="text/javascript" src="navswitch.js"></script> | ||||
| <div class="content" id="metabox"> | ||||
| <h2><span></span>newsbox</h2> | ||||
| <div id="newsbox"> | ||||
| <div id="facebook" class="leftcol"> | ||||
| <!--<a href="http://www.facebook.com/pages/Megatokyo/250777389376" title="Megatokyo" ><img alt="Megatokyo on Facebook" src="https://badge.facebook.com/badge/250777389376.3850.611436821.png" /></a> --> | ||||
| </div> | ||||
| <div id="blogbits" class="rightcol"> | ||||
| <a href="http://www.fredart.com/fredart/index.php3" class="leftcol"><img src="parts/fredart-big01.gif" alt="A Fredart banner" title="More of Fred's art" /></a> | ||||
| <a href="http://www.s-words-podcast.com/" class="rightcol"><img src="parts/s-words.jpg" alt="S-Words" title="Dom's podcast" /></a> | ||||
| <ul id="feed-list"> | ||||
| <li id="feed-twitter-megatokyo"><a href="http://twitter.com/megatokyo"><img src="parts/twtmega.png" alt="Megatokyo Twitter" /></a></li> | ||||
| <li id="feed-megatokyo"><a href="rss/megatokyo.xml"><img src="parts/rssmega.png" alt="Megatokyo RSS feed" title="Megatokyo RSS Feed" /></a></li> | ||||
| <li id="feed-twitter-fredrin"><a href="http://twitter.com/fredrin"><img src="parts/twtfredrin.png" alt="Fred's Twitter" /></a></li> | ||||
| <li id="feed-fredart"><a href="http://fredart.com/wordpress/?feed=rss2"><img src="parts/rssfredart.png" alt="Fredart RSS Feed" title="Fredart RSS Feed" /></a></li> | ||||
| </ul> | ||||
| </div> | ||||
| </div> | ||||
| </div> | ||||
| r64 | <!-- | |||
| r2 | <div class="content" id="support"> | |||
| <h2><span></span>support</h2> | ||||
| <div id="megagear"> | ||||
| <?php // ad_template(7,'a058c23f') ?> | ||||
| <?php // ad_template(9,'a058c23f') ?> | ||||
| r15 | <a href="http://vn.megatokyo.com"><img src="extra/MTVN-ADBANNER-animated-03.gif" alt="MegaTokyo Visual Novel" /></a> | |||
| r2 | </div> | |||
| <div class="thewrap" style="display: none;"> | ||||
| <div class="column leftcol"> | ||||
| <?php ad_template(4, 'a63c0f77') ?> | ||||
| <?php ad_template(3, 'a1f95ec5') ?> | ||||
| </div> | ||||
| <div class="column rightcol"> | ||||
| <?php ad_template(6, 'aad50baf') ?> | ||||
| <?php ad_template(5, 'ad741b2d') ?> | ||||
| </div> | ||||
| </div> | ||||
| <script src="rewrite_supportbox.js" type="text/javascript"></script> | ||||
| </div> | ||||
| r64 | --> | |||
| r2 | ||||
| <div id="console"> | ||||
| <h2><span></span>console</h2> | ||||
| <?php show_rantcol('left') ?> | ||||
| <?php show_rantcol('right') ?> | ||||
| <div class="clearer"></div> | ||||
| </div> | ||||
| <?php pagefoot() ?> | ||||
| </body> | ||||
| </html> | ||||
| <?php | ||||
| function load_fredart() | ||||
| { | ||||
| global $link; | ||||
| $qr = mysqli_query($link,"SELECT DATE_FORMAT(pubdate, '%a %c.%d.%Y') AS pub, title, link | ||||
| FROM fredart ORDER BY pubdate DESC LIMIT 5"); | ||||
| while($tmp = mysqli_fetch_assoc($qr)) | ||||
| $fredart[] = $tmp; | ||||
| return $fredart; | ||||
| } | ||||
| function load_nav_controls() | ||||
| { | ||||
| global $link; | ||||
| $controls = Array(); | ||||
| $qr = mysqli_query($link,'SELECT name FROM meta_t'); | ||||
| while($tmp = mysqli_fetch_row($qr)) | ||||
| $controls['meta'][] = $tmp[0]; | ||||
| return $controls; | ||||
| } | ||||
| function load_rant($id, $side) | ||||
| { | ||||
| global $MAX_METHOD_ID, $EFFECTIVE_ID, $link; | ||||
| $parameters = "r.id AS rantnum, r.title AS title, r.body AS body, | ||||
| r.published AS published, UNIX_TIMESTAMP(r.published) AS date, | ||||
| r.link AS link, r.imagetext AS alttext, m.extension AS extension, | ||||
| c.name AS author, c.email AS email, | ||||
| ( SELECT id FROM rant r1 WHERE r1.status = 'published' AND r1.side = r.side AND r1.published < r.published ORDER BY r1.published DESC LIMIT 1) AS prev, | ||||
| ( SELECT id FROM rant r1 WHERE r1.status = 'published' AND r1.side = r.side AND r1.published > r.published AND r1.published < NOW() ORDER BY r1.published ASC LIMIT 1 ) AS next"; | ||||
| $rantinfo = "rant r JOIN media_t m ON m.id = r.imagetype | ||||
| JOIN contributor c ON c.id = r.author | ||||
| JOIN strip s"; | ||||
| $rantlimit = "( r.side = '$side' AND r.published < NOW() AND r.status = 'published' AND s.id = $id )"; | ||||
| # Create a window of previous days' rants on the most recent strip | ||||
| if($MAX_METHOD_ID == $EFFECTIVE_ID) | ||||
| $rantwindow = "UNION DISTINCT (SELECT $parameters FROM $rantinfo WHERE $rantlimit AND DATEDIFF(NOW(), r.published) < " . RANT_DATE_WINDOW . ')'; | ||||
| $lookahead = mysqli_query($link,"( SELECT $parameters | ||||
| FROM $rantinfo LEFT JOIN strip sn ON sn.id = s.id + 1 | ||||
| WHERE $rantlimit AND ( s.id = $id AND r.published >= s.published) AND ( r.published < sn.published OR sn.published IS NULL ) ) | ||||
| $rantwindow | ||||
| ORDER BY published DESC") or die(mysqli_error($link)); | ||||
| if(mysqli_num_rows($lookahead) > 0) | ||||
| return $lookahead; | ||||
| $lookbehind = mysqli_query($link,"(SELECT $parameters | ||||
| FROM $rantinfo | ||||
| WHERE $rantlimit AND r.published < s.published | ||||
| ORDER BY r.published DESC LIMIT 1) | ||||
| $rantwindow | ||||
| ORDER BY published DESC") or die(mysqli_error($link)); | ||||
| return $lookbehind; | ||||
| } | ||||
| function load_status() | ||||
| { | ||||
| global $link; | ||||
| //"%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]" | ||||
| $qr = mysqli_query($link,'SELECT UNIX_TIMESTAMP(published) as udate, | ||||
| DATE_FORMAT(published, "%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]") AS published, | ||||
| DATE_FORMAT(eta, "%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]") AS eta, percentage, text | ||||
| FROM status | ||||
| ORDER BY udate DESC LIMIT 1') or die(mysqli_error($link)); | ||||
| return mysqli_fetch_assoc($qr); | ||||
| } | ||||
| function show_rantcol($side) | ||||
| { | ||||
| global $RANT, $link; | ||||
| ?> | ||||
| <div class="<?php echo $side ?>col"> | ||||
| <?php $rant = mysqli_fetch_assoc($RANT[$side]) ?> | ||||
| <div class="mainrant" id="rant<?php echo $rant['rantnum'] ?>"> | ||||
| <div class="nameplate"> | ||||
| <span style="background-image:url(nameplates/<?php echo $rant['author'] ?>.jpg)"></span> | ||||
| <h3>< <?php echo $rant['author'] ?> ></h3> | ||||
| </div> | ||||
| <div class="rantimage"><div class="ri-top"><div class="ri-bottom"><div class="ri-matte"><p><?php | ||||
| printf('<a href="%s"><img src="%s/%04d.%s" alt="%s" title="%s" /></a>', | ||||
| $rant['link'], SITE_RANT, $rant['rantnum'], $rant['extension'], | ||||
| utfentities($rant['alttext']), utfentities($rant['alttext'])) | ||||
| ?></p></div></div></div></div> | ||||
| <h4><a href="rant/<?php echo $rant['rantnum'] ?>">"<?php echo utfentities($rant['title']) ?>"</a></h4> | ||||
| <?php echo '<p class="date">', date('l - F j, Y', $rant['date']), '</p>'?> | ||||
| <?php printf('<p class="date">[<a href="mailto:%s">%s</a>] - %s - [<a href="rant/%s">link here</a>]</p>', $rant['email'], $rant['author'], date('H:i:s', $rant['date']), $rant['rantnum']) ?> | ||||
| <div class="rantbody"><?php echo $rant['body'] ?></div> | ||||
| <div class="rantnav"><?php | ||||
| if($rant['prev']) | ||||
| { | ||||
| echo "[<a href=\"./rant/".$rant['prev']."\">previous rant</a>]"; | ||||
| } | ||||
| echo ' - [<a href="rant-archive.php">rant archive</a>]'; | ||||
| if($rant['next'] && $rant['prev']) | ||||
| { | ||||
| echo ' - '; | ||||
| } | ||||
| if($rant['next']) | ||||
| { | ||||
| echo "[<a href=\"./rant/".$rant['next']."\">next rant</a>]"; | ||||
| } | ||||
| ?></div> | ||||
| </div> | ||||
| <?php while($rant = mysqli_fetch_assoc($RANT[$side])) { ?> | ||||
| <div class="oldrant" id="rant<?php echo $rant['rantnum'] ?>"> | ||||
| <div class="rantimage"><div class="ri-top"><div class="ri-bottom"><div class="ri-matte"><p><?php | ||||
| printf('<a href="%s"><img src="%s/%04d.%s" alt="%s" title="%s" /></a>', | ||||
| $rant['link'], SITE_RANT, $rant['rantnum'], $rant['extension'], | ||||
| utfentities($rant['alttext']), utfentities($rant['alttext'])) | ||||
| ?></p></div></div></div></div> | ||||
| <div class="nameplate"> | ||||
| <span style="background-image:url(nameplates/<?php echo $rant['author'] ?>.jpg)"></span> | ||||
| <h3>< <?php echo $rant['author'] ?> ></h3> | ||||
| </div> | ||||
| <h4><a href="rant/<?php echo $rant['rantnum'] ?>">"<?php echo utfentities($rant['title']) ?>"</a></h4> | ||||
| <div class="clearer"></div> | ||||
| <?php echo '<p class="date">', date('l - F j, Y', $rant['date']), '</p>'?> | ||||
| <?php printf('<p class="date">[<a href="mailto:%s">%s</a>] - %s - [<a href="rant/%s">link here</a>]</p>', $rant['email'], $rant['author'], date('H:i:s', $rant['date']), $rant['rantnum']) ?> | ||||
| <div class="rantbody"><?php echo $rant['body'] ?></div> | ||||
| <div class="rantnav"><?php | ||||
| if($rant['prev']) | ||||
| { | ||||
| echo "[<a href=\"./rant/".$rant['prev']."\">previous rant</a>]"; | ||||
| } | ||||
| echo ' - [<a href="rant-archive.php">rant archive</a>]'; | ||||
| if($rant['next'] && $rant['prev']) | ||||
| { | ||||
| echo ' - '; | ||||
| } | ||||
| if($rant['next']) | ||||
| { | ||||
| echo "[<a href=\"./rant/".$rant['next']."\">next rant</a>]"; | ||||
| } | ||||
| ?></div> | ||||
| </div> | ||||
| <?php } ?> | ||||
| </div> | ||||
| <?php } | ||||
| function strip_id_from_rant_id($id) | ||||
| { | ||||
| global $link; | ||||
| $qr = mysqli_query($link,"SELECT MAX(strip.id) FROM strip, rant WHERE strip.published <= rant.published AND rant.id = $id AND rant.published < NOW()"); | ||||
| return current(mysqli_fetch_row($qr)); | ||||
| } | ||||
| function transcript($trans) | ||||
| { | ||||
| global $link; | ||||
| if(!$trans) | ||||
| return "Transcript not yet available for this comic."; | ||||
| $transcript = Array(); | ||||
| foreach($trans as $panel => $lines) { | ||||
| if(!is_numeric($panel)) | ||||
| continue; | ||||
| $idx = array_push($transcript, Array()) - 1; | ||||
| foreach($lines as $line) { | ||||
| array_push($transcript[$idx], $line['speaker']); | ||||
| if($line['speech']) | ||||
| array_push($transcript, wordwrap("\t$line[speaker]:\t$line[speech]", 80, "\n\t\t")); | ||||
| } | ||||
| $transcript[$idx] = "Panel $panel: " . implode(', ', array_unique($transcript[$idx])); | ||||
| } | ||||
| return implode("\n", $transcript); | ||||
| } | ||||
| function numeric_entities($string){ | ||||
| $mapping = array(); | ||||
| foreach (get_html_translation_table(HTML_ENTITIES, ENT_QUOTES) as $char => $entity){ | ||||
| $mapping[$entity] = '&#' . ord($char) . ';'; | ||||
| } | ||||
| return str_replace(array_keys($mapping), $mapping, $string); | ||||
| } | ||||
| ?> | ||||
