@@ -85,7 +85,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
161 | 161 | */ |
162 | 162 | public function isHexa(string $string):bool |
163 | 163 | { |
164 | - return preg_match("/[\da-f]/",$string); |
|
164 | + return preg_match("/[\da-f]/", $string); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -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; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | * @return int |
155 | 155 | * @throws \Exception |
156 | 156 | */ |
157 | - public function addComment(int $postId, int $userId, string $comment, bool $admin=false):int |
|
157 | + public function addComment(int $postId, int $userId, string $comment, bool $admin = false):int |
|
158 | 158 | { |
159 | 159 | $comment = $this->purifyHtml($comment); |
160 | - $sql=" |
|
160 | + $sql = " |
|
161 | 161 | INSERT INTO $this->commentTbl (users_idusers, posts_idposts, comment, approved) |
162 | 162 | VALUES (:userId, :postId, :comment, :approved) |
163 | 163 | "; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->bind(':approved', $admin); |
169 | 169 | |
170 | 170 | $this->execute(); |
171 | - return (int)$this->dbh->lastInsertId(); |
|
171 | + return (int) $this->dbh->lastInsertId(); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | $comment = $this->purifyHtml($comment); |
203 | 203 | |
204 | - $sql=" |
|
204 | + $sql = " |
|
205 | 205 | UPDATE $this->commentTbl |
206 | 206 | SET |
207 | 207 | comment = :comment, |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $this->onlyUser(); |
84 | 84 | |
85 | 85 | //get the session userId |
86 | - $userId = (int)$this->session->get("userId"); |
|
86 | + $userId = (int) $this->session->get("userId"); |
|
87 | 87 | $comment = $this->request->getData("newComment"); |
88 | - $postId = (int)$this->request->getData("postId"); |
|
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; |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | $siteConfig = $this->siteConfig->getSiteConfig(); |
102 | 102 | $post = $this->postModel->getSinglePost($postId); |
103 | 103 | |
104 | - $emailMessage = "<h1>New comment on post " . $post->title . "</a></h1>"; |
|
105 | - $emailMessage .= "<p>Check it out <a href='" . $baseUrl . "admin/comments/moderate-comment/" . $commentId . "'>here</a> </p>"; |
|
104 | + $emailMessage = "<h1>New comment on post ".$post->title."</a></h1>"; |
|
105 | + $emailMessage .= "<p>Check it out <a href='".$baseUrl."admin/comments/moderate-comment/".$commentId."'>here</a> </p>"; |
|
106 | 106 | |
107 | 107 | $this->sendMail->send($siteConfig["admin_email_address"], "New comment added", $emailMessage); |
108 | 108 |
@@ -96,9 +96,11 @@ |
||
96 | 96 | $baseUrl = $this->request->getBaseUrl(); |
97 | 97 | $redirectUrl = $this->removeFromBeginning($refererUrl, $baseUrl); |
98 | 98 | |
99 | - if (!$admin) //if we are not an admin, send an email to alert and add an alertBox |
|
99 | + if (!$admin) { |
|
100 | + //if we are not an admin, send an email to alert and add an alertBox |
|
100 | 101 | { |
101 | 102 | $siteConfig = $this->siteConfig->getSiteConfig(); |
103 | + } |
|
102 | 104 | $post = $this->postModel->getSinglePost($postId); |
103 | 105 | |
104 | 106 | $emailMessage = "<h1>New comment on post " . $post->title . "</a></h1>"; |