@@ -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"); |
@@ -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 | } |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | private function getUserAdapter() |
| 41 | 41 | { |
| 42 | - if (!is_null($this->userAdapter)) |
|
| 43 | - return $this->userAdapter; |
|
| 42 | + if (!is_null($this->userAdapter)) { |
|
| 43 | + return $this->userAdapter; |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | $this->userAdapter = new EntityAdapter(new TableGateway(new User())); |
| 46 | 47 | |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | */ |
| 53 | 54 | private function getUserRoleAdapter() |
| 54 | 55 | { |
| 55 | - if (!is_null($this->userRoleAdapter)) |
|
| 56 | - return $this->userRoleAdapter; |
|
| 56 | + if (!is_null($this->userRoleAdapter)) { |
|
| 57 | + return $this->userRoleAdapter; |
|
| 58 | + } |
|
| 57 | 59 | |
| 58 | 60 | $this->userRoleAdapter = new EntityAdapter(new TableGateway(new UserRole())); |
| 59 | 61 | |
@@ -65,8 +67,9 @@ discard block |
||
| 65 | 67 | */ |
| 66 | 68 | private function getDbUserRoleAdapter() |
| 67 | 69 | { |
| 68 | - if (!is_null($this->dbUserRoleAdapter)) |
|
| 69 | - return $this->dbUserRoleAdapter; |
|
| 70 | + if (!is_null($this->dbUserRoleAdapter)) { |
|
| 71 | + return $this->dbUserRoleAdapter; |
|
| 72 | + } |
|
| 70 | 73 | |
| 71 | 74 | $this->dbUserRoleAdapter = new EntityAdapter(new TableGateway(new DbUserRole())); |
| 72 | 75 | |
@@ -95,24 +98,27 @@ discard block |
||
| 95 | 98 | * $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"]; |
| 96 | 99 | * It should be an unique session id for the app to prevent bad redirections with other projects. |
| 97 | 100 | */ |
| 98 | - if (array_key_exists("last_uri_" . $global_config["project"]["id"], $_SESSION) || !empty($_SESSION["last_uri_" . $global_config["project"]["id"]])) |
|
| 99 | - $location = $_SESSION["last_uri_" . $global_config["project"]["id"]]; |
|
| 100 | - else |
|
| 101 | - $location = $this->getBasePath() . "/public/" . $config["redirect"]; |
|
| 101 | + if (array_key_exists("last_uri_" . $global_config["project"]["id"], $_SESSION) || !empty($_SESSION["last_uri_" . $global_config["project"]["id"]])) { |
|
| 102 | + $location = $_SESSION["last_uri_" . $global_config["project"]["id"]]; |
|
| 103 | + } else { |
|
| 104 | + $location = $this->getBasePath() . "/public/" . $config["redirect"]; |
|
| 105 | + } |
|
| 102 | 106 | |
| 103 | 107 | switch ($method) |
| 104 | 108 | { |
| 105 | 109 | case '_COOKIE': |
| 106 | 110 | |
| 107 | - if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
|
| 108 | - header("location: " . $location); |
|
| 111 | + if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) { |
|
| 112 | + header("location: " . $location); |
|
| 113 | + } |
|
| 109 | 114 | |
| 110 | 115 | break; |
| 111 | 116 | |
| 112 | 117 | case '_SESSION': |
| 113 | 118 | |
| 114 | - if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) |
|
| 115 | - header("location: " . $location); |
|
| 119 | + if (array_key_exists($key, $_SESSION) || !empty($_SESSION[$key])) { |
|
| 120 | + header("location: " . $location); |
|
| 121 | + } |
|
| 116 | 122 | |
| 117 | 123 | break; |
| 118 | 124 | } |
@@ -241,14 +247,14 @@ discard block |
||
| 241 | 247 | $username_str => strtoupper($post["username"]) |
| 242 | 248 | ]); |
| 243 | 249 | |
| 244 | - if (!count($rowset)) |
|
| 245 | - throw new \Drone\Exception\Exception("Your user is not authorized to use this application!"); |
|
| 250 | + if (!count($rowset)) { |
|
| 251 | + throw new \Drone\Exception\Exception("Your user is not authorized to use this application!"); |
|
| 252 | + } |
|
| 246 | 253 | } |
| 247 | 254 | |
| 248 | 255 | $auth = new Authentication("default", false); |
| 249 | 256 | $result = $auth->authenticate($post["username"], $post["password"]); |
| 250 | - } |
|
| 251 | - catch (\Drone\Db\Driver\Exception\ConnectionException $e) |
|
| 257 | + } catch (\Drone\Db\Driver\Exception\ConnectionException $e) |
|
| 252 | 258 | { |
| 253 | 259 | throw new \Drone\Exception\Exception("Wrong user or password"); |
| 254 | 260 | } |
@@ -261,8 +267,9 @@ discard block |
||
| 261 | 267 | $username_str => $post["username"] |
| 262 | 268 | ]); |
| 263 | 269 | |
| 264 | - if (!count($rowset)) |
|
| 265 | - throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 270 | + if (!count($rowset)) { |
|
| 271 | + throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 272 | + } |
|
| 266 | 273 | |
| 267 | 274 | $user = array_shift($rowset); |
| 268 | 275 | |
@@ -274,23 +281,26 @@ discard block |
||
| 274 | 281 | $id_field => $user->{$id_field} |
| 275 | 282 | ]); |
| 276 | 283 | |
| 277 | - if (!count($rowset)) |
|
| 278 | - throw new \Drone\Exception\Exception("Your user is not authorized to use this application!"); |
|
| 284 | + if (!count($rowset)) { |
|
| 285 | + throw new \Drone\Exception\Exception("Your user is not authorized to use this application!"); |
|
| 286 | + } |
|
| 279 | 287 | } |
| 280 | 288 | |
| 281 | 289 | $state_field = $config["authentication"]["gateway"]["table_info"]["columns"]["state_field"]; |
| 282 | 290 | $state_pending_value = $config["authentication"]["gateway"]["table_info"]["column_values"]["state_field"]["pending_email"]; |
| 283 | 291 | |
| 284 | - if ($user->{$state_field} == $state_pending_value) |
|
| 285 | - throw new \Drone\Exception\Exception("User pending of email checking"); |
|
| 292 | + if ($user->{$state_field} == $state_pending_value) { |
|
| 293 | + throw new \Drone\Exception\Exception("User pending of email checking"); |
|
| 294 | + } |
|
| 286 | 295 | |
| 287 | 296 | $securePass = $user->{$password_str}; |
| 288 | 297 | $password = $post["password"]; |
| 289 | 298 | |
| 290 | 299 | $bcrypt = new Bcrypt(); |
| 291 | 300 | |
| 292 | - if (!$bcrypt->verify($password, $securePass)) |
|
| 293 | - throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 301 | + if (!$bcrypt->verify($password, $securePass)) { |
|
| 302 | + throw new \Drone\Exception\Exception("Username or password are incorrect"); |
|
| 303 | + } |
|
| 294 | 304 | |
| 295 | 305 | break; |
| 296 | 306 | |
@@ -315,14 +325,12 @@ discard block |
||
| 315 | 325 | |
| 316 | 326 | # SUCCESS-MESSAGE |
| 317 | 327 | $data["process"] = "success"; |
| 318 | - } |
|
| 319 | - catch (\Drone\Exception\Exception $e) |
|
| 328 | + } catch (\Drone\Exception\Exception $e) |
|
| 320 | 329 | { |
| 321 | 330 | # ERROR-MESSAGE |
| 322 | 331 | $data["process"] = "warning"; |
| 323 | 332 | $data["message"] = $e->getMessage(); |
| 324 | - } |
|
| 325 | - catch (\Exception $e) |
|
| 333 | + } catch (\Exception $e) |
|
| 326 | 334 | { |
| 327 | 335 | $file = str_replace('\\', '', __CLASS__); |
| 328 | 336 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -337,8 +345,9 @@ discard block |
||
| 337 | 345 | } |
| 338 | 346 | |
| 339 | 347 | # errors retrived by the use of ErrorTrait |
| 340 | - if (count($this->getErrors())) |
|
| 341 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 348 | + if (count($this->getErrors())) { |
|
| 349 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 350 | + } |
|
| 342 | 351 | |
| 343 | 352 | $data["code"] = $errorCode; |
| 344 | 353 | $data["message"] = $e->getMessage(); |
@@ -374,15 +383,16 @@ discard block |
||
| 374 | 383 | if (!$hd || !@fwrite($hd, $errorInformation)) |
| 375 | 384 | { |
| 376 | 385 | # error storing are not mandatory! |
| 386 | + } else { |
|
| 387 | + @fclose($hd); |
|
| 377 | 388 | } |
| 378 | - else |
|
| 379 | - @fclose($hd); |
|
| 380 | 389 | |
| 381 | 390 | $config = include 'config/application.config.php'; |
| 382 | 391 | $dev = $config["environment"]["dev_mode"]; |
| 383 | 392 | |
| 384 | - if ($dev) |
|
| 385 | - echo $errorInformation; |
|
| 393 | + if ($dev) { |
|
| 394 | + echo $errorInformation; |
|
| 395 | + } |
|
| 386 | 396 | } |
| 387 | 397 | } |
| 388 | 398 | } |
| 389 | 399 | \ 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 |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | $data = []; |
| 184 | 184 | |
| 185 | 185 | # environment settings |
| 186 | - $post = $this->getPost(); # catch $_POST |
|
| 187 | - $this->setTerminal(true); # set terminal |
|
| 186 | + $post = $this->getPost(); # catch $_POST |
|
| 187 | + $this->setTerminal(true); # set terminal |
|
| 188 | 188 | |
| 189 | 189 | # TRY-CATCH-BLOCK |
| 190 | 190 | try { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $http = new Http(); |
| 196 | 196 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 197 | 197 | |
| 198 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 198 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $idenfiers = $this->getIdentifiersEntity()->select([]); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $http = new Http(); |
| 213 | 213 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 214 | 214 | |
| 215 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 215 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 216 | 216 | } |
| 217 | 217 | }); |
| 218 | 218 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $http = new Http(); |
| 243 | 243 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 244 | 244 | |
| 245 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 245 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 246 | 246 | } |
| 247 | 247 | }); |
| 248 | 248 | |
@@ -361,14 +361,14 @@ discard block |
||
| 361 | 361 | $http = new Http(); |
| 362 | 362 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 363 | 363 | |
| 364 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 364 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | # data to send |
| 368 | 368 | $data = []; |
| 369 | 369 | |
| 370 | - $this->setTerminal(true); # set terminal |
|
| 371 | - $post = $this->getPost(); # catch $_POST |
|
| 370 | + $this->setTerminal(true); # set terminal |
|
| 371 | + $post = $this->getPost(); # catch $_POST |
|
| 372 | 372 | |
| 373 | 373 | $data["id"] = $post["id"]; |
| 374 | 374 | $data["conn"] = $post["conn"]; |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | $data = []; |
| 391 | 391 | |
| 392 | 392 | # environment settings |
| 393 | - $post = $this->getPost(); # catch $_POST |
|
| 394 | - $this->setTerminal(true); # set terminal |
|
| 393 | + $post = $this->getPost(); # catch $_POST |
|
| 394 | + $this->setTerminal(true); # set terminal |
|
| 395 | 395 | |
| 396 | 396 | # TRY-CATCH-BLOCK |
| 397 | 397 | try { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $http = new Http(); |
| 403 | 403 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 404 | 404 | |
| 405 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 405 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $http = new Http(); |
| 415 | 415 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 416 | 416 | |
| 417 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 417 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 418 | 418 | } |
| 419 | 419 | }); |
| 420 | 420 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $http = new Http(); |
| 545 | 545 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 546 | 546 | |
| 547 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 547 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | $row_start = $post["row_start"] + $step; |
@@ -694,11 +694,11 @@ discard block |
||
| 694 | 694 | |
| 695 | 695 | if (gettype($value) == 'object') |
| 696 | 696 | { |
| 697 | - if (get_class($value) == 'OCI-Lob') |
|
| 697 | + if (get_class($value) == 'OCI-Lob') |
|
| 698 | 698 | { |
| 699 | 699 | if (($val = @$value->load()) === false) |
| 700 | 700 | { |
| 701 | - $val = null; # only for default, this value is not used |
|
| 701 | + $val = null; # only for default, this value is not used |
|
| 702 | 702 | $column_errors[] = $column; |
| 703 | 703 | } |
| 704 | 704 | |
@@ -778,8 +778,8 @@ discard block |
||
| 778 | 778 | $data = []; |
| 779 | 779 | |
| 780 | 780 | # environment settings |
| 781 | - $post = $this->getPost(); # catch $_POST |
|
| 782 | - $this->setTerminal(true); # set terminal |
|
| 781 | + $post = $this->getPost(); # catch $_POST |
|
| 782 | + $this->setTerminal(true); # set terminal |
|
| 783 | 783 | |
| 784 | 784 | # TRY-CATCH-BLOCK |
| 785 | 785 | try { |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | $http = new Http(); |
| 791 | 791 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 792 | 792 | |
| 793 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 793 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $http = new Http(); |
| 803 | 803 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 804 | 804 | |
| 805 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 805 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 806 | 806 | } |
| 807 | 807 | }); |
| 808 | 808 | |
@@ -1085,11 +1085,11 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | if (gettype($value) == 'object') |
| 1087 | 1087 | { |
| 1088 | - if (get_class($value) == 'OCI-Lob') |
|
| 1088 | + if (get_class($value) == 'OCI-Lob') |
|
| 1089 | 1089 | { |
| 1090 | 1090 | if (($val = @$value->load()) === false) |
| 1091 | 1091 | { |
| 1092 | - $val = null; # only for default, this value is not used |
|
| 1092 | + $val = null; # only for default, this value is not used |
|
| 1093 | 1093 | $column_errors[] = $column; |
| 1094 | 1094 | } |
| 1095 | 1095 | |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | foreach ($column_names as $column_name) |
| 1113 | 1113 | { |
| 1114 | - $table .= "\t\t\t<td>". $row[$column_name] ."</td>\r\n"; |
|
| 1114 | + $table .= "\t\t\t<td>" . $row[$column_name] . "</td>\r\n"; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | $table .= "\t\t</tr>\r\n"; |
@@ -1153,11 +1153,11 @@ discard block |
||
| 1153 | 1153 | |
| 1154 | 1154 | if (gettype($value) == 'object') |
| 1155 | 1155 | { |
| 1156 | - if (get_class($value) == 'OCI-Lob') |
|
| 1156 | + if (get_class($value) == 'OCI-Lob') |
|
| 1157 | 1157 | { |
| 1158 | 1158 | if (($val = @$value->load()) === false) |
| 1159 | 1159 | { |
| 1160 | - $val = null; # only for default, this value is not used |
|
| 1160 | + $val = null; # only for default, this value is not used |
|
| 1161 | 1161 | $column_errors[] = $column; |
| 1162 | 1162 | } |
| 1163 | 1163 | |
@@ -1258,7 +1258,7 @@ discard block |
||
| 1258 | 1258 | foreach ($errors as $errno => $error) |
| 1259 | 1259 | { |
| 1260 | 1260 | $errorInformation .= |
| 1261 | - "<strong style='color: #a94442'>". |
|
| 1261 | + "<strong style='color: #a94442'>" . |
|
| 1262 | 1262 | $method |
| 1263 | 1263 | . "</strong>: <span style='color: #e24f4c'>{$error}</span> \n<br />"; |
| 1264 | 1264 | } |
@@ -96,8 +96,9 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | private function getUsersEntity() |
| 98 | 98 | { |
| 99 | - if (!is_null($this->usersEntity)) |
|
| 100 | - return $this->usersEntity; |
|
| 99 | + if (!is_null($this->usersEntity)) { |
|
| 100 | + return $this->usersEntity; |
|
| 101 | + } |
|
| 101 | 102 | |
| 102 | 103 | $this->usersEntity = new EntityAdapter(new TableGateway(new UserModel())); |
| 103 | 104 | |
@@ -109,8 +110,9 @@ discard block |
||
| 109 | 110 | */ |
| 110 | 111 | private function getIdentifiersEntity() |
| 111 | 112 | { |
| 112 | - if (!is_null($this->identifiersEntity)) |
|
| 113 | - return $this->identifiersEntity; |
|
| 113 | + if (!is_null($this->identifiersEntity)) { |
|
| 114 | + return $this->identifiersEntity; |
|
| 115 | + } |
|
| 114 | 116 | |
| 115 | 117 | $this->identifiersEntity = new EntityAdapter(new TableGateway(new Identifiers())); |
| 116 | 118 | |
@@ -122,8 +124,9 @@ discard block |
||
| 122 | 124 | */ |
| 123 | 125 | private function getConnectionTypesEntity() |
| 124 | 126 | { |
| 125 | - if (!is_null($this->connectionTypesEntity)) |
|
| 126 | - return $this->connectionTypesEntity; |
|
| 127 | + if (!is_null($this->connectionTypesEntity)) { |
|
| 128 | + return $this->connectionTypesEntity; |
|
| 129 | + } |
|
| 127 | 130 | |
| 128 | 131 | $this->connectionTypesEntity = new EntityAdapter(new TableGateway(new ConnectionType())); |
| 129 | 132 | |
@@ -135,8 +138,9 @@ discard block |
||
| 135 | 138 | */ |
| 136 | 139 | private function getConnectionFieldsEntity() |
| 137 | 140 | { |
| 138 | - if (!is_null($this->connectionFieldsEntity)) |
|
| 139 | - return $this->connectionFieldsEntity; |
|
| 141 | + if (!is_null($this->connectionFieldsEntity)) { |
|
| 142 | + return $this->connectionFieldsEntity; |
|
| 143 | + } |
|
| 140 | 144 | |
| 141 | 145 | $this->connectionFieldsEntity = new EntityAdapter(new TableGateway(new ConnectionTypeField())); |
| 142 | 146 | |
@@ -148,8 +152,9 @@ discard block |
||
| 148 | 152 | */ |
| 149 | 153 | private function getUserConnectionEntity() |
| 150 | 154 | { |
| 151 | - if (!is_null($this->userConnectionEntity)) |
|
| 152 | - return $this->userConnectionEntity; |
|
| 155 | + if (!is_null($this->userConnectionEntity)) { |
|
| 156 | + return $this->userConnectionEntity; |
|
| 157 | + } |
|
| 153 | 158 | |
| 154 | 159 | $this->userConnectionEntity = new EntityAdapter(new UserConnectionsTable(new UserConnection())); |
| 155 | 160 | |
@@ -161,8 +166,9 @@ discard block |
||
| 161 | 166 | */ |
| 162 | 167 | private function getUserConnectionDetailsEntity() |
| 163 | 168 | { |
| 164 | - if (!is_null($this->userConnectionDetailsEntity)) |
|
| 165 | - return $this->userConnectionDetailsEntity; |
|
| 169 | + if (!is_null($this->userConnectionDetailsEntity)) { |
|
| 170 | + return $this->userConnectionDetailsEntity; |
|
| 171 | + } |
|
| 166 | 172 | |
| 167 | 173 | $this->userConnectionDetailsEntity = new EntityAdapter(new TableGateway(new UserConnectionDetails())); |
| 168 | 174 | |
@@ -226,12 +232,12 @@ discard block |
||
| 226 | 232 | { |
| 227 | 233 | foreach ($idenfiers as $identifier) |
| 228 | 234 | { |
| 229 | - if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) |
|
| 230 | - $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 235 | + if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) { |
|
| 236 | + $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 237 | + } |
|
| 231 | 238 | } |
| 232 | 239 | } |
| 233 | - } |
|
| 234 | - else |
|
| 240 | + } else |
|
| 235 | 241 | { |
| 236 | 242 | # STANDARD VALIDATIONS [check needed arguments] |
| 237 | 243 | $needles = ['type', 'aliasname']; |
@@ -287,8 +293,9 @@ discard block |
||
| 287 | 293 | { |
| 288 | 294 | foreach ($idenfiers as $identifier) |
| 289 | 295 | { |
| 290 | - if ($field_number == $identifier->CONN_IDENTI_ID) |
|
| 291 | - $dbconfig[$identifier->CONN_IDENTI_NAME] = $field_value; |
|
| 296 | + if ($field_number == $identifier->CONN_IDENTI_ID) { |
|
| 297 | + $dbconfig[$identifier->CONN_IDENTI_NAME] = $field_value; |
|
| 298 | + } |
|
| 292 | 299 | } |
| 293 | 300 | } |
| 294 | 301 | } |
@@ -300,8 +307,7 @@ discard block |
||
| 300 | 307 | |
| 301 | 308 | $driverAdapter = new \Drone\Db\Driver\DriverAdapter($dbconfig, false); |
| 302 | 309 | $driverAdapter->getDb()->connect(); |
| 303 | - } |
|
| 304 | - catch (\Exception $e) |
|
| 310 | + } catch (\Exception $e) |
|
| 305 | 311 | { |
| 306 | 312 | # SUCCESS-MESSAGE |
| 307 | 313 | $data["process"] = "error"; |
@@ -312,14 +318,12 @@ discard block |
||
| 312 | 318 | |
| 313 | 319 | # SUCCESS-MESSAGE |
| 314 | 320 | $data["process"] = "success"; |
| 315 | - } |
|
| 316 | - catch (\Drone\Exception\Exception $e) |
|
| 321 | + } catch (\Drone\Exception\Exception $e) |
|
| 317 | 322 | { |
| 318 | 323 | # ERROR-MESSAGE |
| 319 | 324 | $data["process"] = "warning"; |
| 320 | 325 | $data["message"] = $e->getMessage(); |
| 321 | - } |
|
| 322 | - catch (\Exception $e) |
|
| 326 | + } catch (\Exception $e) |
|
| 323 | 327 | { |
| 324 | 328 | $file = str_replace('\\', '', __CLASS__); |
| 325 | 329 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -427,13 +431,15 @@ discard block |
||
| 427 | 431 | "USER_CONN_ID" => $id |
| 428 | 432 | ]); |
| 429 | 433 | |
| 430 | - if (!count($connection)) |
|
| 431 | - throw new \Exception("The Connection does not exists"); |
|
| 434 | + if (!count($connection)) { |
|
| 435 | + throw new \Exception("The Connection does not exists"); |
|
| 436 | + } |
|
| 432 | 437 | |
| 433 | 438 | $connection = array_shift($connection); |
| 434 | 439 | |
| 435 | - if ($connection->STATE == 'I') |
|
| 436 | - throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 440 | + if ($connection->STATE == 'I') { |
|
| 441 | + throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 442 | + } |
|
| 437 | 443 | |
| 438 | 444 | $details = $this->getUserConnectionDetailsEntity()->select([ |
| 439 | 445 | "USER_CONN_ID" => $id |
@@ -447,16 +453,18 @@ discard block |
||
| 447 | 453 | { |
| 448 | 454 | foreach ($idenfiers as $identifier) |
| 449 | 455 | { |
| 450 | - if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) |
|
| 451 | - $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 456 | + if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) { |
|
| 457 | + $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 458 | + } |
|
| 452 | 459 | } |
| 453 | 460 | } |
| 454 | 461 | |
| 455 | 462 | /* identifies if sql is base64 encoded */ |
| 456 | 463 | if (array_key_exists('base64', $post)) |
| 457 | 464 | { |
| 458 | - if ((bool) $post["base64"]) |
|
| 459 | - $post["sql"] = base64_decode($post["sql"]); |
|
| 465 | + if ((bool) $post["base64"]) { |
|
| 466 | + $post["sql"] = base64_decode($post["sql"]); |
|
| 467 | + } |
|
| 460 | 468 | } |
| 461 | 469 | |
| 462 | 470 | $data["sql"] = base64_encode($post["sql"]); |
@@ -468,8 +476,9 @@ discard block |
||
| 468 | 476 | */ |
| 469 | 477 | $sql_text = trim($sql_text); |
| 470 | 478 | |
| 471 | - if (empty($sql_text)) |
|
| 472 | - throw new \Drone\Exception\Exception("Empty statement"); |
|
| 479 | + if (empty($sql_text)) { |
|
| 480 | + throw new \Drone\Exception\Exception("Empty statement"); |
|
| 481 | + } |
|
| 473 | 482 | |
| 474 | 483 | $pos = strpos($sql_text, ';'); |
| 475 | 484 | |
@@ -477,8 +486,9 @@ discard block |
||
| 477 | 486 | { |
| 478 | 487 | $end_stament = strstr($sql_text, ';'); |
| 479 | 488 | |
| 480 | - if ($end_stament == ';') |
|
| 481 | - $sql_text = strstr($sql_text, ';', true); |
|
| 489 | + if ($end_stament == ';') { |
|
| 490 | + $sql_text = strstr($sql_text, ';', true); |
|
| 491 | + } |
|
| 482 | 492 | } |
| 483 | 493 | |
| 484 | 494 | # clean comments and other characters |
@@ -556,10 +566,11 @@ discard block |
||
| 556 | 566 | case 'mysqli': |
| 557 | 567 | |
| 558 | 568 | # show statement cannot be a subquery |
| 559 | - if (!$isShowStm) |
|
| 560 | - $sql_text = "SELECT (@ROW_NUM:=@ROW_NUM + 1) AS ROW_NUM, V.* FROM ( |
|
| 569 | + if (!$isShowStm) { |
|
| 570 | + $sql_text = "SELECT (@ROW_NUM:=@ROW_NUM + 1) AS ROW_NUM, V.* FROM ( |
|
| 561 | 571 | " . $sql_text . " |
| 562 | 572 | ) V LIMIT $row_start, $step"; |
| 573 | + } |
|
| 563 | 574 | break; |
| 564 | 575 | |
| 565 | 576 | case 'oci8': |
@@ -636,8 +647,7 @@ discard block |
||
| 636 | 647 | |
| 637 | 648 | # redirect view |
| 638 | 649 | $this->setMethod('error'); |
| 639 | - } |
|
| 640 | - catch (\Exception $e) |
|
| 650 | + } catch (\Exception $e) |
|
| 641 | 651 | { |
| 642 | 652 | # SUCCESS-MESSAGE |
| 643 | 653 | $data["process"] = "error"; |
@@ -689,8 +699,9 @@ discard block |
||
| 689 | 699 | |
| 690 | 700 | foreach ($row as $column => $value) |
| 691 | 701 | { |
| 692 | - if ($isShowStm) |
|
| 693 | - $column++; |
|
| 702 | + if ($isShowStm) { |
|
| 703 | + $column++; |
|
| 704 | + } |
|
| 694 | 705 | |
| 695 | 706 | if (gettype($value) == 'object') |
| 696 | 707 | { |
@@ -703,11 +714,10 @@ discard block |
||
| 703 | 714 | } |
| 704 | 715 | |
| 705 | 716 | $data["data"][$key][$column] = $val; |
| 717 | + } else { |
|
| 718 | + $data["data"][$key][$column] = $value; |
|
| 706 | 719 | } |
| 707 | - else |
|
| 708 | - $data["data"][$key][$column] = $value; |
|
| 709 | - } |
|
| 710 | - else { |
|
| 720 | + } else { |
|
| 711 | 721 | $data["data"][$key][$column] = $value; |
| 712 | 722 | } |
| 713 | 723 | } |
@@ -718,24 +728,24 @@ discard block |
||
| 718 | 728 | { |
| 719 | 729 | $data["column_errors"] = $column_errors; |
| 720 | 730 | |
| 721 | - if ($row_start > 1) |
|
| 722 | - $this->setMethod('nextResults'); |
|
| 731 | + if ($row_start > 1) { |
|
| 732 | + $this->setMethod('nextResults'); |
|
| 733 | + } |
|
| 723 | 734 | } |
| 724 | 735 | |
| 725 | - if (array_key_exists('id', $post)) |
|
| 726 | - $data["id"] = $post["id"]; |
|
| 736 | + if (array_key_exists('id', $post)) { |
|
| 737 | + $data["id"] = $post["id"]; |
|
| 738 | + } |
|
| 727 | 739 | |
| 728 | 740 | # SUCCESS-MESSAGE |
| 729 | 741 | $data["process"] = "success"; |
| 730 | 742 | } |
| 731 | - } |
|
| 732 | - catch (\Drone\Exception\Exception $e) |
|
| 743 | + } catch (\Drone\Exception\Exception $e) |
|
| 733 | 744 | { |
| 734 | 745 | # ERROR-MESSAGE |
| 735 | 746 | $data["process"] = "warning"; |
| 736 | 747 | $data["message"] = $e->getMessage(); |
| 737 | - } |
|
| 738 | - catch (\Exception $e) |
|
| 748 | + } catch (\Exception $e) |
|
| 739 | 749 | { |
| 740 | 750 | $file = str_replace('\\', '', __CLASS__); |
| 741 | 751 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -869,13 +879,15 @@ discard block |
||
| 869 | 879 | "USER_CONN_ID" => $id |
| 870 | 880 | ]); |
| 871 | 881 | |
| 872 | - if (!count($connection)) |
|
| 873 | - throw new \Exception("The Connection does not exists"); |
|
| 882 | + if (!count($connection)) { |
|
| 883 | + throw new \Exception("The Connection does not exists"); |
|
| 884 | + } |
|
| 874 | 885 | |
| 875 | 886 | $connection = array_shift($connection); |
| 876 | 887 | |
| 877 | - if ($connection->STATE == 'I') |
|
| 878 | - throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 888 | + if ($connection->STATE == 'I') { |
|
| 889 | + throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 890 | + } |
|
| 879 | 891 | |
| 880 | 892 | $details = $this->getUserConnectionDetailsEntity()->select([ |
| 881 | 893 | "USER_CONN_ID" => $id |
@@ -889,16 +901,18 @@ discard block |
||
| 889 | 901 | { |
| 890 | 902 | foreach ($idenfiers as $identifier) |
| 891 | 903 | { |
| 892 | - if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) |
|
| 893 | - $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 904 | + if ($field->CONN_IDENTI_ID == $identifier->CONN_IDENTI_ID) { |
|
| 905 | + $dbconfig[$identifier->CONN_IDENTI_NAME] = $field->FIELD_VALUE; |
|
| 906 | + } |
|
| 894 | 907 | } |
| 895 | 908 | } |
| 896 | 909 | |
| 897 | 910 | /* identifies if sql is base64 encoded */ |
| 898 | 911 | if (array_key_exists('base64', $post)) |
| 899 | 912 | { |
| 900 | - if ((bool) $post["base64"]) |
|
| 901 | - $post["sql"] = base64_decode($post["sql"]); |
|
| 913 | + if ((bool) $post["base64"]) { |
|
| 914 | + $post["sql"] = base64_decode($post["sql"]); |
|
| 915 | + } |
|
| 902 | 916 | } |
| 903 | 917 | |
| 904 | 918 | $data["sql"] = base64_encode($post["sql"]); |
@@ -910,8 +924,9 @@ discard block |
||
| 910 | 924 | */ |
| 911 | 925 | $sql_text = trim($sql_text); |
| 912 | 926 | |
| 913 | - if (empty($sql_text)) |
|
| 914 | - throw new \Drone\Exception\Exception("Empty statement"); |
|
| 927 | + if (empty($sql_text)) { |
|
| 928 | + throw new \Drone\Exception\Exception("Empty statement"); |
|
| 929 | + } |
|
| 915 | 930 | |
| 916 | 931 | $pos = strpos($sql_text, ';'); |
| 917 | 932 | |
@@ -919,8 +934,9 @@ discard block |
||
| 919 | 934 | { |
| 920 | 935 | $end_stament = strstr($sql_text, ';'); |
| 921 | 936 | |
| 922 | - if ($end_stament == ';') |
|
| 923 | - $sql_text = strstr($sql_text, ';', true); |
|
| 937 | + if ($end_stament == ';') { |
|
| 938 | + $sql_text = strstr($sql_text, ';', true); |
|
| 939 | + } |
|
| 924 | 940 | } |
| 925 | 941 | |
| 926 | 942 | # clean comments and other characters |
@@ -941,8 +957,9 @@ discard block |
||
| 941 | 957 | $isShowStm = $data["showStm"] = (preg_match('/^SHOW/i', $clean_code)); |
| 942 | 958 | |
| 943 | 959 | # detect selection |
| 944 | - if (!$isSelectStm && !$isShowStm) |
|
| 945 | - throw new \Exception("You can't export a non-selection statement!"); |
|
| 960 | + if (!$isSelectStm && !$isShowStm) { |
|
| 961 | + throw new \Exception("You can't export a non-selection statement!"); |
|
| 962 | + } |
|
| 946 | 963 | |
| 947 | 964 | try { |
| 948 | 965 | |
@@ -988,8 +1005,7 @@ discard block |
||
| 988 | 1005 | |
| 989 | 1006 | # redirect view |
| 990 | 1007 | $this->setMethod('error'); |
| 991 | - } |
|
| 992 | - catch (\Exception $e) |
|
| 1008 | + } catch (\Exception $e) |
|
| 993 | 1009 | { |
| 994 | 1010 | # SUCCESS-MESSAGE |
| 995 | 1011 | $data["process"] = "error"; |
@@ -1060,8 +1076,9 @@ discard block |
||
| 1060 | 1076 | |
| 1061 | 1077 | foreach ($rows[0] as $column_name => $row) |
| 1062 | 1078 | { |
| 1063 | - if (!is_numeric($column_name)) |
|
| 1064 | - $column_names[] = $column_name; |
|
| 1079 | + if (!is_numeric($column_name)) { |
|
| 1080 | + $column_names[] = $column_name; |
|
| 1081 | + } |
|
| 1065 | 1082 | } |
| 1066 | 1083 | |
| 1067 | 1084 | $table .= "\t<thead>\r\n\t\t<tr>\r\n"; |
@@ -1080,8 +1097,9 @@ discard block |
||
| 1080 | 1097 | |
| 1081 | 1098 | foreach ($row as $column => $value) |
| 1082 | 1099 | { |
| 1083 | - if ($isShowStm) |
|
| 1084 | - $column++; |
|
| 1100 | + if ($isShowStm) { |
|
| 1101 | + $column++; |
|
| 1102 | + } |
|
| 1085 | 1103 | |
| 1086 | 1104 | if (gettype($value) == 'object') |
| 1087 | 1105 | { |
@@ -1094,11 +1112,10 @@ discard block |
||
| 1094 | 1112 | } |
| 1095 | 1113 | |
| 1096 | 1114 | $data["data"][$key][$column] = $val; |
| 1115 | + } else { |
|
| 1116 | + $data["data"][$key][$column] = $value; |
|
| 1097 | 1117 | } |
| 1098 | - else |
|
| 1099 | - $data["data"][$key][$column] = $value; |
|
| 1100 | - } |
|
| 1101 | - else { |
|
| 1118 | + } else { |
|
| 1102 | 1119 | $data["data"][$key][$column] = $value; |
| 1103 | 1120 | } |
| 1104 | 1121 | } |
@@ -1130,8 +1147,9 @@ discard block |
||
| 1130 | 1147 | |
| 1131 | 1148 | foreach ($rows[0] as $column_name => $row) |
| 1132 | 1149 | { |
| 1133 | - if (!is_numeric($column_name)) |
|
| 1134 | - $column_names[] = $column_name; |
|
| 1150 | + if (!is_numeric($column_name)) { |
|
| 1151 | + $column_names[] = $column_name; |
|
| 1152 | + } |
|
| 1135 | 1153 | } |
| 1136 | 1154 | |
| 1137 | 1155 | foreach ($column_names as $column_name) |
@@ -1148,8 +1166,9 @@ discard block |
||
| 1148 | 1166 | |
| 1149 | 1167 | foreach ($row as $column => $value) |
| 1150 | 1168 | { |
| 1151 | - if ($isShowStm) |
|
| 1152 | - $column++; |
|
| 1169 | + if ($isShowStm) { |
|
| 1170 | + $column++; |
|
| 1171 | + } |
|
| 1153 | 1172 | |
| 1154 | 1173 | if (gettype($value) == 'object') |
| 1155 | 1174 | { |
@@ -1162,11 +1181,10 @@ discard block |
||
| 1162 | 1181 | } |
| 1163 | 1182 | |
| 1164 | 1183 | $data["data"][$key][$column] = $val; |
| 1184 | + } else { |
|
| 1185 | + $data["data"][$key][$column] = $value; |
|
| 1165 | 1186 | } |
| 1166 | - else |
|
| 1167 | - $data["data"][$key][$column] = $value; |
|
| 1168 | - } |
|
| 1169 | - else { |
|
| 1187 | + } else { |
|
| 1170 | 1188 | $data["data"][$key][$column] = $value; |
| 1171 | 1189 | } |
| 1172 | 1190 | } |
@@ -1203,20 +1221,19 @@ discard block |
||
| 1203 | 1221 | |
| 1204 | 1222 | $data["filename"] = $filename; |
| 1205 | 1223 | |
| 1206 | - if (array_key_exists('id', $post)) |
|
| 1207 | - $data["id"] = $post["id"]; |
|
| 1224 | + if (array_key_exists('id', $post)) { |
|
| 1225 | + $data["id"] = $post["id"]; |
|
| 1226 | + } |
|
| 1208 | 1227 | |
| 1209 | 1228 | # SUCCESS-MESSAGE |
| 1210 | 1229 | $data["process"] = "success"; |
| 1211 | 1230 | } |
| 1212 | - } |
|
| 1213 | - catch (\Drone\Exception\Exception $e) |
|
| 1231 | + } catch (\Drone\Exception\Exception $e) |
|
| 1214 | 1232 | { |
| 1215 | 1233 | # ERROR-MESSAGE |
| 1216 | 1234 | $data["process"] = "warning"; |
| 1217 | 1235 | $data["message"] = $e->getMessage(); |
| 1218 | - } |
|
| 1219 | - catch (\Exception $e) |
|
| 1236 | + } catch (\Exception $e) |
|
| 1220 | 1237 | { |
| 1221 | 1238 | $file = str_replace('\\', '', __CLASS__); |
| 1222 | 1239 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -1231,8 +1248,9 @@ discard block |
||
| 1231 | 1248 | } |
| 1232 | 1249 | |
| 1233 | 1250 | # errors retrived by the use of ErrorTrait |
| 1234 | - if (count($this->getErrors())) |
|
| 1235 | - $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 1251 | + if (count($this->getErrors())) { |
|
| 1252 | + $this->handleErrors($this->getErrors(), __METHOD__); |
|
| 1253 | + } |
|
| 1236 | 1254 | |
| 1237 | 1255 | $data["code"] = $errorCode; |
| 1238 | 1256 | $data["message"] = $e->getMessage(); |
@@ -1268,15 +1286,16 @@ discard block |
||
| 1268 | 1286 | if (!$hd || !@fwrite($hd, $errorInformation)) |
| 1269 | 1287 | { |
| 1270 | 1288 | # error storing are not mandatory! |
| 1289 | + } else { |
|
| 1290 | + @fclose($hd); |
|
| 1271 | 1291 | } |
| 1272 | - else |
|
| 1273 | - @fclose($hd); |
|
| 1274 | 1292 | |
| 1275 | 1293 | $config = include 'config/application.config.php'; |
| 1276 | 1294 | $dev = $config["environment"]["dev_mode"]; |
| 1277 | 1295 | |
| 1278 | - if ($dev) |
|
| 1279 | - echo $errorInformation; |
|
| 1296 | + if ($dev) { |
|
| 1297 | + echo $errorInformation; |
|
| 1298 | + } |
|
| 1280 | 1299 | } |
| 1281 | 1300 | } |
| 1282 | 1301 | } |
| 1283 | 1302 | \ No newline at end of file |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | { |
| 82 | 82 | $new = array(); |
| 83 | 83 | |
| 84 | - foreach($obj as $key => $val) |
|
| 84 | + foreach ($obj as $key => $val) |
|
| 85 | 85 | { |
| 86 | 86 | $new[$key] = $this->object_to_array($val); |
| 87 | 87 | } |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | foreach ($files as $file) |
| 28 | 28 | { |
| 29 | - if (!in_array($file, ['.', '..'])) |
|
| 30 | - $_files[] = $file; |
|
| 29 | + if (!in_array($file, ['.', '..'])) { |
|
| 30 | + $_files[] = $file; |
|
| 31 | + } |
|
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | $_folders[$folder] = $_files; |
@@ -74,8 +75,9 @@ discard block |
||
| 74 | 75 | |
| 75 | 76 | private function object_to_array($obj) |
| 76 | 77 | { |
| 77 | - if (is_object($obj)) |
|
| 78 | - $obj = (array) $obj; |
|
| 78 | + if (is_object($obj)) { |
|
| 79 | + $obj = (array) $obj; |
|
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | if (is_array($obj)) |
| 81 | 83 | { |
@@ -85,9 +87,9 @@ discard block |
||
| 85 | 87 | { |
| 86 | 88 | $new[$key] = $this->object_to_array($val); |
| 87 | 89 | } |
| 90 | + } else { |
|
| 91 | + $new = $obj; |
|
| 88 | 92 | } |
| 89 | - else |
|
| 90 | - $new = $obj; |
|
| 91 | 93 | |
| 92 | 94 | return $new; |
| 93 | 95 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $data = array(); |
| 157 | 157 | |
| 158 | 158 | # environment settings |
| 159 | - $this->setTerminal(true); # set terminal |
|
| 159 | + $this->setTerminal(true); # set terminal |
|
| 160 | 160 | |
| 161 | 161 | # TRY-CATCH-BLOCK |
| 162 | 162 | try { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $http = new Http(); |
| 168 | 168 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 169 | 169 | |
| 170 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 170 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $data["connections"] = $this->getUserConnectionEntity()->select([ |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | $data = array(); |
| 228 | 228 | |
| 229 | 229 | # environment settings |
| 230 | - $post = $this->getPost(); # catch $_POST |
|
| 231 | - $this->setTerminal(true); # set terminal |
|
| 230 | + $post = $this->getPost(); # catch $_POST |
|
| 231 | + $this->setTerminal(true); # set terminal |
|
| 232 | 232 | |
| 233 | 233 | # TRY-CATCH-BLOCK |
| 234 | 234 | try { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $http = new Http(); |
| 240 | 240 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 241 | 241 | |
| 242 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 242 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | # STANDARD VALIDATIONS [check needed arguments] |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $http = new Http(); |
| 252 | 252 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 253 | 253 | |
| 254 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 254 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 255 | 255 | } |
| 256 | 256 | }); |
| 257 | 257 | |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | $data = array(); |
| 360 | 360 | |
| 361 | 361 | # environment settings |
| 362 | - $post = $this->getPost(); # catch $_POST |
|
| 363 | - $this->setTerminal(true); # set terminal |
|
| 362 | + $post = $this->getPost(); # catch $_POST |
|
| 363 | + $this->setTerminal(true); # set terminal |
|
| 364 | 364 | |
| 365 | 365 | # TRY-CATCH-BLOCK |
| 366 | 366 | try { |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $http = new Http(); |
| 400 | 400 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 401 | 401 | |
| 402 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 402 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 403 | 403 | } |
| 404 | 404 | }); |
| 405 | 405 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | $http = new Http(); |
| 493 | 493 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 494 | 494 | |
| 495 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 495 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | catch (\Drone\Exception\Exception $e) |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | $data = array(); |
| 545 | 545 | |
| 546 | 546 | # environment settings |
| 547 | - $post = $this->getPost(); # catch $_POST |
|
| 548 | - $get = $_GET; # catch $_GET |
|
| 549 | - $this->setTerminal(true); # set terminal |
|
| 547 | + $post = $this->getPost(); # catch $_POST |
|
| 548 | + $get = $_GET; # catch $_GET |
|
| 549 | + $this->setTerminal(true); # set terminal |
|
| 550 | 550 | |
| 551 | 551 | # TRY-CATCH-BLOCK |
| 552 | 552 | try { |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | $http = new Http(); |
| 563 | 563 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 564 | 564 | |
| 565 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 565 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 566 | 566 | } |
| 567 | 567 | }); |
| 568 | 568 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $http = new Http(); |
| 625 | 625 | $http->writeStatus($http::HTTP_BAD_REQUEST); |
| 626 | 626 | |
| 627 | - die('Error ' . $http::HTTP_BAD_REQUEST .' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 627 | + die('Error ' . $http::HTTP_BAD_REQUEST . ' (' . $http->getStatusText($http::HTTP_BAD_REQUEST) . ')!!'); |
|
| 628 | 628 | } |
| 629 | 629 | }); |
| 630 | 630 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $http = new Http(); |
| 730 | 730 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 731 | 731 | |
| 732 | - die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 732 | + die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED . ' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
|
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | 735 | catch (\Drone\Exception\Exception $e) |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | foreach ($errors as $errno => $error) |
| 777 | 777 | { |
| 778 | 778 | $errorInformation .= |
| 779 | - "<strong style='color: #a94442'>". |
|
| 779 | + "<strong style='color: #a94442'>" . |
|
| 780 | 780 | $method |
| 781 | 781 | . "</strong>: <span style='color: #e24f4c'>{$error}</span> \n<br />"; |
| 782 | 782 | } |
@@ -85,8 +85,9 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | private function getUsersEntity() |
| 87 | 87 | { |
| 88 | - if (!is_null($this->usersEntity)) |
|
| 89 | - return $this->usersEntity; |
|
| 88 | + if (!is_null($this->usersEntity)) { |
|
| 89 | + return $this->usersEntity; |
|
| 90 | + } |
|
| 90 | 91 | |
| 91 | 92 | $this->usersEntity = new EntityAdapter(new TableGateway(new UserModel())); |
| 92 | 93 | |
@@ -98,8 +99,9 @@ discard block |
||
| 98 | 99 | */ |
| 99 | 100 | private function getConnectionTypesEntity() |
| 100 | 101 | { |
| 101 | - if (!is_null($this->connectionTypesEntity)) |
|
| 102 | - return $this->connectionTypesEntity; |
|
| 102 | + if (!is_null($this->connectionTypesEntity)) { |
|
| 103 | + return $this->connectionTypesEntity; |
|
| 104 | + } |
|
| 103 | 105 | |
| 104 | 106 | $this->connectionTypesEntity = new EntityAdapter(new TableGateway(new ConnectionType())); |
| 105 | 107 | |
@@ -111,8 +113,9 @@ discard block |
||
| 111 | 113 | */ |
| 112 | 114 | private function getConnectionFieldsEntity() |
| 113 | 115 | { |
| 114 | - if (!is_null($this->connectionFieldsEntity)) |
|
| 115 | - return $this->connectionFieldsEntity; |
|
| 116 | + if (!is_null($this->connectionFieldsEntity)) { |
|
| 117 | + return $this->connectionFieldsEntity; |
|
| 118 | + } |
|
| 116 | 119 | |
| 117 | 120 | $this->connectionFieldsEntity = new EntityAdapter(new TableGateway(new ConnectionTypeField())); |
| 118 | 121 | |
@@ -124,8 +127,9 @@ discard block |
||
| 124 | 127 | */ |
| 125 | 128 | private function getUserConnectionEntity() |
| 126 | 129 | { |
| 127 | - if (!is_null($this->userConnectionEntity)) |
|
| 128 | - return $this->userConnectionEntity; |
|
| 130 | + if (!is_null($this->userConnectionEntity)) { |
|
| 131 | + return $this->userConnectionEntity; |
|
| 132 | + } |
|
| 129 | 133 | |
| 130 | 134 | $this->userConnectionEntity = new EntityAdapter(new UserConnectionsTable(new UserConnection())); |
| 131 | 135 | |
@@ -137,8 +141,9 @@ discard block |
||
| 137 | 141 | */ |
| 138 | 142 | private function getUserConnectionDetailsEntity() |
| 139 | 143 | { |
| 140 | - if (!is_null($this->userConnectionDetailsEntity)) |
|
| 141 | - return $this->userConnectionDetailsEntity; |
|
| 144 | + if (!is_null($this->userConnectionDetailsEntity)) { |
|
| 145 | + return $this->userConnectionDetailsEntity; |
|
| 146 | + } |
|
| 142 | 147 | |
| 143 | 148 | $this->userConnectionDetailsEntity = new EntityAdapter(new TableGateway(new UserConnectionDetails())); |
| 144 | 149 | |
@@ -177,14 +182,12 @@ discard block |
||
| 177 | 182 | |
| 178 | 183 | # SUCCESS-MESSAGE |
| 179 | 184 | $data["process"] = "success"; |
| 180 | - } |
|
| 181 | - catch (\Drone\Exception\Exception $e) |
|
| 185 | + } catch (\Drone\Exception\Exception $e) |
|
| 182 | 186 | { |
| 183 | 187 | # ERROR-MESSAGE |
| 184 | 188 | $data["process"] = "warning"; |
| 185 | 189 | $data["message"] = $e->getMessage(); |
| 186 | - } |
|
| 187 | - catch (\Exception $e) |
|
| 190 | + } catch (\Exception $e) |
|
| 188 | 191 | { |
| 189 | 192 | $file = str_replace('\\', '', __CLASS__); |
| 190 | 193 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -289,13 +292,15 @@ discard block |
||
| 289 | 292 | "USER_CONN_ID" => $post["id"] |
| 290 | 293 | ]); |
| 291 | 294 | |
| 292 | - if (!count($connection)) |
|
| 293 | - throw new \Exception("The Connection does not exists"); |
|
| 295 | + if (!count($connection)) { |
|
| 296 | + throw new \Exception("The Connection does not exists"); |
|
| 297 | + } |
|
| 294 | 298 | |
| 295 | 299 | $connection = array_shift($connection); |
| 296 | 300 | |
| 297 | - if ($connection->STATE == 'I') |
|
| 298 | - throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 301 | + if ($connection->STATE == 'I') { |
|
| 302 | + throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 303 | + } |
|
| 299 | 304 | |
| 300 | 305 | $connection->exchangeArray([ |
| 301 | 306 | "STATE" => 'I' |
@@ -309,14 +314,12 @@ discard block |
||
| 309 | 314 | |
| 310 | 315 | # SUCCESS-MESSAGE |
| 311 | 316 | $data["process"] = "success"; |
| 312 | - } |
|
| 313 | - catch (\Drone\Exception\Exception $e) |
|
| 317 | + } catch (\Drone\Exception\Exception $e) |
|
| 314 | 318 | { |
| 315 | 319 | # ERROR-MESSAGE |
| 316 | 320 | $data["process"] = "warning"; |
| 317 | 321 | $data["message"] = $e->getMessage(); |
| 318 | - } |
|
| 319 | - catch (\Exception $e) |
|
| 322 | + } catch (\Exception $e) |
|
| 320 | 323 | { |
| 321 | 324 | $file = str_replace('\\', '', __CLASS__); |
| 322 | 325 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -387,8 +390,7 @@ discard block |
||
| 387 | 390 | |
| 388 | 391 | # SUCCESS-MESSAGE |
| 389 | 392 | $data["process"] = "register-form"; |
| 390 | - } |
|
| 391 | - else if ($this->isPost()) |
|
| 393 | + } else if ($this->isPost()) |
|
| 392 | 394 | { |
| 393 | 395 | # STANDARD VALIDATIONS [check needed arguments] |
| 394 | 396 | $needles = ['field', 'type', 'aliasname']; |
@@ -486,22 +488,19 @@ discard block |
||
| 486 | 488 | |
| 487 | 489 | # SUCCESS-MESSAGE |
| 488 | 490 | $data["process"] = "process-response"; |
| 489 | - } |
|
| 490 | - else |
|
| 491 | + } else |
|
| 491 | 492 | { |
| 492 | 493 | $http = new Http(); |
| 493 | 494 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 494 | 495 | |
| 495 | 496 | die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
| 496 | 497 | } |
| 497 | - } |
|
| 498 | - catch (\Drone\Exception\Exception $e) |
|
| 498 | + } catch (\Drone\Exception\Exception $e) |
|
| 499 | 499 | { |
| 500 | 500 | # ERROR-MESSAGE |
| 501 | 501 | $data["process"] = "warning"; |
| 502 | 502 | $data["message"] = $e->getMessage(); |
| 503 | - } |
|
| 504 | - catch (\Exception $e) |
|
| 503 | + } catch (\Exception $e) |
|
| 505 | 504 | { |
| 506 | 505 | $file = str_replace('\\', '', __CLASS__); |
| 507 | 506 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -588,13 +587,15 @@ discard block |
||
| 588 | 587 | "USER_CONN_ID" => $get["id"] |
| 589 | 588 | ]); |
| 590 | 589 | |
| 591 | - if (!count($connection)) |
|
| 592 | - throw new \Exception("The Connection does not exists"); |
|
| 590 | + if (!count($connection)) { |
|
| 591 | + throw new \Exception("The Connection does not exists"); |
|
| 592 | + } |
|
| 593 | 593 | |
| 594 | 594 | $connection = array_shift($connection); |
| 595 | 595 | |
| 596 | - if ($connection->STATE == 'I') |
|
| 597 | - throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 596 | + if ($connection->STATE == 'I') { |
|
| 597 | + throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 598 | + } |
|
| 598 | 599 | |
| 599 | 600 | $connection_details = $this->getUserConnectionDetailsEntity()->select([ |
| 600 | 601 | "USER_CONN_ID" => $get["id"] |
@@ -612,8 +613,7 @@ discard block |
||
| 612 | 613 | |
| 613 | 614 | # SUCCESS-MESSAGE |
| 614 | 615 | $data["process"] = "update-form"; |
| 615 | - } |
|
| 616 | - else if ($this->isPost()) |
|
| 616 | + } else if ($this->isPost()) |
|
| 617 | 617 | { |
| 618 | 618 | # STANDARD VALIDATIONS [check needed arguments] |
| 619 | 619 | $needles = ['_conn_id', 'type', 'aliasname']; |
@@ -685,13 +685,15 @@ discard block |
||
| 685 | 685 | "USER_CONN_ID" => $post["_conn_id"], |
| 686 | 686 | ]); |
| 687 | 687 | |
| 688 | - if (!count($userConnection)) |
|
| 689 | - throw new \Exception("The Connection does not exists"); |
|
| 688 | + if (!count($userConnection)) { |
|
| 689 | + throw new \Exception("The Connection does not exists"); |
|
| 690 | + } |
|
| 690 | 691 | |
| 691 | 692 | $userConnection = array_shift($userConnection); |
| 692 | 693 | |
| 693 | - if ($userConnection->STATE == 'I') |
|
| 694 | - throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 694 | + if ($userConnection->STATE == 'I') { |
|
| 695 | + throw new \Drone\Exception\Exception("This connection was deleted", 300); |
|
| 696 | + } |
|
| 695 | 697 | |
| 696 | 698 | $userConnection->exchangeArray([ |
| 697 | 699 | "CONN_TYPE_ID" => $post["type"], |
@@ -723,22 +725,19 @@ discard block |
||
| 723 | 725 | |
| 724 | 726 | # SUCCESS-MESSAGE |
| 725 | 727 | $data["process"] = "process-response"; |
| 726 | - } |
|
| 727 | - else |
|
| 728 | + } else |
|
| 728 | 729 | { |
| 729 | 730 | $http = new Http(); |
| 730 | 731 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
| 731 | 732 | |
| 732 | 733 | die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
| 733 | 734 | } |
| 734 | - } |
|
| 735 | - catch (\Drone\Exception\Exception $e) |
|
| 735 | + } catch (\Drone\Exception\Exception $e) |
|
| 736 | 736 | { |
| 737 | 737 | # ERROR-MESSAGE |
| 738 | 738 | $data["process"] = "warning"; |
| 739 | 739 | $data["message"] = $e->getMessage(); |
| 740 | - } |
|
| 741 | - catch (\Exception $e) |
|
| 740 | + } catch (\Exception $e) |
|
| 742 | 741 | { |
| 743 | 742 | $file = str_replace('\\', '', __CLASS__); |
| 744 | 743 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -786,15 +785,16 @@ discard block |
||
| 786 | 785 | if (!$hd || !@fwrite($hd, $errorInformation)) |
| 787 | 786 | { |
| 788 | 787 | # error storing are not mandatory! |
| 788 | + } else { |
|
| 789 | + @fclose($hd); |
|
| 789 | 790 | } |
| 790 | - else |
|
| 791 | - @fclose($hd); |
|
| 792 | 791 | |
| 793 | 792 | $config = include 'config/application.config.php'; |
| 794 | 793 | $dev = $config["environment"]["dev_mode"]; |
| 795 | 794 | |
| 796 | - if ($dev) |
|
| 797 | - echo $errorInformation; |
|
| 795 | + if ($dev) { |
|
| 796 | + echo $errorInformation; |
|
| 797 | + } |
|
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | \ No newline at end of file |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | ], |
| 25 | 25 | 'environment' => [ |
| 26 | 26 | 'base_path' => (dirname(dirname($_SERVER['PHP_SELF'])) == "/") ? "" : dirname(dirname($_SERVER['PHP_SELF'])), |
| 27 | - 'dev_mode' => true, // set this to FALSE for production environments |
|
| 27 | + 'dev_mode' => true, // set this to FALSE for production environments |
|
| 28 | 28 | 'locale' => 'en' |
| 29 | 29 | ], |
| 30 | 30 | ]; |
| 31 | 31 | \ 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 | |