/**
  * returns a list of the last logins
  *
  * @return string
  * @autoTestable
  * @permissions right1
  */
 protected function actionLoginLog()
 {
     $strReturn = "";
     //fetch log-rows
     $objLogbook = new class_module_user_log();
     $objIterator = new class_array_section_iterator($objLogbook->getLoginLogsCount());
     $objIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objIterator->setArraySection(class_module_user_log::getLoginLogs($objIterator->calculateStartPos(), $objIterator->calculateEndPos()));
     $arrRows = array();
     foreach ($objIterator as $arrLogRow) {
         $arrSingleRow = array();
         $arrSingleRow[] = $arrLogRow["user_log_sessid"];
         $arrSingleRow[] = $arrLogRow["user_username"] != "" ? $arrLogRow["user_username"] : $arrLogRow["user_log_userid"];
         $arrSingleRow[] = dateToString(new class_date($arrLogRow["user_log_date"]));
         $arrSingleRow[] = $arrLogRow["user_log_enddate"] != "" ? dateToString(new class_date($arrLogRow["user_log_enddate"])) : "";
         $arrSingleRow[] = $arrLogRow["user_log_status"] == 0 ? $this->getLang("login_status_0") : $this->getLang("login_status_1");
         $arrSingleRow[] = $arrLogRow["user_log_ip"];
         $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrLogRow["user_log_ip"] . "\" target=\"_blank\"";
         $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrLogRow["user_log_ip"] . "\" target=\"_blank\"";
         if ($arrLogRow["user_log_ip"] != "127.0.0.1" && $arrLogRow["user_log_ip"] != "::1") {
             $arrSingleRow[] = $this->objToolkit->listButton(class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->getLang("login_utrace_showmap"), "icon_earth")) . " " . $this->objToolkit->listButton(class_link::getLinkAdminManual($strUtraceLinkText, "", $this->getLang("login_utrace_showtext"), "icon_text"));
         } else {
             $arrSingleRow[] = $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_earthDisabled", $this->getLang("login_utrace_noinfo"))) . " " . $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_textDisabled", $this->getLang("login_utrace_noinfo")));
         }
         $arrRows[] = $arrSingleRow;
     }
     //Building the surrounding table
     $arrHeader = array();
     $arrHeader[] = $this->getLang("login_sessid");
     $arrHeader[] = $this->getLang("login_user");
     $arrHeader[] = $this->getLang("login_logindate");
     $arrHeader[] = $this->getLang("login_logoutdate");
     $arrHeader[] = $this->getLang("login_status");
     $arrHeader[] = $this->getLang("login_ip");
     $arrHeader[] = $this->getLang("login_utrace");
     //and fetch the table
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrRows);
     $strReturn .= $this->objToolkit->getPageview($objIterator, "user", "loginlog");
     return $strReturn;
 }
Exemplo n.º 2
0
 /**
  * Logs a user off from the system
  * @return void
  */
 public function logout()
 {
     class_logger::getInstance()->addLogRow("User: "******" successfully logged out", class_logger::$levelInfo);
     class_module_user_log::registerLogout();
     class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_USERLOGOUT, array($this->getUserID()));
     $this->getObjInternalSession()->setStrLoginstatus(class_module_system_session::$LOGINSTATUS_LOGGEDOUT);
     $this->getObjInternalSession()->updateObjectToDb();
     $this->getObjInternalSession()->deleteObjectFromDatabase();
     $this->objInternalSession = null;
     $this->objUser = null;
     if (isset($_COOKIE[session_name()])) {
         setcookie(session_name(), '', time() - 42000);
     }
     // Finally, destroy the session.
     session_destroy();
     //start a new one
     $this->sessionStart();
     //and create a new sessid
     @session_regenerate_id();
     $this->initInternalSession();
     return;
 }