@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | if (!$this->isAlphaNum($table)) { |
24 | - throw new \ErrorException("Invalid table name " . $table); |
|
24 | + throw new \ErrorException("Invalid table name ".$table); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if (!$this->isAlphaNum($columnName)) { |
28 | - throw new \ErrorException("Invalid Column name " . $columnName); |
|
28 | + throw new \ErrorException("Invalid Column name ".$columnName); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $slugTbl = $this->getTablePrefix($table); |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | public function getIdFromSlug(string $slug, string $table, string $columnName, string $idColumn): int |
50 | 50 | { |
51 | 51 | if (!$this->isAlphaNum($table)) { |
52 | - throw new \ErrorException("Invalid table name " . $table); |
|
52 | + throw new \ErrorException("Invalid table name ".$table); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!$this->isAlphaNum($columnName)) { |
56 | - throw new \ErrorException("Invalid Slug Column name " . $columnName); |
|
56 | + throw new \ErrorException("Invalid Slug Column name ".$columnName); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if (!$this->isAlphaNum($idColumn)) { |
60 | - throw new \ErrorException("Invalid ID Column name " . $columnName); |
|
60 | + throw new \ErrorException("Invalid ID Column name ".$columnName); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $slugTbl = $this->getTablePrefix($table); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $trimed .= $string[$wordCounter]; |
93 | 93 | if ($wordCounter < $count - 1) { |
94 | 94 | $trimed .= " "; |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | $trimed .= "..."; |
97 | 97 | } |
98 | 98 | } |
@@ -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 | } |