@@ -12,10 +12,10 @@ |
||
| 12 | 12 | require_once("vendor/autoload.php"); |
| 13 | 13 | |
| 14 | 14 | try { |
| 15 | - $mvc = new Drone\Mvc\Application(include "config/application.config.php"); |
|
| 16 | - $mvc->run(); |
|
| 15 | + $mvc = new Drone\Mvc\Application(include "config/application.config.php"); |
|
| 16 | + $mvc->run(); |
|
| 17 | 17 | } |
| 18 | 18 | catch (Drone\Mvc\PageNotFoundException $e) |
| 19 | 19 | { |
| 20 | - die('Error 404 (Page Not Found)!!'); |
|
| 20 | + die('Error 404 (Page Not Found)!!'); |
|
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | date_default_timezone_set("America/Bogota"); |
| 7 | 7 | |
| 8 | 8 | // Memory limit |
| 9 | -ini_set("memory_limit","256M"); |
|
| 9 | +ini_set("memory_limit", "256M"); |
|
| 10 | 10 | |
| 11 | 11 | // Run application |
| 12 | 12 | require_once("vendor/autoload.php"); |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | try { |
| 15 | 15 | $mvc = new Drone\Mvc\Application(include "config/application.config.php"); |
| 16 | 16 | $mvc->run(); |
| 17 | -} |
|
| 18 | -catch (Drone\Mvc\PageNotFoundException $e) |
|
| 17 | +} catch (Drone\Mvc\PageNotFoundException $e) |
|
| 19 | 18 | { |
| 20 | 19 | die('Error 404 (Page Not Found)!!'); |
| 21 | 20 | } |
| 22 | 21 | \ No newline at end of file |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $http = new Http(); |
| 87 | 87 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 88 | 88 | |
| 89 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 89 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $this->checkSession(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $http = new Http(); |
| 117 | 117 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 118 | 118 | |
| 119 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 119 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $http = new Http(); |
| 129 | 129 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 130 | 130 | |
| 131 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 131 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | 134 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | foreach ($errors as $errno => $error) |
| 269 | 269 | { |
| 270 | 270 | $errorInformation .= |
| 271 | - "<strong style='color: #a94442'>". |
|
| 271 | + "<strong style='color: #a94442'>" . |
|
| 272 | 272 | $method |
| 273 | 273 | . "</strong>: <span style='color: #e24f4c'>{$error}</span> \n<br />"; |
| 274 | 274 | } |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | private function getUsersAdapter() |
| 28 | 28 | { |
| 29 | - if (!is_null($this->usersAdapter)) |
|
| 30 | - return $this->usersAdapter; |
|
| 29 | + if (!is_null($this->usersAdapter)) { |
|
| 30 | + return $this->usersAdapter; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | $this->usersAdapter = new EntityAdapter(new TableGateway(new User())); |
| 33 | 34 | |
@@ -51,10 +52,11 @@ discard block |
||
| 51 | 52 | |
| 52 | 53 | if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
| 53 | 54 | { |
| 54 | - if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) |
|
| 55 | - header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 56 | - else |
|
| 57 | - header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 55 | + if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) { |
|
| 56 | + header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 57 | + } else { |
|
| 58 | + header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 59 | + } |
|
| 58 | 60 | } |
| 59 | 61 | |
| 60 | 62 | break; |
@@ -63,10 +65,11 @@ discard block |
||
| 63 | 65 | |
| 64 | 66 | if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) |
| 65 | 67 | { |
| 66 | - if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) |
|
| 67 | - header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 68 | - else |
|
| 69 | - header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 68 | + if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) { |
|
| 69 | + header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 70 | + } else { |
|
| 71 | + header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 72 | + } |
|
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | break; |
@@ -187,21 +190,24 @@ discard block |
||
| 187 | 190 | "$username_str" => $post["username"] |
| 188 | 191 | ]); |
| 189 | 192 | |
| 190 | - if (!count($row)) |
|
| 191 | - throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 193 | + if (!count($row)) { |
|
| 194 | + throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 195 | + } |
|
| 192 | 196 | |
| 193 | 197 | $user = array_shift($row); |
| 194 | 198 | |
| 195 | 199 | $securePass = $user->{$password_str}; |
| 196 | 200 | $password = $post["password"]; |
| 197 | 201 | |
| 198 | - if ($user->USER_STATE_ID == 1) |
|
| 199 | - throw new \Drone\Exception\Exception("User pending of email checking!"); |
|
| 202 | + if ($user->USER_STATE_ID == 1) { |
|
| 203 | + throw new \Drone\Exception\Exception("User pending of email checking!"); |
|
| 204 | + } |
|
| 200 | 205 | |
| 201 | 206 | $bcrypt = new Bcrypt(); |
| 202 | 207 | |
| 203 | - if (!$bcrypt->verify($password, $securePass)) |
|
| 204 | - throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 208 | + if (!$bcrypt->verify($password, $securePass)) { |
|
| 209 | + throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 210 | + } |
|
| 205 | 211 | |
| 206 | 212 | $key = $config["authentication"]["key"]; |
| 207 | 213 | $method = $config["authentication"]["method"]; |
@@ -219,14 +225,12 @@ discard block |
||
| 219 | 225 | |
| 220 | 226 | # SUCCESS-MESSAGE |
| 221 | 227 | $data["process"] = "success"; |
| 222 | - } |
|
| 223 | - catch (\Drone\Exception\Exception $e) |
|
| 228 | + } catch (\Drone\Exception\Exception $e) |
|
| 224 | 229 | { |
| 225 | 230 | # ERROR-MESSAGE |
| 226 | 231 | $data["process"] = "warning"; |
| 227 | 232 | $data["message"] = $e->getMessage(); |
| 228 | - } |
|
| 229 | - catch (\Exception $e) |
|
| 233 | + } catch (\Exception $e) |
|
| 230 | 234 | { |
| 231 | 235 | $file = str_replace('\\', '', __CLASS__); |
| 232 | 236 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -241,8 +245,9 @@ discard block |
||
| 241 | 245 | } |
| 242 | 246 | |
| 243 | 247 | # errors retrived by the use of ErrorTrait |
| 244 | - if (count($this->getErrors())) |
|
| 245 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 248 | + if (count($this->getErrors())) { |
|
| 249 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 250 | + } |
|
| 246 | 251 | |
| 247 | 252 | $data["code"] = $errorCode; |
| 248 | 253 | $data["message"] = $e->getMessage(); |
@@ -278,15 +283,16 @@ discard block |
||
| 278 | 283 | if (!$hd || !@fwrite($hd, $errorInformation)) |
| 279 | 284 | { |
| 280 | 285 | # error storing are not mandatory! |
| 286 | + } else { |
|
| 287 | + @fclose($hd); |
|
| 281 | 288 | } |
| 282 | - else |
|
| 283 | - @fclose($hd); |
|
| 284 | 289 | |
| 285 | 290 | $config = include 'config/application.config.php'; |
| 286 | 291 | $dev = $config["environment"]["dev_mode"]; |
| 287 | 292 | |
| 288 | - if ($dev) |
|
| 289 | - echo $errorInformation; |
|
| 293 | + if ($dev) { |
|
| 294 | + echo $errorInformation; |
|
| 295 | + } |
|
| 290 | 296 | } |
| 291 | 297 | } |
| 292 | 298 | } |
| 293 | 299 | \ No newline at end of file |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $http = new Http(); |
| 88 | 88 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 89 | 89 | |
| 90 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 90 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $this->checkSession(); |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | $data = []; |
| 107 | 107 | |
| 108 | 108 | # environment settings |
| 109 | - $post = $this->getPost(); # catch $_POST |
|
| 110 | - $this->setTerminal(true); # set terminal |
|
| 109 | + $post = $this->getPost(); # catch $_POST |
|
| 110 | + $this->setTerminal(true); # set terminal |
|
| 111 | 111 | |
| 112 | 112 | # TRY-CATCH-BLOCK |
| 113 | 113 | try { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $http = new Http(); |
| 119 | 119 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 120 | 120 | |
| 121 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 121 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $http = new Http(); |
| 131 | 131 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 132 | 132 | |
| 133 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 133 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | 136 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $headers = 'MIME-Version: 1.0' . "\r\n"; |
| 243 | 243 | $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; |
| 244 | - $headers .= 'From: '. $from ."\r\n". 'X-Mailer: PHP/' . phpversion(); |
|
| 244 | + $headers .= 'From: ' . $from . "\r\n" . 'X-Mailer: PHP/' . phpversion(); |
|
| 245 | 245 | |
| 246 | 246 | if (!@mail( |
| 247 | 247 | $post["email"], "Email checking!", |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $http = new Http(); |
| 322 | 322 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 323 | 323 | |
| 324 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 324 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $http = new Http(); |
| 334 | 334 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 335 | 335 | |
| 336 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 336 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 337 | 337 | } |
| 338 | 338 | }); |
| 339 | 339 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | foreach ($errors as $errno => $error) |
| 412 | 412 | { |
| 413 | 413 | $errorInformation .= |
| 414 | - "<strong style='color: #a94442'>". |
|
| 414 | + "<strong style='color: #a94442'>" . |
|
| 415 | 415 | $method |
| 416 | 416 | . "</strong>: <span style='color: #e24f4c'>{$error}</span> \n<br />"; |
| 417 | 417 | } |
@@ -27,8 +27,9 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | private function getUsersEntity() |
| 29 | 29 | { |
| 30 | - if (!is_null($this->usersEntity)) |
|
| 31 | - return $this->usersEntity; |
|
| 30 | + if (!is_null($this->usersEntity)) { |
|
| 31 | + return $this->usersEntity; |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | $this->usersEntity = new EntityAdapter(new UserTbl(new User())); |
| 34 | 35 | |
@@ -52,10 +53,11 @@ discard block |
||
| 52 | 53 | |
| 53 | 54 | if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
| 54 | 55 | { |
| 55 | - if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) |
|
| 56 | - header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 57 | - else |
|
| 58 | - header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 56 | + if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) { |
|
| 57 | + header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 58 | + } else { |
|
| 59 | + header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 60 | + } |
|
| 59 | 61 | } |
| 60 | 62 | |
| 61 | 63 | break; |
@@ -64,10 +66,11 @@ discard block |
||
| 64 | 66 | |
| 65 | 67 | if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) |
| 66 | 68 | { |
| 67 | - if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) |
|
| 68 | - header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 69 | - else |
|
| 70 | - header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 69 | + if (array_key_exists("CR_VAR_URL_REJECTED", $_SESSION) || !empty($_SESSION["CR_VAR_URL_REJECTED"])) { |
|
| 70 | + header("location: " . $_SESSION["CR_VAR_URL_REJECTED"]); |
|
| 71 | + } else { |
|
| 72 | + header("location: " . $this->basePath . "/public/" . $config["redirect"]); |
|
| 73 | + } |
|
| 71 | 74 | } |
| 72 | 75 | |
| 73 | 76 | break; |
@@ -136,8 +139,9 @@ discard block |
||
| 136 | 139 | |
| 137 | 140 | $this->checkSession(); |
| 138 | 141 | |
| 139 | - if ($post["password"] !== $post["password_confirm"]) |
|
| 140 | - throw new \Drone\Exception\Exception("The password fields are different!", 300); |
|
| 142 | + if ($post["password"] !== $post["password_confirm"]) { |
|
| 143 | + throw new \Drone\Exception\Exception("The password fields are different!", 300); |
|
| 144 | + } |
|
| 141 | 145 | |
| 142 | 146 | $components = [ |
| 143 | 147 | "attributes" => [ |
@@ -205,8 +209,9 @@ discard block |
||
| 205 | 209 | "USERNAME" => $post["username"] |
| 206 | 210 | ]); |
| 207 | 211 | |
| 208 | - if (count($row)) |
|
| 209 | - throw new \Drone\Exception\Exception("This username already exists!", 300); |
|
| 212 | + if (count($row)) { |
|
| 213 | + throw new \Drone\Exception\Exception("This username already exists!", 300); |
|
| 214 | + } |
|
| 210 | 215 | |
| 211 | 216 | $bcrypt = new Bcrypt(); |
| 212 | 217 | $securePass = $bcrypt->create($post["password"]); |
@@ -262,14 +267,12 @@ discard block |
||
| 262 | 267 | |
| 263 | 268 | # SUCCESS-MESSAGE |
| 264 | 269 | $data["process"] = "success"; |
| 265 | - } |
|
| 266 | - catch (\Drone\Exception\Exception $e) |
|
| 270 | + } catch (\Drone\Exception\Exception $e) |
|
| 267 | 271 | { |
| 268 | 272 | # ERROR-MESSAGE |
| 269 | 273 | $data["process"] = "warning"; |
| 270 | 274 | $data["message"] = $e->getMessage(); |
| 271 | - } |
|
| 272 | - catch (\Exception $e) |
|
| 275 | + } catch (\Exception $e) |
|
| 273 | 276 | { |
| 274 | 277 | $file = str_replace('\\', '', __CLASS__); |
| 275 | 278 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -284,8 +287,9 @@ discard block |
||
| 284 | 287 | } |
| 285 | 288 | |
| 286 | 289 | # errors retrived by the use of ErrorTrait |
| 287 | - if (count($this->getErrors())) |
|
| 288 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 290 | + if (count($this->getErrors())) { |
|
| 291 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 292 | + } |
|
| 289 | 293 | |
| 290 | 294 | $data["code"] = $errorCode; |
| 291 | 295 | $data["message"] = $e->getMessage(); |
@@ -346,13 +350,15 @@ discard block |
||
| 346 | 350 | "TOKEN" => $token |
| 347 | 351 | ]); |
| 348 | 352 | |
| 349 | - if (!count($row)) |
|
| 350 | - throw new \Drone\Exception\Exception("Token has expired or username does not exists!."); |
|
| 353 | + if (!count($row)) { |
|
| 354 | + throw new \Drone\Exception\Exception("Token has expired or username does not exists!."); |
|
| 355 | + } |
|
| 351 | 356 | |
| 352 | 357 | $user = array_shift($row); |
| 353 | 358 | |
| 354 | - if ($user->USER_STATE_ID <> 1) |
|
| 355 | - throw new \Drone\Exception\Exception("This email address had verified before!.", 300); |
|
| 359 | + if ($user->USER_STATE_ID <> 1) { |
|
| 360 | + throw new \Drone\Exception\Exception("This email address had verified before!.", 300); |
|
| 361 | + } |
|
| 356 | 362 | |
| 357 | 363 | $user->USER_STATE_ID = 2; |
| 358 | 364 | |
@@ -362,14 +368,12 @@ discard block |
||
| 362 | 368 | |
| 363 | 369 | # SUCCESS-MESSAGE |
| 364 | 370 | $data["process"] = "success"; |
| 365 | - } |
|
| 366 | - catch (\Drone\Exception\Exception $e) |
|
| 371 | + } catch (\Drone\Exception\Exception $e) |
|
| 367 | 372 | { |
| 368 | 373 | # ERROR-MESSAGE |
| 369 | 374 | $data["process"] = "warning"; |
| 370 | 375 | $data["message"] = $e->getMessage(); |
| 371 | - } |
|
| 372 | - catch (\Exception $e) |
|
| 376 | + } catch (\Exception $e) |
|
| 373 | 377 | { |
| 374 | 378 | $file = str_replace('\\', '', __CLASS__); |
| 375 | 379 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -384,8 +388,9 @@ discard block |
||
| 384 | 388 | } |
| 385 | 389 | |
| 386 | 390 | # errors retrived by the use of ErrorTrait |
| 387 | - if (count($this->getErrors())) |
|
| 388 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 391 | + if (count($this->getErrors())) { |
|
| 392 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 393 | + } |
|
| 389 | 394 | |
| 390 | 395 | $data["code"] = $errorCode; |
| 391 | 396 | $data["message"] = $e->getMessage(); |
@@ -421,15 +426,16 @@ discard block |
||
| 421 | 426 | if (!$hd || !@fwrite($hd, $errorInformation)) |
| 422 | 427 | { |
| 423 | 428 | # error storing are not mandatory! |
| 429 | + } else { |
|
| 430 | + @fclose($hd); |
|
| 424 | 431 | } |
| 425 | - else |
|
| 426 | - @fclose($hd); |
|
| 427 | 432 | |
| 428 | 433 | $config = include 'config/application.config.php'; |
| 429 | 434 | $dev = $config["environment"]["dev_mode"]; |
| 430 | 435 | |
| 431 | - if ($dev) |
|
| 432 | - echo $errorInformation; |
|
| 436 | + if ($dev) { |
|
| 437 | + echo $errorInformation; |
|
| 438 | + } |
|
| 433 | 439 | } |
| 434 | 440 | } |
| 435 | 441 | } |
| 436 | 442 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $http = new Http(); |
| 21 | 21 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 22 | 22 | |
| 23 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 23 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $config = include 'module/Auth/config/user.config.php'; |
@@ -30,8 +30,9 @@ |
||
| 30 | 30 | switch ($method) |
| 31 | 31 | { |
| 32 | 32 | case '_COOKIE': |
| 33 | - if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
|
| 34 | - setcookie($key, $_COOKIE[$key], time() - 1, '/'); |
|
| 33 | + if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) { |
|
| 34 | + setcookie($key, $_COOKIE[$key], time() - 1, '/'); |
|
| 35 | + } |
|
| 35 | 36 | break; |
| 36 | 37 | |
| 37 | 38 | case '_SESSION': |
@@ -21,9 +21,10 @@ |
||
| 21 | 21 | $db->setDbuser($user); |
| 22 | 22 | $db->setDbpass($pass); |
| 23 | 23 | |
| 24 | - if ($db->isConnected()) |
|
| 25 | - return $db->reconnect() |
|
| 24 | + if ($db->isConnected()) { |
|
| 25 | + return $db->reconnect() |
|
| 26 | 26 | else |
| 27 | 27 | return $db->connect(); |
| 28 | + } |
|
| 28 | 29 | } |
| 29 | 30 | } |
| 30 | 31 | \ No newline at end of file |
@@ -6,52 +6,52 @@ |
||
| 6 | 6 | |
| 7 | 7 | class User extends Entity |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var integer |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var integer |
|
| 11 | + */ |
|
| 12 | 12 | public $USER_ID; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 14 | + /** |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | 17 | public $USERNAME; |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var integer |
|
| 21 | - */ |
|
| 19 | + /** |
|
| 20 | + * @var integer |
|
| 21 | + */ |
|
| 22 | 22 | public $USER_STATE_ID; |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var integer |
|
| 26 | - */ |
|
| 24 | + /** |
|
| 25 | + * @var integer |
|
| 26 | + */ |
|
| 27 | 27 | public $ROLE_ID; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | public $USER_PASSWORD; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var string |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var string |
|
| 36 | + */ |
|
| 37 | 37 | public $EMAIL; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var string |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var string |
|
| 41 | + */ |
|
| 42 | 42 | public $TOKEN; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var date |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var date |
|
| 46 | + */ |
|
| 47 | 47 | public $RECORD_DATE; |
| 48 | 48 | |
| 49 | 49 | public function __construct($data = []) |
| 50 | 50 | { |
| 51 | - parent::__construct($data); |
|
| 51 | + parent::__construct($data); |
|
| 52 | 52 | |
| 53 | - $config = include 'module/Auth/config/user.config.php'; |
|
| 54 | - $table = $config["authentication"]["gateway"]["entity"]; |
|
| 53 | + $config = include 'module/Auth/config/user.config.php'; |
|
| 54 | + $table = $config["authentication"]["gateway"]["entity"]; |
|
| 55 | 55 | |
| 56 | 56 | $this->setTableName($table); |
| 57 | 57 | } |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class Module extends AbstractionModule |
| 11 | 11 | { |
| 12 | - public function init(AbstractionController $c) |
|
| 13 | - { |
|
| 14 | - $config = $this->getUserConfig(); |
|
| 15 | - $_config = $this->toFormConfig($config); |
|
| 12 | + public function init(AbstractionController $c) |
|
| 13 | + { |
|
| 14 | + $config = $this->getUserConfig(); |
|
| 15 | + $_config = $this->toFormConfig($config); |
|
| 16 | 16 | |
| 17 | - # config constraints |
|
| 17 | + # config constraints |
|
| 18 | 18 | |
| 19 | 19 | $components = [ |
| 20 | 20 | "attributes" => [ |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $this->setTranslator($c); |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | private function setTranslator(AbstractionController $c) |
| 86 | 86 | { |
@@ -102,30 +102,30 @@ discard block |
||
| 102 | 102 | $c->translator = new \Zend\Mvc\I18n\Translator($i18nTranslator); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function getUserConfig() |
|
| 106 | - { |
|
| 107 | - return include __DIR__ . "/config/user.config.php"; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - private function toFormConfig($config) |
|
| 111 | - { |
|
| 112 | - $new_config = []; |
|
| 113 | - $again = false; |
|
| 114 | - |
|
| 115 | - foreach ($config as $param => $configure) |
|
| 116 | - { |
|
| 117 | - if (is_array($configure)) |
|
| 118 | - { |
|
| 119 | - foreach ($configure as $key => $value) |
|
| 120 | - { |
|
| 121 | - $again = true; |
|
| 122 | - $new_config[$param . "_" . $key] = $value; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - else |
|
| 126 | - $new_config[$param] = $configure; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - return (!$again) ? $new_config : $this->toFormConfig($new_config); |
|
| 130 | - } |
|
| 105 | + public function getUserConfig() |
|
| 106 | + { |
|
| 107 | + return include __DIR__ . "/config/user.config.php"; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + private function toFormConfig($config) |
|
| 111 | + { |
|
| 112 | + $new_config = []; |
|
| 113 | + $again = false; |
|
| 114 | + |
|
| 115 | + foreach ($config as $param => $configure) |
|
| 116 | + { |
|
| 117 | + if (is_array($configure)) |
|
| 118 | + { |
|
| 119 | + foreach ($configure as $key => $value) |
|
| 120 | + { |
|
| 121 | + $again = true; |
|
| 122 | + $new_config[$param . "_" . $key] = $value; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + else |
|
| 126 | + $new_config[$param] = $configure; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + return (!$again) ? $new_config : $this->toFormConfig($new_config); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -121,9 +121,9 @@ |
||
| 121 | 121 | $again = true; |
| 122 | 122 | $new_config[$param . "_" . $key] = $value; |
| 123 | 123 | } |
| 124 | + } else { |
|
| 125 | + $new_config[$param] = $configure; |
|
| 124 | 126 | } |
| 125 | - else |
|
| 126 | - $new_config[$param] = $configure; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return (!$again) ? $new_config : $this->toFormConfig($new_config); |
@@ -3,12 +3,12 @@ |
||
| 3 | 3 | return [ |
| 4 | 4 | "Register form" => "Register form", |
| 5 | 5 | "User registering" => "User registering", |
| 6 | - "Username" => "Username", |
|
| 7 | - "username" => "username", |
|
| 8 | - "Email" => "Email", |
|
| 9 | - "email" => "email", |
|
| 10 | - "Password" => "Password", |
|
| 11 | - "password" => "password", |
|
| 6 | + "Username" => "Username", |
|
| 7 | + "username" => "username", |
|
| 8 | + "Email" => "Email", |
|
| 9 | + "email" => "email", |
|
| 10 | + "Password" => "Password", |
|
| 11 | + "password" => "password", |
|
| 12 | 12 | "Repeat your password" => "Repeat your password", |
| 13 | 13 | "Register now" => "Register now", |
| 14 | 14 | "Log in" => "Log in", |
@@ -1,25 +1,25 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'project' => [ |
|
| 5 | - 'name' => 'SQLWebManager', |
|
| 6 | - ], |
|
| 7 | - 'mail' => [ |
|
| 8 | - 'checking' => [ |
|
| 9 | - 'enabled' => false, |
|
| 10 | - 'from' => '[email protected]' |
|
| 11 | - ], |
|
| 12 | - ], |
|
| 13 | - "authentication" => [ |
|
| 14 | - "method" => "_COOKIE", |
|
| 15 | - "key" => "session_id", |
|
| 16 | - "gateway" => [ |
|
| 17 | - "entity" => "SWM_USERS", |
|
| 18 | - "credentials" => [ |
|
| 19 | - "username" => "USERNAME", |
|
| 20 | - "password" => "USER_PASSWORD" |
|
| 21 | - ] |
|
| 22 | - ] |
|
| 23 | - ], |
|
| 24 | - "redirect" => "Workarea" |
|
| 4 | + 'project' => [ |
|
| 5 | + 'name' => 'SQLWebManager', |
|
| 6 | + ], |
|
| 7 | + 'mail' => [ |
|
| 8 | + 'checking' => [ |
|
| 9 | + 'enabled' => false, |
|
| 10 | + 'from' => '[email protected]' |
|
| 11 | + ], |
|
| 12 | + ], |
|
| 13 | + "authentication" => [ |
|
| 14 | + "method" => "_COOKIE", |
|
| 15 | + "key" => "session_id", |
|
| 16 | + "gateway" => [ |
|
| 17 | + "entity" => "SWM_USERS", |
|
| 18 | + "credentials" => [ |
|
| 19 | + "username" => "USERNAME", |
|
| 20 | + "password" => "USER_PASSWORD" |
|
| 21 | + ] |
|
| 22 | + ] |
|
| 23 | + ], |
|
| 24 | + "redirect" => "Workarea" |
|
| 25 | 25 | ]; |
| 26 | 26 | \ No newline at end of file |