Пример #1
0
 function __construct($message = "")
 {
     parent::__construct("404 ;_;", "", 0);
     $this->setBody("<h1>404 ;_;</h1><div class='centertext' style='font-size:1.5em;'>{$message}</div><br><br>");
     $this->appendToBody("<p style='text-align:center;'><img src='/image/404.png' alt='file not found' /></p>");
     header("HTTP/1.0 404 Not Found");
 }
Пример #2
0
 function __construct()
 {
     parent::__construct(Config::getCfg('site')['pagetitle'], "", 0);
     $boards = Model::get()->getBoards();
     $archiveBoards = array_filter($boards, function ($b) {
         return $b->isArchive();
     });
     $plainBoards = array_filter($boards, function ($b) {
         return !$b->isArchive();
     });
     $html = "<div class='boardlist_big'><h1>Archived Boards</h1><hr style='width:64px;'>";
     foreach ($archiveBoards as $b) {
         $html .= Site::parseHtmlFragment("indexArchiveBoard.html", ["%ago%", "%crawltime%", "%shortname%", "%longname%", "%posts%", "%threads%", "%firstcrawl%"], [ago(time() - $b->getLastCrawl()), $b->getLastCrawl(), $b->getName(), $b->getLongName(), $b->getNoPosts(), $b->getNoThreads(), date("j F Y", $b->getFirstCrawl())]);
     }
     $html .= "</div>";
     $html .= "<script type='text/javascript' src='/script/boardUpdate.js'></script>";
     if (count($plainBoards) > 0) {
         $html .= "<div class='boardlist_big'><h1>Boards</h1><hr style='width:64px;'>";
         foreach ($plainBoards as $b) {
             $html .= Site::parseHtmlFragment("indexBoard.html", ["%ago%", "%crawltime%", "%shortname%", "%longname%", "%posts%", "%threads%", "%firstcrawl%"], [ago(time() - $b->getLastCrawl()), $b->getLastCrawl(), $b->getName(), $b->getLongName(), $b->getNoPosts(), $b->getNoThreads(), date("j F Y", $b->getFirstCrawl())]);
         }
         $html .= "</div>";
     }
     $this->setBody($html);
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct("Report Queue", el('h2', "Reports"), Config::getCfg('permissions')['delete']);
     $reports = Model::get()->getReports();
     $html = "<table class='reportTable'><tr><th colspan='3'>Report Queue</th></tr><tr><th style='width:3em;'>Times</th><th>Post</th><th style='width:20em;'>Options</th></tr>";
     foreach ($reports as $report) {
         $hash = bin2hex($report['md5']);
         $html .= "<tr id='report{$report['no']}'>";
         $html .= "<td>" . $report['count'] . "</td>";
         $html .= "<td><a href='{$report['threadid']}#p{$report['no']}' data-board='{$report['board']}' data-thread='{$report['threadid']}' data-post='{$report['no']}' class='quotelink noEmbed'>&gt;&gt;{$report['no']}</a></td>";
         $html .= "<td><a class='button' href='javascript:deletePost({$report['no']},\"{$report['board']}\");' >Delete&nbsp;Post</a>&nbsp;";
         $html .= "<a class='button' href='javascript:banImage(\"{$hash}\");' id='ban{$hash}'>Ban&nbsp;Image</a>&nbsp;";
         $html .= "<a class='button' href='javascript:deleteReport({$report['no']},\"{$report['board']}\");'>Delete&nbsp;Report</a>&nbsp;";
         $html .= "<a class='button' href='javascript:banReporter({$report['no']},\"{$report['board']}\");'>Ban&nbsp;Reporter</a></td>";
         $html .= "</tr>";
     }
     $html .= "</table>";
     if (Site::getUser()->getPrivilege() >= Config::getCfg('permissions')['owner']) {
         $html .= "<br><table class='reportTable'><tr><th colspan='3'>Last Few Deleted Posts</th></tr><tr><th style='width:3em;'>Board</th><th>Post</th><th style='width:7em;'>Options</th></tr>";
         foreach (Model::get()->getBoards() as $board) {
             $lastFew = OldModel::getLastNDeletedPosts($board->getName(), 5);
             foreach ($lastFew as $report) {
                 $html .= "<tr id='report{$report['no']}'>";
                 $html .= "<td>" . $board->getName() . "</td>";
                 $html .= "<td>&gt;&gt;{$report['no']} ({$report['name']}{$report['trip']})</td>";
                 $html .= "<td><a class='button' href='javascript:restorePost({$report['no']},\"{$board->getName()}\");' >Restore&nbsp;Post</a></td>";
                 $html .= "</tr>";
             }
         }
         $html .= "</table>";
     }
     $this->appendToBody($html);
 }
