@@ -6,32 +6,32 @@ |
||
6 | 6 | |
7 | 7 | class Role extends Entity |
8 | 8 | { |
9 | - /** |
|
10 | - * @var integer |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var integer |
|
11 | + */ |
|
12 | 12 | public $ROLE_ID; |
13 | 13 | |
14 | - /** |
|
15 | - * @var string |
|
16 | - */ |
|
14 | + /** |
|
15 | + * @var string |
|
16 | + */ |
|
17 | 17 | public $ROLE_NAME; |
18 | 18 | |
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | 22 | public $STATE; |
23 | 23 | |
24 | - /** |
|
25 | - * @var date |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var date |
|
26 | + */ |
|
27 | 27 | public $RECORD_DATE; |
28 | 28 | |
29 | 29 | public function __construct($data = []) |
30 | 30 | { |
31 | - parent::__construct($data); |
|
31 | + parent::__construct($data); |
|
32 | 32 | |
33 | - $config = include 'module/Auth/config/user.config.php'; |
|
34 | - $prefix = $config["database"]["prefix"]; |
|
33 | + $config = include 'module/Auth/config/user.config.php'; |
|
34 | + $prefix = $config["database"]["prefix"]; |
|
35 | 35 | |
36 | 36 | $this->setTableName($prefix . "_" . "ROLE"); |
37 | 37 | } |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class DbUserRole extends Entity |
8 | 8 | { |
9 | - /** |
|
10 | - * @var string |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var string |
|
11 | + */ |
|
12 | 12 | public $USERNAME; |
13 | 13 | |
14 | 14 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $http = new Http(); |
94 | 94 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
95 | 95 | |
96 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
96 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $this->checkSession(); |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | $data = []; |
113 | 113 | |
114 | 114 | # environment settings |
115 | - $post = $this->getPost(); # catch $_POST |
|
116 | - $this->setTerminal(true); # set terminal |
|
115 | + $post = $this->getPost(); # catch $_POST |
|
116 | + $this->setTerminal(true); # set terminal |
|
117 | 117 | |
118 | 118 | # TRY-CATCH-BLOCK |
119 | 119 | try { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $http = new Http(); |
125 | 125 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
126 | 126 | |
127 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
127 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $http = new Http(); |
137 | 137 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
138 | 138 | |
139 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
139 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
140 | 140 | } |
141 | 141 | }); |
142 | 142 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | $this->getUserAdapter()->insert($user); |
249 | 249 | |
250 | - $link = $_SERVER["REQUEST_SCHEME"] .'://'. $_SERVER["HTTP_HOST"] . $this->getBasePath() . "/public/Auth/SingUp/verifyEmail/user/" . $post["username"] . "/token/" . $token; |
|
250 | + $link = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER["HTTP_HOST"] . $this->getBasePath() . "/public/Auth/SingUp/verifyEmail/user/" . $post["username"] . "/token/" . $token; |
|
251 | 251 | |
252 | 252 | if ($data["mail"]) |
253 | 253 | { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $http = new Http(); |
339 | 339 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
340 | 340 | |
341 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
341 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $http = new Http(); |
351 | 351 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
352 | 352 | |
353 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
353 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
354 | 354 | } |
355 | 355 | }); |
356 | 356 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | foreach ($errors as $errno => $error) |
438 | 438 | { |
439 | 439 | $errorInformation .= |
440 | - "<strong style='color: #a94442'>". |
|
440 | + "<strong style='color: #a94442'>" . |
|
441 | 441 | $method |
442 | 442 | . "</strong>: <span style='color: #e24f4c'>{$error}</span> \n<br />"; |
443 | 443 | } |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | */ |
28 | 28 | private function getUserAdapter() |
29 | 29 | { |
30 | - if (!is_null($this->userAdapter)) |
|
31 | - return $this->userAdapter; |
|
30 | + if (!is_null($this->userAdapter)) { |
|
31 | + return $this->userAdapter; |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->userAdapter = new EntityAdapter(new UserTbl(new User())); |
34 | 35 | |
@@ -57,24 +58,27 @@ discard block |
||
57 | 58 | * $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"]; |
58 | 59 | * It should be an unique session id for the app to prevent bad redirections with other projects. |
59 | 60 | */ |
60 | - if (array_key_exists("last_uri_" . $global_config["project"]["id"], $_SESSION) || !empty($_SESSION["last_uri_" . $global_config["project"]["id"]])) |
|
61 | - $location = $_SESSION["last_uri_" . $global_config["project"]["id"]]; |
|
62 | - else |
|
63 | - $location = $this->getBasePath() . "/public/" . $config["redirect"]; |
|
61 | + if (array_key_exists("last_uri_" . $global_config["project"]["id"], $_SESSION) || !empty($_SESSION["last_uri_" . $global_config["project"]["id"]])) { |
|
62 | + $location = $_SESSION["last_uri_" . $global_config["project"]["id"]]; |
|
63 | + } else { |
|
64 | + $location = $this->getBasePath() . "/public/" . $config["redirect"]; |
|
65 | + } |
|
64 | 66 | |
65 | 67 | switch ($method) |
66 | 68 | { |
67 | 69 | case '_COOKIE': |
68 | 70 | |
69 | - if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
|
70 | - header("location: " . $location); |
|
71 | + if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) { |
|
72 | + header("location: " . $location); |
|
73 | + } |
|
71 | 74 | |
72 | 75 | break; |
73 | 76 | |
74 | 77 | case '_SESSION': |
75 | 78 | |
76 | - if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) |
|
77 | - header("location: " . $location); |
|
79 | + if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) { |
|
80 | + header("location: " . $location); |
|
81 | + } |
|
78 | 82 | |
79 | 83 | break; |
80 | 84 | } |
@@ -142,8 +146,9 @@ discard block |
||
142 | 146 | |
143 | 147 | $this->checkSession(); |
144 | 148 | |
145 | - if ($post["password"] !== $post["password_confirm"]) |
|
146 | - throw new \Drone\Exception\Exception("The password fields are different!", 300); |
|
149 | + if ($post["password"] !== $post["password_confirm"]) { |
|
150 | + throw new \Drone\Exception\Exception("The password fields are different!", 300); |
|
151 | + } |
|
147 | 152 | |
148 | 153 | $components = [ |
149 | 154 | "attributes" => [ |
@@ -221,8 +226,9 @@ discard block |
||
221 | 226 | $username_str => $post["username"] |
222 | 227 | ]); |
223 | 228 | |
224 | - if (count($rowset)) |
|
225 | - throw new \Drone\Exception\Exception("This username already exists!", 300); |
|
229 | + if (count($rowset)) { |
|
230 | + throw new \Drone\Exception\Exception("This username already exists!", 300); |
|
231 | + } |
|
226 | 232 | |
227 | 233 | $bcrypt = new Bcrypt(); |
228 | 234 | $securePass = $bcrypt->create($post["password"]); |
@@ -279,14 +285,12 @@ discard block |
||
279 | 285 | |
280 | 286 | # SUCCESS-MESSAGE |
281 | 287 | $data["process"] = "success"; |
282 | - } |
|
283 | - catch (\Drone\Exception\Exception $e) |
|
288 | + } catch (\Drone\Exception\Exception $e) |
|
284 | 289 | { |
285 | 290 | # ERROR-MESSAGE |
286 | 291 | $data["process"] = "warning"; |
287 | 292 | $data["message"] = $e->getMessage(); |
288 | - } |
|
289 | - catch (\Exception $e) |
|
293 | + } catch (\Exception $e) |
|
290 | 294 | { |
291 | 295 | $file = str_replace('\\', '', __CLASS__); |
292 | 296 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -301,8 +305,9 @@ discard block |
||
301 | 305 | } |
302 | 306 | |
303 | 307 | # errors retrived by the use of ErrorTrait |
304 | - if (count($this->getErrors())) |
|
305 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
308 | + if (count($this->getErrors())) { |
|
309 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
310 | + } |
|
306 | 311 | |
307 | 312 | $data["code"] = $errorCode; |
308 | 313 | $data["message"] = $e->getMessage(); |
@@ -370,13 +375,15 @@ discard block |
||
370 | 375 | "TOKEN" => $token |
371 | 376 | ]); |
372 | 377 | |
373 | - if (!count($row)) |
|
374 | - throw new \Drone\Exception\Exception("Token has expired or username does not exists!."); |
|
378 | + if (!count($row)) { |
|
379 | + throw new \Drone\Exception\Exception("Token has expired or username does not exists!."); |
|
380 | + } |
|
375 | 381 | |
376 | 382 | $user = array_shift($row); |
377 | 383 | |
378 | - if ($user->{$state_field} <> $pending_state) |
|
379 | - throw new \Drone\Exception\Exception("This email address had verified before!.", 300); |
|
384 | + if ($user->{$state_field} <> $pending_state) { |
|
385 | + throw new \Drone\Exception\Exception("This email address had verified before!.", 300); |
|
386 | + } |
|
380 | 387 | |
381 | 388 | $user->exchangeArray([ |
382 | 389 | $state_field => $active_state |
@@ -388,14 +395,12 @@ discard block |
||
388 | 395 | |
389 | 396 | # SUCCESS-MESSAGE |
390 | 397 | $data["process"] = "success"; |
391 | - } |
|
392 | - catch (\Drone\Exception\Exception $e) |
|
398 | + } catch (\Drone\Exception\Exception $e) |
|
393 | 399 | { |
394 | 400 | # ERROR-MESSAGE |
395 | 401 | $data["process"] = "warning"; |
396 | 402 | $data["message"] = $e->getMessage(); |
397 | - } |
|
398 | - catch (\Exception $e) |
|
403 | + } catch (\Exception $e) |
|
399 | 404 | { |
400 | 405 | $file = str_replace('\\', '', __CLASS__); |
401 | 406 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -410,8 +415,9 @@ discard block |
||
410 | 415 | } |
411 | 416 | |
412 | 417 | # errors retrived by the use of ErrorTrait |
413 | - if (count($this->getErrors())) |
|
414 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
418 | + if (count($this->getErrors())) { |
|
419 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
420 | + } |
|
415 | 421 | |
416 | 422 | $data["code"] = $errorCode; |
417 | 423 | $data["message"] = $e->getMessage(); |
@@ -447,15 +453,16 @@ discard block |
||
447 | 453 | if (!$hd || !@fwrite($hd, $errorInformation)) |
448 | 454 | { |
449 | 455 | # error storing are not mandatory! |
456 | + } else { |
|
457 | + @fclose($hd); |
|
450 | 458 | } |
451 | - else |
|
452 | - @fclose($hd); |
|
453 | 459 | |
454 | 460 | $config = include 'config/application.config.php'; |
455 | 461 | $dev = $config["environment"]["dev_mode"]; |
456 | 462 | |
457 | - if ($dev) |
|
458 | - echo $errorInformation; |
|
463 | + if ($dev) { |
|
464 | + echo $errorInformation; |
|
465 | + } |
|
459 | 466 | } |
460 | 467 | } |
461 | 468 | } |
462 | 469 | \ No newline at end of file |
@@ -202,8 +202,8 @@ |
||
202 | 202 | $c->translator = new \Zend\Mvc\I18n\Translator($i18nTranslator); |
203 | 203 | } |
204 | 204 | |
205 | - public function getUserConfig() |
|
206 | - { |
|
207 | - return include __DIR__ . "/config/user.config.php"; |
|
208 | - } |
|
205 | + public function getUserConfig() |
|
206 | + { |
|
207 | + return include __DIR__ . "/config/user.config.php"; |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | \ No newline at end of file |
@@ -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 |
@@ -2,41 +2,41 @@ |
||
2 | 2 | |
3 | 3 | if (!function_exists('ifdef')) |
4 | 4 | { |
5 | - function ifdef($value, Array $array) |
|
6 | - { |
|
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
5 | + function ifdef($value, Array $array) |
|
6 | + { |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | - if (file_exists($global)) |
|
10 | - { |
|
11 | - $key = array_shift($array); |
|
12 | - $in = include $global; |
|
9 | + if (file_exists($global)) |
|
10 | + { |
|
11 | + $key = array_shift($array); |
|
12 | + $in = include $global; |
|
13 | 13 | |
14 | - do |
|
15 | - { |
|
16 | - if (is_array($in)) |
|
17 | - { |
|
18 | - if (array_key_exists($key, $in)) |
|
19 | - $in = $in[$key]; |
|
20 | - else |
|
21 | - return $value; |
|
22 | - } |
|
23 | - else |
|
24 | - return $value; |
|
14 | + do |
|
15 | + { |
|
16 | + if (is_array($in)) |
|
17 | + { |
|
18 | + if (array_key_exists($key, $in)) |
|
19 | + $in = $in[$key]; |
|
20 | + else |
|
21 | + return $value; |
|
22 | + } |
|
23 | + else |
|
24 | + return $value; |
|
25 | 25 | |
26 | - $key = ($array) ? array_shift($array) : NULL; |
|
26 | + $key = ($array) ? array_shift($array) : NULL; |
|
27 | 27 | |
28 | - if (!$key) |
|
29 | - return $in; |
|
28 | + if (!$key) |
|
29 | + return $in; |
|
30 | 30 | |
31 | - } while($key); |
|
32 | - } |
|
33 | - else |
|
34 | - return $value; |
|
35 | - } |
|
31 | + } while($key); |
|
32 | + } |
|
33 | + else |
|
34 | + return $value; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return [ |
39 | - 'project' => [ |
|
40 | - 'name' => ifdef('PROTOTYPE4', ["project", "name"]), # The name of your project |
|
41 | - ], |
|
39 | + 'project' => [ |
|
40 | + 'name' => ifdef('PROTOTYPE4', ["project", "name"]), # The name of your project |
|
41 | + ], |
|
42 | 42 | ]; |
43 | 43 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | function ifdef($value, Array $array) |
6 | 6 | { |
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | 9 | if (file_exists($global)) |
10 | 10 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (!$key) |
29 | 29 | return $in; |
30 | 30 | |
31 | - } while($key); |
|
31 | + } while ($key); |
|
32 | 32 | } |
33 | 33 | else |
34 | 34 | return $value; |
@@ -37,6 +37,6 @@ discard block |
||
37 | 37 | |
38 | 38 | return [ |
39 | 39 | 'project' => [ |
40 | - 'name' => ifdef('PROTOTYPE4', ["project", "name"]), # The name of your project |
|
40 | + 'name' => ifdef('PROTOTYPE4', ["project", "name"]), # The name of your project |
|
41 | 41 | ], |
42 | 42 | ]; |
43 | 43 | \ No newline at end of file |
@@ -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 |
@@ -7,25 +7,25 @@ |
||
7 | 7 | |
8 | 8 | class Error extends AbstractionController |
9 | 9 | { |
10 | - public function notFound() |
|
11 | - { |
|
12 | - $this->setShowView(false); |
|
13 | - $this->setLayout('HTTP404'); |
|
10 | + public function notFound() |
|
11 | + { |
|
12 | + $this->setShowView(false); |
|
13 | + $this->setLayout('HTTP404'); |
|
14 | 14 | |
15 | 15 | $http = new Http(); |
16 | 16 | $http->writeStatus($http::HTTP_NOT_FOUND); |
17 | 17 | |
18 | - return []; |
|
19 | - } |
|
18 | + return []; |
|
19 | + } |
|
20 | 20 | |
21 | - public function notFoundView() |
|
22 | - { |
|
23 | - $this->setLayout('blank'); |
|
24 | - //$this->setTerminal(true); |
|
21 | + public function notFoundView() |
|
22 | + { |
|
23 | + $this->setLayout('blank'); |
|
24 | + //$this->setTerminal(true); |
|
25 | 25 | |
26 | 26 | $http = new Http(); |
27 | 27 | $http->writeStatus($http::HTTP_NOT_FOUND); |
28 | 28 | |
29 | - return []; |
|
30 | - } |
|
29 | + return []; |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'project' => [ |
5 | - 'id' => 'id6447896', # Unique ID for the project |
|
6 | - 'name' => 'SQLWebManager' # The name of your project |
|
5 | + 'id' => 'id6447896', # Unique ID for the project |
|
6 | + 'name' => 'SQLWebManager' # The name of your project |
|
7 | 7 | ], |
8 | - 'mail' => [ |
|
9 | - "noreply" => "", |
|
10 | - "host" => "" |
|
11 | - ], |
|
12 | - "authentication" => [ |
|
13 | - "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | - "key" => "session_id6448654", # the key in the array to store credentials |
|
15 | - ], |
|
16 | - "database" => [ |
|
17 | - /** TABLE PREFIX: |
|
18 | - * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
19 | - */ |
|
20 | - "prefix" => "SWM" |
|
21 | - ] |
|
8 | + 'mail' => [ |
|
9 | + "noreply" => "", |
|
10 | + "host" => "" |
|
11 | + ], |
|
12 | + "authentication" => [ |
|
13 | + "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | + "key" => "session_id6448654", # the key in the array to store credentials |
|
15 | + ], |
|
16 | + "database" => [ |
|
17 | + /** TABLE PREFIX: |
|
18 | + * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
19 | + */ |
|
20 | + "prefix" => "SWM" |
|
21 | + ] |
|
22 | 22 | ]; |
23 | 23 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'project' => [ |
5 | - 'id' => 'id6447896', # Unique ID for the project |
|
5 | + 'id' => 'id6447896', # Unique ID for the project |
|
6 | 6 | 'name' => 'SQLWebManager' # The name of your project |
7 | 7 | ], |
8 | 8 | 'mail' => [ |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | "host" => "" |
11 | 11 | ], |
12 | 12 | "authentication" => [ |
13 | - "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | - "key" => "session_id6448654", # the key in the array to store credentials |
|
13 | + "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | + "key" => "session_id6448654", # the key in the array to store credentials |
|
15 | 15 | ], |
16 | 16 | "database" => [ |
17 | 17 | /** TABLE PREFIX: |
@@ -2,52 +2,52 @@ |
||
2 | 2 | |
3 | 3 | if (!function_exists('ifdef')) |
4 | 4 | { |
5 | - function ifdef($value, Array $array) |
|
6 | - { |
|
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
5 | + function ifdef($value, Array $array) |
|
6 | + { |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | - if (file_exists($global)) |
|
10 | - { |
|
11 | - $key = array_shift($array); |
|
12 | - $in = include $global; |
|
9 | + if (file_exists($global)) |
|
10 | + { |
|
11 | + $key = array_shift($array); |
|
12 | + $in = include $global; |
|
13 | 13 | |
14 | - do |
|
15 | - { |
|
16 | - if (is_array($in)) |
|
17 | - { |
|
18 | - if (array_key_exists($key, $in)) |
|
19 | - $in = $in[$key]; |
|
20 | - else |
|
21 | - return $value; |
|
22 | - } |
|
23 | - else |
|
24 | - return $value; |
|
14 | + do |
|
15 | + { |
|
16 | + if (is_array($in)) |
|
17 | + { |
|
18 | + if (array_key_exists($key, $in)) |
|
19 | + $in = $in[$key]; |
|
20 | + else |
|
21 | + return $value; |
|
22 | + } |
|
23 | + else |
|
24 | + return $value; |
|
25 | 25 | |
26 | - $key = ($array) ? array_shift($array) : NULL; |
|
26 | + $key = ($array) ? array_shift($array) : NULL; |
|
27 | 27 | |
28 | - if (!$key) |
|
29 | - return $in; |
|
28 | + if (!$key) |
|
29 | + return $in; |
|
30 | 30 | |
31 | - } while($key); |
|
32 | - } |
|
33 | - else |
|
34 | - return $value; |
|
35 | - } |
|
31 | + } while($key); |
|
32 | + } |
|
33 | + else |
|
34 | + return $value; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return [ |
39 | - 'project' => [ |
|
40 | - 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | - ], |
|
42 | - "authentication" => [ |
|
43 | - "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
44 | - "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
45 | - ], |
|
46 | - "database" => [ |
|
47 | - /** TABLE PREFIX: |
|
48 | - * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
49 | - */ |
|
50 | - "prefix" => ifdef('APP', ["database", "prefix"]) |
|
51 | - ], |
|
52 | - "redirect" => "Auth" # where users will be redirect to if the they aren't logged in |
|
39 | + 'project' => [ |
|
40 | + 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | + ], |
|
42 | + "authentication" => [ |
|
43 | + "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
44 | + "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
45 | + ], |
|
46 | + "database" => [ |
|
47 | + /** TABLE PREFIX: |
|
48 | + * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
49 | + */ |
|
50 | + "prefix" => ifdef('APP', ["database", "prefix"]) |
|
51 | + ], |
|
52 | + "redirect" => "Auth" # where users will be redirect to if the they aren't logged in |
|
53 | 53 | ]; |
54 | 54 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | function ifdef($value, Array $array) |
6 | 6 | { |
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | 9 | if (file_exists($global)) |
10 | 10 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (!$key) |
29 | 29 | return $in; |
30 | 30 | |
31 | - } while($key); |
|
31 | + } while ($key); |
|
32 | 32 | } |
33 | 33 | else |
34 | 34 | return $value; |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | |
38 | 38 | return [ |
39 | 39 | 'project' => [ |
40 | - 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
40 | + 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | 41 | ], |
42 | 42 | "authentication" => [ |
43 | - "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
44 | - "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
43 | + "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
44 | + "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
45 | 45 | ], |
46 | 46 | "database" => [ |
47 | 47 | /** TABLE PREFIX: |
@@ -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"]; |