@@ -96,14 +96,14 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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"); |
@@ -8,7 +8,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |