@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | while(($module = readdir($moduleDir)) !== false){ |
| 62 | 62 | if($module != '.' && $module != '..' && preg_match('/^([a-z0-9-_]+)$/i', $module) && is_dir(MODULE_PATH . $module)){ |
| 63 | 63 | self::$list[] = $module; |
| 64 | - } |
|
| 65 | - else{ |
|
| 64 | + } else{ |
|
| 66 | 65 | $logger->info('Skipping [' .$module. '], may be this is not a directory or does not exists or is invalid name'); |
| 67 | 66 | } |
| 68 | 67 | } |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | |
| 73 | 72 | if(self::hasModule()){ |
| 74 | 73 | $logger->info('The application contains the module below [' . implode(', ', self::getModuleList()) . ']'); |
| 75 | - } |
|
| 76 | - else{ |
|
| 74 | + } else{ |
|
| 77 | 75 | $logger->info('The application contains no module skipping'); |
| 78 | 76 | } |
| 79 | 77 | } |
@@ -145,8 +143,7 @@ discard block |
||
| 145 | 143 | if(! empty($route) && is_array($route)){ |
| 146 | 144 | $routes = array_merge($routes, $route); |
| 147 | 145 | unset($route); |
| 148 | - } |
|
| 149 | - else{ |
|
| 146 | + } else{ |
|
| 150 | 147 | show_error('No routing configuration found in [' .$file. '] for module [' . $module . ']'); |
| 151 | 148 | } |
| 152 | 149 | } |
@@ -175,8 +172,7 @@ discard block |
||
| 175 | 172 | if(file_exists($filePath)){ |
| 176 | 173 | $logger->info('Found controller [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 177 | 174 | return $filePath; |
| 178 | - } |
|
| 179 | - else{ |
|
| 175 | + } else{ |
|
| 180 | 176 | $logger->info('Controller [' . $class . '] does not exist in the module [' .$module. ']'); |
| 181 | 177 | return false; |
| 182 | 178 | } |
@@ -202,8 +198,7 @@ discard block |
||
| 202 | 198 | if(file_exists($filePath)){ |
| 203 | 199 | $logger->info('Found model [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 204 | 200 | return $filePath; |
| 205 | - } |
|
| 206 | - else{ |
|
| 201 | + } else{ |
|
| 207 | 202 | $logger->info('Model [' . $class . '] does not exist in the module [' .$module. ']'); |
| 208 | 203 | return false; |
| 209 | 204 | } |
@@ -228,8 +223,7 @@ discard block |
||
| 228 | 223 | if(file_exists($filePath)){ |
| 229 | 224 | $logger->info('Found configuration [' . $configuration . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 230 | 225 | return $filePath; |
| 231 | - } |
|
| 232 | - else{ |
|
| 226 | + } else{ |
|
| 233 | 227 | $logger->info('Configuration [' . $configuration . '] does not exist in the module [' .$module. ']'); |
| 234 | 228 | return false; |
| 235 | 229 | } |
@@ -255,8 +249,7 @@ discard block |
||
| 255 | 249 | if(file_exists($filePath)){ |
| 256 | 250 | $logger->info('Found helper [' . $helper . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 257 | 251 | return $filePath; |
| 258 | - } |
|
| 259 | - else{ |
|
| 252 | + } else{ |
|
| 260 | 253 | $logger->info('Helper [' . $helper . '] does not exist in the module [' .$module. ']'); |
| 261 | 254 | return false; |
| 262 | 255 | } |
@@ -282,8 +275,7 @@ discard block |
||
| 282 | 275 | if(file_exists($filePath)){ |
| 283 | 276 | $logger->info('Found library [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 284 | 277 | return $filePath; |
| 285 | - } |
|
| 286 | - else{ |
|
| 278 | + } else{ |
|
| 287 | 279 | $logger->info('Library [' . $class . '] does not exist in the module [' .$module. ']'); |
| 288 | 280 | return false; |
| 289 | 281 | } |
@@ -311,8 +303,7 @@ discard block |
||
| 311 | 303 | if(file_exists($filePath)){ |
| 312 | 304 | $logger->info('Found view [' . $view . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 313 | 305 | return $filePath; |
| 314 | - } |
|
| 315 | - else{ |
|
| 306 | + } else{ |
|
| 316 | 307 | $logger->info('View [' . $view . '] does not exist in the module [' .$module. ']'); |
| 317 | 308 | return false; |
| 318 | 309 | } |
@@ -339,8 +330,7 @@ discard block |
||
| 339 | 330 | if(file_exists($filePath)){ |
| 340 | 331 | $logger->info('Found language [' . $language . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 341 | 332 | return $filePath; |
| 342 | - } |
|
| 343 | - else{ |
|
| 333 | + } else{ |
|
| 344 | 334 | $logger->info('Language [' . $language . '] does not exist in the module [' .$module. ']'); |
| 345 | 335 | return false; |
| 346 | 336 | } |
@@ -230,16 +230,14 @@ discard block |
||
| 230 | 230 | ); |
| 231 | 231 | if (isset($http_status[$code])){ |
| 232 | 232 | $text = $http_status[$code]; |
| 233 | - } |
|
| 234 | - else{ |
|
| 233 | + } else{ |
|
| 235 | 234 | show_error('No HTTP status text found for your code please check it.'); |
| 236 | 235 | } |
| 237 | 236 | } |
| 238 | 237 | |
| 239 | 238 | if (strpos(php_sapi_name(), 'cgi') === 0){ |
| 240 | 239 | header('Status: ' . $code . ' ' . $text, TRUE); |
| 241 | - } |
|
| 242 | - else{ |
|
| 240 | + } else{ |
|
| 243 | 241 | $proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; |
| 244 | 242 | header($proto . ' ' . $code . ' ' . $text, TRUE, $code); |
| 245 | 243 | } |
@@ -281,11 +279,9 @@ discard block |
||
| 281 | 279 | */ |
| 282 | 280 | if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'){ |
| 283 | 281 | return true; |
| 284 | - } |
|
| 285 | - else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ |
|
| 282 | + } else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ |
|
| 286 | 283 | return true; |
| 287 | - } |
|
| 288 | - else if (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){ |
|
| 284 | + } else if (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){ |
|
| 289 | 285 | return true; |
| 290 | 286 | } |
| 291 | 287 | return false; |
@@ -328,8 +324,7 @@ discard block |
||
| 328 | 324 | function php_exception_handler($ex){ |
| 329 | 325 | if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){ |
| 330 | 326 | show_error('An exception is occured in file '. $ex->getFile() .' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode()); |
| 331 | - } |
|
| 332 | - else{ |
|
| 327 | + } else{ |
|
| 333 | 328 | save_to_log('error', 'An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception'); |
| 334 | 329 | } |
| 335 | 330 | return true; |
@@ -451,15 +446,13 @@ discard block |
||
| 451 | 446 | function clean_input($str){ |
| 452 | 447 | if (is_array($str)){ |
| 453 | 448 | $str = array_map('clean_input', $str); |
| 454 | - } |
|
| 455 | - else if (is_object($str)){ |
|
| 449 | + } else if (is_object($str)){ |
|
| 456 | 450 | $obj = $str; |
| 457 | 451 | foreach ($str as $var => $value) { |
| 458 | 452 | $obj->$var = clean_input($value); |
| 459 | 453 | } |
| 460 | 454 | $str = $obj; |
| 461 | - } |
|
| 462 | - else{ |
|
| 455 | + } else{ |
|
| 463 | 456 | $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8'); |
| 464 | 457 | } |
| 465 | 458 | return $str; |
@@ -532,8 +525,7 @@ discard block |
||
| 532 | 525 | session_save_path($sessionSavePath); |
| 533 | 526 | $logger->info('Session save path: ' . $sessionSavePath); |
| 534 | 527 | } |
| 535 | - } |
|
| 536 | - else if ($sessionHandler == 'database'){ |
|
| 528 | + } else if ($sessionHandler == 'database'){ |
|
| 537 | 529 | //load database session handle library |
| 538 | 530 | //Model |
| 539 | 531 | require_once CORE_CLASSES_MODEL_PATH . 'Model.php'; |
@@ -544,8 +536,7 @@ discard block |
||
| 544 | 536 | $DBS =& class_loader('DBSessionHandler', 'classes'); |
| 545 | 537 | session_set_save_handler($DBS, true); |
| 546 | 538 | $logger->info('session save path: ' . get_config('session_save_path')); |
| 547 | - } |
|
| 548 | - else{ |
|
| 539 | + } else{ |
|
| 549 | 540 | show_error('Invalid session handler configuration'); |
| 550 | 541 | } |
| 551 | 542 | $lifetime = get_config('session_cookie_lifetime', 0); |