@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $onFrontpage = $posts["isOnFrontPage"]; |
117 | 117 | $idUser = $userSessionId; |
118 | 118 | |
119 | - if(!is_int($idUser) || $idUser === null) |
|
119 | + if (!is_int($idUser) || $idUser === null) |
|
120 | 120 | { |
121 | 121 | throw new \Error("Invalid userID"); |
122 | 122 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | |
151 | 151 | //checking result and redirecting |
152 | 152 | if ($postId != null) { |
153 | - $this->alertBox->setAlert("Post " . $title . " Created"); |
|
154 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
153 | + $this->alertBox->setAlert("Post ".$title." Created"); |
|
154 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
155 | 155 | } |
156 | - $this->alertBox->setAlert("Error creating " . $title, "error"); |
|
156 | + $this->alertBox->setAlert("Error creating ".$title, "error"); |
|
157 | 157 | $this->container->getResponse()->redirect("admin/post/new"); |
158 | 158 | |
159 | 159 | } |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | |
223 | 223 | //checking result and redirecting |
224 | 224 | if ($postUpdate) { |
225 | - $this->alertBox->setAlert("Post " . $title . " Updated"); |
|
226 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
225 | + $this->alertBox->setAlert("Post ".$title." Updated"); |
|
226 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
227 | 227 | } |
228 | - $this->alertBox->setAlert("Error updating " . $title, "error"); |
|
229 | - $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug); |
|
228 | + $this->alertBox->setAlert("Error updating ".$title, "error"); |
|
229 | + $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | \ No newline at end of file |
@@ -196,10 +196,12 @@ |
||
196 | 196 | $this->alertBox->setAlert("empty slug not allowed", "error"); |
197 | 197 | } |
198 | 198 | |
199 | - if ($postSlug != $originalPostSlug) //if the slug has been updated |
|
199 | + if ($postSlug != $originalPostSlug) { |
|
200 | + //if the slug has been updated |
|
200 | 201 | { |
201 | 202 | if (!$this->slugModel->isUnique($postSlug, "posts", "posts_slug")) { |
202 | 203 | $error = true; |
204 | + } |
|
203 | 205 | $originalPostSlug = $this->slugModel->getSlugFromId($postId, "posts", "idposts", "posts_slug"); |
204 | 206 | $this->alertBox->setAlert("Slug not unique", "error"); |
205 | 207 | } |