Passed
Pull Request — master (#57)
by Stone
03:27
created
App/Models/UserModel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         //check if email is valid for sanity
172 172
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
173 173
             $email = htmlspecialchars($email);
174
-            throw new BlogocException("invalid email " . $email);
174
+            throw new BlogocException("invalid email ".$email);
175 175
         }
176 176
         $sql = $this->baseSqlSelect();
177 177
         $sql .= "
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $this->bind(':roles_idroles', 1); //we set to one, should probably get from database and config
215 215
         $this->execute();
216 216
 
217
-        return (int)$this->dbh->lastInsertId();
217
+        return (int) $this->dbh->lastInsertId();
218 218
     }
219 219
 
220 220
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function updateUser(\stdClass $user)
226 226
     {
227
-        $sql="
227
+        $sql = "
228 228
             UPDATE $this->userTbl
229 229
             SET
230 230
               name=:name,
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         if ($this->isAccountPasswordBlocked($user)) {
277
-            $response->message = "too many bad passwords, account is blocked for " . Constant::LOCKOUT_MINUTES . " minutes";
277
+            $response->message = "too many bad passwords, account is blocked for ".Constant::LOCKOUT_MINUTES." minutes";
278 278
             return $response;
279 279
         }
280 280
 
Please login to merge, or discard this patch.
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.
App/Modules/SendMail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Swift_Message;
9 9
 use Swift_SmtpTransport;
10 10
 
11
-class SendMail extends Module{
11
+class SendMail extends Module {
12 12
 
13 13
     private $siteConfig;
14 14
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
         // Create the Transport for mail sending
26 26
         //$config = $this->siteConfig->getSiteConfig();
27
-        $this->transport = (new Swift_SmtpTransport($this->siteConfig["SMTP_server"], (int)$this->siteConfig["SMTP_port"]))
27
+        $this->transport = (new Swift_SmtpTransport($this->siteConfig["SMTP_server"], (int) $this->siteConfig["SMTP_port"]))
28 28
             ->setUsername($this->siteConfig["SMTP_user"])
29 29
             ->setPassword($this->siteConfig["SMTP_pass"])
30 30
         ;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $message = "<h1>Message from <a href='".$this->container->getRequest()->getBaseUrl()."'>".$this->siteConfig["site_name"]."</a></h1>";
70 70
         $message .= "<p>You have asked to reset your password, please click <a href=\"".$url."\">Here</a> to define a new password</p>";
71 71
 
72
-        $this->send($to, "Define New Password", $message );
72
+        $this->send($to, "Define New Password", $message);
73 73
 
74 74
     }
75 75
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $message .= "<p>You have sucsessfuly created an account, now all you need to do is <a href=\"".$url."\">Create your new password</a></p>";
90 90
         $message .= "<p>Have fun</p>";
91 91
 
92
-        $this->send($to, "Define Password at ".$this->siteConfig["site_name"], $message );
92
+        $this->send($to, "Define Password at ".$this->siteConfig["site_name"], $message);
93 93
 
94 94
     }
95 95
 }
96 96
\ No newline at end of file
Please login to merge, or discard this patch.