| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | $viewData['showErrors'] = true; //sending the config option down to twig | 
| 67 | 67 | $viewData['classException'] = get_class($exception); | 
| 68 | 68 | $viewData['stackTrace'] = $exception->getTraceAsString(); | 
| 69 | - $viewData['thrownIn'] = $exception->getFile() . " On line " . $exception->getLine(); | |
| 69 | + $viewData['thrownIn'] = $exception->getFile()." On line ".$exception->getLine(); | |
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | 72 | $container = new Container(); | 
| @@ -74,9 +74,9 @@ discard block | ||
| 74 | 74 | //Making sure that the twig template renders correctly. | 
| 75 | 75 |          try { | 
| 76 | 76 | $twig = $container->getTemplate(); | 
| 77 | -            $twig->display('ErrorPages/' . $code . '.twig', $viewData); | |
| 77 | +            $twig->display('ErrorPages/'.$code.'.twig', $viewData); | |
| 78 | 78 |          } catch (\Exception $e) { | 
| 79 | - echo 'Twig Error : ' . $e->getMessage(); | |
| 79 | + echo 'Twig Error : '.$e->getMessage(); | |
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | 82 | |
| @@ -102,7 +102,7 @@ | ||
| 102 | 102 | 500 => '500 Internal Server Error' | 
| 103 | 103 | ); | 
| 104 | 104 | // ok, validation error, or failure | 
| 105 | -        header('Status: ' . $status[$code]); | |
| 105 | +        header('Status: '.$status[$code]); | |
| 106 | 106 | // return the encoded json | 
| 107 | 107 | return json_encode(array( | 
| 108 | 108 | 'status' => $code < 300, // success or not? | 
| @@ -45,7 +45,7 @@ | ||
| 45 | 45 | $hash = bin2hex($rand); | 
| 46 | 46 |                  $this->session->set('csrf_token', $hash); | 
| 47 | 47 |              } catch (\Exception $e) { | 
| 48 | - echo 'Random generator not present on server: ' . $e->getMessage(); | |
| 48 | + echo 'Random generator not present on server: '.$e->getMessage(); | |
| 49 | 49 | } | 
| 50 | 50 | } | 
| 51 | 51 | } | 
| @@ -59,7 +59,7 @@ | ||
| 59 | 59 |      { | 
| 60 | 60 | $host = $_SERVER['HTTP_HOST']; | 
| 61 | 61 | $https = !empty($_SERVER['HTTPS']) ? 'https' : 'http'; | 
| 62 | - return $https . '://' . $host . '/'; | |
| 62 | + return $https.'://'.$host.'/'; | |
| 63 | 63 | } | 
| 64 | 64 | |
| 65 | 65 | /** | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | $specialNamespace = array_shift($url); | 
| 68 | 68 | |
| 69 | 69 | //making sure we have a single backslash | 
| 70 | - $specialNamespace = rtrim($specialNamespace, '\\') . '\\'; | |
| 70 | + $specialNamespace = rtrim($specialNamespace, '\\').'\\'; | |
| 71 | 71 | |
| 72 | 72 | //capitalize the special namespace | 
| 73 | 73 | $specialNamespace = $this->convertToStudlyCaps($specialNamespace); | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 |      { | 
| 135 | 135 | |
| 136 | 136 | //try to create the controller object | 
| 137 | - $fullControllerName = $this->currentNamespace . $this->currentController; | |
| 137 | + $fullControllerName = $this->currentNamespace.$this->currentController; | |
| 138 | 138 | |
| 139 | 139 | //make sure the class exists before continuing | 
| 140 | 140 |          if (!class_exists($fullControllerName)) { | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | default: | 
| 24 | 24 | $headerType = 'text/html'; | 
| 25 | 25 | } | 
| 26 | - $contentType = 'Content-Type: ' . $headerType; | |
| 26 | + $contentType = 'Content-Type: '.$headerType; | |
| 27 | 27 | |
| 28 | 28 | header($contentType); | 
| 29 | 29 | } | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | } | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | -        header("location: /" . $url); | |
| 44 | +        header("location: /".$url); | |
| 45 | 45 | exit(); //after redirect do not execute anything else from the function | 
| 46 | 46 | } | 
| 47 | 47 | } | 
| 48 | 48 | \ No newline at end of file | 
| @@ -36,7 +36,7 @@ | ||
| 36 | 36 | } | 
| 37 | 37 |          if ($success) { | 
| 38 | 38 |              $this->alertBox->setAlert('Configuration updates successfully'); | 
| 39 | -        } else { | |
| 39 | +        }else { | |
| 40 | 40 |              $this->alertBox->setAlert('error in configuration update', 'error'); | 
| 41 | 41 | } | 
| 42 | 42 |          $this->container->getResponse()->redirect('admin/config'); | 
| @@ -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 | /** | 
| @@ -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 | } | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | $this->onlyPost(); | 
| 118 | 118 | |
| 119 | 119 | $posts = $this->request->getDataFull(); | 
| 120 | -        $userSessionId = (int)$this->session->get("userId"); | |
| 120 | +        $userSessionId = (int) $this->session->get("userId"); | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | $title = trim($posts["postTitle"]); | 
| @@ -163,10 +163,10 @@ discard block | ||
| 163 | 163 | |
| 164 | 164 | //checking result and redirecting | 
| 165 | 165 |          if ($postId != null) { | 
| 166 | -            $this->alertBox->setAlert("Post " . $title . " Created"); | |
| 167 | -            $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); | |
| 166 | +            $this->alertBox->setAlert("Post ".$title." Created"); | |
| 167 | +            $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); | |
| 168 | 168 | } | 
| 169 | -        $this->alertBox->setAlert("Error creating " . $title, "error"); | |
| 169 | +        $this->alertBox->setAlert("Error creating ".$title, "error"); | |
| 170 | 170 |          $this->container->getResponse()->redirect("admin/post/new"); | 
| 171 | 171 | |
| 172 | 172 | } | 
| @@ -231,11 +231,11 @@ discard block | ||
| 231 | 231 | |
| 232 | 232 | //checking result and redirecting | 
| 233 | 233 |          if ($postUpdate) { | 
| 234 | -            $this->alertBox->setAlert("Post " . $title . " Updated"); | |
| 235 | -            $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); | |
| 234 | +            $this->alertBox->setAlert("Post ".$title." Updated"); | |
| 235 | +            $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); | |
| 236 | 236 | } | 
| 237 | -        $this->alertBox->setAlert("Error updating " . $title, "error"); | |
| 238 | -        $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug); | |
| 237 | +        $this->alertBox->setAlert("Error updating ".$title, "error"); | |
| 238 | +        $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug); | |
| 239 | 239 | } | 
| 240 | 240 | |
| 241 | 241 | |
| @@ -252,7 +252,7 @@ discard block | ||
| 252 | 252 | $removedPost = $this->postModel->deletePost($postId); | 
| 253 | 253 | |
| 254 | 254 |          if ($removedPost) { | 
| 255 | -            $this->alertBox->setAlert("Post " . $postTitle . " deleted"); | |
| 255 | +            $this->alertBox->setAlert("Post ".$postTitle." deleted"); | |
| 256 | 256 | } | 
| 257 | 257 | |
| 258 | 258 |          $this->response->redirect("admin/post/list/"); |