@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $totalPosts = $this->postModel->totalNumberFullPosts(); |
78 | 78 | $pagination = $this->pagination->getPagination($page, $totalPosts, $postsPerPage); |
79 | 79 | |
80 | - if($postsPerPage !== Constant::LIST_PER_PAGE){ |
|
80 | + if ($postsPerPage !== Constant::LIST_PER_PAGE) { |
|
81 | 81 | $this->data['paginationPostsPerPage'] = $postsPerPage; |
82 | 82 | } |
83 | 83 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $onFrontPage = $posts["isOnFrontPage"]; |
133 | 133 | $idUser = $userSessionId; |
134 | 134 | |
135 | - if(!is_int($idUser) || $idUser === null) |
|
135 | + if (!is_int($idUser) || $idUser === null) |
|
136 | 136 | { |
137 | 137 | throw new \Error("Invalid userID"); |
138 | 138 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | //checking result and redirecting |
168 | 168 | if ($postId != null) { |
169 | - $this->alertBox->setAlert("Post " . $title . " Created"); |
|
170 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
169 | + $this->alertBox->setAlert("Post ".$title." Created"); |
|
170 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
171 | 171 | } |
172 | - $this->alertBox->setAlert("Error creating " . $title, "error"); |
|
172 | + $this->alertBox->setAlert("Error creating ".$title, "error"); |
|
173 | 173 | $this->container->getResponse()->redirect("admin/post/new"); |
174 | 174 | |
175 | 175 | } |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | |
238 | 238 | //checking result and redirecting |
239 | 239 | if ($postUpdate) { |
240 | - $this->alertBox->setAlert("Post " . $title . " Updated"); |
|
241 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
240 | + $this->alertBox->setAlert("Post ".$title." Updated"); |
|
241 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
242 | 242 | } |
243 | - $this->alertBox->setAlert("Error updating " . $title, "error"); |
|
244 | - $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug); |
|
243 | + $this->alertBox->setAlert("Error updating ".$title, "error"); |
|
244 | + $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->tagModel->removeTagsOnPost($postId); |
258 | 258 | $removedPost = $this->postModel->deletePost($postId); |
259 | 259 | |
260 | - if($removedPost) |
|
260 | + if ($removedPost) |
|
261 | 261 | { |
262 | 262 | $this->alertBox->setAlert("Post ".$postTitle." deleted"); |
263 | 263 | } |
@@ -211,10 +211,12 @@ |
||
211 | 211 | $this->alertBox->setAlert("empty slug not allowed", "error"); |
212 | 212 | } |
213 | 213 | |
214 | - if ($postSlug != $originalPostSlug) //if the slug has been updated |
|
214 | + if ($postSlug != $originalPostSlug) { |
|
215 | + //if the slug has been updated |
|
215 | 216 | { |
216 | 217 | if (!$this->postModel->isPostSlugUnique($postSlug)) { |
217 | 218 | $error = true; |
219 | + } |
|
218 | 220 | $originalPostSlug = $this->postModel->getPostSlugFromId($postId); |
219 | 221 | $this->alertBox->setAlert("Slug not unique", "error"); |
220 | 222 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $postId = $this->request->getData("postId"); |
28 | 28 | |
29 | 29 | $data = false; |
30 | - if(!$this->isAlphaNum($postSlug)) |
|
30 | + if (!$this->isAlphaNum($postSlug)) |
|
31 | 31 | { |
32 | 32 | echo json_encode($data); |
33 | 33 | return true; |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | $data = $postModel->isPostSlugUnique($postSlug); |
39 | 39 | |
40 | - if($data == false) //slug is not unique, but could be from the same post |
|
40 | + if ($data == false) //slug is not unique, but could be from the same post |
|
41 | 41 | { |
42 | 42 | $slugOfId = $postModel->getPostSlugFromId($postId); |
43 | - if($slugOfId === $postSlug) |
|
43 | + if ($slugOfId === $postSlug) |
|
44 | 44 | { |
45 | 45 | //it's the same post, return true |
46 | 46 | $data = true; |
@@ -37,9 +37,11 @@ |
||
37 | 37 | |
38 | 38 | $data = $postModel->isPostSlugUnique($postSlug); |
39 | 39 | |
40 | - if($data == false) //slug is not unique, but could be from the same post |
|
40 | + if($data == false) { |
|
41 | + //slug is not unique, but could be from the same post |
|
41 | 42 | { |
42 | 43 | $slugOfId = $postModel->getPostSlugFromId($postId); |
44 | + } |
|
43 | 45 | if($slugOfId === $postSlug) |
44 | 46 | { |
45 | 47 | //it's the same post, return true |