Пример #4
0
 public function __construct(Board $board)
 {
     parent::__construct("/{$board->getName()}/ - {$board->getLongName()}", "", $board->getPrivilege());
     $boardBanner = div("", "boardBanner centertext")->append(div("/{$board->getName()}/ - {$board->getLongName()}", "boardTitle"));
     if ($board->isArchive()) {
         $boardBanner->append(a("View this board on 4chan", '//boards.4chan.org/' . $board->getName()));
     }
     $this->appendToBody("<hr>" . $boardBanner . "<hr>");
     $this->board = $board;
 }
Пример #5
0
 function __construct()
 {
     parent::__construct("b-stats news", "", 0);
     $this->appendToBody("<h2>News</h2>");
     $articles = Model::get()->getAllNewsArticles();
     foreach ($articles as $article) {
         $date = date("Y-m-d g:i a", $article['time']);
         $content = nl2br($article['content']);
         $this->appendToBody(Site::parseHtmlFragment("article.html", ['_author_', '_id_', '_title_', '_content_', '_date_'], [$article['username'], $article['article_id'], $article['title'], $content, $date]));
     }
 }
Пример #6
0
 public function __construct()
 {
     parent::__construct("Dashboard", "", 1);
     if (isset($_GET['success'])) {
         $error = "<br>Successfully changed.";
     } else {
         if (isset($_GET['failure'])) {
             $error = "<br>Password change unsuccessful.";
         } else {
             $error = "";
         }
     }
     $user = Site::getUser();
     $this->appendToBody(Site::parseHtmlFragment("dashboard.html", ['<!-- username -->', '<!-- privilege -->', '<!-- theme -->', '<!-- error -->'], [$user->getUsername(), $user->getPrivilege(), $user->getTheme(), $error]));
 }
Пример #7
0
 public function __construct()
 {
     parent::__construct("Apply for Access", "", 0);
     $db = Config::getMysqliConnectionRW();
     $err = '';
     if (isset($_POST['username'])) {
         if (post('captcha') == $_SESSION['captcha']) {
             $username = $db->real_escape_string(post('username'));
             $password = md5(post('password'));
             $email = $db->real_escape_string(post('email'));
             $reason = $db->real_escape_string(post('why'));
             $ip = Site::ip();
             $db->query("INSERT INTO `request` (`ip`,`username`,`password`,`email`,`reason`,`time`) VALUES ('{$ip}','{$username}',UNHEX('{$password}'),'{$email}','{$reason}',UNIX_TIMESTAMP())");
             header('Location: /');
             exit;
         } else {
             $err = 'Invalid captcha.';
         }
     }
     $q = $db->query("SELECT * FROM `request` WHERE `ip`='" . Site::ip() . "'");
     if ($q->num_rows === 0) {
         $_SESSION['captcha'] = rand(100000, 999999);
         if ($err != '') {
             $this->appendToBody("<p class='center'>{$err}</p>");
         }
         $this->appendToBody(Site::parseHtmlFragment('reqForm.html', ['__captcha__'], ['<img src="/captcha" alt="captcha">']));
     } else {
         $r = $q->fetch_assoc();
         if ($r['accepted'] == 0) {
             $this->appendToBody("<h2>Hold Your Horses</h2><p class='center'>You have successfully applied. Check this page or your email for your status.</p>");
         } else {
             if ($r['accepted'] == -1) {
                 $this->appendToBody("<h2>Oh noes ;_;</h2><p class='center'>Sorry, your application has been reviewed and denied. Now that you have seen this message, you may submit a new application.</p>");
                 $db->query("DELETE FROM `request` WHERE `ip`='" . Site::ip() . "'");
             } else {
                 if ($r['accepted'] == 1) {
                     $this->appendToBody("<h2>Congratulations</h2><p class='center'>Your application was reviewed and accepted.<br>You may now log in with the username and password that you chose.</p>");
                 }
             }
         }
     }
 }
Пример #8
0
 function __construct()
 {
     parent::__construct("Server Control Panel", "", Site::LEVEL_TERRANCE);
     $this->appendToBody(Site::parseHtmlFragment("scp.html", ['<!-- uptime -->'], [`uptime` . '<br>' . human_filesize(disk_free_space(__DIR__), 2) . " free"]));
 }
Пример #9
0
 function __construct()
 {
     parent::__construct("FAQ", "", 0);
     $this->setBody(Site::parseHtmlFragment("faq.html"));
 }