Passed
Push — Security_and_bug_fixes ( cb92f3...2b89b6 )
by Stone
03:26
created
App/Controllers/Home.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         $this->config = $this->siteConfig->getSiteConfig();
36 36
         $this->userModel = new UserModel($this->container);
37 37
         $this->postModel = new PostModel($this->container);
38
-        if($this->auth->isuser())
38
+        if ($this->auth->isuser())
39 39
         {
40 40
             $this->data["user"] = $this->userModel->getUserDetailsById($this->session->get("userId"));
41 41
         }
Please login to merge, or discard this patch.
App/Controllers/Ajax/PostVerification.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,9 +45,11 @@
 block discarded – undo
45 45
 
46 46
         $data = $this->postModel->isPostSlugUnique(/** @scrutinizer ignore-type */$postSlug); //we have checked that slug is valid so no type error
47 47
 
48
-        if ($data === false) //slug is not unique, but could be from the same post
48
+        if ($data === false) {
49
+            //slug is not unique, but could be from the same post
49 50
         {
50 51
             $slugOfId = $this->postModel->getPostSlugFromId($postId);
52
+        }
51 53
             if ($slugOfId === $postSlug) {
52 54
                 //it's the same post, return true
53 55
                 $data = true;
Please login to merge, or discard this patch.
App/Controllers/Ajax/Config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             if (!$this->configModel->updateConfig($update->name, $update->value)) {
44 44
                 $result['success'] = false;
45 45
                 $result['errorId'][] = $update->name;
46
-            } else {
46
+            }else {
47 47
                 $result['successId'][] = $update->name;
48 48
             }
49 49
         }
Please login to merge, or discard this patch.
App/Modules/SendMail.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         // Create the Transport for mail sending
27 27
         //$config = $this->siteConfig->getSiteConfig();
28 28
         $this->transport = (new Swift_SmtpTransport($this->siteConfig["SMTP_server"],
29
-            (int)$this->siteConfig["SMTP_port"]))
29
+            (int) $this->siteConfig["SMTP_port"]))
30 30
             ->setUsername($this->siteConfig["SMTP_user"])
31 31
             ->setPassword($this->siteConfig["SMTP_pass"]);
32 32
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     public function sendResetPasswordMail(string $to, string $token, int $userId)
69 69
     {
70 70
         $url = $this->container->getRequest()->getBaseUrl();
71
-        $url .= "password/reset/get?token=" . $token;
72
-        $url .= "&userId=" . $userId;
71
+        $url .= "password/reset/get?token=".$token;
72
+        $url .= "&userId=".$userId;
73 73
 
74
-        $message = "<h1>Message from <a href='" . $this->container->getRequest()->getBaseUrl() . "'>" . $this->siteConfig["site_name"] . "</a></h1>";
75
-        $message .= "<p>You have asked to reset your password, please click <a href=\"" . $url . "\">Here</a> to define a new password</p>";
74
+        $message = "<h1>Message from <a href='".$this->container->getRequest()->getBaseUrl()."'>".$this->siteConfig["site_name"]."</a></h1>";
75
+        $message .= "<p>You have asked to reset your password, please click <a href=\"".$url."\">Here</a> to define a new password</p>";
76 76
 
77 77
         $this->send($to, "Define New Password", $message);
78 78
     }
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
     public function sendNewPasswordMail(string $to, string $token, int $userId)
87 87
     {
88 88
         $url = $this->container->getRequest()->getBaseUrl();
89
-        $url .= "password/reset/get?token=" . $token;
90
-        $url .= "&userId=" . $userId;
91
-        $message = "<h1>Message from <a href='" . $this->container->getRequest()->getBaseUrl() . "'>" . $this->siteConfig["site_name"] . "</a></h1>";
89
+        $url .= "password/reset/get?token=".$token;
90
+        $url .= "&userId=".$userId;
91
+        $message = "<h1>Message from <a href='".$this->container->getRequest()->getBaseUrl()."'>".$this->siteConfig["site_name"]."</a></h1>";
92 92
         $message .= "<h2>Welcome to the site</h2>";
93
-        $message .= "<p>You have sucsessfuly created an account, now all you need to do is <a href=\"" . $url . "\">Create your new password</a></p>";
93
+        $message .= "<p>You have sucsessfuly created an account, now all you need to do is <a href=\"".$url."\">Create your new password</a></p>";
94 94
         $message .= "<p>Have fun</p>";
95 95
 
96
-        $this->send($to, "Define Password at " . $this->siteConfig["site_name"], $message);
96
+        $this->send($to, "Define Password at ".$this->siteConfig["site_name"], $message);
97 97
     }
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
App/Modules/SiteConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $categories = $this->categoryModel->getCategories();
61 61
         foreach ($categories as $category) {
62 62
             $data += [
63
-                $category->category_name => '/category/posts/' . $category->categories_slug
63
+                $category->category_name => '/category/posts/'.$category->categories_slug
64 64
             ];
65 65
         }
66 66
         return $data;
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
         $session = $this->container->getSession();
77 77
         $userToken = $cookie->getCookie("rememberMe");
78 78
 
79
-        if($userToken && $this->isHexa($userToken))
79
+        if ($userToken && $this->isHexa($userToken))
80 80
         {
81 81
             //we have a rememberMe Hash, login
82 82
             $rememberedLogin = $this->rememberedLoginModel->findByToken($userToken);
83
-            if($rememberedLogin){
83
+            if ($rememberedLogin) {
84 84
                 //we have a hash, login
85 85
                 $user = $this->userModel->getUserDetailsById($rememberedLogin->users_idusers);
86 86
                 $session->regenerateSessionId(); //regenerate the ID to avoid session ghosting
Please login to merge, or discard this patch.
App/Models/CommentModel.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 HTMLPurifier;
9 9
 use HTMLPurifier_Config;
10 10
 
11
-class CommentModel extends Model{
11
+class CommentModel extends Model {
12 12
 
13 13
     private $commentTbl;
14 14
     private $userTbl;
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
      * @return int
167 167
      * @throws \Exception
168 168
      */
169
-    public function addComment(int $postId, int $userId, string $comment, bool $admin=false):int
169
+    public function addComment(int $postId, int $userId, string $comment, bool $admin = false):int
170 170
     {
171 171
         $comment = $this->purifyHtml($comment);
172
-        $sql="
172
+        $sql = "
173 173
             INSERT INTO $this->commentTbl (users_idusers, posts_idposts, comment, approved)
174 174
             VALUES (:userId, :postId, :comment, :approved)
175 175
         ";
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $this->bind(':approved', $admin);
181 181
 
182 182
         $this->execute();
183
-        return (int)$this->dbh->lastInsertId();
183
+        return (int) $this->dbh->lastInsertId();
184 184
     }
185 185
 
186 186
     /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     {
213 213
         $comment = $this->purifyHtml($comment);
214 214
 
215
-        $sql="
215
+        $sql = "
216 216
             UPDATE $this->commentTbl 
217 217
             SET
218 218
               comment = :comment,
Please login to merge, or discard this patch.