Passed
Push — master ( 8d229b...ad0e9b )
by IRFA
04:33
created
src/Initializing/Variable.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Func/Core.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.