コード例 #1
0
 /**
  * Initialize the settings controller; redirect if the user isn't logged in.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (!ET::$session->userId) {
         $this->redirect(URL(""));
     }
 }
コード例 #2
0
 /**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'><i class='icon-dashboard'></i> " . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'><i class='icon-cog'></i> " . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'><i class='icon-eye-open'></i> " . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'><i class='icon-tags'></i> " . T("Channels") . "</a>");
     $this->defaultMenu->add("members", "<a href='" . URL("members") . "'><i class='icon-group'></i> " . T("Members") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'><i class='icon-puzzle-piece'></i> " . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     // If new registrations require admin approval, add the 'unapproved' admin page with a count.
     if (C("esoTalk.registration.requireConfirmation") == "approval") {
         $count = ET::SQL()->select("COUNT(1)")->from("member")->where("confirmed", 0)->exec()->result();
         $this->menu->add("unapproved", "<a href='" . URL("admin/unapproved") . "'><i class='icon-lock'></i> " . T("Unapproved") . " <span class='badge'>" . $count . "</span></a>");
     }
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->pushNavigation("admin", "administration", URL($this->selfURL));
     }
     $this->addJSFile("core/js/admin.js");
     $this->addCSSFile("core/skin/admin.css");
     $this->trigger("initAdmin", array($this->menu, $this->defaultMenu));
 }
コード例 #3
0
 /**
  * Initialize the settings controller; redirect if the user isn't logged in.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (!ET::$session->userId) {
         if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
             $this->redirect(URL(""));
         } else {
             exit;
         }
     }
 }
コード例 #4
0
 /**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'>" . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'>" . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'>" . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'>" . T("Channels") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'>" . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     $this->addJSFile("js/admin.js");
     $this->addCSSFile("skins/base/admin.css");
 }