diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..35f8288 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/config.php diff --git a/app/classes/BaseController.php b/app/classes/BaseController.php index b189451..b7c6cbf 100644 --- a/app/classes/BaseController.php +++ b/app/classes/BaseController.php @@ -67,7 +67,7 @@ public function onBefore() { //if auth is disabled if ($server && !$server->mongoAuth() && !$server->controlAuth()) { - MUser::login("rockmongo_memo", "rockmongo_memo", xi("host"), "admin", 10800); + MUser::login("rockmongo_memo", "rockmongo_memo", xi("host"), "admin"); $this->_admin = MUser::userInSession(); } else { @@ -139,10 +139,10 @@ protected function _convertValue($mongodb, $dataType, $format, $value, $integerV case "long": if (class_exists("MongoInt64")) { $realValue = new MongoInt64($longValue); - } + } else { $realValue = $longValue; - } + } break; case "float": case "double": diff --git a/app/controllers/login.php b/app/controllers/login.php index b0d047e..7e9eef0 100644 --- a/app/controllers/login.php +++ b/app/controllers/login.php @@ -21,10 +21,6 @@ public function doIndex() { $this->db = trim(xn("db")); $this->hostIndex = xi("host"); $this->languages = rock_load_languages(); - $this->expires = array( - 3 => "3 " . rock_lang("hours"), - 720 => "1 " . rock_lang("month"), - ); $this->moreOptions = xi("more"); if ($this->isPost()) { @@ -44,7 +40,7 @@ public function doIndex() { //remember user import("models.MUser"); - MUser::login($this->username, $password, $this->hostIndex, $this->db, xi("expire") * 3600); + MUser::login($this->username, $password, $this->hostIndex, $this->db); //remember lang setcookie("ROCK_LANG", x("lang"), time() + 365 * 86400); diff --git a/app/models/MUser.php b/app/models/MUser.php index 5089af8..a293a8b 100644 --- a/app/models/MUser.php +++ b/app/models/MUser.php @@ -5,7 +5,6 @@ class MUser { private $_password; private $_hostIndex; private $_db; - private $_timeout; public function __construct() { @@ -63,10 +62,6 @@ public function dbs() { return preg_split("/\\s*,\\s*/", $this->_db); } - public function setTimeout($timeout) { - $this->_timeout = $timeout; - } - /** * Validate User * @@ -90,14 +85,13 @@ public function changeHost($hostIndex) { $_SESSION["login"]["index"] = $hostIndex; } - public static function login($username, $password, $hostIndex, $db, $timeout) { + public static function login($username, $password, $hostIndex, $db) { $_SESSION["login"] = array( "username" => $username, "password" => $password, "index" => $hostIndex, "db" => $db ); - setcookie(session_name(), session_id(), time() + $timeout); } /** diff --git a/config.php b/config.php deleted file mode 100644 index 5dd3a9f..0000000 --- a/config.php +++ /dev/null @@ -1,55 +0,0 @@ - \ No newline at end of file diff --git a/config.sample.php b/config.sample.php index 5dd3a9f..3e8e973 100644 --- a/config.sample.php +++ b/config.sample.php @@ -5,7 +5,19 @@ * Defining default options and server configuration * @package rockmongo */ - + +// session store configurating + +// Timeuot of session in seconds +ini_set('session.gc_maxlifetime', 60*60*3); //3 hours + +// this defines, where session files will be stored. +// it is important in this case: http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime +$currentSessionPath = ini_get('session.save_path'); +$save_path = $currentSessionPath . DIRECTORY_SEPARATOR . 'rockmongo'; +if (!is_dir($save_path)) mkdir($save_path, 0777, true); +ini_set('session.save_path', $save_path); + $MONGO = array(); $MONGO["features"]["log_query"] = "on";//log queries $MONGO["features"]["theme"] = "default";//theme diff --git a/themes/default/views/header.php b/themes/default/views/header.php index e480fac..3a5e884 100644 --- a/themes/default/views/header.php +++ b/themes/default/views/header.php @@ -6,6 +6,7 @@ +