@@ -5,22 +5,22 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Variable { |
| 7 | 7 | |
| 8 | - protected $ip; |
|
| 9 | - protected $input; |
|
| 10 | - protected $dir; |
|
| 11 | - protected $path; |
|
| 12 | - protected $permission_code; |
|
| 8 | + protected $ip; |
|
| 9 | + protected $input; |
|
| 10 | + protected $dir; |
|
| 11 | + protected $path; |
|
| 12 | + protected $permission_code; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Initializing variable. |
|
| 16 | - * |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - protected function initVar(){ |
|
| 20 | - $this->ip = Request::ip(); |
|
| 21 | - $this->input = Request::input(config('irfa.lockout.input_name')); |
|
| 22 | - $this->dir = config('irfa.lockout.lockout_file_path'); |
|
| 23 | - $this->path = $this->dir.md5($this->input); |
|
| 24 | - } |
|
| 14 | + /** |
|
| 15 | + * Initializing variable. |
|
| 16 | + * |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + protected function initVar(){ |
|
| 20 | + $this->ip = Request::ip(); |
|
| 21 | + $this->input = Request::input(config('irfa.lockout.input_name')); |
|
| 22 | + $this->dir = config('irfa.lockout.lockout_file_path'); |
|
| 23 | + $this->path = $this->dir.md5($this->input); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - } |
|
| 27 | 26 | \ No newline at end of file |
| 27 | + } |
|
| 28 | 28 | \ No newline at end of file |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | - protected function initVar(){ |
|
| 19 | + protected function initVar() { |
|
| 20 | 20 | $this->ip = Request::ip(); |
| 21 | 21 | $this->input = Request::input(config('irfa.lockout.input_name')); |
| 22 | 22 | $this->dir = config('irfa.lockout.lockout_file_path'); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$ip],'last_attemps' => date("Y-m-d H:i:s",time())]; |
| 53 | 53 | File::put($this->path,json_encode($content)); |
| 54 | 54 | if(File::exists($this->path)){ |
| 55 | - chmod($this->path,0755); |
|
| 55 | + chmod($this->path,0755); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -81,31 +81,31 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Check if user is locked |
|
| 86 | - * |
|
| 87 | - * @param string $username |
|
| 88 | - * @return boolean |
|
| 89 | - */ |
|
| 84 | + /** |
|
| 85 | + * Check if user is locked |
|
| 86 | + * |
|
| 87 | + * @param string $username |
|
| 88 | + * @return boolean |
|
| 89 | + */ |
|
| 90 | 90 | protected function is_locked($username){ |
| 91 | 91 | |
| 92 | 92 | if(File::exists($this->path)) |
| 93 | 93 | { |
| 94 | - $get = json_decode(File::get($this->path)); |
|
| 95 | - if($get->attemps > $attemps || $get->attemps == "lock"){ |
|
| 96 | - return true; |
|
| 97 | - } else{ |
|
| 98 | - return false; |
|
| 99 | - } |
|
| 94 | + $get = json_decode(File::get($this->path)); |
|
| 95 | + if($get->attemps > $attemps || $get->attemps == "lock"){ |
|
| 96 | + return true; |
|
| 97 | + } else{ |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 100 | 100 | } else{ |
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Show message if failed x attemps |
|
| 107 | - * |
|
| 108 | - * @return string |
|
| 106 | + * Show message if failed x attemps |
|
| 107 | + * |
|
| 108 | + * @return string |
|
| 109 | 109 | */ |
| 110 | 110 | protected function showMessage(){ |
| 111 | 111 | if(Session::has(config('irfa.lockout.message_name'))){ |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * Check ip locked |
|
| 151 | - * |
|
| 152 | - * @return boolean |
|
| 153 | - */ |
|
| 149 | + /** |
|
| 150 | + * Check ip locked |
|
| 151 | + * |
|
| 152 | + * @return boolean |
|
| 153 | + */ |
|
| 154 | 154 | private function checkIp($ip_list,$ip){ |
| 155 | 155 | if(collect($ip_list)->contains($ip)){ |
| 156 | 156 | return true; |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * Clear all locked account |
|
| 165 | - * |
|
| 166 | - * @return boolean |
|
| 167 | - */ |
|
| 163 | + /** |
|
| 164 | + * Clear all locked account |
|
| 165 | + * |
|
| 166 | + * @return boolean |
|
| 167 | + */ |
|
| 168 | 168 | public function clear_all(){ |
| 169 | 169 | $file = new Filesystem(); |
| 170 | 170 | if($file->cleanDirectory($this->path)){ |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - /** |
|
| 178 | - * Unlocking account manually. |
|
| 179 | - * |
|
| 180 | - * @return boolean or json(if cli) |
|
| 181 | - */ |
|
| 177 | + /** |
|
| 178 | + * Unlocking account manually. |
|
| 179 | + * |
|
| 180 | + * @return boolean or json(if cli) |
|
| 181 | + */ |
|
| 182 | 182 | public function unlock_account($username){ |
| 183 | - if(File::exists($this->path)){ |
|
| 183 | + if(File::exists($this->path)){ |
|
| 184 | 184 | $readf = File::get($this->path); |
| 185 | 185 | File::delete($this->path); |
| 186 | 186 | if(php_sapi_name() == "cli"){ |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | - } |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * Check account with details |
@@ -207,58 +207,58 @@ discard block |
||
| 207 | 207 | * @return boolean |
| 208 | 208 | */ |
| 209 | 209 | public function check_account($username){ |
| 210 | - if(File::exists($this->path)){ |
|
| 211 | - $readf = File::get($this->path); |
|
| 212 | - if(php_sapi_name() == "cli"){ |
|
| 210 | + if(File::exists($this->path)){ |
|
| 211 | + $readf = File::get($this->path); |
|
| 212 | + if(php_sapi_name() == "cli"){ |
|
| 213 | 213 | |
| 214 | - return $readf; |
|
| 214 | + return $readf; |
|
| 215 | 215 | |
| 216 | - } else{ |
|
| 217 | - return $readf; |
|
| 218 | - } |
|
| 219 | - } else{ |
|
| 220 | - if(php_sapi_name() == "cli"){ |
|
| 221 | - echo Lang::get('lockoutMessage.user_lock_404')."\n"; |
|
| 222 | - exit(); |
|
| 223 | - } else{ |
|
| 224 | - return false; |
|
| 225 | - } |
|
| 226 | - } |
|
| 216 | + } else{ |
|
| 217 | + return $readf; |
|
| 218 | + } |
|
| 219 | + } else{ |
|
| 220 | + if(php_sapi_name() == "cli"){ |
|
| 221 | + echo Lang::get('lockoutMessage.user_lock_404')."\n"; |
|
| 222 | + exit(); |
|
| 223 | + } else{ |
|
| 224 | + return false; |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * Locking account manually |
|
| 231 | - * |
|
| 232 | - * @param string $username |
|
| 233 | - * @return boolean |
|
| 234 | - */ |
|
| 229 | + /** |
|
| 230 | + * Locking account manually |
|
| 231 | + * |
|
| 232 | + * @param string $username |
|
| 233 | + * @return boolean |
|
| 234 | + */ |
|
| 235 | 235 | public function lock_account($username){ |
| 236 | 236 | $sapi = php_sapi_name() == "cli"?"lock-via-cli":"lock-via-web"; |
| 237 | 237 | |
| 238 | 238 | try{ |
| 239 | - if(!File::exists($this->dir)){ |
|
| 240 | - File::makeDirectory($this->dir, 0755, true); |
|
| 241 | - } |
|
| 242 | - $login_fail = "lock"; |
|
| 239 | + if(!File::exists($this->dir)){ |
|
| 240 | + File::makeDirectory($this->dir, 0755, true); |
|
| 241 | + } |
|
| 242 | + $login_fail = "lock"; |
|
| 243 | 243 | |
| 244 | - $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$sapi],'last_attemps' => date("Y-m-d H:i:s",time())]; |
|
| 245 | - File::put($this->path,json_encode($content)); |
|
| 246 | - if(File::exists($this->path)){ |
|
| 244 | + $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$sapi],'last_attemps' => date("Y-m-d H:i:s",time())]; |
|
| 245 | + File::put($this->path,json_encode($content)); |
|
| 246 | + if(File::exists($this->path)){ |
|
| 247 | 247 | chmod($this->path,0755); |
| 248 | - } |
|
| 249 | - if(php_sapi_name() == "cli"){ |
|
| 248 | + } |
|
| 249 | + if(php_sapi_name() == "cli"){ |
|
| 250 | 250 | return Lang::get('lockoutMessage.user_lock_success')."\n"; |
| 251 | 251 | |
| 252 | - } else{ |
|
| 253 | - return true; |
|
| 254 | - } |
|
| 255 | - } catch(Exception $e){ |
|
| 256 | - if(php_sapi_name() == "cli"){ |
|
| 252 | + } else{ |
|
| 253 | + return true; |
|
| 254 | + } |
|
| 255 | + } catch(Exception $e){ |
|
| 256 | + if(php_sapi_name() == "cli"){ |
|
| 257 | 257 | return "error"; |
| 258 | 258 | |
| 259 | - } else{ |
|
| 259 | + } else{ |
|
| 260 | 260 | return false; |
| 261 | - } |
|
| 262 | - } |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | namespace Irfa\Lockout\Func; |
| 3 | 3 | |
| 4 | 4 | use Log; |
| 5 | -use Illuminate\Support\Facades\Request,File,Lang,Session; |
|
| 5 | +use Illuminate\Support\Facades\Request, File, Lang, Session; |
|
| 6 | 6 | use Illuminate\Filesystem\Filesystem; |
| 7 | 7 | use Symfony\Component\Console\Helper\Table; |
| 8 | 8 | use Irfa\Lockout\Initializing\Variable; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | - public function __construct(){ |
|
| 19 | + public function __construct() { |
|
| 20 | 20 | $this->initVar(); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -25,34 +25,34 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - protected function eventFailedLogin(){ |
|
| 28 | + protected function eventFailedLogin() { |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - if(!File::exists($this->dir)){ |
|
| 31 | + if (!File::exists($this->dir)) { |
|
| 32 | 32 | File::makeDirectory($this->dir, 0755, true); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(!File::exists($this->path)) |
|
| 35 | + if (!File::exists($this->path)) |
|
| 36 | 36 | { |
| 37 | 37 | $login_fail = 1; |
| 38 | - } else{ |
|
| 38 | + } else { |
|
| 39 | 39 | |
| 40 | 40 | $get = json_decode(File::get($this->path)); |
| 41 | 41 | $ip_list = $get->ip; |
| 42 | - if(!$this->checkIp($ip_list,$this->ip)){ |
|
| 43 | - array_push($ip_list,$this->ip); |
|
| 42 | + if (!$this->checkIp($ip_list, $this->ip)) { |
|
| 43 | + array_push($ip_list, $this->ip); |
|
| 44 | 44 | } |
| 45 | - if($get->attemps == "lock"){ |
|
| 45 | + if ($get->attemps == "lock") { |
|
| 46 | 46 | $login_fail = "lock"; |
| 47 | - } else{ |
|
| 47 | + } else { |
|
| 48 | 48 | $login_fail = $get->attemps+1; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$ip],'last_attemps' => date("Y-m-d H:i:s",time())]; |
|
| 53 | - File::put($this->path,json_encode($content)); |
|
| 54 | - if(File::exists($this->path)){ |
|
| 55 | - chmod($this->path,0755); |
|
| 52 | + $content = ['username' => $this->input, 'attemps' => $login_fail, 'ip' => isset($ip_list) ? $ip_list : [$ip], 'last_attemps' => date("Y-m-d H:i:s", time())]; |
|
| 53 | + File::put($this->path, json_encode($content)); |
|
| 54 | + if (File::exists($this->path)) { |
|
| 55 | + chmod($this->path, 0755); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $rootNamespace |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - protected function eventCleanLockoutAccount(){ |
|
| 66 | + protected function eventCleanLockoutAccount() { |
|
| 67 | 67 | $this->unlock_account($this->input); |
| 68 | 68 | |
| 69 | 69 | } |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @param string $middleware |
| 76 | 76 | * @return void |
| 77 | 77 | */ |
| 78 | - protected function logging($middleware="WEB"){ |
|
| 79 | - if(config('irfa.lockout.logging')){ |
|
| 78 | + protected function logging($middleware = "WEB") { |
|
| 79 | + if (config('irfa.lockout.logging')) { |
|
| 80 | 80 | Log::notice($middleware." | Login attemps fail | "."username : ".Request::input(config('irfa.lockout.input_name'))." | ipAddress : ".Request::ip()." | userAgent : ".$_SERVER['HTTP_USER_AGENT'].PHP_EOL); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | * @param string $username |
| 88 | 88 | * @return boolean |
| 89 | 89 | */ |
| 90 | - protected function is_locked($username){ |
|
| 90 | + protected function is_locked($username) { |
|
| 91 | 91 | |
| 92 | - if(File::exists($this->path)) |
|
| 92 | + if (File::exists($this->path)) |
|
| 93 | 93 | { |
| 94 | 94 | $get = json_decode(File::get($this->path)); |
| 95 | - if($get->attemps > $attemps || $get->attemps == "lock"){ |
|
| 95 | + if ($get->attemps > $attemps || $get->attemps == "lock") { |
|
| 96 | 96 | return true; |
| 97 | - } else{ |
|
| 97 | + } else { |
|
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | - } else{ |
|
| 100 | + } else { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - protected function showMessage(){ |
|
| 111 | - if(Session::has(config('irfa.lockout.message_name'))){ |
|
| 110 | + protected function showMessage() { |
|
| 111 | + if (Session::has(config('irfa.lockout.message_name'))) { |
|
| 112 | 112 | return Session::get(config('irfa.lockout.message_name')); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,28 +120,28 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return boolean |
| 122 | 122 | */ |
| 123 | - protected function lockLogin(){ |
|
| 123 | + protected function lockLogin() { |
|
| 124 | 124 | |
| 125 | - if(File::exists($this->path)) |
|
| 125 | + if (File::exists($this->path)) |
|
| 126 | 126 | { |
| 127 | 127 | $get = json_decode(File::get($this->path)); |
| 128 | - if($get->attemps == "lock"){ |
|
| 128 | + if ($get->attemps == "lock") { |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | - if($get->attemps > $attemps){ |
|
| 132 | - if($matchip){ |
|
| 133 | - if($this->checkIp($ip_list,$this->ip)){ |
|
| 131 | + if ($get->attemps > $attemps) { |
|
| 132 | + if ($matchip) { |
|
| 133 | + if ($this->checkIp($ip_list, $this->ip)) { |
|
| 134 | 134 | return true; |
| 135 | - } else{ |
|
| 135 | + } else { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | - } else{ |
|
| 138 | + } else { |
|
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | - } else{ |
|
| 141 | + } else { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | - } else{ |
|
| 144 | + } else { |
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @return boolean |
| 153 | 153 | */ |
| 154 | - private function checkIp($ip_list,$ip){ |
|
| 155 | - if(collect($ip_list)->contains($ip)){ |
|
| 154 | + private function checkIp($ip_list, $ip) { |
|
| 155 | + if (collect($ip_list)->contains($ip)) { |
|
| 156 | 156 | return true; |
| 157 | - } else{ |
|
| 157 | + } else { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return boolean |
| 167 | 167 | */ |
| 168 | - public function clear_all(){ |
|
| 168 | + public function clear_all() { |
|
| 169 | 169 | $file = new Filesystem(); |
| 170 | - if($file->cleanDirectory($this->path)){ |
|
| 170 | + if ($file->cleanDirectory($this->path)) { |
|
| 171 | 171 | return true; |
| 172 | - } else{ |
|
| 172 | + } else { |
|
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -179,22 +179,22 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @return boolean or json(if cli) |
| 181 | 181 | */ |
| 182 | - public function unlock_account($username){ |
|
| 183 | - if(File::exists($this->path)){ |
|
| 182 | + public function unlock_account($username) { |
|
| 183 | + if (File::exists($this->path)) { |
|
| 184 | 184 | $readf = File::get($this->path); |
| 185 | 185 | File::delete($this->path); |
| 186 | - if(php_sapi_name() == "cli"){ |
|
| 186 | + if (php_sapi_name() == "cli") { |
|
| 187 | 187 | echo Lang::get('lockoutMessage.user_unlock_success')."\n"; |
| 188 | 188 | return $readf; |
| 189 | 189 | |
| 190 | - } else{ |
|
| 190 | + } else { |
|
| 191 | 191 | return true; |
| 192 | 192 | } |
| 193 | - } else{ |
|
| 194 | - if(php_sapi_name() == "cli"){ |
|
| 193 | + } else { |
|
| 194 | + if (php_sapi_name() == "cli") { |
|
| 195 | 195 | echo Lang::get('lockoutMessage.user_lock_404')."\n"; |
| 196 | 196 | exit(); |
| 197 | - } else{ |
|
| 197 | + } else { |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -206,21 +206,21 @@ discard block |
||
| 206 | 206 | * @param string $username |
| 207 | 207 | * @return boolean |
| 208 | 208 | */ |
| 209 | - public function check_account($username){ |
|
| 210 | - if(File::exists($this->path)){ |
|
| 209 | + public function check_account($username) { |
|
| 210 | + if (File::exists($this->path)) { |
|
| 211 | 211 | $readf = File::get($this->path); |
| 212 | - if(php_sapi_name() == "cli"){ |
|
| 212 | + if (php_sapi_name() == "cli") { |
|
| 213 | 213 | |
| 214 | 214 | return $readf; |
| 215 | 215 | |
| 216 | - } else{ |
|
| 216 | + } else { |
|
| 217 | 217 | return $readf; |
| 218 | 218 | } |
| 219 | - } else{ |
|
| 220 | - if(php_sapi_name() == "cli"){ |
|
| 219 | + } else { |
|
| 220 | + if (php_sapi_name() == "cli") { |
|
| 221 | 221 | echo Lang::get('lockoutMessage.user_lock_404')."\n"; |
| 222 | 222 | exit(); |
| 223 | - } else{ |
|
| 223 | + } else { |
|
| 224 | 224 | return false; |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -232,31 +232,31 @@ discard block |
||
| 232 | 232 | * @param string $username |
| 233 | 233 | * @return boolean |
| 234 | 234 | */ |
| 235 | - public function lock_account($username){ |
|
| 236 | - $sapi = php_sapi_name() == "cli"?"lock-via-cli":"lock-via-web"; |
|
| 235 | + public function lock_account($username) { |
|
| 236 | + $sapi = php_sapi_name() == "cli" ? "lock-via-cli" : "lock-via-web"; |
|
| 237 | 237 | |
| 238 | - try{ |
|
| 239 | - if(!File::exists($this->dir)){ |
|
| 238 | + try { |
|
| 239 | + if (!File::exists($this->dir)) { |
|
| 240 | 240 | File::makeDirectory($this->dir, 0755, true); |
| 241 | 241 | } |
| 242 | 242 | $login_fail = "lock"; |
| 243 | 243 | |
| 244 | - $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$sapi],'last_attemps' => date("Y-m-d H:i:s",time())]; |
|
| 245 | - File::put($this->path,json_encode($content)); |
|
| 246 | - if(File::exists($this->path)){ |
|
| 247 | - chmod($this->path,0755); |
|
| 244 | + $content = ['username' => $this->input, 'attemps' => $login_fail, 'ip' => isset($ip_list) ? $ip_list : [$sapi], 'last_attemps' => date("Y-m-d H:i:s", time())]; |
|
| 245 | + File::put($this->path, json_encode($content)); |
|
| 246 | + if (File::exists($this->path)) { |
|
| 247 | + chmod($this->path, 0755); |
|
| 248 | 248 | } |
| 249 | - if(php_sapi_name() == "cli"){ |
|
| 249 | + if (php_sapi_name() == "cli") { |
|
| 250 | 250 | return Lang::get('lockoutMessage.user_lock_success')."\n"; |
| 251 | 251 | |
| 252 | - } else{ |
|
| 252 | + } else { |
|
| 253 | 253 | return true; |
| 254 | 254 | } |
| 255 | - } catch(Exception $e){ |
|
| 256 | - if(php_sapi_name() == "cli"){ |
|
| 255 | + } catch (Exception $e) { |
|
| 256 | + if (php_sapi_name() == "cli") { |
|
| 257 | 257 | return "error"; |
| 258 | 258 | |
| 259 | - } else{ |
|
| 259 | + } else { |
|
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | } |