Example #1
0
 public function __construct(Board $board, array $path)
 {
     parent::__construct($board);
     $topLinks = div('', 'topLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Return', '/' . $this->board->getName() . '/') . ']');
     if (!$board->isSwfBoard()) {
         $topLinks->append(' [' . a('Catalog', '/' . $this->board->getName() . '/catalog') . ']');
     }
     $this->appendToBody($topLinks);
     $this->appendToBody(el('h2', 'Board Search'));
     try {
         $method = $path[3] ?? "";
         if (method_exists(self::class, $method)) {
             $this->perPage = (int) get('perpage', 250);
             $this->page = (int) get('page', 0);
             $this->start = $this->perPage * $this->page;
             $result = $this->{$path[3]}($path[4] ?? NULL);
             $this->appendToBody(div($result->count . ' results.', 'centertext'));
             $pages = $this->makePageSelector($result->count);
             $this->appendToBody($pages);
             $i = $this->start + 1;
             foreach ($result->result as $post) {
                 $this->appendToBody(div($i++ . " >>", 'sideArrows') . PostRenderer::renderPost($post));
             }
             $this->appendToBody($pages);
         } else {
             $this->appendToBody("<h3>Invalid search parameter '{$method}' provided</h3>");
         }
     } catch (Exception $e) {
         $this->appendToBody("<h3>Error: {$e->getMessage()}</h3>");
     }
     $this->appendToBody('<hr>' . $topLinks);
 }
Example #2
0
 function __construct(Thread $thread)
 {
     parent::__construct($thread->getBoard());
     $topLinks = div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Return', '/' . $this->board->getName() . '/') . ']');
     if (!$thread->getBoard()->isSwfBoard()) {
         $topLinks->append(' [' . a('Catalog', '/' . $this->board->getName() . '/catalog') . ']');
     }
     if (!$thread->getBoard()->isArchive() && $thread->isActive()) {
         if ($thread->isClosed()) {
             $this->appendToBody(el('h2', 'Thread is closed.'));
         } else {
             if (!isset($_SESSION['captcha'])) {
                 $_SESSION['captcha'] = rand(100000, 999999);
             }
             $this->appendToBody(Site::parseHtmlFragment('postForm.html', ['_board_', '_resto_', '_password_'], [$thread->getBoard()->getName(), $thread->getThreadId(), 'password']));
         }
     }
     $this->appendToBody($topLinks);
     $thread->loadAll();
     $dur = secsToDHMS($thread->getPost($thread->getPosts() - 1)->getTime() - $thread->getPost(0)->getTime());
     $board = div('', 'board');
     if ($thread->getBoard()->isArchive()) {
         $threadStats = Site::parseHtmlFragment("threadStats.html", ["__threadid__", "__posts__", "__posts_actual__", "__images__", "__images_actual__", "__lifetime__", "__deleted__", "<!--4chanLink-->", "<!--tag-->"], [$thread->getThreadId(), $thread->getChanPosts(), $thread->getPosts() - 1, $thread->getChanImages(), $thread->getImages() - 1, "{$dur[0]}d {$dur[1]}h {$dur[2]}m {$dur[3]}s", $thread->getDeleted(), $thread->isActive() ? "<a target='_blank' href='//boards.4chan.org/{$this->board->getName()}/thread/{$thread->getThreadId()}'>View on 4chan</a>" : "Thread is dead.", $thread->getTag() != null ? "<br>Tagged as: " . $thread->getTag() : ""]);
         $board->append($threadStats);
     } else {
         $board->append('<hr>');
     }
     $this->appendToBody($board->append(div($thread->displayThread(), 'thread')));
     $bottomLinks = $topLinks;
     $this->appendToBody("<hr>" . $bottomLinks);
 }
Example #3
0
 public function __construct(ImageBoard\Board $board)
 {
     parent::__construct($board);
     if ($board->isSwfBoard()) {
         //throw new Exception("Catalogs don't work on upload boards");
     }
     $this->addToHead("<link rel='stylesheet' href='/css/bstats-catalog.css' type='text/css'>");
     $catalog = OldModel::getCatalog($board, false);
     $this->appendToBody(div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Return', '/' . $board->getName() . '/') . ']') . '<br/><br/>');
     $html = div('', 'extended-small')->set('id', 'threads');
     while ($thread = $catalog->fetch_assoc()) {
         $post = new Post($thread, $board);
         $html->append(PostRenderer::renderPost($post, PostRenderer::DISPLAY_CATALOG));
     }
     $this->appendToBody($html);
 }
Example #4
0
 public function __construct(ImageBoard\Board $board, int $page)
 {
     parent::__construct($board);
     if (!$board->isArchive()) {
         if (!isset($_SESSION['captcha'])) {
             $_SESSION['captcha'] = rand(100000, 999999);
         }
         $this->appendToBody(Site::parseHtmlFragment('postForm.html', ['_board_', '_resto_', '_password_'], [$board->getName(), 0, 'password']));
     }
     if ($board->isSwfBoard()) {
         $this->appendToBody(div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Catalog', '/' . $board->getName() . '/catalog') . ']'));
         $this->renderSwfBoard($page);
     } else {
         $this->appendToBody(div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Catalog', '/' . $board->getName() . '/catalog') . ']'));
         $this->renderPage($page);
     }
 }
Example #5
0
 public function __construct(Post $p)
 {
     parent::__construct($p->board);
     $this->appendToBody(el('h2', 'Orphaned Post') . div('This post was found, but its thread is nowhere to be seen!', 'centertext'));
     $this->appendToBody(div('>>', 'sideArrows') . PostRenderer::renderPost($p));
 }