|
@ -2,7 +2,7 @@ |
|
|
/** |
|
|
/** |
|
|
* Класс для работы с пользователями |
|
|
* Класс для работы с пользователями |
|
|
* |
|
|
* |
|
|
* @copyright |
|
|
|
|
|
|
|
|
* @copyright netmonsters.ru |
|
|
* @link |
|
|
* @link |
|
|
* @package Majestic |
|
|
* @package Majestic |
|
|
* @subpackage Decorator |
|
|
* @subpackage Decorator |
|
@ -25,7 +25,7 @@ class User |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
self::setInfo(self::getByLogin($login)); |
|
|
self::setInfo(self::getByLogin($login)); |
|
|
if (!self::getInfo() || self::$user->isBanned()) { |
|
|
|
|
|
|
|
|
if (!self::getInfo()) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -34,8 +34,6 @@ class User |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
self::setSession(); |
|
|
self::setSession(); |
|
|
$model = new UserDataModel(); |
|
|
|
|
|
$model->loginUpdate($login); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -45,7 +43,6 @@ class User |
|
|
Env::setCookie(session_name(), '', 0); |
|
|
Env::setCookie(session_name(), '', 0); |
|
|
Env::setCookie('login', '', 0); |
|
|
Env::setCookie('login', '', 0); |
|
|
Env::setCookie('login_hash', '', 0); |
|
|
Env::setCookie('login_hash', '', 0); |
|
|
Env::setCookie('login_ipbhash', '', 0); |
|
|
|
|
|
if (session_id()) { |
|
|
if (session_id()) { |
|
|
session_destroy(); |
|
|
session_destroy(); |
|
|
} |
|
|
} |
|
@ -66,7 +63,6 @@ class User |
|
|
$hash = self::getHash(); |
|
|
$hash = self::getHash(); |
|
|
Env::setCookie('login', self::$user->login, TIME_NOW + LOGIN_COOKIE_TTL); |
|
|
Env::setCookie('login', self::$user->login, TIME_NOW + LOGIN_COOKIE_TTL); |
|
|
Env::setCookie('login_hash', $hash, TIME_NOW + LOGIN_COOKIE_TTL); |
|
|
Env::setCookie('login_hash', $hash, TIME_NOW + LOGIN_COOKIE_TTL); |
|
|
Env::setCookie('login_ipbhash', self::getIPBHash($hash), TIME_NOW + LOGIN_COOKIE_TTL); |
|
|
|
|
|
|
|
|
|
|
|
@session_start(); |
|
|
@session_start(); |
|
|
|
|
|
|
|
@ -93,15 +89,6 @@ class User |
|
|
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai'); |
|
|
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Создает хеш для проверки хеша в в IPB |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
static public function getIPBHash($hash) |
|
|
|
|
|
{ |
|
|
|
|
|
return md5($hash . strtolower(self::$user->login) . 'brainfuck'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static function getInfo() |
|
|
static function getInfo() |
|
|
{ |
|
|
{ |
|
|
return Env::Session('user', self::$user); |
|
|
return Env::Session('user', self::$user); |
|
@ -128,39 +115,5 @@ class User |
|
|
$model = new UserDataModel(); |
|
|
$model = new UserDataModel(); |
|
|
return $model->getById($id); |
|
|
return $model->getById($id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* отправляет письмо для активации |
|
|
|
|
|
* |
|
|
|
|
|
* @param string $mail |
|
|
|
|
|
* @param string $login |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
static function sendActivateMail($mail, $login) |
|
|
|
|
|
{ |
|
|
|
|
|
$settings = Env::getParam('site_settings'); |
|
|
|
|
|
$model = new UserActivateModel(); |
|
|
|
|
|
$link = 'http://' . $settings['host_name'] . '/activate/?key=' . $model->generateKey($login, $mail); |
|
|
|
|
|
|
|
|
|
|
|
$text = new SettingsTextModel(); |
|
|
|
|
|
$message = $text->getText('mail_activate'); |
|
|
|
|
|
|
|
|
|
|
|
$replaces = array( |
|
|
|
|
|
'link' => $link, |
|
|
|
|
|
'host' => $settings['site_url'], |
|
|
|
|
|
'email' => $mail, |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!$message) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($replaces as $key => $val) { |
|
|
|
|
|
$message->text = str_replace('%' . $key . '%', $val, $message->text); |
|
|
|
|
|
} |
|
|
|
|
|
$mailer = new Mailer(); |
|
|
|
|
|
return $mailer->sendMessage($mail, 'Подтверждение E-mail ' . $settings['host_name'], $message->text); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
?>
|
|
|
?>
|