@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use App\Models\SlugModel; |
| 5 | 5 | use Core\AjaxController; |
| 6 | -class PostVerification extends AjaxController{ |
|
| 6 | +class PostVerification extends AjaxController { |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * checks if the slug is unique |
@@ -82,29 +82,29 @@ |
||
| 82 | 82 | $postModel = new PostModel($this->container); |
| 83 | 83 | |
| 84 | 84 | //security and error checks |
| 85 | - $error=false; |
|
| 86 | - if($title == "") |
|
| 85 | + $error = false; |
|
| 86 | + if ($title == "") |
|
| 87 | 87 | { |
| 88 | - $error=true; |
|
| 88 | + $error = true; |
|
| 89 | 89 | $this->alertBox->setAlert("empty title not allowed", "error"); |
| 90 | 90 | } |
| 91 | 91 | if (!$slugModel->isUnique($postSlug, "posts", "posts_slug")) { |
| 92 | - $error=true; |
|
| 92 | + $error = true; |
|
| 93 | 93 | $this->alertBox->setAlert("Slug not unique", "error"); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($error) |
|
| 96 | + if ($error) |
|
| 97 | 97 | { |
| 98 | 98 | $this->container->getResponse()->redirect("admin/post/new"); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $postId = $postModel->newPost($title, $postImage, $idCategory, $article, $idUser, $published, $onFrontpage, $postSlug); |
| 102 | 102 | |
| 103 | - echo "<p>new post ID : " . $postId . "</p>"; |
|
| 103 | + echo "<p>new post ID : ".$postId."</p>"; |
|
| 104 | 104 | |
| 105 | - if(isset($posts["tags"])){ |
|
| 105 | + if (isset($posts["tags"])) { |
|
| 106 | 106 | foreach ($posts["tags"] as $tag) { |
| 107 | - if(isset($tag["id"])){ |
|
| 107 | + if (isset($tag["id"])) { |
|
| 108 | 108 | $tagModel->addTagToPost($postId, $tag["id"]); |
| 109 | 109 | continue; |
| 110 | 110 | } |