From 75b096c6b202fe5fec9a3ef2a4cf949343e85b5b Mon Sep 17 00:00:00 2001 From: pzinovkin Date: Sun, 26 Apr 2009 20:15:02 +0000 Subject: [PATCH] removed nakon related stuff git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/legacy@78 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Env.class.php | 16 ----- classes/User.class.php | 166 ------------------------------------------------- 2 files changed, 182 deletions(-) delete mode 100644 classes/User.class.php diff --git a/classes/Env.class.php b/classes/Env.class.php index b3104ab..f9d8a9b 100644 --- a/classes/Env.class.php +++ b/classes/Env.class.php @@ -87,21 +87,5 @@ final class Env $res = isset($_FILES[$name]) ? $_FILES[$name] : $default; return $param ? $res[$param] : $res; } - - /** - * Получить цену ставки - * - * @param integer $dis - некое число от кооторого считается скидка - */ - static public function getBidCost($dis = 0) - { - $settings_model = new SettingsModel(); - $cost = $settings_model->get('bid_base_price'); - if ($dis > 0 && $dis <= 100) { - return $cost - intval($dis); - } - - return $cost; - } } ?> \ No newline at end of file diff --git a/classes/User.class.php b/classes/User.class.php deleted file mode 100644 index 687204d..0000000 --- a/classes/User.class.php +++ /dev/null @@ -1,166 +0,0 @@ -isBanned()) { - return false; - } - - if(self::$user->pass != $password){ - return false; - } - - self::setSession(); - $model = new UserDataModel(); - $model->loginUpdate($login); - - return true; - } - - static function logout() - { - Env::setCookie(session_name(), '', 0); - Env::setCookie('login', '', 0); - Env::setCookie('login_hash', '', 0); - Env::setCookie('login_ipbhash', '', 0); - if (session_id()) { - session_destroy(); - } - } - - static function process() - { - if (Env::getCookie(session_name())) { //есть сессия - @session_start(); - self::setInfo(Env::Session('user')); - } elseif (Env::getCookie('login') && Env::getCookie('login_hash')) { - self::remember(); - } - } - - static function setSession() - { - $hash = self::getHash(); - Env::setCookie('login', self::$user->login, 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['user'] = self::$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 { - self::logout(); - } - } - - static function getHash() - { - 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() - { - return Env::Session('user', self::$user); - } - - static function setInfo($data) - { - self::$user = $data; - } - - static function isGuest() - { - return ! (bool) Env::Session('user'); - } - - static function getByLogin($login) - { - $model = new UserDataModel(); - return $model->getByLogin($login); - } - - static function getById($id) - { - $model = new UserDataModel(); - 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); - } -} -?> \ No newline at end of file