|
|
@ -2,11 +2,11 @@ |
|
|
|
/** |
|
|
|
* Класс для работы с пользователями |
|
|
|
* |
|
|
|
* @copyright |
|
|
|
* @link |
|
|
|
* @copyright |
|
|
|
* @link |
|
|
|
* @package Majestic |
|
|
|
* @subpackage Decorator |
|
|
|
* @since |
|
|
|
* @since |
|
|
|
* @version SVN: $Id$ |
|
|
|
* @filesource $URL$ |
|
|
|
*/ |
|
|
@ -19,23 +19,23 @@ class User |
|
|
|
if (empty($login) || empty($password)) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!preg_match("/^[a-z0-9_-]{3,50}$/i", $login)) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
self::setInfo(self::getByLogin(strtolower($login))); |
|
|
|
if (!self::getInfo()) { |
|
|
|
if (!self::getInfo() || self::$user->isBanned()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if(self::$user->pass != $password){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self::setSession(); |
|
|
|
Load::model('UserData')->loginUpdate($login); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -72,11 +72,11 @@ class User |
|
|
|
static function remember() |
|
|
|
{ |
|
|
|
self::setInfo(self::getByLogin(Env::getCookie('login'))); |
|
|
|
|
|
|
|
|
|
|
|
if (!self::getInfo()) { |
|
|
|
self::logout(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (Env::getCookie('login_hash') == self::getHash()) { |
|
|
|
self::setSession(); |
|
|
|
} else { |
|
|
@ -88,12 +88,12 @@ class User |
|
|
|
{ |
|
|
|
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static function getInfo() |
|
|
|
{ |
|
|
|
return Env::Session('user', self::$user); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static function setInfo($data) |
|
|
|
{ |
|
|
|
self::$user = $data; |
|
|
@ -108,27 +108,27 @@ class User |
|
|
|
{ |
|
|
|
return Load::model('UserData')->getByLogin($login); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static function getById($id) |
|
|
|
{ |
|
|
|
return Load::model('UserData')->getById($id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* отправляет письмо для активации |
|
|
|
* |
|
|
|
* |
|
|
|
* @param string $mail |
|
|
|
* @param string $login |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
static function sendActivateMail($mail, $login) |
|
|
|
static function sendActivateMail($mail, $login) |
|
|
|
{ |
|
|
|
$link = 'http://'.Env::Server('SERVER_NAME').'/activate/?key='.Load::model('UserActivate')->generateKey($login, $mail); |
|
|
|
|
|
|
|
|
|
|
|
$mailer = new Mailer('UserRegister'); |
|
|
|
return $mailer->send($mail, "Подтверждени E-mail ".Env::Server('SERVER_NAME'), array('link' => $link, 'site_name' => Env::Server('SERVER_NAME'))); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
?>
|