@@ -143,8 +143,7 @@ discard block |
||
| 143 | 143 | $data["messages"] = $validator->getMessages(); |
| 144 | 144 | throw new \Exception("Module config errros in user.config!", 300); |
| 145 | 145 | } |
| 146 | - } |
|
| 147 | - catch (\Exception $e) |
|
| 146 | + } catch (\Exception $e) |
|
| 148 | 147 | { |
| 149 | 148 | $file = str_replace('\\', '', __CLASS__); |
| 150 | 149 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -175,10 +174,11 @@ discard block |
||
| 175 | 174 | $layoutManager->setParams($data); |
| 176 | 175 | |
| 177 | 176 | # for AJAX requests! |
| 178 | - if ($c->isXmlHttpRequest()) |
|
| 179 | - $layoutManager->content(); |
|
| 180 | - else |
|
| 181 | - $layoutManager->fromTemplate($this, 'blank'); |
|
| 177 | + if ($c->isXmlHttpRequest()) { |
|
| 178 | + $layoutManager->content(); |
|
| 179 | + } else { |
|
| 180 | + $layoutManager->fromTemplate($this, 'blank'); |
|
| 181 | + } |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -15,23 +15,25 @@ |
||
| 15 | 15 | { |
| 16 | 16 | if (is_array($in)) |
| 17 | 17 | { |
| 18 | - if (array_key_exists($key, $in)) |
|
| 19 | - $in = $in[$key]; |
|
| 20 | - else |
|
| 21 | - return $value; |
|
| 18 | + if (array_key_exists($key, $in)) { |
|
| 19 | + $in = $in[$key]; |
|
| 20 | + } else { |
|
| 21 | + return $value; |
|
| 22 | + } |
|
| 23 | + } else { |
|
| 24 | + return $value; |
|
| 22 | 25 | } |
| 23 | - else |
|
| 24 | - return $value; |
|
| 25 | 26 | |
| 26 | 27 | $key = ($array) ? array_shift($array) : NULL; |
| 27 | 28 | |
| 28 | - if (!$key) |
|
| 29 | - return $in; |
|
| 29 | + if (!$key) { |
|
| 30 | + return $in; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | } while($key); |
| 34 | + } else { |
|
| 35 | + return $value; |
|
| 32 | 36 | } |
| 33 | - else |
|
| 34 | - return $value; |
|
| 35 | 37 | } |
| 36 | 38 | } |
| 37 | 39 | |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | private function getUserAdapter() |
| 26 | 26 | { |
| 27 | - if (!is_null($this->userAdapter)) |
|
| 28 | - return $this->userAdapter; |
|
| 27 | + if (!is_null($this->userAdapter)) { |
|
| 28 | + return $this->userAdapter; |
|
| 29 | + } |
|
| 29 | 30 | |
| 30 | 31 | $this->userAdapter = new EntityAdapter(new UserTbl(new User())); |
| 31 | 32 | |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | * when users log in. It should be an unique session id for the app to prevent bad redirections with other projects. |
| 49 | 50 | */ |
| 50 | 51 | # save only no XmlHttpRequest! |
| 51 | - if (!$c->isXmlHttpRequest()) |
|
| 52 | - $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"]; |
|
| 52 | + if (!$c->isXmlHttpRequest()) { |
|
| 53 | + $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"]; |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | # config constraints |
| 55 | 57 | $components = [ |
@@ -133,9 +135,9 @@ discard block |
||
| 133 | 135 | $c->stopExecution(false); |
| 134 | 136 | |
| 135 | 137 | header("location: " . $c->getBasePath() . "/public/" . $redirect); |
| 138 | + } else { |
|
| 139 | + $username_credential = $_COOKIE[$key]; |
|
| 136 | 140 | } |
| 137 | - else |
|
| 138 | - $username_credential = $_COOKIE[$key]; |
|
| 139 | 141 | |
| 140 | 142 | break; |
| 141 | 143 | |
@@ -147,9 +149,9 @@ discard block |
||
| 147 | 149 | $c->stopExecution(false); |
| 148 | 150 | |
| 149 | 151 | header("location: " . $c->getBasePath() . "/public/" . $redirect); |
| 152 | + } else { |
|
| 153 | + $username_credential = $_SESSION[$key]; |
|
| 150 | 154 | } |
| 151 | - else |
|
| 152 | - $username_credential = $_SESSION[$key]; |
|
| 153 | 155 | |
| 154 | 156 | break; |
| 155 | 157 | } |
@@ -161,10 +163,10 @@ discard block |
||
| 161 | 163 | $state_field = $config["authentication"]["gateway"]["table_info"]["columns"]["state_field"]; |
| 162 | 164 | $active_state = $config["authentication"]["gateway"]["table_info"]["column_values"]["state_field"]["user_active"]; |
| 163 | 165 | |
| 164 | - if ($user->{$state_field} != $active_state) |
|
| 165 | - throw new \Exception("The user has been inactived!. Please log-in again."); |
|
| 166 | - } |
|
| 167 | - catch (\Exception $e) |
|
| 166 | + if ($user->{$state_field} != $active_state) { |
|
| 167 | + throw new \Exception("The user has been inactived!. Please log-in again."); |
|
| 168 | + } |
|
| 169 | + } catch (\Exception $e) |
|
| 168 | 170 | { |
| 169 | 171 | $file = str_replace('\\', '', __CLASS__); |
| 170 | 172 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -194,10 +196,11 @@ discard block |
||
| 194 | 196 | $layoutManager->setParams($data); |
| 195 | 197 | |
| 196 | 198 | # for AJAX requests! |
| 197 | - if ($c->isXmlHttpRequest()) |
|
| 198 | - $layoutManager->content(); |
|
| 199 | - else |
|
| 200 | - $layoutManager->fromTemplate($this, 'blank'); |
|
| 199 | + if ($c->isXmlHttpRequest()) { |
|
| 200 | + $layoutManager->content(); |
|
| 201 | + } else { |
|
| 202 | + $layoutManager->fromTemplate($this, 'blank'); |
|
| 203 | + } |
|
| 201 | 204 | } |
| 202 | 205 | } |
| 203 | 206 | |
@@ -207,8 +210,9 @@ discard block |
||
| 207 | 210 | |
| 208 | 211 | if (array_key_exists('locale', $_GET)) |
| 209 | 212 | { |
| 210 | - if (in_array($_GET['locale'], ['en', 'es', 'fr'])) |
|
| 211 | - $_SESSION["LOCALE"] = $_GET['locale']; |
|
| 213 | + if (in_array($_GET['locale'], ['en', 'es', 'fr'])) { |
|
| 214 | + $_SESSION["LOCALE"] = $_GET['locale']; |
|
| 215 | + } |
|
| 212 | 216 | } |
| 213 | 217 | |
| 214 | 218 | $locale = (array_key_exists('LOCALE', $_SESSION)) ? $_SESSION["LOCALE"] : $config["environment"]["locale"]; |
@@ -15,23 +15,25 @@ |
||
| 15 | 15 | { |
| 16 | 16 | if (is_array($in)) |
| 17 | 17 | { |
| 18 | - if (array_key_exists($key, $in)) |
|
| 19 | - $in = $in[$key]; |
|
| 20 | - else |
|
| 21 | - return $value; |
|
| 18 | + if (array_key_exists($key, $in)) { |
|
| 19 | + $in = $in[$key]; |
|
| 20 | + } else { |
|
| 21 | + return $value; |
|
| 22 | + } |
|
| 23 | + } else { |
|
| 24 | + return $value; |
|
| 22 | 25 | } |
| 23 | - else |
|
| 24 | - return $value; |
|
| 25 | 26 | |
| 26 | 27 | $key = ($array) ? array_shift($array) : NULL; |
| 27 | 28 | |
| 28 | - if (!$key) |
|
| 29 | - return $in; |
|
| 29 | + if (!$key) { |
|
| 30 | + return $in; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | } while($key); |
| 34 | + } else { |
|
| 35 | + return $value; |
|
| 32 | 36 | } |
| 33 | - else |
|
| 34 | - return $value; |
|
| 35 | 37 | } |
| 36 | 38 | } |
| 37 | 39 | |
@@ -15,23 +15,25 @@ |
||
| 15 | 15 | { |
| 16 | 16 | if (is_array($in)) |
| 17 | 17 | { |
| 18 | - if (array_key_exists($key, $in)) |
|
| 19 | - $in = $in[$key]; |
|
| 20 | - else |
|
| 21 | - return $value; |
|
| 18 | + if (array_key_exists($key, $in)) { |
|
| 19 | + $in = $in[$key]; |
|
| 20 | + } else { |
|
| 21 | + return $value; |
|
| 22 | + } |
|
| 23 | + } else { |
|
| 24 | + return $value; |
|
| 22 | 25 | } |
| 23 | - else |
|
| 24 | - return $value; |
|
| 25 | 26 | |
| 26 | 27 | $key = ($array) ? array_shift($array) : NULL; |
| 27 | 28 | |
| 28 | - if (!$key) |
|
| 29 | - return $in; |
|
| 29 | + if (!$key) { |
|
| 30 | + return $in; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | } while($key); |
| 34 | + } else { |
|
| 35 | + return $value; |
|
| 32 | 36 | } |
| 33 | - else |
|
| 34 | - return $value; |
|
| 35 | 37 | } |
| 36 | 38 | } |
| 37 | 39 | |