@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->query($sql); |
| 88 | 88 | if ($select != null) { |
| 89 | 89 | foreach ($select as $col => $val) { |
| 90 | - $this->bind(":" . $col, $val); |
|
| 90 | + $this->bind(":".$col, $val); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | $this->bind(":limit", $limit); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $this->query($sql); |
| 122 | 122 | if ($select != null) { |
| 123 | 123 | foreach ($select as $col => $val) { |
| 124 | - $this->bind(":" . $col, $val); |
|
| 124 | + $this->bind(":".$col, $val); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | $this->execute(); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $this->execute(); |
| 293 | 293 | |
| 294 | - return (int)$this->dbh->lastInsertId(); |
|
| 294 | + return (int) $this->dbh->lastInsertId(); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $categories = $categoryModel->getCategories(); |
| 35 | 35 | foreach ($categories as $category) { |
| 36 | 36 | $data += [ |
| 37 | - $category->category_name => '/category/posts/' . $category->categories_slug |
|
| 37 | + $category->category_name => '/category/posts/'.$category->categories_slug |
|
| 38 | 38 | ]; |
| 39 | 39 | } |
| 40 | 40 | return $data; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace |
| 140 | 140 | //since our models all end with Model, we should remove it. |
| 141 | 141 | $table = $this->removeFromEnd($table, 'Model'); |
| 142 | - $table = $table . 's'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
| 142 | + $table = $table.'s'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
| 143 | 143 | $table = strtolower($table); //the database names are in lowercase |
| 144 | 144 | } |
| 145 | 145 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | //if we are here, then table doesn't exist, check for view |
| 165 | - $view = 'v_' . $table; |
|
| 165 | + $view = 'v_'.$table; |
|
| 166 | 166 | $stmt->bindValue(':table', $view, PDO::PARAM_STR); |
| 167 | 167 | $stmt->execute(); |
| 168 | 168 | $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | protected function getTablePrefix($table) |
| 187 | 187 | { |
| 188 | 188 | if (Config::TABLE_PREFIX != '') { |
| 189 | - $table = Config::TABLE_PREFIX . '_' . $table; |
|
| 189 | + $table = Config::TABLE_PREFIX.'_'.$table; |
|
| 190 | 190 | } |
| 191 | 191 | return $table; |
| 192 | 192 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | protected function getRowById($rowId, $table = null) |
| 256 | 256 | { |
| 257 | 257 | $tableName = $this->getTable($table); |
| 258 | - $idName = 'id' . $tableName; |
|
| 258 | + $idName = 'id'.$tableName; |
|
| 259 | 259 | $sql = "SELECT * FROM $tableName WHERE $idName = :rowId"; |
| 260 | 260 | $this->query($sql); |
| 261 | 261 | $this->bind(':rowId', $rowId); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | //Searching for the page break tag |
| 86 | 86 | $breakTagPosition = strpos($text, "<!-- EndOfExcerptBlogOc -->"); |
| 87 | - if($breakTagPosition > 0){ |
|
| 87 | + if ($breakTagPosition > 0) { |
|
| 88 | 88 | return $this->completeDom(substr($text, 0, $breakTagPosition)); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $string = preg_split('/(<img[^>]+\>)|(<p[^>]+\>)|(<span[^>]+\>)|\s/', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
| 93 | 93 | |
| 94 | 94 | //The preg split can return false, probably will never happen but just in case. |
| 95 | - if(!$string) |
|
| 95 | + if (!$string) |
|
| 96 | 96 | { |
| 97 | 97 | throw new \Error("excerpt generation failed"); |
| 98 | 98 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $trimed .= $string[$wordCounter]; |
| 106 | 106 | if ($wordCounter < $count - 1) { |
| 107 | 107 | $trimed .= " "; |
| 108 | - } else { |
|
| 108 | + }else { |
|
| 109 | 109 | $trimed .= "[...]"; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $result = true; |
| 160 | 160 | foreach ($strings as $string) |
| 161 | 161 | { |
| 162 | - if(!$this->isAlphaNum($string)) |
|
| 162 | + if (!$this->isAlphaNum($string)) |
|
| 163 | 163 | { |
| 164 | 164 | $result = false; |
| 165 | 165 | } |
@@ -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 | } |
@@ -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 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $removedPost = $this->postModel->deletePost($postId); |
| 259 | 259 | |
| 260 | 260 | if ($removedPost) { |
| 261 | - $this->alertBox->setAlert("Post " . $postTitle . " deleted"); |
|
| 261 | + $this->alertBox->setAlert("Post ".$postTitle." deleted"); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $this->response->redirect("admin/post/list/"); |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | //checking result and redirecting |
| 105 | 105 | if ($categoryUpdate) { |
| 106 | - $this->alertBox->setAlert("Category " . $categoryName . " updated"); |
|
| 106 | + $this->alertBox->setAlert("Category ".$categoryName." updated"); |
|
| 107 | 107 | $this->container->getResponse()->redirect("/admin/category/list/"); |
| 108 | 108 | } |
| 109 | - $this->alertBox->setAlert("Error updating " . $categoryName, "error"); |
|
| 109 | + $this->alertBox->setAlert("Error updating ".$categoryName, "error"); |
|
| 110 | 110 | $this->container->getResponse()->redirect("/admin/category/list/"); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $removedCategory = $this->categoryModel->delete($categoryId); |
| 124 | 124 | |
| 125 | 125 | if ($removedCategory) { |
| 126 | - $this->alertBox->setAlert("Category " . $categoryName . " deleted"); |
|
| 126 | + $this->alertBox->setAlert("Category ".$categoryName." deleted"); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $this->response->redirect("/admin/category/list/"); |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | //checking result and redirecting |
| 170 | 170 | if ($categoryNew) { |
| 171 | - $this->alertBox->setAlert("Category " . $categoryName . " created"); |
|
| 171 | + $this->alertBox->setAlert("Category ".$categoryName." created"); |
|
| 172 | 172 | $this->container->getResponse()->redirect("/admin/category/list/"); |
| 173 | 173 | } |
| 174 | - $this->alertBox->setAlert("Error creating " . $categoryName, "error"); |
|
| 174 | + $this->alertBox->setAlert("Error creating ".$categoryName, "error"); |
|
| 175 | 175 | $this->container->getResponse()->redirect("/admin/category/list/"); |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | \ No newline at end of file |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | //checking result and redirecting |
| 91 | 91 | if ($tagUpdate) { |
| 92 | - $this->alertBox->setAlert("Tag " . $tagName . " updated"); |
|
| 92 | + $this->alertBox->setAlert("Tag ".$tagName." updated"); |
|
| 93 | 93 | $this->response->redirect("/admin/tag/list/"); |
| 94 | 94 | } |
| 95 | - $this->alertBox->setAlert("Error updating " . $tagName, "error"); |
|
| 95 | + $this->alertBox->setAlert("Error updating ".$tagName, "error"); |
|
| 96 | 96 | $this->response->redirect("/admin/tag/list/"); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $removedTag = $this->tagModel->delete($tagId); |
| 110 | 110 | |
| 111 | 111 | if ($removedTag) { |
| 112 | - $this->alertBox->setAlert("Tag " . $tagName . " deleted"); |
|
| 112 | + $this->alertBox->setAlert("Tag ".$tagName." deleted"); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $this->response->redirect("/admin/tag/list/"); |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | //checking result and redirecting |
| 147 | 147 | if ($tagNew) { |
| 148 | - $this->alertBox->setAlert("Tag " . $tagName . " created"); |
|
| 148 | + $this->alertBox->setAlert("Tag ".$tagName." created"); |
|
| 149 | 149 | $this->response->redirect("/admin/tag/list/"); |
| 150 | 150 | } |
| 151 | - $this->alertBox->setAlert("Error creating " . $tagName, "error"); |
|
| 151 | + $this->alertBox->setAlert("Error creating ".$tagName, "error"); |
|
| 152 | 152 | $this->response->redirect("/admin/tag/list/"); |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function index() |
| 17 | 17 | { |
| 18 | - if(!$this->auth->isUser()){ |
|
| 18 | + if (!$this->auth->isUser()) { |
|
| 19 | 19 | $this->alertBox->setAlert("You must be connected to access the admin interface", 'warning'); |
| 20 | 20 | $this->container->getResponse()->redirect(); |
| 21 | 21 | } |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | private function getFilename(string $folder, string $file): string |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | - $fileUrl = $folder . $file; |
|
| 46 | + $fileUrl = $folder.$file; |
|
| 47 | 47 | $docRoot = $this->request->getDocumentRoot(); |
| 48 | - $filePath = $docRoot . "/public/" . $fileUrl; |
|
| 48 | + $filePath = $docRoot."/public/".$fileUrl; |
|
| 49 | 49 | if (file_exists($filePath) !== 1) { |
| 50 | 50 | $fileNum = 0; |
| 51 | 51 | while (file_exists($filePath)) { |
| 52 | - $fileUrl = $folder . $fileNum . "_" . $file; |
|
| 53 | - $filePath = $docRoot . "/public/" . $fileUrl; |
|
| 52 | + $fileUrl = $folder.$fileNum."_".$file; |
|
| 53 | + $filePath = $docRoot."/public/".$fileUrl; |
|
| 54 | 54 | $fileNum += 1; |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | // Respond to the successful upload with JSON. |
| 76 | 76 | echo json_encode(array('location' => $filetowrite)); |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | // Notify editor that the upload failed |
| 79 | 79 | echo json_encode(array('error' => 'Upload failed, file might be too big')); |
| 80 | 80 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // Respond to the successful upload with JSON. |
| 110 | 110 | echo json_encode(array('location' => $filetowrite)); |
| 111 | - } else { |
|
| 111 | + }else { |
|
| 112 | 112 | // Notify editor that the upload failed |
| 113 | 113 | header("HTTP/1.1 500 Server Error"); |
| 114 | 114 | } |