Passed
Push — Auth ( 0585e4...0626eb )
by Stone
02:59
created
App/Controllers/Admin/Home.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
         $this->onlyUser();
97 97
         $this->onlyPost();
98 98
 
99
-        $user = (object)$this->request->getDataFull();
99
+        $user = (object) $this->request->getDataFull();
100 100
         $redirectUrl = "/admin";
101 101
 
102 102
         if ($user->userId !== $this->session->get("userId") || isset($user->userRoleSelector) || isset($user->locked_out)) {
103 103
             //an admin is trying to update a user or form tampered with
104 104
             $this->onlyAdmin();
105
-            $redirectUrl = "/admin/home/view-user/" . $user->userId;
106
-        } else {
105
+            $redirectUrl = "/admin/home/view-user/".$user->userId;
106
+        }else {
107 107
             //set the role to the original state for update
108 108
             $beforeUser = $this->userModel->getUserDetailsById($user->userId);
109 109
             $user->userRoleSelector = $beforeUser->roles_idroles;
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $error = false;
118 118
         $registerErrors = new \stdClass();
119 119
 
120
-        if($userId == 1 && $user->userLockedOut == 1)
120
+        if ($userId == 1 && $user->userLockedOut == 1)
121 121
         {
122 122
             $error = true;
123 123
             $this->alertBox->setAlert("Original admin may not be deactivated", "error");
124 124
         }
125 125
 
126
-        if($userId == 1 && $user->userRoleSelector != 2)
126
+        if ($userId == 1 && $user->userRoleSelector != 2)
127 127
         {
128 128
             $error = true;
129 129
             $this->alertBox->setAlert("Original admin must stay admin", "error");
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             throw new \Exception("Error in passed ID");
205 205
         }
206 206
 
207
-        if($userId === 1)
207
+        if ($userId === 1)
208 208
         {
209 209
             $this->alertBox->setAlert('Original Admin can not be deleted', "error");
210 210
             $this->response->redirect("/admin/home/list-users");
Please login to merge, or discard this patch.
App/Controllers/Ajax/User.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Core\JsonException;
9 9
 use Core\Traits\StringFunctions;
10 10
 
11
-class User  extends AjaxController{
11
+class User  extends AjaxController {
12 12
 
13 13
     use StringFunctions;
14 14
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         //the router needs a parameter with get functions else throsw a wobbly
26 26
         //we pass a get variable and call the /controller/function/get?bla
27 27
         //for better use and security, we must pass "get" as the parameter
28
-        if(!$this->startsWith(strtolower($get),"get"))
28
+        if (!$this->startsWith(strtolower($get), "get"))
29 29
         {
30 30
             throw new JsonException("invalid call");
31 31
         }
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $this->onlyAdmin();
48 48
         $this->onlyPost();
49
-        $state = (bool)($this->request->getData("state") === 'true');
50
-        $userId = (int)$this->request->getData("userId");
49
+        $state = (bool) ($this->request->getData("state") === 'true');
50
+        $userId = (int) $this->request->getData("userId");
51 51
 
52 52
         $result = array();
53 53
         $result["success"] = false;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $result["userId"] = $userId;
56 56
 
57 57
         // we can not update the Original Admin activation state
58
-        if($userId !== 1)
58
+        if ($userId !== 1)
59 59
         {
60 60
             $result["success"] = $this->userModel->activateUser(!$state, $userId);
61 61
             $result["state"] = !$state;
Please login to merge, or discard this patch.