} } Comments::set_all($page->url, $comments); } $p->body .= "Hidden {$total_change} comments"; } $num_new_spam = 0; $p->body .= '<table class="spam">'; foreach (Resolver::find_all_pages('blog') as $page) { $comments = Comments::get_all($page->url, true); $com_body = array(); foreach ($comments as $comment) { $is_spam = ($comment->visible ? 'visible' : 'hidden') . ' ' . ($comment->is_spam() ? 'spam' : 'nonspam'); if ($comment->visible || !$comment->is_spam()) { $com_body[] = "<td class='{$is_spam} summary'>" . htmlspecialchars($comment->author_name) . ', ' . htmlspecialchars($comment->author_email) . ', ' . htmlspecialchars($comment->author_url) . ', ' . htmlspecialchars($comment->author_ip) . "<td class='{$is_spam} summary'>" . htmlspecialchars(substr($comment->body, 0, 100)); //"<td class='$is_spam summary'>" . $comment->body_html(); } if ($comment->visible && $comment->is_spam()) { $num_new_spam++; } } if ($com_body) { $p->body .= "<tr class='first'><td rowspan='" . count($com_body) . "'><a href='" . htmlspecialchars($page->url) . "'>" . $page->title . '</a>'; $p->body .= implode('<tr>', $com_body); } } $p->body .= '</table>'; $p->body .= '<p>'; $p->body .= "<form method='post' action='delete-spam.php'><input type='hidden' name='confirm' value='1'><input type='submit' value='Be gone, all {$num_new_spam} of you.'></form>"; HtmlTemplate::write($p);
static function die_not_found($url, $msg = '') { $page = Page::error_page_file_not_found($url, $msg); HtmlTemplate::write($page); exit; }
static function forbidden($msg = '') { if (AUTH_METHOD == 'Digest') { header('WWW-Authenticate: Digest realm="' . AUTH_REALM . '",qop="auth",nonce="' . uniqid() . '",opaque="' . md5(AUTH_REALM) . '"'); } else { header('WWW-Authenticate: Basic realm="' . AUTH_REALM . '"'); } $page = new Page(''); $page->title = "Authentication required"; $page->body = "Authentication is required to access this page." . ($msg ? "\n{$msg}" : ""); $page->status_code = 401; HtmlTemplate::write($page); exit; }
if ($page->show_comments) { $comments = count(Comments::get_all($page->url)); if ($comments == 0) { $notes .= "0 comments<br>"; } elseif ($comments == 1) { $notes .= "1 comment<br>"; } else { $notes .= "{$comments} comments<br>"; } } $out .= "<li>"; $out .= '<a href="' . htmlspecialchars($page->url) . '">'; $out .= "<span class='thumbnail {$page->icon}'></span>"; $out .= "<span class='details'>" . $notes . "</span>"; $out .= "<span class='title'>" . htmlspecialchars($page->title) . "</span>"; $out .= "<span class='desc'>" . htmlspecialchars($page->subtitle) . "</span>"; $out .= "</a></li>\n"; } $out .= "</ul>"; if ($this->tag) { //$out .= "<p><a href='feed/$this->tag'>Feed for posts tagged '$this->tag'</a>"; } else { $out .= "<p><a href='feed'>Subscribe to my feed</a>"; } return $out; } } $page = new BlogPage('blog'); Cache::begin($page); HtmlTemplate::write($page);