Passed
Push — Showing-Posts ( 80516c...edf5ba )
by Stone
01:53
created
App/Controllers/Admin/Post.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $totalPosts = $this->postModel->totalNumberFullPosts();
81 81
         $pagination = $this->pagination->getPagination($page, $totalPosts, $postsPerPage);
82 82
 
83
-        if($postsPerPage !== Constant::LIST_PER_PAGE){
83
+        if ($postsPerPage !== Constant::LIST_PER_PAGE) {
84 84
             $this->data['paginationPostsPerPage'] = $postsPerPage;
85 85
         }
86 86
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $onFrontpage = $posts["isOnFrontPage"];
136 136
         $idUser = $userSessionId;
137 137
 
138
-        if(!is_int($idUser) || $idUser === null)
138
+        if (!is_int($idUser) || $idUser === null)
139 139
         {
140 140
             throw new \Error("Invalid userID");
141 141
         }
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 
170 170
         //checking result and redirecting
171 171
         if ($postId != null) {
172
-            $this->alertBox->setAlert("Post " . $title . " Created");
173
-            $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug);
172
+            $this->alertBox->setAlert("Post ".$title." Created");
173
+            $this->container->getResponse()->redirect("admin/post/modify/".$postSlug);
174 174
         }
175
-        $this->alertBox->setAlert("Error creating " . $title, "error");
175
+        $this->alertBox->setAlert("Error creating ".$title, "error");
176 176
         $this->container->getResponse()->redirect("admin/post/new");
177 177
 
178 178
     }
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 
242 242
         //checking result and redirecting
243 243
         if ($postUpdate) {
244
-            $this->alertBox->setAlert("Post " . $title . " Updated");
245
-            $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug);
244
+            $this->alertBox->setAlert("Post ".$title." Updated");
245
+            $this->container->getResponse()->redirect("admin/post/modify/".$postSlug);
246 246
         }
247
-        $this->alertBox->setAlert("Error updating " . $title, "error");
248
-        $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug);
247
+        $this->alertBox->setAlert("Error updating ".$title, "error");
248
+        $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug);
249 249
     }
250 250
 
251 251
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $this->tagModel->removeTagsOnPost($postId);
262 262
         $removedPost = $this->postModel->deletePost($postId);
263 263
 
264
-        if($removedPost)
264
+        if ($removedPost)
265 265
         {
266 266
             $this->alertBox->setAlert("Post ".$postTitle." deleted");
267 267
         }
Please login to merge, or discard this patch.
App/Controllers/Admin/Category.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Core\Container;
9 9
 use Twig\Error\Error;
10 10
 
11
-class Category extends AdminController{
11
+class Category extends AdminController {
12 12
 
13 13
     protected $siteConfig;
14 14
     protected $pagination;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $totalCategories = $this->categoryModel->countCategories();
49 49
         $pagination = $this->pagination->getPagination($page, $totalCategories, $linesPerPage);
50 50
 
51
-        if($linesPerPage !== $defaultLinesPerPage){
51
+        if ($linesPerPage !== $defaultLinesPerPage) {
52 52
             $this->data['paginationPostsPerPage'] = $linesPerPage;
53 53
         }
54 54
 
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
         $categorySlug = $category["categories_slug"];
77 77
 
78 78
         //Sanity check on ID
79
-        if($categoryId == null )
79
+        if ($categoryId == null)
80 80
         {
81 81
             throw new \ErrorException("invalid category ID");
82 82
         }
83 83
 
84
-        $originalCategorySlug = $this->slugModel->getSlugFromId($categoryId, "categories", "idcategories","categories_slug");
84
+        $originalCategorySlug = $this->slugModel->getSlugFromId($categoryId, "categories", "idcategories", "categories_slug");
85 85
 
86 86
         //Error checking
87 87
         $error = false;
88
-        if($categoryName == "")
88
+        if ($categoryName == "")
89 89
         {
90 90
             $error = true;
91 91
             $this->alertBox->setAlert("empty name not allowed", "error");
92 92
         }
93
-        if($categorySlug == "")
93
+        if ($categorySlug == "")
94 94
         {
95 95
             $error = true;
96 96
             $this->alertBox->setAlert("empty slug not allowed", "error");
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 
109 109
         //checking result and redirecting
110 110
         if ($categoryUpdate) {
111
-            $this->alertBox->setAlert("Category " . $categoryName . " updated");
111
+            $this->alertBox->setAlert("Category ".$categoryName." updated");
112 112
             $this->container->getResponse()->redirect("/admin/category/list/");
113 113
         }
114
-        $this->alertBox->setAlert("Error updating " . $categoryName, "error");
114
+        $this->alertBox->setAlert("Error updating ".$categoryName, "error");
115 115
         $this->container->getResponse()->redirect("/admin/category/list/");
116 116
     }
117 117
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
         $removedCategory = $this->categoryModel->delete($categoryId);
129 129
 
130
-        if($removedCategory)
130
+        if ($removedCategory)
131 131
         {
132 132
             $this->alertBox->setAlert("Category ".$categoryName." deleted");
133 133
         }
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 
154 154
         //Error checking
155 155
         $error = false;
156
-        if($categoryName == "")
156
+        if ($categoryName == "")
157 157
         {
158 158
             $error = true;
159 159
             $this->alertBox->setAlert("empty name not allowed", "error");
160 160
         }
161
-        if($categorySlug == "")
161
+        if ($categorySlug == "")
162 162
         {
163 163
             $error = true;
164 164
             $this->alertBox->setAlert("empty slug not allowed", "error");
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 
177 177
         //checking result and redirecting
178 178
         if ($categoryNew) {
179
-            $this->alertBox->setAlert("Category " . $categoryName . " created");
179
+            $this->alertBox->setAlert("Category ".$categoryName." created");
180 180
             $this->container->getResponse()->redirect("/admin/category/list/");
181 181
         }
182
-        $this->alertBox->setAlert("Error creating " . $categoryName, "error");
182
+        $this->alertBox->setAlert("Error creating ".$categoryName, "error");
183 183
         $this->container->getResponse()->redirect("/admin/category/list/");
184 184
     }
185 185
 }
186 186
\ No newline at end of file
Please login to merge, or discard this patch.
Core/Constant.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
     const POSTS_PER_PAGE = 4;
24 24
     const LIST_PER_PAGE = 10;
25 25
 
26
-    const EXCERPT_WORD_COUNT =50;
26
+    const EXCERPT_WORD_COUNT = 50;
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.