@@ -8,7 +8,7 @@ discard block |
||
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 |
||
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, comment_date) |
174 | 174 | VALUES (:userId, :postId, :comment, :approved, NOW()) |
175 | 175 | "; |
@@ -180,7 +180,7 @@ discard block |
||
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 |
||
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, |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $this->config = $this->siteConfig->getSiteConfig(); |
37 | 37 | $this->userModel = new UserModel($this->container); |
38 | 38 | $this->postModel = new PostModel($this->container); |
39 | - if($this->auth->isuser()) |
|
39 | + if ($this->auth->isuser()) |
|
40 | 40 | { |
41 | - $this->data["user"] = $this->userModel->getUserDetailsById((int)$this->session->get("userId")); |
|
41 | + $this->data["user"] = $this->userModel->getUserDetailsById((int) $this->session->get("userId")); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | private function testCapcha(string $gCapchaResponse):bool |
51 | 51 | { |
52 | 52 | $error = false; |
53 | - if(Config::GOOGLE_RECAPCHA_PUBLIC_KEY !== "" && Config::GOOGLE_RECAPCHA_SECRET_KEY !== "") |
|
53 | + if (Config::GOOGLE_RECAPCHA_PUBLIC_KEY !== "" && Config::GOOGLE_RECAPCHA_SECRET_KEY !== "") |
|
54 | 54 | { |
55 | - if(empty($gCapchaResponse)) |
|
55 | + if (empty($gCapchaResponse)) |
|
56 | 56 | { |
57 | 57 | $error = true; |
58 | 58 | $this->alertBox->setAlert('Capcha not set', 'error'); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $grequest = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.Config::GOOGLE_RECAPCHA_SECRET_KEY.'&response='.$gCapchaResponse); |
62 | 62 | // The result is in a JSON format. Decoding.. |
63 | 63 | $gresponse = json_decode($grequest); |
64 | - if(!$gresponse->success) |
|
64 | + if (!$gresponse->success) |
|
65 | 65 | { |
66 | 66 | $error = true; |
67 | 67 | $this->alertBox->setAlert('Capcha Error', 'error'); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | $capchaError = $this->testCapcha($message["g-recaptcha-response"]); |
161 | 161 | |
162 | - if($capchaError === true) |
|
162 | + if ($capchaError === true) |
|
163 | 163 | { |
164 | 164 | $error = true; |
165 | 165 | } |