@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | if(is_object($logger)){ |
| 45 | 45 | $this->logger = $logger; |
| 46 | - } |
|
| 47 | - else{ |
|
| 46 | + } else{ |
|
| 48 | 47 | $this->logger =& class_loader('Log', 'classes'); |
| 49 | 48 | $this->logger->setLogger('Library::ApcCache'); |
| 50 | 49 | } |
@@ -62,8 +61,7 @@ discard block |
||
| 62 | 61 | if($success === false){ |
| 63 | 62 | $this->logger->info('No cache found for the key ['. $key .'], return false'); |
| 64 | 63 | return false; |
| 65 | - } |
|
| 66 | - else{ |
|
| 64 | + } else{ |
|
| 67 | 65 | $cacheInfo = $this->_getCacheInfo($key); |
| 68 | 66 | $expire = time(); |
| 69 | 67 | if($cacheInfo){ |
@@ -89,8 +87,7 @@ discard block |
||
| 89 | 87 | if($result === false){ |
| 90 | 88 | $this->logger->error('Can not write cache data for the key ['. $key .'], return false'); |
| 91 | 89 | return false; |
| 92 | - } |
|
| 93 | - else{ |
|
| 90 | + } else{ |
|
| 94 | 91 | $this->logger->info('Cache data saved for the key ['. $key .']'); |
| 95 | 92 | return true; |
| 96 | 93 | } |
@@ -109,8 +106,7 @@ discard block |
||
| 109 | 106 | if($cacheInfo === false){ |
| 110 | 107 | $this->logger->info('This cache data does not exists skipping'); |
| 111 | 108 | return false; |
| 112 | - } |
|
| 113 | - else{ |
|
| 109 | + } else{ |
|
| 114 | 110 | $this->logger->info('Found cache data for the key [' .$key. '] remove it'); |
| 115 | 111 | return apc_delete($key) === true; |
| 116 | 112 | } |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | 'ttl' => $cacheInfos['ttl'] |
| 135 | 131 | ); |
| 136 | 132 | return $data; |
| 137 | - } |
|
| 138 | - else{ |
|
| 133 | + } else{ |
|
| 139 | 134 | $this->logger->info('This cache does not exists skipping'); |
| 140 | 135 | return false; |
| 141 | 136 | } |
@@ -159,8 +154,7 @@ discard block |
||
| 159 | 154 | if(empty($cacheInfos['cache_list'])){ |
| 160 | 155 | $this->logger->info('No cache data were found skipping'); |
| 161 | 156 | return false; |
| 162 | - } |
|
| 163 | - else{ |
|
| 157 | + } else{ |
|
| 164 | 158 | $this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove'); |
| 165 | 159 | return apc_clear_cache('user'); |
| 166 | 160 | } |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | if(is_object($logger)){ |
| 50 | 50 | $this->logger = $logger; |
| 51 | - } |
|
| 52 | - else{ |
|
| 51 | + } else{ |
|
| 53 | 52 | $this->logger =& class_loader('Log', 'classes'); |
| 54 | 53 | $this->logger->setLogger('Library::FileCache'); |
| 55 | 54 | } |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | // Unlinking when the file was expired |
| 96 | 95 | unlink($filePath); |
| 97 | 96 | return false; |
| 98 | - } |
|
| 99 | - else{ |
|
| 97 | + } else{ |
|
| 100 | 98 | $this->logger->info('The cache not yet expire, now return the cache data for key ['. $key .'], the cache will expire at [' . date('Y-m-d H:i:s', $data['expire']) . ']'); |
| 101 | 99 | return $data['data']; |
| 102 | 100 | } |
@@ -133,8 +131,7 @@ discard block |
||
| 133 | 131 | $this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false'); |
| 134 | 132 | fclose($handle); |
| 135 | 133 | return false; |
| 136 | - } |
|
| 137 | - else{ |
|
| 134 | + } else{ |
|
| 138 | 135 | $this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']'); |
| 139 | 136 | fclose($handle); |
| 140 | 137 | chmod($filePath, 0640); |
@@ -156,8 +153,7 @@ discard block |
||
| 156 | 153 | if(! file_exists($filePath)){ |
| 157 | 154 | $this->logger->info('This cache file does not exists skipping'); |
| 158 | 155 | return false; |
| 159 | - } |
|
| 160 | - else{ |
|
| 156 | + } else{ |
|
| 161 | 157 | $this->logger->info('Found cache file [' .$filePath. '] remove it'); |
| 162 | 158 | unlink($filePath); |
| 163 | 159 | return true; |
@@ -179,16 +175,14 @@ discard block |
||
| 179 | 175 | if(! file_exists($filePath)){ |
| 180 | 176 | $this->logger->info('This cache file does not exists skipping'); |
| 181 | 177 | return false; |
| 182 | - } |
|
| 183 | - else{ |
|
| 178 | + } else{ |
|
| 184 | 179 | $this->logger->info('Found cache file [' .$filePath. '] check the validity'); |
| 185 | 180 | $data = file_get_contents($filePath); |
| 186 | 181 | $data = @unserialize($this->compressCacheData ? gzinflate($data) : $data); |
| 187 | 182 | if(! $data){ |
| 188 | 183 | $this->logger->warning('Can not unserialize the cache data for file [' . $filePath . ']'); |
| 189 | 184 | return false; |
| 190 | - } |
|
| 191 | - else{ |
|
| 185 | + } else{ |
|
| 192 | 186 | $this->logger->info('This cache data is OK check for expire'); |
| 193 | 187 | if(isset($data['expire']) && $data['expire'] > time()){ |
| 194 | 188 | $this->logger->info('This cache not yet expired return cache informations'); |
@@ -198,8 +192,7 @@ discard block |
||
| 198 | 192 | 'ttl' => $data['ttl'] |
| 199 | 193 | ); |
| 200 | 194 | return $info; |
| 201 | - } |
|
| 202 | - else{ |
|
| 195 | + } else{ |
|
| 203 | 196 | $this->logger->info('This cache already expired return false'); |
| 204 | 197 | return false; |
| 205 | 198 | } |
@@ -216,8 +209,7 @@ discard block |
||
| 216 | 209 | $list = glob(CACHE_PATH . '*.cache'); |
| 217 | 210 | if(! $list){ |
| 218 | 211 | $this->logger->info('No cache files were found skipping'); |
| 219 | - } |
|
| 220 | - else{ |
|
| 212 | + } else{ |
|
| 221 | 213 | $this->logger->info('Found [' . count($list) . '] cache files to remove if expired'); |
| 222 | 214 | foreach ($list as $file) { |
| 223 | 215 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -225,12 +217,10 @@ discard block |
||
| 225 | 217 | $data = @unserialize($this->compressCacheData ? gzinflate($data) : $data); |
| 226 | 218 | if(! $data){ |
| 227 | 219 | $this->logger->warning('Can not unserialize the cache data for file [' . $file . ']'); |
| 228 | - } |
|
| 229 | - else if(time() > $data['expire']){ |
|
| 220 | + } else if(time() > $data['expire']){ |
|
| 230 | 221 | $this->logger->info('The cache data for file [' . $file . '] already expired remove it'); |
| 231 | 222 | unlink($file); |
| 232 | - } |
|
| 233 | - else{ |
|
| 223 | + } else{ |
|
| 234 | 224 | $this->logger->info('The cache data for file [' . $file . '] not yet expired skip it'); |
| 235 | 225 | } |
| 236 | 226 | } |
@@ -245,8 +235,7 @@ discard block |
||
| 245 | 235 | $list = glob(CACHE_PATH . '*.cache'); |
| 246 | 236 | if(! $list){ |
| 247 | 237 | $this->logger->info('No cache files were found skipping'); |
| 248 | - } |
|
| 249 | - else{ |
|
| 238 | + } else{ |
|
| 250 | 239 | $this->logger->info('Found [' . count($list) . '] cache files to remove'); |
| 251 | 240 | foreach ($list as $file) { |
| 252 | 241 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -273,8 +262,7 @@ discard block |
||
| 273 | 262 | |
| 274 | 263 | $this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE'); |
| 275 | 264 | $this->compressCacheData = false; |
| 276 | - } |
|
| 277 | - else{ |
|
| 265 | + } else{ |
|
| 278 | 266 | $this->compressCacheData = $status; |
| 279 | 267 | } |
| 280 | 268 | return $this; |
@@ -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; |
@@ -452,15 +447,13 @@ discard block |
||
| 452 | 447 | function clean_input($str){ |
| 453 | 448 | if(is_array($str)){ |
| 454 | 449 | $str = array_map('clean_input', $str); |
| 455 | - } |
|
| 456 | - else if(is_object($str)){ |
|
| 450 | + } else if(is_object($str)){ |
|
| 457 | 451 | $obj = $str; |
| 458 | 452 | foreach ($str as $var => $value) { |
| 459 | 453 | $obj->$var = clean_input($value); |
| 460 | 454 | } |
| 461 | 455 | $str = $obj; |
| 462 | - } |
|
| 463 | - else{ |
|
| 456 | + } else{ |
|
| 464 | 457 | $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8'); |
| 465 | 458 | } |
| 466 | 459 | return $str; |
@@ -533,8 +526,7 @@ discard block |
||
| 533 | 526 | session_save_path($sessionSavePath); |
| 534 | 527 | $logger->info('Session save path: ' . $sessionSavePath); |
| 535 | 528 | } |
| 536 | - } |
|
| 537 | - else if($sessionHandler == 'database'){ |
|
| 529 | + } else if($sessionHandler == 'database'){ |
|
| 538 | 530 | //load database session handle library |
| 539 | 531 | //Model |
| 540 | 532 | require_once CORE_CLASSES_MODEL_PATH . 'Model.php'; |
@@ -545,8 +537,7 @@ discard block |
||
| 545 | 537 | $DBS =& class_loader('DBSessionHandler', 'classes'); |
| 546 | 538 | session_set_save_handler($DBS, true); |
| 547 | 539 | $logger->info('session save path: ' . get_config('session_save_path')); |
| 548 | - } |
|
| 549 | - else{ |
|
| 540 | + } else{ |
|
| 550 | 541 | show_error('Invalid session handler configuration'); |
| 551 | 542 | } |
| 552 | 543 | $lifetime = get_config('session_cookie_lifetime', 0); |
@@ -143,8 +143,7 @@ discard block |
||
| 143 | 143 | public function __construct(Database $db = null){ |
| 144 | 144 | if(is_object($db)){ |
| 145 | 145 | $this->setDatabaseInstance($db); |
| 146 | - } |
|
| 147 | - else{ |
|
| 146 | + } else{ |
|
| 148 | 147 | $obj = & get_instance(); |
| 149 | 148 | if(isset($obj->database) && is_object($obj->database)){ |
| 150 | 149 | /** |
@@ -256,8 +255,7 @@ discard block |
||
| 256 | 255 | $insert_id = $this->_database->insertId(); |
| 257 | 256 | $this->trigger('after_create', $insert_id); |
| 258 | 257 | return $insert_id; |
| 259 | - } |
|
| 260 | - else |
|
| 258 | + } else |
|
| 261 | 259 | { |
| 262 | 260 | return FALSE; |
| 263 | 261 | } |
@@ -294,8 +292,7 @@ discard block |
||
| 294 | 292 | ->update($data, $escape); |
| 295 | 293 | $this->trigger('after_update', array($data, $result)); |
| 296 | 294 | return $result; |
| 297 | - } |
|
| 298 | - else |
|
| 295 | + } else |
|
| 299 | 296 | { |
| 300 | 297 | return FALSE; |
| 301 | 298 | } |
@@ -318,8 +315,7 @@ discard block |
||
| 318 | 315 | ->update($data, $escape); |
| 319 | 316 | $this->trigger('after_update', array($data, $result)); |
| 320 | 317 | return $result; |
| 321 | - } |
|
| 322 | - else |
|
| 318 | + } else |
|
| 323 | 319 | { |
| 324 | 320 | return FALSE; |
| 325 | 321 | } |
@@ -336,8 +332,7 @@ discard block |
||
| 336 | 332 | if(is_array($args[1])){ |
| 337 | 333 | $data = array_pop($args); |
| 338 | 334 | } |
| 339 | - } |
|
| 340 | - else if(count($args) == 3){ |
|
| 335 | + } else if(count($args) == 3){ |
|
| 341 | 336 | if(is_array($args[2])){ |
| 342 | 337 | $data = array_pop($args); |
| 343 | 338 | } |
@@ -349,8 +344,7 @@ discard block |
||
| 349 | 344 | $result = $this->_database->from($this->_table)->update($data); |
| 350 | 345 | $this->trigger('after_update', array($data, $result)); |
| 351 | 346 | return $result; |
| 352 | - } |
|
| 353 | - else |
|
| 347 | + } else |
|
| 354 | 348 | { |
| 355 | 349 | return FALSE; |
| 356 | 350 | } |
@@ -377,8 +371,7 @@ discard block |
||
| 377 | 371 | if ($this->soft_delete) |
| 378 | 372 | { |
| 379 | 373 | $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE )); |
| 380 | - } |
|
| 381 | - else |
|
| 374 | + } else |
|
| 382 | 375 | { |
| 383 | 376 | $result = $this->_database->from($this->_table)->delete(); |
| 384 | 377 | } |
@@ -398,8 +391,7 @@ discard block |
||
| 398 | 391 | if ($this->soft_delete) |
| 399 | 392 | { |
| 400 | 393 | $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE )); |
| 401 | - } |
|
| 402 | - else |
|
| 394 | + } else |
|
| 403 | 395 | { |
| 404 | 396 | $result = $this->_database->from($this->_table)->delete(); |
| 405 | 397 | } |
@@ -417,8 +409,7 @@ discard block |
||
| 417 | 409 | if ($this->soft_delete) |
| 418 | 410 | { |
| 419 | 411 | $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE )); |
| 420 | - } |
|
| 421 | - else |
|
| 412 | + } else |
|
| 422 | 413 | { |
| 423 | 414 | $result = $this->_database->from($this->_table)->delete(); |
| 424 | 415 | } |
@@ -463,8 +454,7 @@ discard block |
||
| 463 | 454 | { |
| 464 | 455 | $relationship = $value; |
| 465 | 456 | $options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' ); |
| 466 | - } |
|
| 467 | - else |
|
| 457 | + } else |
|
| 468 | 458 | { |
| 469 | 459 | $relationship = $key; |
| 470 | 460 | $options = $value; |
@@ -474,15 +464,13 @@ discard block |
||
| 474 | 464 | { |
| 475 | 465 | if(is_object($this->loaderInstance)){ |
| 476 | 466 | $this->loaderInstance->model($options['model'], $relationship . '_model'); |
| 477 | - } |
|
| 478 | - else{ |
|
| 467 | + } else{ |
|
| 479 | 468 | Loader::model($options['model'], $relationship . '_model'); |
| 480 | 469 | } |
| 481 | 470 | if (is_object($row)) |
| 482 | 471 | { |
| 483 | 472 | $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']}); |
| 484 | - } |
|
| 485 | - else |
|
| 473 | + } else |
|
| 486 | 474 | { |
| 487 | 475 | $row[$relationship] = $this->{$relationship . '_model'}->get($row[$options['primary_key']]); |
| 488 | 476 | } |
@@ -495,8 +483,7 @@ discard block |
||
| 495 | 483 | { |
| 496 | 484 | $relationship = $value; |
| 497 | 485 | $options = array( 'primary_key' => $this->_table . '_id', 'model' => $value . '_model' ); |
| 498 | - } |
|
| 499 | - else |
|
| 486 | + } else |
|
| 500 | 487 | { |
| 501 | 488 | $relationship = $key; |
| 502 | 489 | $options = $value; |
@@ -506,15 +493,13 @@ discard block |
||
| 506 | 493 | { |
| 507 | 494 | if(is_object($this->loaderInstance)){ |
| 508 | 495 | $this->loaderInstance->model($options['model'], $relationship . '_model'); |
| 509 | - } |
|
| 510 | - else{ |
|
| 496 | + } else{ |
|
| 511 | 497 | Loader::model($options['model'], $relationship . '_model'); |
| 512 | 498 | } |
| 513 | 499 | if (is_object($row)) |
| 514 | 500 | { |
| 515 | 501 | $row->{$relationship} = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row->{$this->primary_key}); |
| 516 | - } |
|
| 517 | - else |
|
| 502 | + } else |
|
| 518 | 503 | { |
| 519 | 504 | $row[$relationship] = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row[$this->primary_key]); |
| 520 | 505 | } |
@@ -536,8 +521,7 @@ discard block |
||
| 536 | 521 | if(count($args) == 2) |
| 537 | 522 | { |
| 538 | 523 | list($key, $value) = $args; |
| 539 | - } |
|
| 540 | - else |
|
| 524 | + } else |
|
| 541 | 525 | { |
| 542 | 526 | $key = $this->primary_key; |
| 543 | 527 | $value = $args[0]; |
@@ -685,8 +669,7 @@ discard block |
||
| 685 | 669 | if (is_object($row)) |
| 686 | 670 | { |
| 687 | 671 | $row->created_at = date('Y-m-d H:i:s'); |
| 688 | - } |
|
| 689 | - else |
|
| 672 | + } else |
|
| 690 | 673 | { |
| 691 | 674 | $row['created_at'] = date('Y-m-d H:i:s'); |
| 692 | 675 | } |
@@ -699,8 +682,7 @@ discard block |
||
| 699 | 682 | if (is_object($row)) |
| 700 | 683 | { |
| 701 | 684 | $row->updated_at = date('Y-m-d H:i:s'); |
| 702 | - } |
|
| 703 | - else |
|
| 685 | + } else |
|
| 704 | 686 | { |
| 705 | 687 | $row['updated_at'] = date('Y-m-d H:i:s'); |
| 706 | 688 | } |
@@ -727,8 +709,7 @@ discard block |
||
| 727 | 709 | if (is_array($row)) |
| 728 | 710 | { |
| 729 | 711 | $row[$column] = unserialize($row[$column]); |
| 730 | - } |
|
| 731 | - else |
|
| 712 | + } else |
|
| 732 | 713 | { |
| 733 | 714 | $row->$column = unserialize($row->$column); |
| 734 | 715 | } |
@@ -748,8 +729,7 @@ discard block |
||
| 748 | 729 | if(isset($row->$attr)){ |
| 749 | 730 | unset($row->$attr); |
| 750 | 731 | } |
| 751 | - } |
|
| 752 | - else |
|
| 732 | + } else |
|
| 753 | 733 | { |
| 754 | 734 | if(isset($row[$attr])){ |
| 755 | 735 | unset($row[$attr]); |
@@ -828,8 +808,7 @@ discard block |
||
| 828 | 808 | { |
| 829 | 809 | $this->_database->orderBy($key, $value); |
| 830 | 810 | } |
| 831 | - } |
|
| 832 | - else |
|
| 811 | + } else |
|
| 833 | 812 | { |
| 834 | 813 | $this->_database->orderBy($criteria, $order); |
| 835 | 814 | } |
@@ -887,8 +866,7 @@ discard block |
||
| 887 | 866 | $fv = null; |
| 888 | 867 | if(is_object($this->formValidationInstance)){ |
| 889 | 868 | $fv = $this->formValidationInstance; |
| 890 | - } |
|
| 891 | - else{ |
|
| 869 | + } else{ |
|
| 892 | 870 | Loader::library('FormValidation'); |
| 893 | 871 | $fv = $this->formvalidation; |
| 894 | 872 | $this->setFormValidation($fv); |
@@ -900,13 +878,11 @@ discard block |
||
| 900 | 878 | if ($fv->run()) |
| 901 | 879 | { |
| 902 | 880 | return $data; |
| 903 | - } |
|
| 904 | - else |
|
| 881 | + } else |
|
| 905 | 882 | { |
| 906 | 883 | return FALSE; |
| 907 | 884 | } |
| 908 | - } |
|
| 909 | - else |
|
| 885 | + } else |
|
| 910 | 886 | { |
| 911 | 887 | return $data; |
| 912 | 888 | } |
@@ -925,46 +901,38 @@ discard block |
||
| 925 | 901 | if (is_array($filter)) |
| 926 | 902 | { |
| 927 | 903 | $this->_database->in($field, $filter); |
| 928 | - } |
|
| 929 | - else |
|
| 904 | + } else |
|
| 930 | 905 | { |
| 931 | 906 | if (is_int($field)) |
| 932 | 907 | { |
| 933 | 908 | $this->_database->where($filter); |
| 934 | - } |
|
| 935 | - else |
|
| 909 | + } else |
|
| 936 | 910 | { |
| 937 | 911 | $this->_database->where($field, $filter); |
| 938 | 912 | } |
| 939 | 913 | } |
| 940 | 914 | } |
| 941 | - } |
|
| 942 | - else if (count($params) == 1) |
|
| 915 | + } else if (count($params) == 1) |
|
| 943 | 916 | { |
| 944 | 917 | $this->_database->where($params[0]); |
| 945 | - } |
|
| 946 | - else if(count($params) == 2) |
|
| 918 | + } else if(count($params) == 2) |
|
| 947 | 919 | { |
| 948 | 920 | if (is_array($params[1])) |
| 949 | 921 | { |
| 950 | 922 | $this->_database->in($params[0], $params[1]); |
| 951 | - } |
|
| 952 | - else |
|
| 923 | + } else |
|
| 953 | 924 | { |
| 954 | 925 | $this->_database->where($params[0], $params[1]); |
| 955 | 926 | } |
| 956 | - } |
|
| 957 | - else if(count($params) == 3) |
|
| 927 | + } else if(count($params) == 3) |
|
| 958 | 928 | { |
| 959 | 929 | $this->_database->where($params[0], $params[1], $params[2]); |
| 960 | - } |
|
| 961 | - else |
|
| 930 | + } else |
|
| 962 | 931 | { |
| 963 | 932 | if (is_array($params[1])) |
| 964 | 933 | { |
| 965 | 934 | $this->_database->in($params[0], $params[1]); |
| 966 | - } |
|
| 967 | - else |
|
| 935 | + } else |
|
| 968 | 936 | { |
| 969 | 937 | $this->_database->where($params[0], $params[1]); |
| 970 | 938 | } |
@@ -152,8 +152,7 @@ discard block |
||
| 152 | 152 | if(! headers_sent()){ |
| 153 | 153 | header('Location: '.$url); |
| 154 | 154 | exit; |
| 155 | - } |
|
| 156 | - else{ |
|
| 155 | + } else{ |
|
| 157 | 156 | echo '<script> |
| 158 | 157 | location.href = "'.$url.'"; |
| 159 | 158 | </script>'; |
@@ -202,12 +201,10 @@ discard block |
||
| 202 | 201 | if($moduleViewPath){ |
| 203 | 202 | $path = $moduleViewPath; |
| 204 | 203 | $logger->info('Found view [' . $view . '] in module [' .$mod. '], the file path is [' .$moduleViewPath. '] we will used it'); |
| 205 | - } |
|
| 206 | - else{ |
|
| 204 | + } else{ |
|
| 207 | 205 | $logger->info('Cannot find view [' . $view . '] in module [' .$mod. '] using the default location'); |
| 208 | 206 | } |
| 209 | - } |
|
| 210 | - else{ |
|
| 207 | + } else{ |
|
| 211 | 208 | $logger->info('The current request does not use module using the default location.'); |
| 212 | 209 | } |
| 213 | 210 | } |
@@ -291,8 +288,7 @@ discard block |
||
| 291 | 288 | //compress the output if is available |
| 292 | 289 | if (self::$_canCompressOutput){ |
| 293 | 290 | ob_start('ob_gzhandler'); |
| 294 | - } |
|
| 295 | - else{ |
|
| 291 | + } else{ |
|
| 296 | 292 | ob_start(); |
| 297 | 293 | } |
| 298 | 294 | self::sendHeaders(200); |
@@ -324,8 +320,7 @@ discard block |
||
| 324 | 320 | $logger->info('The cache page content is not yet expire for the URL [' . $url . '] send 304 header to browser'); |
| 325 | 321 | self::sendHeaders(304); |
| 326 | 322 | return; |
| 327 | - } |
|
| 328 | - else{ |
|
| 323 | + } else{ |
|
| 329 | 324 | $logger->info('The cache page content is expired or the browser don\'t send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $url . '] send cache headers to tell the browser'); |
| 330 | 325 | self::sendHeaders(200); |
| 331 | 326 | //get the cache content |
@@ -345,15 +340,13 @@ discard block |
||
| 345 | 340 | //compress the output if is available |
| 346 | 341 | if (self::$_canCompressOutput){ |
| 347 | 342 | ob_start('ob_gzhandler'); |
| 348 | - } |
|
| 349 | - else{ |
|
| 343 | + } else{ |
|
| 350 | 344 | ob_start(); |
| 351 | 345 | } |
| 352 | 346 | echo $content; |
| 353 | 347 | ob_end_flush(); |
| 354 | 348 | return; |
| 355 | - } |
|
| 356 | - else{ |
|
| 349 | + } else{ |
|
| 357 | 350 | $logger->info('The page cache content for the URL [' . $url . '] is not valid may be already expired'); |
| 358 | 351 | $cache->delete($pageCacheKey); |
| 359 | 352 | } |
@@ -394,16 +387,14 @@ discard block |
||
| 394 | 387 | //compress the output if is available |
| 395 | 388 | if (self::$_canCompressOutput){ |
| 396 | 389 | ob_start('ob_gzhandler'); |
| 397 | - } |
|
| 398 | - else{ |
|
| 390 | + } else{ |
|
| 399 | 391 | ob_start(); |
| 400 | 392 | } |
| 401 | 393 | require_once $path; |
| 402 | 394 | $output = ob_get_clean(); |
| 403 | 395 | self::sendHeaders(404); |
| 404 | 396 | echo $output; |
| 405 | - } |
|
| 406 | - else{ |
|
| 397 | + } else{ |
|
| 407 | 398 | show_error('The 404 view [' .$path. '] does not exist'); |
| 408 | 399 | } |
| 409 | 400 | } |
@@ -418,8 +409,7 @@ discard block |
||
| 418 | 409 | //compress the output if exists |
| 419 | 410 | if (self::$_canCompressOutput){ |
| 420 | 411 | ob_start('ob_gzhandler'); |
| 421 | - } |
|
| 422 | - else{ |
|
| 412 | + } else{ |
|
| 423 | 413 | ob_start(); |
| 424 | 414 | } |
| 425 | 415 | extract($data); |
@@ -427,8 +417,7 @@ discard block |
||
| 427 | 417 | $output = ob_get_clean(); |
| 428 | 418 | self::sendHeaders(503); |
| 429 | 419 | echo $output; |
| 430 | - } |
|
| 431 | - else{ |
|
| 420 | + } else{ |
|
| 432 | 421 | //can't use show_error() at this time because some dependencies not yet loaded and to prevent loop |
| 433 | 422 | set_http_status_header(503); |
| 434 | 423 | echo 'The error view [' . $path . '] does not exist'; |
@@ -148,8 +148,7 @@ discard block |
||
| 148 | 148 | if(isset($path[1])){ |
| 149 | 149 | $instance = strtolower($path[1]); |
| 150 | 150 | } |
| 151 | - } |
|
| 152 | - else{ |
|
| 151 | + } else{ |
|
| 153 | 152 | $instance = strtolower($class); |
| 154 | 153 | } |
| 155 | 154 | } |
@@ -169,8 +168,7 @@ discard block |
||
| 169 | 168 | $searchModuleName = $path[0]; |
| 170 | 169 | $class = ucfirst($path[1]); |
| 171 | 170 | } |
| 172 | - } |
|
| 173 | - else{ |
|
| 171 | + } else{ |
|
| 174 | 172 | $class = ucfirst($class); |
| 175 | 173 | } |
| 176 | 174 | |
@@ -181,8 +179,7 @@ discard block |
||
| 181 | 179 | if($moduleModelFilePath){ |
| 182 | 180 | $logger->info('Found model [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleModelFilePath. '] we will used it'); |
| 183 | 181 | $classFilePath = $moduleModelFilePath; |
| 184 | - } |
|
| 185 | - else{ |
|
| 182 | + } else{ |
|
| 186 | 183 | $logger->info('Cannot find model [' . $class . '] from modules using the default location'); |
| 187 | 184 | } |
| 188 | 185 | $logger->info('The model file path to be loaded is [' . $classFilePath . ']'); |
@@ -194,12 +191,10 @@ discard block |
||
| 194 | 191 | $obj->{$instance} = $c; |
| 195 | 192 | static::$loaded[$instance] = $class; |
| 196 | 193 | $logger->info('Model [' . $class . '] --> ' . $classFilePath . ' loaded successfully.'); |
| 197 | - } |
|
| 198 | - else{ |
|
| 194 | + } else{ |
|
| 199 | 195 | show_error('The file '.$classFilePath.' exists but does not contain the class ['. $class . ']'); |
| 200 | 196 | } |
| 201 | - } |
|
| 202 | - else{ |
|
| 197 | + } else{ |
|
| 203 | 198 | show_error('Unable to find the model [' . $class . ']'); |
| 204 | 199 | } |
| 205 | 200 | } |
@@ -227,8 +222,7 @@ discard block |
||
| 227 | 222 | if(isset($path[1])){ |
| 228 | 223 | $instance = strtolower($path[1]); |
| 229 | 224 | } |
| 230 | - } |
|
| 231 | - else{ |
|
| 225 | + } else{ |
|
| 232 | 226 | $instance = strtolower($class); |
| 233 | 227 | } |
| 234 | 228 | } |
@@ -252,8 +246,7 @@ discard block |
||
| 252 | 246 | $libraryFilePath = CORE_LIBRARY_PATH . $file; |
| 253 | 247 | $class = ucfirst($class); |
| 254 | 248 | $logger->info('This library is a system library'); |
| 255 | - } |
|
| 256 | - else{ |
|
| 249 | + } else{ |
|
| 257 | 250 | $logger->info('This library is not a system library'); |
| 258 | 251 | //first check if this library is in the module |
| 259 | 252 | $logger->debug('Checking library [' . $class . '] from module list ...'); |
@@ -265,8 +258,7 @@ discard block |
||
| 265 | 258 | $searchModuleName = $path[0]; |
| 266 | 259 | $class = ucfirst($path[1]); |
| 267 | 260 | } |
| 268 | - } |
|
| 269 | - else{ |
|
| 261 | + } else{ |
|
| 270 | 262 | $class = ucfirst($class); |
| 271 | 263 | } |
| 272 | 264 | if(! $searchModuleName && !empty($obj->moduleName)){ |
@@ -276,8 +268,7 @@ discard block |
||
| 276 | 268 | if($moduleLibraryPath){ |
| 277 | 269 | $logger->info('Found library [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLibraryPath. '] we will used it'); |
| 278 | 270 | $libraryFilePath = $moduleLibraryPath; |
| 279 | - } |
|
| 280 | - else{ |
|
| 271 | + } else{ |
|
| 281 | 272 | $logger->info('Cannot find library [' . $class . '] from modules using the default location'); |
| 282 | 273 | } |
| 283 | 274 | } |
@@ -301,12 +292,10 @@ discard block |
||
| 301 | 292 | $obj->{$instance} = $c; |
| 302 | 293 | static::$loaded[$instance] = $class; |
| 303 | 294 | $logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.'); |
| 304 | - } |
|
| 305 | - else{ |
|
| 295 | + } else{ |
|
| 306 | 296 | show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class); |
| 307 | 297 | } |
| 308 | - } |
|
| 309 | - else{ |
|
| 298 | + } else{ |
|
| 310 | 299 | show_error('Unable to find library class [' . $class . ']'); |
| 311 | 300 | } |
| 312 | 301 | } |
@@ -350,8 +339,7 @@ discard block |
||
| 350 | 339 | if($moduleFunctionPath){ |
| 351 | 340 | $logger->info('Found helper [' . $function . '] from module [' .$searchModuleName. '], the file path is [' .$moduleFunctionPath. '] we will used it'); |
| 352 | 341 | $functionFilePath = $moduleFunctionPath; |
| 353 | - } |
|
| 354 | - else{ |
|
| 342 | + } else{ |
|
| 355 | 343 | $logger->info('Cannot find helper [' . $function . '] from modules using the default location'); |
| 356 | 344 | } |
| 357 | 345 | if(! $functionFilePath){ |
@@ -370,8 +358,7 @@ discard block |
||
| 370 | 358 | require_once $functionFilePath; |
| 371 | 359 | static::$loaded['function_' . $function] = $functionFilePath; |
| 372 | 360 | $logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.'); |
| 373 | - } |
|
| 374 | - else{ |
|
| 361 | + } else{ |
|
| 375 | 362 | show_error('Unable to find helper file [' . $file . ']'); |
| 376 | 363 | } |
| 377 | 364 | } |
@@ -414,8 +401,7 @@ discard block |
||
| 414 | 401 | if($moduleConfigPath){ |
| 415 | 402 | $logger->info('Found config [' . $filename . '] from module [' .$searchModuleName. '], the file path is [' .$moduleConfigPath. '] we will used it'); |
| 416 | 403 | $configFilePath = $moduleConfigPath; |
| 417 | - } |
|
| 418 | - else{ |
|
| 404 | + } else{ |
|
| 419 | 405 | $logger->info('Cannot find config [' . $filename . '] from modules using the default location'); |
| 420 | 406 | } |
| 421 | 407 | $logger->info('The config file path to be loaded is [' . $configFilePath . ']'); |
@@ -424,8 +410,7 @@ discard block |
||
| 424 | 410 | if(! empty($config) && is_array($config)){ |
| 425 | 411 | Config::setAll($config); |
| 426 | 412 | } |
| 427 | - } |
|
| 428 | - else{ |
|
| 413 | + } else{ |
|
| 429 | 414 | show_error('Unable to find config file ['. $configFilePath . ']'); |
| 430 | 415 | } |
| 431 | 416 | static::$loaded['config_' . $filename] = $configFilePath; |
@@ -483,8 +468,7 @@ discard block |
||
| 483 | 468 | if($moduleLanguagePath){ |
| 484 | 469 | $logger->info('Found language [' . $language . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLanguagePath. '] we will used it'); |
| 485 | 470 | $languageFilePath = $moduleLanguagePath; |
| 486 | - } |
|
| 487 | - else{ |
|
| 471 | + } else{ |
|
| 488 | 472 | $logger->info('Cannot find language [' . $language . '] from modules using the default location'); |
| 489 | 473 | } |
| 490 | 474 | if(! $languageFilePath){ |
@@ -511,8 +495,7 @@ discard block |
||
| 511 | 495 | } |
| 512 | 496 | static::$loaded['lang_' . $language] = $languageFilePath; |
| 513 | 497 | $logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.'); |
| 514 | - } |
|
| 515 | - else{ |
|
| 498 | + } else{ |
|
| 516 | 499 | show_error('Unable to find language file [' . $file . ']'); |
| 517 | 500 | } |
| 518 | 501 | } |
@@ -104,8 +104,7 @@ discard block |
||
| 104 | 104 | $this->routes = $route; |
| 105 | 105 | unset($route); |
| 106 | 106 | } |
| 107 | - } |
|
| 108 | - else{ |
|
| 107 | + } else{ |
|
| 109 | 108 | show_error('Unable to find the routes configuration file [' . $routesPath . ']'); |
| 110 | 109 | } |
| 111 | 110 | |
@@ -115,8 +114,7 @@ discard block |
||
| 115 | 114 | if($modulesRoutes && is_array($modulesRoutes)){ |
| 116 | 115 | $this->routes = array_merge($this->routes, $modulesRoutes); |
| 117 | 116 | $this->logger->info('Routes for all modules loaded successfully'); |
| 118 | - } |
|
| 119 | - else{ |
|
| 117 | + } else{ |
|
| 120 | 118 | $this->logger->info('No routes found for all modules skipping.'); |
| 121 | 119 | } |
| 122 | 120 | $this->logger->info('The routes configuration are listed below: ' . stringfy_vars($this->routes)); |
@@ -132,8 +130,7 @@ discard block |
||
| 132 | 130 | if($suffix = get_config('url_suffix')){ |
| 133 | 131 | $this->logger->info('URL suffix is enabled in the configuration, the value is [' . $suffix . ']' ); |
| 134 | 132 | $uri = str_ireplace($suffix, '', $uri); |
| 135 | - } |
|
| 136 | - else{ |
|
| 133 | + } else{ |
|
| 137 | 134 | $this->logger->info('URL suffix is not enabled in the configuration'); |
| 138 | 135 | } |
| 139 | 136 | if(strpos($uri, '?') !== false){ |
@@ -226,8 +223,7 @@ discard block |
||
| 226 | 223 | $this->logger->info('The request URI contains the front controller'); |
| 227 | 224 | array_shift($segment); |
| 228 | 225 | $this->segments = $segment; |
| 229 | - } |
|
| 230 | - else{ |
|
| 226 | + } else{ |
|
| 231 | 227 | $this->logger->info('The request URI does not contain the front controller'); |
| 232 | 228 | } |
| 233 | 229 | $uri = implode('/', $segment); |
@@ -249,8 +245,7 @@ discard block |
||
| 249 | 245 | $this->logger->info('The current request use the module [' .$moduleControllerMethod[0]. ']'); |
| 250 | 246 | $this->module = $moduleControllerMethod[0]; |
| 251 | 247 | $moduleControllerMethod = explode('@', $moduleControllerMethod[1]); |
| 252 | - } |
|
| 253 | - else{ |
|
| 248 | + } else{ |
|
| 254 | 249 | $this->logger->info('The current request does not use the module'); |
| 255 | 250 | $moduleControllerMethod = explode('@', $this->callback[$index]); |
| 256 | 251 | } |
@@ -297,8 +292,7 @@ discard block |
||
| 297 | 292 | } |
| 298 | 293 | //args |
| 299 | 294 | $this->args = $segment; |
| 300 | - } |
|
| 301 | - else{ |
|
| 295 | + } else{ |
|
| 302 | 296 | $this->logger->info('The application contains a loaded module will check if the current request is found in the module list'); |
| 303 | 297 | if(in_array($segment[0], $modules)){ |
| 304 | 298 | $this->logger->info('Found, the current request use the module [' . $segment[0] . ']'); |
@@ -312,8 +306,7 @@ discard block |
||
| 312 | 306 | if(! $path){ |
| 313 | 307 | $this->logger->info('The controller [' . $this->getController() . '] not found in the module, may be will use the module [' . $this->getModule() . '] as controller'); |
| 314 | 308 | $this->controller = $this->getModule(); |
| 315 | - } |
|
| 316 | - else{ |
|
| 309 | + } else{ |
|
| 317 | 310 | $this->controllerPath = $path; |
| 318 | 311 | array_shift($segment); |
| 319 | 312 | } |
@@ -325,8 +318,7 @@ discard block |
||
| 325 | 318 | } |
| 326 | 319 | //the remaining is for args |
| 327 | 320 | $this->args = $segment; |
| 328 | - } |
|
| 329 | - else{ |
|
| 321 | + } else{ |
|
| 330 | 322 | $this->logger->info('The current request information is not found in the module list'); |
| 331 | 323 | //controller |
| 332 | 324 | if(isset($segment[0])){ |
@@ -354,8 +346,7 @@ discard block |
||
| 354 | 346 | //if it is the module controller |
| 355 | 347 | if($this->getModule()){ |
| 356 | 348 | $this->controllerPath = Module::findControllerFullPath(ucfirst($this->getController()), $this->getModule()); |
| 357 | - } |
|
| 358 | - else{ |
|
| 349 | + } else{ |
|
| 359 | 350 | $this->controllerPath = APPS_CONTROLLER_PATH . ucfirst($this->getController()) . '.php'; |
| 360 | 351 | } |
| 361 | 352 | } |
@@ -370,15 +361,13 @@ discard block |
||
| 370 | 361 | if(! class_exists($controller, false)){ |
| 371 | 362 | $e404 = true; |
| 372 | 363 | $this->logger->info('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']'); |
| 373 | - } |
|
| 374 | - else{ |
|
| 364 | + } else{ |
|
| 375 | 365 | $controllerInstance = new $controller(); |
| 376 | 366 | $controllerMethod = $this->getMethod(); |
| 377 | 367 | if(! method_exists($controllerInstance, $controllerMethod)){ |
| 378 | 368 | $e404 = true; |
| 379 | 369 | $this->logger->info('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']'); |
| 380 | - } |
|
| 381 | - else{ |
|
| 370 | + } else{ |
|
| 382 | 371 | $this->logger->info('Routing data is set correctly now GO!'); |
| 383 | 372 | call_user_func_array(array($controllerInstance, $controllerMethod), $this->getArgs()); |
| 384 | 373 | $obj = & get_instance(); |
@@ -387,8 +376,7 @@ discard block |
||
| 387 | 376 | $obj->response->renderFinalPage(); |
| 388 | 377 | } |
| 389 | 378 | } |
| 390 | - } |
|
| 391 | - else{ |
|
| 379 | + } else{ |
|
| 392 | 380 | $this->logger->info('The controller file path [' . $classFilePath . '] does not exist'); |
| 393 | 381 | $e404 = true; |
| 394 | 382 | } |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | while(($module = readdir($moduleDir)) !== false){ |
| 61 | 61 | if($module != '.' && $module != '..' && preg_match('/^([a-z0-9-_]+)$/i', $module) && is_dir(MODULE_PATH . $module)){ |
| 62 | 62 | self::$list[] = $module; |
| 63 | - } |
|
| 64 | - else{ |
|
| 63 | + } else{ |
|
| 65 | 64 | $logger->info('Skipping [' .$module. '], may be this is not a directory or does not exists or is invalid name'); |
| 66 | 65 | } |
| 67 | 66 | } |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | |
| 71 | 70 | if(self::hasModule()){ |
| 72 | 71 | $logger->info('The application contains the module below [' . implode(', ', self::getModuleList()) . ']'); |
| 73 | - } |
|
| 74 | - else{ |
|
| 72 | + } else{ |
|
| 75 | 73 | $logger->info('The application contains no module skipping'); |
| 76 | 74 | } |
| 77 | 75 | } |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | if(! empty($route) && is_array($route)){ |
| 144 | 142 | $routes = array_merge($routes, $route); |
| 145 | 143 | unset($route); |
| 146 | - } |
|
| 147 | - else{ |
|
| 144 | + } else{ |
|
| 148 | 145 | show_error('No routing configuration found in [' .$file. '] for module [' . $module . ']'); |
| 149 | 146 | } |
| 150 | 147 | } |
@@ -173,8 +170,7 @@ discard block |
||
| 173 | 170 | if(file_exists($filePath)){ |
| 174 | 171 | $logger->info('Found controller [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 175 | 172 | return $filePath; |
| 176 | - } |
|
| 177 | - else{ |
|
| 173 | + } else{ |
|
| 178 | 174 | $logger->info('Controller [' . $class . '] does not exist in the module [' .$module. ']'); |
| 179 | 175 | return false; |
| 180 | 176 | } |
@@ -200,8 +196,7 @@ discard block |
||
| 200 | 196 | if(file_exists($filePath)){ |
| 201 | 197 | $logger->info('Found model [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 202 | 198 | return $filePath; |
| 203 | - } |
|
| 204 | - else{ |
|
| 199 | + } else{ |
|
| 205 | 200 | $logger->info('Model [' . $class . '] does not exist in the module [' .$module. ']'); |
| 206 | 201 | return false; |
| 207 | 202 | } |
@@ -226,8 +221,7 @@ discard block |
||
| 226 | 221 | if(file_exists($filePath)){ |
| 227 | 222 | $logger->info('Found configuration [' . $configuration . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 228 | 223 | return $filePath; |
| 229 | - } |
|
| 230 | - else{ |
|
| 224 | + } else{ |
|
| 231 | 225 | $logger->info('Configuration [' . $configuration . '] does not exist in the module [' .$module. ']'); |
| 232 | 226 | return false; |
| 233 | 227 | } |
@@ -253,8 +247,7 @@ discard block |
||
| 253 | 247 | if(file_exists($filePath)){ |
| 254 | 248 | $logger->info('Found helper [' . $helper . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 255 | 249 | return $filePath; |
| 256 | - } |
|
| 257 | - else{ |
|
| 250 | + } else{ |
|
| 258 | 251 | $logger->info('Helper [' . $helper . '] does not exist in the module [' .$module. ']'); |
| 259 | 252 | return false; |
| 260 | 253 | } |
@@ -280,8 +273,7 @@ discard block |
||
| 280 | 273 | if(file_exists($filePath)){ |
| 281 | 274 | $logger->info('Found library [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 282 | 275 | return $filePath; |
| 283 | - } |
|
| 284 | - else{ |
|
| 276 | + } else{ |
|
| 285 | 277 | $logger->info('Library [' . $class . '] does not exist in the module [' .$module. ']'); |
| 286 | 278 | return false; |
| 287 | 279 | } |
@@ -309,8 +301,7 @@ discard block |
||
| 309 | 301 | if(file_exists($filePath)){ |
| 310 | 302 | $logger->info('Found view [' . $view . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 311 | 303 | return $filePath; |
| 312 | - } |
|
| 313 | - else{ |
|
| 304 | + } else{ |
|
| 314 | 305 | $logger->info('View [' . $view . '] does not exist in the module [' .$module. ']'); |
| 315 | 306 | return false; |
| 316 | 307 | } |
@@ -337,8 +328,7 @@ discard block |
||
| 337 | 328 | if(file_exists($filePath)){ |
| 338 | 329 | $logger->info('Found language [' . $language . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 339 | 330 | return $filePath; |
| 340 | - } |
|
| 341 | - else{ |
|
| 331 | + } else{ |
|
| 342 | 332 | $logger->info('Language [' . $language . '] does not exist in the module [' .$module. ']'); |
| 343 | 333 | return false; |
| 344 | 334 | } |
@@ -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 | } |
@@ -156,15 +155,13 @@ discard block |
||
| 156 | 155 | //check if the server is running under IPv6 |
| 157 | 156 | if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE){ |
| 158 | 157 | $baseUrl = '['.$_SERVER['SERVER_ADDR'].']'; |
| 159 | - } |
|
| 160 | - else{ |
|
| 158 | + } else{ |
|
| 161 | 159 | $baseUrl = $_SERVER['SERVER_ADDR']; |
| 162 | 160 | } |
| 163 | 161 | $port = ((isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] != '80' && ! is_https() || $_SERVER['SERVER_PORT'] != '443' && is_https()) ) ? ':' . $_SERVER['SERVER_PORT'] : ''); |
| 164 | 162 | $baseUrl = (is_https() ? 'https' : 'http').'://' . $baseUrl . $port |
| 165 | 163 | . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME']))); |
| 166 | - } |
|
| 167 | - else{ |
|
| 164 | + } else{ |
|
| 168 | 165 | $logger->warning('Can not determine the application base URL automatically, use http://localhost as default'); |
| 169 | 166 | $baseUrl = 'http://localhost/'; |
| 170 | 167 | } |