Example #1
0
 /**
  * Index action.
  *
  * @return Bengine_Comm_Controller_Index
  */
 public function indexAction()
 {
     Hook::event("CommIndexStart", array($this));
     $this->assign("errorMsg", Core::getRequest()->getGET("error"));
     if ($this->isPost()) {
         $encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
         $login = new Bengine_Game_Login($this->getParam("username"), $this->getParam("password"), "game", $encryption);
         $login->setRedirectOnFailure(false)->checkData();
         if ($login->getCanLogin()) {
             Hook::event("PreLogin", array($login));
             $login->startSession();
             Hook::event("PostLogin", array($login));
         } else {
             $this->assign("errorMsg", $login->getErrors()->getFirst());
         }
     }
     if ($this->errorMsg != "") {
         Core::getLang()->load("error");
         $this->assign("errorMsg", Core::getLang()->get($this->errorMsg));
     }
     $this->assign("page", Core::getLang()->getItem("LOGIN"));
     if ($cmsPage = Comm::getCMS()->getPage("index")) {
         $this->assign("page", $cmsPage["title"]);
         $this->assign("content", $cmsPage["content"]);
         $this->setTemplate("cms_page");
     } else {
         $this->assign("showDefaultContent", true);
     }
     Hook::event("CommIndexEnd", array($this));
     return $this;
 }