Example #1
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);
 }
Example #2
0
 public function __construct()
 {
     parent::__construct("Banned", "You're banned.");
     $banInfo = OldModel::getBanInfo($_SERVER['REMOTE_ADDR']);
     $expires = $banInfo['expires'] == 0 ? "Never" : date("Y-m-d h:i:s T", $banInfo['expires']);
     $this->body = Site::parseHtmlFragment('banned.html', ['__ip__', '__reason__', '__expires__'], [$_SERVER['REMOTE_ADDR'], $banInfo['reason'], $expires]);
     $this->title = "/b/ stats: ACCESS DENIED";
 }
Example #3
0
 function setTheme($theme)
 {
     if (in_array($theme, array_keys(Config::getCfg('styles')))) {
         if ($this->uid != 0) {
             OldModel::updateUserTheme($this->uid, $theme);
         }
         $this->theme = $theme;
     }
 }
Example #4
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 #5
0
 function __construct($no, Board $board)
 {
     if (is_array($no)) {
         $arr = $no;
         $this->doc_id = $arr['doc_id'] ?? 0;
         $this->no = $arr['no'];
         $this->threadid = $arr['resto'];
         $this->time = $arr['time'];
         $this->tim = $arr['tim'] ?? 0;
         $this->id = isset($arr['id']) && $arr['id'] != '' ? $arr['id'] : (isset($arr['ns_id']) && $arr['ns_id'] != '' ? $arr['ns_id'] : null);
         $this->name = $arr['name'];
         $this->email = $arr['email'];
         $this->sub = $arr['sub'];
         $this->trip = $arr['trip'];
         $this->com = $arr['com'];
         $this->md5 = base64_encode($arr['md5']) ?? null;
         $this->md5bin = $arr['md5'] ?? null;
         $this->filename = $arr['filename'] ?? "";
         $this->fsize = $arr['fsize'] ?? 0;
         $this->ext = $arr['ext'] ?? "";
         $this->w = $arr['w'] ?? 0;
         $this->h = $arr['h'] ?? 0;
         list($this->tn_w, $this->tn_h) = tn_Size($this->w, $this->h);
         $this->dnt = $arr['dnt'] ?? 0;
         $this->images = $arr['images'] ?? 0;
         $this->replies = $arr['replies'] ?? 0;
         $this->tag = $arr['tag'] ?? "";
         $this->deleted = $arr['deleted'];
         $this->capcode = $arr['capcode'];
         $this->filedeleted = $arr['filedeleted'];
     }
     if ($this->md5 != '' && in_array(bin2hex(base64_decode(str_replace("-", "/", $this->md5))), OldModel::getBannedHashes())) {
         $this->imgbanned = true;
     } else {
         $this->imgbanned = false;
     }
     $this->owner = null;
     $this->backlinks = array();
     $this->board = $board;
 }
Example #6
0
                break;
            case "banImage":
                OldModel::banHash($_POST['hash']);
                $err = false;
                break;
            case "deleteReport":
                OldModel::deleteReport($_POST['no'], $_POST['b']);
                $err = false;
                break;
            case "banReporter":
                OldModel::banReporter($_POST['no'], $_POST['b']);
                $err = false;
                break;
            case "restorePost":
                if (Site::getUser()->getPrivilege() >= Site::LEVEL_TERRANCE) {
                    OldModel::restorePost($_POST['no'], $_POST['b']);
                } else {
                    list($err, $errmsg) = [true, "Check your privilege"];
                }
                break;
            default:
                $err = true;
                $errmsg = "No action.";
                break;
        }
    } catch (Exception $e) {
        $err = true;
        $errmsg = $e->getMessage();
    }
} else {
    $err = true;
Example #7
0
 public static function banImage(array $path) : array
 {
     self::ensurePOST();
     OldModel::banHash($path[3]);
     return ['result' => 'Success'];
 }