@@ -268,8 +268,7 @@ discard block |
||
| 268 | 268 | if(isset($_SERVER['argv'][1])){ |
| 269 | 269 | $routeUri = $_SERVER['argv'][1]; |
| 270 | 270 | } |
| 271 | - } |
|
| 272 | - else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 271 | + } else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 273 | 272 | $routeUri = $_SERVER['REQUEST_URI']; |
| 274 | 273 | } |
| 275 | 274 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
@@ -365,15 +364,13 @@ discard block |
||
| 365 | 364 | if(! class_exists($controller, false)){ |
| 366 | 365 | $e404 = true; |
| 367 | 366 | $this->logger->warning('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']'); |
| 368 | - } |
|
| 369 | - else{ |
|
| 367 | + } else{ |
|
| 370 | 368 | $controllerInstance = new $controller(); |
| 371 | 369 | $controllerMethod = $this->getMethod(); |
| 372 | 370 | if(! method_exists($controllerInstance, $controllerMethod)){ |
| 373 | 371 | $e404 = true; |
| 374 | 372 | $this->logger->warning('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']'); |
| 375 | - } |
|
| 376 | - else{ |
|
| 373 | + } else{ |
|
| 377 | 374 | $this->logger->info('Routing data is set correctly now GO!'); |
| 378 | 375 | call_user_func_array(array($controllerInstance, $controllerMethod), $this->args); |
| 379 | 376 | //render the final page to user |
@@ -381,8 +378,7 @@ discard block |
||
| 381 | 378 | get_instance()->response->renderFinalPage(); |
| 382 | 379 | } |
| 383 | 380 | } |
| 384 | - } |
|
| 385 | - else{ |
|
| 381 | + } else{ |
|
| 386 | 382 | $this->logger->info('The controller file path [' . $classFilePath . '] does not exist'); |
| 387 | 383 | $e404 = true; |
| 388 | 384 | } |
@@ -484,8 +480,7 @@ discard block |
||
| 484 | 480 | $this->logger->info('The current request use the module [' .$moduleControllerMethod[0]. ']'); |
| 485 | 481 | $this->module = $moduleControllerMethod[0]; |
| 486 | 482 | $moduleControllerMethod = explode('@', $moduleControllerMethod[1]); |
| 487 | - } |
|
| 488 | - else{ |
|
| 483 | + } else{ |
|
| 489 | 484 | $this->logger->info('The current request does not use the module'); |
| 490 | 485 | $moduleControllerMethod = explode('@', $this->callback[$index]); |
| 491 | 486 | } |
@@ -541,8 +536,7 @@ discard block |
||
| 541 | 536 | } |
| 542 | 537 | //args |
| 543 | 538 | $this->args = $segment; |
| 544 | - } |
|
| 545 | - else{ |
|
| 539 | + } else{ |
|
| 546 | 540 | $this->logger->info('The application contains a loaded module will check if the current request is found in the module list'); |
| 547 | 541 | if(in_array($segment[0], $modules)){ |
| 548 | 542 | $this->logger->info('Found, the current request use the module [' . $segment[0] . ']'); |
@@ -556,8 +550,7 @@ discard block |
||
| 556 | 550 | if(! $path){ |
| 557 | 551 | $this->logger->info('The controller [' . $this->getController() . '] not found in the module, may be will use the module [' . $this->getModule() . '] as controller'); |
| 558 | 552 | $this->controller = $this->getModule(); |
| 559 | - } |
|
| 560 | - else{ |
|
| 553 | + } else{ |
|
| 561 | 554 | $this->controllerPath = $path; |
| 562 | 555 | array_shift($segment); |
| 563 | 556 | } |
@@ -569,8 +562,7 @@ discard block |
||
| 569 | 562 | } |
| 570 | 563 | //the remaining is for args |
| 571 | 564 | $this->args = $segment; |
| 572 | - } |
|
| 573 | - else{ |
|
| 565 | + } else{ |
|
| 574 | 566 | $this->logger->info('The current request information is not found in the module list'); |
| 575 | 567 | //controller |
| 576 | 568 | if(isset($segment[0])){ |
@@ -613,8 +605,7 @@ discard block |
||
| 613 | 605 | protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){ |
| 614 | 606 | if ($logger !== null){ |
| 615 | 607 | $this->logger = $logger; |
| 616 | - } |
|
| 617 | - else{ |
|
| 608 | + } else{ |
|
| 618 | 609 | $this->logger =& class_loader('Log', 'classes'); |
| 619 | 610 | $this->logger->setLogger('Library::Router'); |
| 620 | 611 | } |
@@ -128,8 +128,7 @@ discard block |
||
| 128 | 128 | $logger->info('Delete config item ['.$item.']'); |
| 129 | 129 | unset(self::$config[$item]); |
| 130 | 130 | return true; |
| 131 | - } |
|
| 132 | - else{ |
|
| 131 | + } else{ |
|
| 133 | 132 | $logger->warning('Config item ['.$item.'] to be deleted does not exists'); |
| 134 | 133 | return false; |
| 135 | 134 | } |
@@ -179,8 +178,7 @@ discard block |
||
| 179 | 178 | 0, |
| 180 | 179 | strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])) |
| 181 | 180 | ); |
| 182 | - } |
|
| 183 | - else{ |
|
| 181 | + } else{ |
|
| 184 | 182 | $logger->warning('Can not determine the application base URL automatically, use http://localhost as default'); |
| 185 | 183 | $baseUrl = 'http://localhost/'; |
| 186 | 184 | } |
@@ -234,8 +234,7 @@ discard block |
||
| 234 | 234 | //first check for CSRF |
| 235 | 235 | if (get_config('csrf_enable', false) && ! Security::validateCSRF()){ |
| 236 | 236 | show_error('Invalide data, Cross Site Request Forgery do his job, the data to validate is corrupted.'); |
| 237 | - } |
|
| 238 | - else{ |
|
| 237 | + } else{ |
|
| 239 | 238 | $this->logger->info('CSRF is not enabled in configuration or not set manully, no need to check it'); |
| 240 | 239 | } |
| 241 | 240 | } |
@@ -255,8 +254,7 @@ discard block |
||
| 255 | 254 | foreach ($this->getData() as $inputName => $inputVal) { |
| 256 | 255 | if(is_array($this->data[$inputName])){ |
| 257 | 256 | $this->data[$inputName] = array_map('trim', $this->data[$inputName]); |
| 258 | - } |
|
| 259 | - else{ |
|
| 257 | + } else{ |
|
| 260 | 258 | $this->data[$inputName] = trim($this->data[$inputName]); |
| 261 | 259 | } |
| 262 | 260 | |
@@ -624,8 +622,7 @@ discard block |
||
| 624 | 622 | if ($inputVal == '' && $callbackReturn == true) { |
| 625 | 623 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
| 626 | 624 | } |
| 627 | - } |
|
| 628 | - else if($inputVal == '') { |
|
| 625 | + } else if($inputVal == '') { |
|
| 629 | 626 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
| 630 | 627 | } |
| 631 | 628 | } |
@@ -684,8 +681,7 @@ discard block |
||
| 684 | 681 | $this->_setError($inputName, $ruleName . ',post:key', array($this->_getLabel($inputName), $this->_getLabel(str_replace('post:', '', $doNotEqual)))); |
| 685 | 682 | continue; |
| 686 | 683 | } |
| 687 | - } |
|
| 688 | - else{ |
|
| 684 | + } else{ |
|
| 689 | 685 | if ($inputVal == $doNotEqual) { |
| 690 | 686 | $this->_setError($inputName, $ruleName . ',string', array($this->_getLabel($inputName), $doNotEqual)); |
| 691 | 687 | continue; |