From b5db27307f7b45f27c6114510490a7d958f19e5b Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 10 Dec 2021 23:16:15 +0300 Subject: [PATCH] =?UTF-8?q?[*]=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- add_cron.php | 2 +- ajax/changeRelayState.php | 4 ++-- ajax/getDallasData.php | 4 ++-- ajax/getRelayState.php | 4 ++-- ajax/keepAlive.php | 2 +- boardinfo.php | 2 +- boardlist.php | 2 +- cron.php | 2 +- edit_cron.php | 2 +- editprofile.php | 2 +- events.php | 2 +- inc/bootstrap.php | 2 +- inc/header.php | 4 ++-- inc/lib/CUser.class.php | 18 +++++++++--------- login.php | 4 ++-- login_as.php | 4 ++-- logout.php | 2 +- php_cmd.php | 2 +- register.php | 8 ++++---- sql.php | 2 +- test.php | 2 +- test2.php | 2 +- users.php | 4 ++-- 23 files changed, 41 insertions(+), 41 deletions(-) diff --git a/add_cron.php b/add_cron.php index cc597f7..7bd83b7 100644 --- a/add_cron.php +++ b/add_cron.php @@ -1,6 +1,6 @@ 'fail', 'error' => '403 - Access denied']; } else { $result = ['status' => 'ok']; diff --git a/boardinfo.php b/boardinfo.php index bfa183d..ea26f58 100644 --- a/boardinfo.php +++ b/boardinfo.php @@ -5,7 +5,7 @@ header("Location: index.php?"); die(); } $deviceId = prepareString($_REQUEST['id']); - if(!isHaveAccessToDevice($deviceId, $USER['id']) and !CUser::is_admin()) { + if(!isHaveAccessToDevice($deviceId, $USER['id']) and !CUser::isAdmin()) { die('403 - Access denied'); } diff --git a/boardlist.php b/boardlist.php index fc16cbb..072f0a0 100644 --- a/boardlist.php +++ b/boardlist.php @@ -1,6 +1,6 @@ Компоненты - + diff --git a/inc/lib/CUser.class.php b/inc/lib/CUser.class.php index 41b6405..2e08758 100644 --- a/inc/lib/CUser.class.php +++ b/inc/lib/CUser.class.php @@ -121,7 +121,7 @@ class CUser { * @param string $name * @param string $image */ - public static function Registration($login, $password, $email, $level = 'user', $name = '', $image = ''):void { + public static function registration($login, $password, $email, $level = 'user', $name = '', $image = ''):void { self::$DB->addItem(self::$table, array('login' => $login, 'password' => $password, 'access_level' => $level, 'name' => $name,'image' => $image, 'email' => $email, 'last_active' => time())); $result = self::$DB->getItem(self::$table, array('login'=>$login, 'password' => $password)); @@ -142,7 +142,7 @@ class CUser { * * @return bool */ - public static function user_exists($login):bool{ + public static function isUserExists($login):bool{ $result = self::$DB->getItem(self::$table, array('login'=>$login)); if($result) { @@ -157,7 +157,7 @@ class CUser { * * @return int */ - public static function count_users():int{ + public static function countUsers():int{ $result = self::$DB->getItems(self::$table, array('id'=>'>0')); if($result) { @@ -174,7 +174,7 @@ class CUser { * * @return bool */ - public static function Authorize($id):bool{ + public static function authorize($id):bool{ $result = self::$DB->getItem(self::$table, array('id'=>$id), true); if($result) { @@ -198,7 +198,7 @@ class CUser { * * @return bool */ - public static function SecurityAuthorize($login, $password):bool{ + public static function securityAuthorize($login, $password):bool{ $result = self::$DB->getItem(self::$table, array('login'=>$login, 'password' => $password), true); if($result) { @@ -219,7 +219,7 @@ class CUser { * * @return bool */ - public static function is_user():bool { + public static function isUser():bool { if(!isset($_SESSION['authorize']) or empty($_SESSION['authorize']) or $_SESSION['authorize'] !== 'Y') { return false; } @@ -244,8 +244,8 @@ class CUser { * * @return bool */ - public static function is_admin():bool { - if(self::is_user()) { + public static function isAdmin():bool { + if(self::isUser()) { if(self::getFields(self::$id)['access_level'] == 'admin') { return true; } else { @@ -259,7 +259,7 @@ class CUser { /** * Метод выхода из системы */ - public static function Logout():void { + public static function logout():void { $_SESSION['id'] = ''; $_SESSION['authorize'] = ''; $_SESSION['login'] = ''; diff --git a/login.php b/login.php index 300b41a..c5212ac 100644 --- a/login.php +++ b/login.php @@ -8,12 +8,12 @@ */ require_once __DIR__ . '/inc/bootstrap.php'; -if(CUser::is_user()) { +if(CUser::isUser()) { $auth = true; } else { $auth = false; if($_REQUEST['login']!=='' and $_REQUEST['pass']!=='' and !empty($_REQUEST['login'] and !empty($_REQUEST['pass']))){ - if(CUser::SecurityAuthorize($_REQUEST['login'], $_REQUEST['pass'])) { + if(CUser::securityAuthorize($_REQUEST['login'], $_REQUEST['pass'])) { $auth = true; } else { $auth = false; diff --git a/login_as.php b/login_as.php index 9407a6f..662f1a4 100644 --- a/login_as.php +++ b/login_as.php @@ -9,9 +9,9 @@ } $id = prepareString($_REQUEST['id']); - CUser::Logout(); + CUser::logout(); session_start(); //TODO: нужно будет убрать при корректировке метода Logout - CUser::Authorize($id); + CUser::authorize($id); header("Location: index.php"); die(); \ No newline at end of file diff --git a/logout.php b/logout.php index 29a1a4c..370ca31 100644 --- a/logout.php +++ b/logout.php @@ -7,5 +7,5 @@ * Сайт: https://it-stories.ru */ require_once __DIR__ . '/inc/bootstrap.php'; -CUser::Logout(); +CUser::logout(); header("Location: index.php"); \ No newline at end of file diff --git a/php_cmd.php b/php_cmd.php index 817045d..e472446 100644 --- a/php_cmd.php +++ b/php_cmd.php @@ -1,6 +1,6 @@ '.$_REQUEST['login'].'', 'info', 'reguser'); header("Location: index.php"); die(); diff --git a/sql.php b/sql.php index 643860d..f29267c 100644 --- a/sql.php +++ b/sql.php @@ -1,6 +1,6 @@