@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | //check if email is valid for sanity |
| 68 | 68 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
| 69 | 69 | $email = htmlspecialchars($email); |
| 70 | - throw new \Exception("invalid email " . $email); |
|
| 70 | + throw new \Exception("invalid email ".$email); |
|
| 71 | 71 | } |
| 72 | 72 | $sql = " |
| 73 | 73 | SELECT idusers, username, avatar, email, surname, name, creation_date, last_update, locked_out, role_name, role_level |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $this->bind(':roles_idroles', 1); |
| 124 | 124 | $this->execute(); |
| 125 | 125 | |
| 126 | - return (int)$this->dbh->lastInsertId(); |
|
| 126 | + return (int) $this->dbh->lastInsertId(); |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -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 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -106,12 +106,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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'])) { |