From e66b8410a71c1d1551df2056915220d0d72175f7 Mon Sep 17 00:00:00 2001 From: ejikharev Date: Tue, 9 Dec 2008 10:36:55 +0000 Subject: [PATCH] git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@23 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/User.class.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/classes/User.class.php b/classes/User.class.php index 4f7d32e..2ed5d74 100644 --- a/classes/User.class.php +++ b/classes/User.class.php @@ -24,19 +24,18 @@ class User return false; } - if (!self::$user = self::getByLogin(strtolower($login)) ) { + self::setInfo(self::getByLogin(strtolower($login))); + if (!self::getInfo()) { return false; } if (stripslashes(self::$user->pass) != $password) { return false; } - - if (!self::isActive(self::$user->id)) { - return false; - } - self::setSession(); + self::setSession(); + Load::model('UserData')->loginUpdate($login); + return true; } @@ -54,6 +53,7 @@ class User { if (Env::getCookie(session_name())) { //есть сессия session_start(); + self::setInfo(Env::Session('user')); } elseif (Env::getCookie('login') && Env::getCookie('login_hash')) { self::remember(); } @@ -71,7 +71,9 @@ class User static function remember() { - if (! self::$user = self::getByLogin(Env::getCookie('login'))) { + self::setInfo(self::getByLogin(Env::getCookie('login'))); + + if (!self::getInfo()) { self::logout(); } @@ -91,6 +93,11 @@ class User { return Env::Session('user', self::$user); } + + static function setInfo($data) + { + self::$user = $data; + } static function isGuest() { @@ -102,9 +109,10 @@ class User return Load::model('UserData')->getByLogin($login); } - static function isActive($user_id) + static function getById($id) { - return Load::model('UserActivate')->isActive($user_id); + return Load::model('UserData')->getById($id); } + } ?> \ No newline at end of file