@@ -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/"); |
@@ -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 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | if (!$this->container->getRequest()->isPost()) { |
29 | 29 | throw new \Core\JsonException('Call is not post'); |
30 | 30 | } |
31 | - $state = (bool)($this->request->getData("state") === 'true'); |
|
32 | - $postId = (int)$this->request->getData("postId"); |
|
31 | + $state = (bool) ($this->request->getData("state") === 'true'); |
|
32 | + $postId = (int) $this->request->getData("postId"); |
|
33 | 33 | |
34 | 34 | $result = array(); |
35 | 35 | $result["success"] = $this->postModule->setPublished(!$state, $postId); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | throw new \Core\JsonException('Call is not post'); |
50 | 50 | } |
51 | 51 | $state = ($this->request->getData("state") === 'true'); |
52 | - $postId = (int)$this->request->getData("postId"); |
|
52 | + $postId = (int) $this->request->getData("postId"); |
|
53 | 53 | |
54 | 54 | $result = array(); |
55 | 55 | $result["success"] = $this->postModule->setOnFrontPage(!$state, $postId); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | //make sure we have the right type or throw an error |
30 | 30 | |
31 | 31 | if (!in_array($type, $this->allowedTypes)) { |
32 | - throw new \Exception("Invalid toastr alert type " . $type); |
|
32 | + throw new \Exception("Invalid toastr alert type ".$type); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $message = htmlspecialchars($message); //avoid any injection |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $this->bind(':roles_idroles', 1); |
101 | 101 | $this->execute(); |
102 | 102 | |
103 | - return (int)$this->dbh->lastInsertId(); |
|
103 | + return (int) $this->dbh->lastInsertId(); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | private function populateUserFromId(int $userId) |
61 | 61 | { |
62 | 62 | $result = $this->userModel->getUserDetailsById($userId); |
63 | - $this->populateUser((array)$result); |
|
63 | + $this->populateUser((array) $result); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | private function populateUserFromMail(string $email) |
72 | 72 | { |
73 | 73 | $result = $this->userModel->getUserDetailsByEmail($email); |
74 | - $this->populateUser((array)$result); |
|
74 | + $this->populateUser((array) $result); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Core\Container; |
8 | 8 | use Core\Traits\StringFunctions; |
9 | 9 | |
10 | -class User extends AjaxController{ |
|
10 | +class User extends AjaxController { |
|
11 | 11 | |
12 | 12 | use StringFunctions; |
13 | 13 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | //the router needs a parameter with get functions else throsw a wobbly |
25 | 25 | //we pass a get variable and call the /controller/function/get?bla |
26 | 26 | //for better use and security, we must pass "get" as the parameter |
27 | - if(!$this->startsWith(strtolower($get),"get")) |
|
27 | + if (!$this->startsWith(strtolower($get), "get")) |
|
28 | 28 | { |
29 | 29 | throw new \Exception("invalid call"); |
30 | 30 | } |
31 | 31 | $email = $this->request->getData("email"); |
32 | - $return = !$this->userModel->isEmailUsed($email); |
|
32 | + $return = !$this->userModel->isEmailUsed($email); |
|
33 | 33 | echo json_encode($return); |
34 | 34 | |
35 | 35 | } |