@@ -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 |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | $loadModuleObj = $this->getModuleNamespace($loadModule); |
85 | 85 | //Modules must be children of the Module template |
86 | 86 | if (!is_subclass_of($loadModuleObj, 'Core\Modules\Module')) { |
87 | - throw new \ErrorException('Module ' . $loadModuleName . ' must be a sub class of module'); |
|
87 | + throw new \ErrorException('Module '.$loadModuleName.' must be a sub class of module'); |
|
88 | 88 | } |
89 | 89 | $loadedModule = new $loadModuleObj($this->container); |
90 | 90 | //we are not allowed to create public modules, they must be a placeholder ready |
91 | 91 | if (!property_exists($this, $loadModuleName)) { |
92 | - throw new \ErrorException('the protected or private variable of ' . $loadModuleName . ' is not present'); |
|
92 | + throw new \ErrorException('the protected or private variable of '.$loadModuleName.' is not present'); |
|
93 | 93 | } |
94 | 94 | $this->$loadModuleName = $loadedModule; |
95 | 95 | } |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | $childClass = new \ReflectionClass(get_class($this)); |
107 | 107 | $childClassNamespace = $childClass->getNamespaceName(); |
108 | 108 | //check in classNameSpace |
109 | - if (class_exists($childClassNamespace . '\\Modules\\' . $loadModule)) { |
|
110 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', $childClassNamespace . '\\' . $loadModule); |
|
111 | - return $childClassNamespace . '\\' . $loadModule; |
|
109 | + if (class_exists($childClassNamespace.'\\Modules\\'.$loadModule)) { |
|
110 | + $this->addToDevHelper('module '.$loadModule.' loaded', $childClassNamespace.'\\'.$loadModule); |
|
111 | + return $childClassNamespace.'\\'.$loadModule; |
|
112 | 112 | } |
113 | 113 | //check in app |
114 | - if (class_exists('App\\Modules\\' . $loadModule)) { |
|
115 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'App\\Modules\\' . $loadModule); |
|
116 | - return 'App\\Modules\\' . $loadModule; |
|
114 | + if (class_exists('App\\Modules\\'.$loadModule)) { |
|
115 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'App\\Modules\\'.$loadModule); |
|
116 | + return 'App\\Modules\\'.$loadModule; |
|
117 | 117 | } |
118 | 118 | //check in core, send error popup if overcharged |
119 | - if (class_exists('Core\\Modules\\' . $loadModule)) { |
|
120 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'Core\\Modules\\' . $loadModule); |
|
121 | - return 'Core\\Modules\\' . $loadModule; |
|
119 | + if (class_exists('Core\\Modules\\'.$loadModule)) { |
|
120 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'Core\\Modules\\'.$loadModule); |
|
121 | + return 'Core\\Modules\\'.$loadModule; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | //if we are here then no module found |
125 | - throw new \ErrorException('module ' . $loadModule . ' does not exist or not loaded'); |
|
125 | + throw new \ErrorException('module '.$loadModule.' does not exist or not loaded'); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public function getView($template) |
148 | 148 | { |
149 | 149 | $twig = $this->container->getTemplate(); |
150 | - return $twig->render($template . '.twig', $this->data); |
|
150 | + return $twig->render($template.'.twig', $this->data); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->devHelper(); |
170 | 170 | } |
171 | 171 | $twig = $this->container->getTemplate(); |
172 | - $twig->display($template . '.twig', $this->data); |
|
172 | + $twig->display($template.'.twig', $this->data); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | protected function addToDevHelper($name, $var) |
202 | 202 | { |
203 | 203 | //only populate if in dev environment |
204 | - if (Config::DEV_ENVIRONMENT){ |
|
204 | + if (Config::DEV_ENVIRONMENT) { |
|
205 | 205 | $classMethods = []; |
206 | 206 | $classMethods[$name] = $var; |
207 | 207 | if (!isset($this->data['dev_info'])) { |
@@ -91,7 +91,7 @@ |
||
91 | 91 | * return the entire session superglobal. mainly for debugging purposes |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - public function getAllSessionVars(){ |
|
94 | + public function getAllSessionVars() { |
|
95 | 95 | return $_SESSION; |
96 | 96 | } |
97 | 97 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * fetches the result from an executed query |
102 | 102 | * @return array |
103 | 103 | */ |
104 | - protected function fetchAll(){ |
|
104 | + protected function fetchAll() { |
|
105 | 105 | return $this->stmt->fetchAll(); |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * returns a single line from the executed query |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - protected function fetch(){ |
|
112 | + protected function fetch() { |
|
113 | 113 | return $this->stmt->fetch(); |
114 | 114 | } |
115 | 115 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace |
137 | 137 | //since our models all end with Model, we should remove it. |
138 | 138 | $table = $this->removeFromEnd($table, 'Model'); |
139 | - $table = $table . 's'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
139 | + $table = $table.'s'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
140 | 140 | $table = strtolower($table); //the database names are in lowercase |
141 | 141 | } |
142 | 142 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | //if we are here, then table doesn't exist, check for view |
158 | - $view = 'v_' . $table; |
|
158 | + $view = 'v_'.$table; |
|
159 | 159 | $stmt->bindValue(':table', $view, PDO::PARAM_STR); |
160 | 160 | $stmt->execute(); |
161 | 161 | $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param $table string the table name |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - protected function getTablePrefix($table){ |
|
180 | - if(Config::TABLE_PREFIX != '') |
|
179 | + protected function getTablePrefix($table) { |
|
180 | + if (Config::TABLE_PREFIX != '') |
|
181 | 181 | { |
182 | 182 | $table = Config::TABLE_PREFIX.'_'.$table; |
183 | 183 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | protected function getRowById($rowId, $table = ''): array |
249 | 249 | { |
250 | 250 | $tableName = $this->getTable($table); |
251 | - $idName = 'id' . $tableName; |
|
251 | + $idName = 'id'.$tableName; |
|
252 | 252 | $sql = "SELECT * FROM $tableName WHERE $idName = :rowId"; |
253 | 253 | $this->query($sql); |
254 | 254 | $this->bind(':rowId', $rowId); |
@@ -7,11 +7,11 @@ |
||
7 | 7 | class Update extends AdminController { |
8 | 8 | |
9 | 9 | |
10 | - public function index(){ |
|
10 | + public function index() { |
|
11 | 11 | echo'TEST'; |
12 | 12 | } |
13 | 13 | |
14 | - public function updateConfig(){ |
|
14 | + public function updateConfig() { |
|
15 | 15 | //$this->onlyAdmin(); |
16 | 16 | echo '<pre>'; |
17 | 17 | var_dump($_POST); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * get the current uri for routing |
35 | 35 | * @return mixed |
36 | 36 | */ |
37 | - public function getUri(){ |
|
37 | + public function getUri() { |
|
38 | 38 | return $_SERVER['REQUEST_URI']; |
39 | 39 | } |
40 | 40 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $host = $_SERVER['HTTP_HOST']; |
69 | 69 | $https = !empty($_SERVER['HTTPS']) ? 'https' : 'http'; |
70 | - return $https . '://' . $host . '/'; |
|
70 | + return $https.'://'.$host.'/'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |