@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | session_start(); |
73 | 73 | } |
74 | 74 | // Fix for phpunits |
75 | - if(!isset($_SESSION)) { |
|
75 | + if (!isset($_SESSION)) { |
|
76 | 76 | $_SESSION = []; |
77 | 77 | } |
78 | 78 | } |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | { |
133 | 133 | $saved = true; |
134 | 134 | try { |
135 | - $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: []; |
|
136 | - $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']); |
|
135 | + $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: []; |
|
136 | + $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']); |
|
137 | 137 | $admins[$user['username']]['profile'] = $user['profile']; |
138 | 138 | |
139 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true); |
|
140 | - } catch(\Exception $e) { |
|
139 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true); |
|
140 | + }catch (\Exception $e) { |
|
141 | 141 | Logger::log($e->getMessage(), LOG_ERR); |
142 | 142 | $saved = false; |
143 | 143 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function getAdmins() |
176 | 176 | { |
177 | - return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true); |
|
177 | + return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | if (!empty($user) && !empty($admins[$user])) { |
204 | 204 | $auth = $admins[$user]['hash']; |
205 | - $this->authorized = ($auth == sha1($user . $pass)); |
|
205 | + $this->authorized = ($auth == sha1($user.$pass)); |
|
206 | 206 | if ($this->authorized) { |
207 | 207 | $this->admin = array( |
208 | 208 | 'alias' => $user, |