Passed
Branch Comments (3db3c7)
by Stone
06:29 queued 02:56
created
App/Controllers/Ajax/PostVerification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         $this->onlyPost();
33 33
 
34 34
         $postSlug = $this->request->getData("postSlug");
35
-        $postId = (int)$this->request->getData("postId");
35
+        $postId = (int) $this->request->getData("postId");
36 36
 
37 37
         $data = false;
38 38
         if (!$this->slug->isSlugValid($postSlug) || !$this->isInt($postId)) {
Please login to merge, or discard this patch.
App/Controllers/Ajax/User.php 1 patch
Spacing   +6 added lines, -6 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,12 +25,12 @@  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
         }
32 32
         $email = $this->request->getData("email");
33
-        if($email === null)
33
+        if ($email === null)
34 34
         {
35 35
             throw new JsonException("Empty email");
36 36
         }
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $this->onlyAdmin();
53 53
         $this->onlyPost();
54
-        $state = (bool)($this->request->getData("state") === 'true');
55
-        $userId = (int)$this->request->getData("userId");
54
+        $state = (bool) ($this->request->getData("state") === 'true');
55
+        $userId = (int) $this->request->getData("userId");
56 56
 
57 57
         $result = array();
58 58
         $result["success"] = false;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $result["userId"] = $userId;
61 61
 
62 62
         // we can not update the Original Admin activation state
63
-        if($userId !== 1)
63
+        if ($userId !== 1)
64 64
         {
65 65
             $result["success"] = $this->userModel->activateUser(!$state, $userId);
66 66
             $result["state"] = !$state;
Please login to merge, or discard this patch.
App/Controllers/Post.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
         $this->onlyUser();
84 84
 
85 85
         //get the session userId
86
-        $userId = (int)$this->session->get("userId");
87
-        $comment = (string)$this->request->getData("newComment");
88
-        $postId = (int)$this->request->getData("postId");
86
+        $userId = (int) $this->session->get("userId");
87
+        $comment = (string) $this->request->getData("newComment");
88
+        $postId = (int) $this->request->getData("postId");
89 89
 
90 90
         //check if we are admin, Admins do not need moderation
91 91
         $admin = $this->session->get('user_role_level') >= Constant::ADMIN_LEVEL;
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
             $post = $this->postModel->getSinglePost($postId);
98 98
             $baseUrl = $this->request->getBaseUrl();
99 99
 
100
-            $emailMessage = "<h1>New comment on post " . $post->title . "</a></h1>";
101
-            $emailMessage .= "<p>Check it out <a href='" . $baseUrl . "admin/comments/moderate-comment/" . $commentId . "'>here</a> </p>";
100
+            $emailMessage = "<h1>New comment on post ".$post->title."</a></h1>";
101
+            $emailMessage .= "<p>Check it out <a href='".$baseUrl."admin/comments/moderate-comment/".$commentId."'>here</a> </p>";
102 102
 
103 103
             $this->sendMail->send($siteConfig["admin_email_address"], "New comment added", $emailMessage);
104 104
 
@@ -107,6 +107,6 @@  discard block
 block discarded – undo
107 107
 
108 108
         $postSlug = $this->postModel->getPostSlugFromId($postId);
109 109
 
110
-        $this->response->redirect("/post/view-post/" . $postSlug);
110
+        $this->response->redirect("/post/view-post/".$postSlug);
111 111
     }
112 112
 }
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
App/Controllers/Admin/Comments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Core\Container;
10 10
 use Core\Traits\StringFunctions;
11 11
 
