Passed
Push — Auth ( 7d6ef6...9d76f0 )
by Stone
02:16
created
App/Controllers/Ajax/ImageUpload.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
App/Controllers/Ajax/PostVerification.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,9 +36,11 @@
 block discarded – undo
36 36
 
37 37
         $data = $postModel->isPostSlugUnique($postSlug);
38 38
 
39
-        if ($data === false) //slug is not unique, but could be from the same post
39
+        if ($data === false) {
40
+            //slug is not unique, but could be from the same post
40 41
         {
41 42
             $slugOfId = $postModel->getPostSlugFromId($postId);
43
+        }
42 44
             if ($slugOfId === $postSlug) {
43 45
                 //it's the same post, return true
44 46
                 $data = true;
Please login to merge, or discard this patch.
Core/Modules/AlertBox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
App/Controllers/Ajax/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Core\JsonException;
9 9
 use Core\Traits\StringFunctions;
10 10
 
11
-class User  extends AjaxController{
11
+class User  extends AjaxController {
12 12
 
13 13
     use StringFunctions;
14 14
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         //the router needs a parameter with get functions else throsw a wobbly
26 26
         //we pass a get variable and call the /controller/function/get?bla
27 27
         //for better use and security, we must pass "get" as the parameter
28
-        if(!$this->startsWith(strtolower($get),"get"))
28
+        if (!$this->startsWith(strtolower($get), "get"))
29 29
         {
30 30
             throw new JsonException("invalid call");
31 31
         }
Please login to merge, or discard this patch.
App/Controllers/Login.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
     /**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         }
164 164
 
165 165
         $authUser = $this->userModel->authenticateUser($email, $password);
166
-        if(!$authUser)
166
+        if (!$authUser)
167 167
         {
168 168
             $error = true;
169 169
             $loginErrors->password = "Incorrect Password";
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         //we are authenticated here
179 179
 
180 180
         //populate the user object with returned data
181
-        $this->populateUser((array)$authUser);
181
+        $this->populateUser((array) $authUser);
182 182
         $this->setUserSession();
183 183
 
184 184
         //if all is valid, redirect to user admin page
Please login to merge, or discard this patch.
Core/Controller.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
         $loadModuleObj = $this->getModuleNamespace($loadModule);
107 107
         //Modules must be children of the Module template
108 108
         if (!is_subclass_of($loadModuleObj, 'Core\Modules\Module')) {
109
-            throw new \ErrorException('Module ' . $loadModuleName . ' must be a sub class of module');
109
+            throw new \ErrorException('Module '.$loadModuleName.' must be a sub class of module');
110 110
         }
111 111
         $loadedModule = new $loadModuleObj($this->container);
112 112
         //we are not allowed to create public modules, they must be a placeholder ready
113 113
         if (!property_exists($this, $loadModuleName)) {
114
-            throw new \ErrorException('the protected or private variable of ' . $loadModuleName . ' is not present');
114
+            throw new \ErrorException('the protected or private variable of '.$loadModuleName.' is not present');
115 115
         }
116 116
         $this->$loadModuleName = $loadedModule;
117 117
     }
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
         $childClass = new \ReflectionClass(get_class($this));
129 129
         $childClassNamespace = $childClass->getNamespaceName();
130 130
         //check in classNameSpace
131
-        if (class_exists($childClassNamespace . '\\Modules\\' . $loadModule)) {
132
-            $this->addToDevHelper('module ' . $loadModule . ' loaded', $childClassNamespace . '\\' . $loadModule);
133
-            return $childClassNamespace . '\\' . $loadModule;
131
+        if (class_exists($childClassNamespace.'\\Modules\\'.$loadModule)) {
132
+            $this->addToDevHelper('module '.$loadModule.' loaded', $childClassNamespace.'\\'.$loadModule);
133
+            return $childClassNamespace.'\\'.$loadModule;
134 134
         }
135 135
         //check in app
136
-        if (class_exists('App\\Modules\\' . $loadModule)) {
137
-            $this->addToDevHelper('module ' . $loadModule . ' loaded', 'App\\Modules\\' . $loadModule);
138
-            return 'App\\Modules\\' . $loadModule;
136
+        if (class_exists('App\\Modules\\'.$loadModule)) {
137
+            $this->addToDevHelper('module '.$loadModule.' loaded', 'App\\Modules\\'.$loadModule);
138
+            return 'App\\Modules\\'.$loadModule;
139 139
         }
140 140
         //check in core, send error popup if overcharged
141
-        if (class_exists('Core\\Modules\\' . $loadModule)) {
142
-            $this->addToDevHelper('module ' . $loadModule . ' loaded', 'Core\\Modules\\' . $loadModule);
143
-            return 'Core\\Modules\\' . $loadModule;
141
+        if (class_exists('Core\\Modules\\'.$loadModule)) {
142
+            $this->addToDevHelper('module '.$loadModule.' loaded', 'Core\\Modules\\'.$loadModule);
143
+            return 'Core\\Modules\\'.$loadModule;
144 144
         }
145 145
 
146 146
         //if we are here then no module found
147
-        throw new \ErrorException('module ' . $loadModule . ' does not exist or not loaded');
147
+        throw new \ErrorException('module '.$loadModule.' does not exist or not loaded');
148 148
 
149 149
     }
150 150
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function getView($template)
170 170
     {
171 171
         $twig = $this->container->getTemplate();
172
-        return $twig->render($template . '.twig', $this->data);
172
+        return $twig->render($template.'.twig', $this->data);
173 173
     }
174 174
 
175 175
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         }
196 196
 
197 197
         $twig = $this->container->getTemplate();
198
-        $twig->display($template . '.twig', $this->data);
198
+        $twig->display($template.'.twig', $this->data);
199 199
     }
200 200
 
201 201
     /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     protected function addToDevHelper($name, $var)
228 228
     {
229 229
         //only populate if in dev environment
230
-        if (Config::DEV_ENVIRONMENT){
230
+        if (Config::DEV_ENVIRONMENT) {
231 231
             $classMethods = [];
232 232
             $classMethods[$name] = $var;
233 233
             if (!isset($this->data['dev_info'])) {
Please login to merge, or discard this patch.
App/Controllers/Ajax/postModification.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
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);
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
         if (!$this->container->getRequest()->isPost()) {
49 49
             throw new \Core\JsonException('Call is not post');
50 50
         }
51
-        $state = (bool)($this->request->getData("state") === 'true'); //TODO test this element
52
-        $postId = (int)$this->request->getData("postId");
51
+        $state = (bool) ($this->request->getData("state") === 'true'); //TODO test this element
52
+        $postId = (int) $this->request->getData("postId");
53 53
 
54 54
         $result = array();
55 55
         $result["success"] = $this->postModule->setOnFrontPage(!$state, $postId);
Please login to merge, or discard this patch.
Core/Dependency/Session.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
      * return the entire session superglobal.
93 93
      * @return mixed
94 94
      */
95
-    public function getAllSessionVars(){
95
+    public function getAllSessionVars() {
96 96
         return $_SESSION;
97 97
     }
98 98
 
Please login to merge, or discard this patch.
App/Models/UserModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         //check if email is valid for sanity
69 69
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
70 70
             $email = htmlspecialchars($email);
71
-            throw new BlogocException("invalid email " . $email);
71
+            throw new BlogocException("invalid email ".$email);
72 72
         }
73 73
         $sql = "
74 74
             SELECT idusers, username, avatar, email, surname, name, creation_date, last_update, locked_out, role_name, role_level
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $this->bind(':roles_idroles', 1);
125 125
         $this->execute();
126 126
 
127
-        return (int)$this->dbh->lastInsertId();
127
+        return (int) $this->dbh->lastInsertId();
128 128
 
129 129
     }
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.