Passed
Push — Comments ( 870b9e...c71663 )
by Stone
02:05
created
App/Controllers/Post.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,9 +91,11 @@
 block discarded – undo
91 91
         $admin = $this->session->get('user_role_level') >= Constant::ADMIN_LEVEL;
92 92
         $commentId = $this->commentModel->addComment($postId, $userId, $comment, $admin);
93 93
 
94
-        if (!$admin) //if we are not an admin, send an email to alert and add an alertBox
94
+        if (!$admin) {
95
+            //if we are not an admin, send an email to alert and add an alertBox
95 96
         {
96 97
             $siteConfig = $this->siteConfig->getSiteConfig();
98
+        }
97 99
             $post = $this->postModel->getSinglePost($postId);
98 100
             $baseUrl = $this->request->getBaseUrl();
99 101
 
Please login to merge, or discard this patch.
App/Controllers/Admin/Comments.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,10 +121,12 @@
 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 === "") {
125
+            //referer can return null, set default
125 126
         {
126 127
             $refererUrl = "admin/comments/view-comments";
127 128
         }
129
+        }
128 130
         $baseUrl = $this->request->getBaseUrl();
129 131
         $redirectUrl = $this->removeFromBeginning($refererUrl, $baseUrl);
130 132
 
Please login to merge, or discard this patch.
App/Controllers/Ajax/Comment.php 1 patch
Spacing   +7 added lines, -7 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,17 +36,17 @@  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
-        $result["success"]=false;
43
+        $result["success"] = false;
44 44
         $data = array();
45 45
 
46 46
         $data["comments"] = $this->commentModel->getCommentsListOnPost($postId, $commentOffset);
47
-        if($data["comments"] !== false)
47
+        if ($data["comments"] !== false)
48 48
         {
49
-            $result["success"]=true;
49
+            $result["success"] = true;
50 50
             $twig = $this->container->getTemplate();
51 51
             $html = $twig->render('Includes/LoadComments.twig', $data);
52 52
 
Please login to merge, or discard this patch.