function GetReplies() { $res = DB::Execute('SELECT r.id, r.time, r.author, r.name, r.poster_number, r.body, r.edit_time, r.flags, i.file_name FROM {P}Replies as r LEFT OUTER JOIN {P}Images as i ON r.id = i.reply_id WHERE r.parent_id = ' . $this->ID . ' ORDER BY id'); $tuple = array(1 => 'double', 2 => 'triple', 3 => 'quadruple', 4 => 'quintuple'); while ($row = $res->FetchRow()) { $reply = new Reply($this); list($reply->ID, $reply->Time, $reply->AuthorID, $reply->AuthorName, $pn, $reply->Body, $reply->EditTime, $reply->Flags, $reply->FileName) = $row; $reply->Action = ''; //Protip: If you're going to make a shortcut var, remember to populate that shortcut var :V $uid = $reply->AuthorID; if (!array_key_exists($uid, $this->UIDs)) { $this->UIDs[$uid] = array('Anonymous ' . AnonySeqID(count($this->UIDs))); $reply->Action = 'joined in and '; } if (empty($reply->AuthorName)) { $reply->AuthorName = $this->UIDs[$uid][0]; } else { if (!in_array($reply->AuthorName, $this->UIDs[$uid])) { $this->UIDs[$uid][] = $reply->AuthorName; } } // Check for samefagging. if ($this->PreviousReply->AuthorID == $reply->AuthorID) { $reply->SFM = $this->PreviousReply->SFM + 1; if ($reply->SFM < 4) { $reply->Action = $tuple[$reply->SFM] . '-posted'; } else { $reply->Action = 'samefagged for the ' . OrdSuffix($reply->SFM) . ' time with'; } } else { $reply->SFM = 0; $reply->Action = 'replied with'; } $this->Replies[$reply->ID] = $reply; // DO NOT F*****G CHANGE THE ORDER OF THESE. $this->Replies[$reply->ID]->Parse($this); $this->PreviousReply = $this->Replies[$reply->ID]; // END DO NOT CHANGE ORDER } }
echo $editing ? 'Update' : 'Post'; ?> " class="inline"> </div> </form> </div> <?php // If citing, fetch and display the reply in question. if (ctype_digit($_GET['cite'])) { $res = DB::Execute('SELECT body, poster_number FROM {P}Replies WHERE id = ' . $_GET['cite']); list($cited_text, $poster_number) = $res->FetchRow(); if (!empty($cited_text)) { $cited_text = parse($cited_text); // Linkify citations within the text. preg_match_all('/^@([0-9,]+)/m', $cited_text, $matches); foreach ($matches[0] as $formatted_id) { $pure_id = str_replace(array('@', ','), '', $formatted_id); $cited_text = str_replace($formatted_id, '<a href="/topic/' . $_GET['reply'] . '#reply_' . $pure_id . '" class="unimportant">' . $formatted_id . '</a>', $cited_text); } // And output it! echo '<h3 id="replying_to">Replying to Anonymous ' . AnonySeqID($poster_number) . '…</h3> <div class="body standalone">' . $cited_text . '</div>'; } } else { if ($reply && !isset($_GET['quote_topic']) && !isset($_GET['quote_reply']) && !$editing) { $res = DB::Execute('SELECT body FROM {P}Topics WHERE id = ' . $_GET['reply']); list($cited_text) = $res->FetchRow(); echo '<h3 id="replying_to">Original post</h3> <div class="body standalone">' . parse($cited_text) . '</div>'; } } require 'includes/footer.php';