Passed
Push — master ( b43194...ce05c1 )
by Ferry
04:20
created
src/controllers/AuthSuspend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
     {
29 29
         $key = md5(request()->ip().request()->userAgent());
30 30
 
31
-        if(Cache::has("loginSuspended".$key)) {
31
+        if (Cache::has("loginSuspended".$key)) {
32 32
             return true;
33 33
         }
34 34
 
35
-        if(getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
35
+        if (getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
36 36
             Cache::put("loginSuspended".$key, true, 30);
37 37
             $this->clearSuspendAttempt();
38 38
             return true;
Please login to merge, or discard this patch.
src/controllers/DeveloperMiscellaneousController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
31 31
     {
32
-        foreach(request()->except("_token") as $key=>$val) {
33
-            putSetting( $key,  $val);
32
+        foreach (request()->except("_token") as $key=>$val) {
33
+            putSetting($key, $val);
34 34
         }
35 35
 
36
-        putSetting("enable_register",request("enable_register"));
36
+        putSetting("enable_register", request("enable_register"));
37 37
         putSetting("enable_forget", request("enable_forget"));
38 38
         putSetting("register_mail_verification", request("register_mail_verification"));
39 39
 
40
-        return cb()->redirectBack("Setting has been updated!","success");
40
+        return cb()->redirectBack("Setting has been updated!", "success");
41 41
     }
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/ForgetController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         try {
25 25
             cb()->validation(['email'=>'required|email']);
26 26
 
27
-            if($user = cb()->find("users",["email"=>request("email")])) {
27
+            if ($user = cb()->find("users", ["email"=>request("email")])) {
28 28
                 $token = Str::random(6);
29 29
                 $linkToken = cb()->getAdminUrl("continue-reset/".$token);
30 30
                 Cache::put("forget_".$token, $user->id, now()->addHours(12));
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
                 $mail = new MailHelper();
39 39
                 $mail->to($user->email);
40
-                $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName());
41
-                $mail->content("Please Confirm Your Forgot Password","
40
+                $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName());
41
+                $mail->content("Please Confirm Your Forgot Password", "
42 42
                     Hi $user->name,<br/><br>
43 43
                     Someone with the detail bellow: <br/>
44 44
                     Time = ".now()->format("Y-m-d H:i:s")."<br/>
@@ -58,28 +58,28 @@  discard block
 block discarded – undo
58 58
                 return cb()->redirectBack("Your email is not registered");
59 59
             }
60 60
 
61
-        }catch (CBValidationException $e) {
61
+        } catch (CBValidationException $e) {
62 62
             return cb()->redirectBack($e->getMessage());
63 63
         } catch (\Exception $e) {
64 64
             Log::error($e);
65 65
             return cb()->redirectBack(cbLang("something_went_wrong"));
66 66
         }
67 67
 
68
-        return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email","success");
68
+        return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email", "success");
69 69
     }
70 70
 
71 71
     public function getContinueReset($token) {
72
-        if(Cache::has("forget_".$token)) {
72
+        if (Cache::has("forget_".$token)) {
73 73
             $id = Cache::get("forget_".$token);
74 74
             $newPassword = Str::random(6);
75 75
             cb()->update("users", $id, ["password"=>Hash::make($newPassword)]);
76 76
 
77
-            $user = cb()->find("users",$id);
77
+            $user = cb()->find("users", $id);
78 78
 
79 79
             $mail = new MailHelper();
80 80
             $mail->to($user->email);
81
-            $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName());
82
-            $mail->content("This Is Your New Password","
81
+            $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName());
82
+            $mail->content("This Is Your New Password", "
83 83
                     Hi $user->name,<br/><br>
84 84
                     Thank you for confirming the request new password. Here is your new password: <br>
85 85
                     <h2>$newPassword</h2>
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
                 ");
91 91
             $mail->send();
92 92
 
93
-            return cb()->redirect(cb()->getAdminUrl("login"),"We've sent you new password email. Please check at your mail inbox or spambox","success");
93
+            return cb()->redirect(cb()->getAdminUrl("login"), "We've sent you new password email. Please check at your mail inbox or spambox", "success");
94 94
         } else {
95
-            return cb()->redirect(cb()->getAdminUrl("login"),"It looks like the url has been expired!");
95
+            return cb()->redirect(cb()->getAdminUrl("login"), "It looks like the url has been expired!");
96 96
         }
97 97
     }
98 98
 
Please login to merge, or discard this patch.
src/controllers/traits/ColumnIntervention.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
      */
19 19
     public function columnIntervention()
20 20
     {
21
-        if(request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
21
+        if (request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
22 22
             /*
23 23
              * If there is sub module, the column that has same name with foreign key should be remove
24 24
              * And change to hidden. So we can save the foreign Key id from the parent module.
25 25
              */
26 26
             $subModule = Cache::get("subModule".request("sub_module"));
27 27
             $this->removeColumn($subModule["foreignKey"])
28
-                ->addHidden($subModule["foreignKey"],$subModule['foreignKey'])
28
+                ->addHidden($subModule["foreignKey"], $subModule['foreignKey'])
29 29
                 ->defaultValue($subModule['foreignValue']);
30 30
         }
31 31
     }
Please login to merge, or discard this patch.
src/controllers/traits/Validation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
      */
20 20
     private function validation()
21 21
     {
22
-        if(isset($this->data['validation'])) {
22
+        if (isset($this->data['validation'])) {
23 23
             $validator = Validator::make(request()->all(), @$this->data['validation'], @$this->data['validation_messages']);
24 24
             if ($validator->fails()) {
25 25
                 $message = $validator->messages();
26 26
                 $message_all = $message->all();
27
-                throw new CBValidationException(implode(', ',$message_all));
27
+                throw new CBValidationException(implode(', ', $message_all));
28 28
             }
29 29
         }
30 30
     }
Please login to merge, or discard this patch.
src/helpers/MiscellanousSingleton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public function hasData($key) {
25 25
         $data = $this->data;
26
-        if(isset($data[$key])) return true;
26
+        if (isset($data[$key])) return true;
27 27
         else return false;
28 28
     }
29 29
 
Please login to merge, or discard this patch.
src/helpers/SchemaHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
     public static function hasColumn($table, $column)
17 17
     {
18 18
         $columns = cb()->listAllColumns($table);
19
-        return in_array($column,$columns);
19
+        return in_array($column, $columns);
20 20
     }
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/helpers/CacheHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public static function putInGroup($key, $value, $group, $duration) {
17 17
         $key = md5($key);
18
-        $exist = (Cache::get($group))?:[];
19
-        $exist[ $key ] = ['value'=>$value,'duration'=>$duration];
18
+        $exist = (Cache::get($group)) ?: [];
19
+        $exist[$key] = ['value'=>$value, 'duration'=>$duration];
20 20
 
21
-        if($duration == -1) {
21
+        if ($duration == -1) {
22 22
             Cache::forever($group, $exist);
23 23
         } else {
24 24
             Cache::put($group, $exist, $duration);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public static function getItemInGroup($key, $group) {
29 29
         $groupdata = Cache::get($group);
30 30
         $key = md5($key);
31
-        if(isset($groupdata[$key])) {
31
+        if (isset($groupdata[$key])) {
32 32
             return $groupdata[$key]['value'];
33 33
         }
34 34
         return null;
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         Cache::forget($group);
39 39
     }
40 40
 
41
-    public static function forgetInGroup($key,$group) {
41
+    public static function forgetInGroup($key, $group) {
42 42
         $key = md5($key);
43 43
         $data = Cache::get($group);
44 44
         $duration = null;
45
-        if(isset($data[$key])) {
45
+        if (isset($data[$key])) {
46 46
             $item = $data[$key];
47 47
             unset($data[$key]);
48 48
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperSecurityController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
31 31
     {
32
-        if(!isConfigCached()) {
32
+        if (!isConfigCached()) {
33 33
             setEnvironmentValue([
34 34
                 "APP_DEBUG"=>request("APP_DEBUG")
35 35
             ]);
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
         putSetting("AUTO_REDIRECT_TO_LOGIN", request("AUTO_REDIRECT_TO_LOGIN"));
42 42
         putSetting("LOGIN_NOTIFICATION", request("LOGIN_NOTIFICATION"));
43 43
 
44
-        if(request("htaccess_ServerSignature")) {
44
+        if (request("htaccess_ServerSignature")) {
45 45
             putHtaccess("ServerSignature Off");
46 46
         }
47 47
 
48
-        if(request("htaccess_IndexIgnore")) {
48
+        if (request("htaccess_IndexIgnore")) {
49 49
             putHtaccess("IndexIgnore *");
50 50
         }
51 51
 
52
-        if(request("htaccess_dotAccess")) {
52
+        if (request("htaccess_dotAccess")) {
53 53
 putHtaccess("
54 54
 <FilesMatch \"^\.\">
55 55
 Order allow,deny
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 </FilesMatch>");
58 58
         }
59 59
 
60
-        if(request("htaccess_preventVendor")) {
60
+        if (request("htaccess_preventVendor")) {
61 61
             putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]");
62 62
         }
63 63
 
64 64
 
65
-        return cb()->redirectBack("Security has been updated!","success");
65
+        return cb()->redirectBack("Security has been updated!", "success");
66 66
     }
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.