/**
  * Carries out the specified action
  */
 function perform()
 {
     // initialize the view, but we first check if there is session information avaible
     // since in that case we will not make the user choose enter user and pass again, but
     // show the main menu page straight away
     if ($this->sessionInfoAvailable()) {
         AdminController::setForwardAction("emptyAction");
         // launch the event since we have all the info we need
         $pm =& PluginManager::getPluginManager();
         $pm->setBlogInfo($this->_blogInfo);
         $pm->setUserInfo($this->_userInfo);
         $pm->notifyEvent(EVENT_LOGIN_SUCCESS);
     } else {
         $this->_view = new AdminDefaultView();
     }
     // better to return true if everything fine
     return true;
 }
 /**
  * Carries out the specified action
  */
 function perform()
 {
     // we don't have to worry about much more here, we can let the
     // $this->_nextAction action take care of everytyhing now...
     // If $this->_nextAction is null, we use "newPost" as default nextAction
     $this->_nextAction = $this->_request->getValue("action");
     if ($this->_nextAction) {
         AdminController::setForwardAction($this->_nextAction);
     } else {
         AdminController::setForwardAction("newPost");
     }
     // better to return true if everything fine
     return true;
 }
 /**
  * Carries out the specified action
  */
 function perform()
 {
     // get the parameters, which have already been validated
     $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName"));
     $this->_userPassword = $this->_request->getValue("userPassword");
     $this->_op = Textfilter::filterAllHTML($this->_request->getValue("op"));
     // create a plugin manager
     $pm =& PluginManager::getPluginManager();
     // try to authenticate the user
     $users = new Users();
     if (!$users->authenticateUser($this->_userName, $this->_userPassword)) {
         $this->_view = new AdminDefaultView();
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password"));
         $this->setCommonData();
         $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName));
         return false;
     }
     // if the user is correct, get and put his or her information in the session
     $userInfo = $users->getUserInfo($this->_userName, $this->_userPassword);
     if (!$userInfo) {
         $this->_view = new AdminDefaultView();
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password"));
         $this->setCommonData();
         $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName));
         return false;
     }
     $pm->notifyEvent(EVENT_USER_LOADED, array("user" => &$userInfo, "from" => "Login"));
     //$sessionInfo = $_SESSION["SessionInfo"];
     $session = HttpVars::getSession();
     $sessionInfo = $session["SessionInfo"];
     $sessionInfo->setValue("userInfo", $userInfo);
     $session["SessionInfo"] = $sessionInfo;
     HttpVars::setSession($session);
     // get the list of blogs to which the user belongs
     $userBlogs = $users->getUsersBlogs($userInfo->getId(), BLOG_STATUS_ACTIVE);
     // but if he or she does not belong to any yet, we quit
     if (empty($userBlogs)) {
         $this->_view = new AdminDefaultView();
         $this->_view->setErrorMessage($this->_locale->tr("error_dont_belong_to_any_blog"));
         $this->setCommonData();
         return false;
     }
     $pm->notifyEvent(EVENT_BLOGS_LOADED, array("blogs" => &$userBlogs, "from" => "Login"));
     // check if we are skipping the dashboard
     if ($this->_config->getValue("skip_dashboard")) {
         // get the first blog that came
         $this->_blogInfo = end($userBlogs);
         // set it in the session
         $session = HttpVars::getSession();
         $session["SessionInfo"]->setValue("blogInfo", $this->_blogInfo);
         HttpVars::setSession($session);
         // and then continue...
         AdminController::setForwardAction("newPost");
     } else {
         $this->_view = new AdminDashboardView($userInfo, $userBlogs);
     }
     // better to return true if everything's fine
     return true;
 }