Example #1
0
 /**
  * Gets a query for the board catalog.
  * @param Board $board
  * @param boolean $active
  * @return mysqli::query
  */
 static function getCatalog($board, $active = true)
 {
     $dbl = Config::getMysqliConnection();
     $board_shortname = $dbl->real_escape_string($board->getName());
     $prefix = $board_shortname . "_";
     $pTable = $prefix . "post";
     $tTable = $prefix . "thread";
     $pageQuery = "SELECT {$tTable}.*, {$pTable}.*  FROM {$tTable} LEFT JOIN {$pTable} ON {$pTable}.no = {$tTable}.threadid ";
     if ($active) {
         $pageQuery .= "WHERE {$tTable}.active = 1 ";
     }
     $pageQuery .= "ORDER BY {$tTable}.lastreply DESC LIMIT 0,{$board->getMaxActiveThreads()}";
     $q = $dbl->query($pageQuery);
     return $q;
 }
Example #2
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;
 }
Example #3
0
 /**
  * <code>Thread::parseQuotes</code> searches for inter-post links and adds backlinks to the respective posts.
  *
  * @todo Use getters and setters rather than public attributes.
  * @todo Put this functionality into the b-stats native extension to save server resources.
  * @todo Better inline comments in this function.
  * @todo Show if backlinks are from (Dead) posts
  * @param string $com the post text to be searched
  * @param string|int $no the id of the post to be searched
  */
 function parseQuotes($com, $no)
 {
     $matches = array();
     if ($this->board->isArchive()) {
         $search = '~link">&gt;&gt;(\\d+)</~';
     } else {
         $search = '~>>(\\d+)~';
     }
     preg_match_all($search, $com, $matches);
     for ($i = 0; $i < count($matches[1]); $i++) {
         $postno = $matches[1][$i];
         for ($j = 0; $j < count($this->posts); $j++) {
             $p = $this->posts[$j];
             if ($p->no == $postno) {
                 if (!in_array($no, $p->backlinks)) {
                     $this->posts[$j]->backlinks[] = $no;
                 }
                 break;
             }
         }
     }
 }
Example #4
0
 function renderHeader()
 {
     parent::renderHeader();
     if (!$this->clearHeader) {
         $this->header .= Site::parseHtmlFragment('pagebody.html', ['<!-- boardlist -->', '<!-- name -->', '<!-- subtitle -->'], [Board::getBoardList(), Config::getCfg('site')['name'], Config::getCfg('site')['subtitle']]);
         if ($_SERVER['SCRIPT_NAME'] != "/index.php") {
             if ($this->board == null) {
                 $this->header .= div('[' . a('HOME', '/index.php') . ']', 'centertext');
             } else {
                 $this->header .= "<div style='position:relative; top: -20px;' id='topLinks'>[<a href='/index.php'>Home</a>]";
                 if ($_SERVER['SCRIPT_NAME'] != "/board.php") {
                     $this->header .= " [" . a('Return', "/{$this->board->getName()}/") . "]";
                 }
                 if ($_SERVER['SCRIPT_NAME'] != "/catalog.php" && !$this->board->isSwfBoard()) {
                     $this->header .= " [" . a('Catalog', "/{$this->board->getName()}/catalog") . "]";
                 }
                 $this->header .= "</div><br>";
             }
         }
     }
     return $this->header;
 }
Example #5
0
 public function archiveReport(ImageBoard\Board $board, int $post)
 {
     $this->conn_rw->prepare("UPDATE `reports` SET `archived`=1 WHERE `board`=:b AND `no`=:no")->execute([':b' => $board->getName(), ':no' => $post]);
 }