12
-class Comments extends AdminController{
12
+class Comments extends AdminController {
13 13
 
14 14
     use StringFunctions;
15 15
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
 
123 123
         $refererUrl = $this->request->getReferer();
124
-        if($refererUrl === "") //referer can return null, set default
124
+        if ($refererUrl === "") //referer can return null, set default
125 125
         {
126 126
             $refererUrl = "admin/comments/view-comments";
127 127
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
         //update comment
155
-        if($this->commentModel->update($commentId, $comment["commentTextArea"], $comment["commentApproved"]))
155
+        if ($this->commentModel->update($commentId, $comment["commentTextArea"], $comment["commentApproved"]))
156 156
         {
157 157
             $this->alertBox->setAlert("Comment updated");
158 158
         }
Please login to merge, or discard this patch.
Core/Traits/StringFunctions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         //Searching for the page break tag
87 87
         $breakTagPosition = strpos($text, "<!-- EndOfExcerptBlogOc -->");
88
-        if($breakTagPosition > 0){
88
+        if ($breakTagPosition > 0) {
89 89
             return $this->completeDom(substr($text, 0, $breakTagPosition));
90 90
         }
91 91
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $string = preg_split('/(<img[^>]+\>)|(<p[^>]+\>)|(<span[^>]+\>)|\s/', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
94 94
 
95 95
         //The preg split can return false, probably will never happen but just in case.
96
-        if(!$string)
96
+        if (!$string)
97 97
         {
98 98
             throw new \Error("excerpt generation failed");
99 99
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $trimmed .= $string[$wordCounter];
107 107
             if ($wordCounter < $count - 1) {
108 108
                 $trimmed .= " ";
109
-            } else {
109
+            }else {
110 110
                 $trimmed .= "[...]";
111 111
             }
112 112
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $result = true;
147 147
         foreach ($strings as $string)
148 148
         {
149
-            if(!$this->isAlphaNum($string))
149
+            if (!$this->isAlphaNum($string))
150 150
             {
151 151
                 $result = false;
152 152
             }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function isHexa(string $string):bool
163 163
     {
164
-        return preg_match("/[\da-f]/",$string) === 1;
164
+        return preg_match("/[\da-f]/", $string) === 1;
165 165
     }
166 166
 
167 167
     /**
Please login to merge, or discard this patch.
App/Models/UserModel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         //check if email is valid for sanity
193 193
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
194 194
             $email = htmlspecialchars($email);
195
-            throw new BlogocException("invalid email " . $email);
195
+            throw new BlogocException("invalid email ".$email);
196 196
         }
197 197
         $sql = $this->baseSqlSelect();
198 198
         $sql .= "
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $this->bind(':roles_idroles', 1); //we set to one, should probably get from database and config
236 236
         $this->execute();
237 237
 
238
-        return (int)$this->dbh->lastInsertId();
238
+        return (int) $this->dbh->lastInsertId();
239 239
     }
240 240
 
241 241
     /**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public function updateUser(\stdClass $user):void
247 247
     {
248
-        $sql="
248
+        $sql = "
249 249
             UPDATE $this->userTbl
250 250
             SET
251 251
               name=:name,
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         if ($this->isAccountPasswordBlocked($user)) {
299
-            $response->message = "too many bad passwords, account is blocked for " . Constant::LOCKOUT_MINUTES . " minutes";
299
+            $response->message = "too many bad passwords, account is blocked for ".Constant::LOCKOUT_MINUTES." minutes";
300 300
             return $response;
301 301
         }
302 302
 
Please login to merge, or discard this patch.
App/Controllers/Login.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     private function populateUserFromId(int $userId)
75 75
     {
76 76
         $result = $this->userModel->getUserDetailsById($userId);
77
-        $this->populateUser((array)$result);
77
+        $this->populateUser((array) $result);
78 78
     }
79 79
 
80 80
     /**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         //we are authenticated here
198 198
 
199 199
         //populate the user object with returned data
200
-        $this->populateUser((array)$authUser->user);
200
+        $this->populateUser((array) $authUser->user);
201 201
 
202 202
         //if the user wanted to be remembered
203 203
         if ($rememberMe) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         $register = $this->request->getDataFull();
227 227
 
228
-        if($register === null)
228
+        if ($register === null)
229 229
         {
230 230
             throw new \Exception("Error no data passed");
231 231
         }
Please login to merge, or discard this patch.
App/Controllers/Ajax/Comment.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $this->onlyAdmin();
26 26
         $this->onlyPost();
27
-        $state = (bool)($this->request->getData("state") === 'true');
28
-        $commentId = (int)$this->request->getData("commentId");
27
+        $state = (bool) ($this->request->getData("state") === 'true');
28
+        $commentId = (int) $this->request->getData("commentId");
29 29
 
30 30
         $result = array();
31 31
         $result["success"] = $this->commentModel->setApproved(!$state, $commentId);
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function loadComments()
38 38
     {
39
-        $commentOffset = (int)$this->request->getData("commentOffset");
40
-        $postId = (int)$this->request->getData("postId");
39
+        $commentOffset = (int) $this->request->getData("commentOffset");
40
+        $postId = (int) $this->request->getData("postId");
41 41
 
42 42
         $result = array();
43 43
         $result["success"] = false;
Please login to merge, or discard this patch.