Example #1
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 #2
0
 /**
  * Default constructor
  * @param string $title Text in the <code>&lt;title&gt;</code> tags.
  * @param string $body Initial body text.
  * @param int $privelege The minimum access level to see the page.
  */
 function __construct($title, $body = "", $privilege = 1, $board = null)
 {
     parent::__construct($title, $body);
     $this->requiredLevel = $privilege;
     $this->board = $board;
     if ($this->user->getPrivilege() >= Site::LEVEL_SEARCH) {
         $this->addToHead("<script type='text/javascript'>\$(document).ready(function(){ImageHover.init('');});</script>");
     }
     if ($this->user->getPrivilege() >= Site::LEVEL_ADMIN) {
         $this->addToHead("<script type='text/javascript' src='/script/bstats-admin.js'></script>");
     }
     if ($this->user->getPrivilege() < $this->requiredLevel) {
         throw new PermissionException($this->user->getPrivilege(), $this->requiredLevel);
     }
     $navBarExtra = "";
     if ($this->user->getPrivilege() == 0) {
         //If not logged in, show login form.
         $navBarExtra .= Site::parseHtmlFragment("loginform.html");
     }
     if ($this->user->getPrivilege() > 0) {
         $navBarExtra .= Site::parseHtmlFragment('loginticker.html', ['%username%', '%privilege%', '<!-- more buttons -->'], [$this->user->getUsername(), $this->user->getPrivilege(), $this->renderExtraButtons()]);
     }
     $this->navbar->append($navBarExtra);
 }