@@ -19,26 +19,34 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function isIDExists($id, $site_srl = 0) |
| 21 | 21 | { |
| 22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
| 22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 23 | 25 | // directory and rss/atom/api reserved checking, etc. |
| 24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
| 25 | 27 | $dirs[] = 'rss'; |
| 26 | 28 | $dirs[] = 'atom'; |
| 27 | 29 | $dirs[] = 'api'; |
| 28 | - if(in_array($id, $dirs)) return true; |
|
| 30 | + if(in_array($id, $dirs)) { |
|
| 31 | + return true; |
|
| 32 | + } |
|
| 29 | 33 | // mid test |
| 30 | 34 | $args = new stdClass(); |
| 31 | 35 | $args->mid = $id; |
| 32 | 36 | $args->site_srl = $site_srl; |
| 33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
| 34 | - if($output->data->count) return true; |
|
| 38 | + if($output->data->count) { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
| 36 | 42 | if(!$site_srl) |
| 37 | 43 | { |
| 38 | 44 | $site_args = new stdClass(); |
| 39 | 45 | $site_args->domain = $id; |
| 40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
| 41 | - if($output->data->count) return true; |
|
| 47 | + if($output->data->count) { |
|
| 48 | + return true; |
|
| 49 | + } |
|
| 42 | 50 | } |
| 43 | 51 | |
| 44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
| 82 | 90 | function getDefaultMid() |
| 83 | 91 | { |
| 84 | 92 | $default_url = Context::getDefaultUrl(); |
| 85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
| 94 | + $default_url = substr($default_url, 0, -1); |
|
| 95 | + } |
|
| 86 | 96 | |
| 87 | 97 | $request_url = Context::getRequestUri(); |
| 88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
| 99 | + $request_url = substr($request_url, 0, -1); |
|
| 100 | + } |
|
| 89 | 101 | |
| 90 | 102 | $default_url_parse = parse_url($default_url); |
| 91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
| 100 | 112 | $url_info = parse_url($request_url); |
| 101 | 113 | $hostname = $url_info['host']; |
| 102 | 114 | $path = $url_info['path']; |
| 103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
| 116 | + $path = substr($path, 0, -1); |
|
| 117 | + } |
|
| 104 | 118 | |
| 105 | 119 | $domain = sprintf('%s%s%s', $hostname, $url_info['port']&&$url_info['port']!=80?':'.$url_info['port']:'',$path); |
| 106 | 120 | } |
| 107 | 121 | |
| 108 | 122 | if($domain === '') |
| 109 | 123 | { |
| 110 | - if(!$vid) $vid = $mid; |
|
| 124 | + if(!$vid) { |
|
| 125 | + $vid = $mid; |
|
| 126 | + } |
|
| 111 | 127 | if($vid) |
| 112 | 128 | { |
| 113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
| 133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
| 134 | 150 | $site_info = $output->data; |
| 135 | 151 | |
| 136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 152 | + if($oCacheHandler->isSupport()) { |
|
| 153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 154 | + } |
|
| 137 | 155 | } |
| 138 | 156 | |
| 139 | 157 | if($site_info && $vid) |
| 140 | 158 | { |
| 141 | 159 | Context::set('vid', $site_info->domain, true); |
| 142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
| 160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
| 161 | + Context::set('mid', $site_info->mid,true); |
|
| 162 | + } |
|
| 143 | 163 | } |
| 144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
| 145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
| 165 | 185 | { |
| 166 | 186 | // Create a table if sites table doesn't exist |
| 167 | 187 | $oDB = &DB::getInstance(); |
| 168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | - if(!$oDB->isTableExists('sites')) return; |
|
| 188 | + if(!$oDB->isTableExists('sites')) { |
|
| 189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 190 | + } |
|
| 191 | + if(!$oDB->isTableExists('sites')) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 170 | 194 | |
| 171 | 195 | // Get mid, language |
| 172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
| 184 | 208 | if($output->data && !$output->data->index_module_srl) |
| 185 | 209 | { |
| 186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
| 187 | - } |
|
| 188 | - else |
|
| 211 | + } else |
|
| 189 | 212 | { |
| 190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
| 191 | - if(!$output->toBool()) return $output; |
|
| 214 | + if(!$output->toBool()) { |
|
| 215 | + return $output; |
|
| 216 | + } |
|
| 192 | 217 | } |
| 193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
| 194 | 219 | } |
| 195 | 220 | $site_info = $output->data; |
| 196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 221 | + if($oCacheHandler->isSupport()) { |
|
| 222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 223 | + } |
|
| 197 | 224 | } |
| 198 | 225 | } |
| 199 | 226 | |
| 200 | - if(!$site_info->module_srl) return $site_info; |
|
| 201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 227 | + if(!$site_info->module_srl) { |
|
| 228 | + return $site_info; |
|
| 229 | + } |
|
| 230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
| 231 | + $site_info = $site_info[0]; |
|
| 232 | + } |
|
| 202 | 233 | return $this->addModuleExtraVars($site_info); |
| 203 | 234 | } |
| 204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
| 248 | 279 | } |
| 249 | 280 | |
| 250 | 281 | $this->applyDefaultSkin($module_info); |
| 251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
| 283 | + $module_info = $module_info->data[0]; |
|
| 284 | + } |
|
| 252 | 285 | return $this->addModuleExtraVars($module_info); |
| 253 | 286 | } |
| 254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
| 340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
| 341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
| 343 | - } |
|
| 344 | - else |
|
| 376 | + } else |
|
| 345 | 377 | { |
| 346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
| 347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
| 382 | 414 | $args = new stdClass(); |
| 383 | 415 | $args->module_srl = $module_srl; |
| 384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
| 385 | - if(!$output->toBool()) return; |
|
| 417 | + if(!$output->toBool()) { |
|
| 418 | + return; |
|
| 419 | + } |
|
| 386 | 420 | |
| 387 | 421 | $mid_info = $output->data; |
| 388 | 422 | $this->applyDefaultSkin($mid_info); |
| 389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 423 | + if($oCacheHandler->isSupport()) { |
|
| 424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
| 425 | + } |
|
| 390 | 426 | } |
| 391 | 427 | |
| 392 | 428 | if($mid_info && count($columnList)) |
@@ -399,11 +435,14 @@ discard block |
||
| 399 | 435 | $module_info->$key = $item; |
| 400 | 436 | } |
| 401 | 437 | } |
| 438 | + } else { |
|
| 439 | + $module_info = $mid_info; |
|
| 402 | 440 | } |
| 403 | - else $module_info = $mid_info; |
|
| 404 | 441 | |
| 405 | 442 | $oModuleController = getController('module'); |
| 406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 443 | + if(isset($module_info->browser_title)) { |
|
| 444 | + $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 445 | + } |
|
| 407 | 446 | |
| 408 | 447 | $this->applyDefaultSkin($module_info); |
| 409 | 448 | return $this->addModuleExtraVars($module_info); |
@@ -451,11 +490,15 @@ discard block |
||
| 451 | 490 | */ |
| 452 | 491 | function getModulesInfo($module_srls, $columnList = array()) |
| 453 | 492 | { |
| 454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
| 493 | + if(is_array($module_srls)) { |
|
| 494 | + $module_srls = implode(',',$module_srls); |
|
| 495 | + } |
|
| 455 | 496 | $args = new stdClass(); |
| 456 | 497 | $args->module_srls = $module_srls; |
| 457 | 498 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
| 458 | - if(!$output->toBool()) return; |
|
| 499 | + if(!$output->toBool()) { |
|
| 500 | + return; |
|
| 501 | + } |
|
| 459 | 502 | return $this->addModuleExtraVars($output->data); |
| 460 | 503 | } |
| 461 | 504 | |
@@ -465,31 +508,44 @@ discard block |
||
| 465 | 508 | function addModuleExtraVars($module_info) |
| 466 | 509 | { |
| 467 | 510 | // Process although one or more module informaion is requested |
| 468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
| 469 | - else $target_module_info = $module_info; |
|
| 511 | + if(!is_array($module_info)) { |
|
| 512 | + $target_module_info = array($module_info); |
|
| 513 | + } else { |
|
| 514 | + $target_module_info = $module_info; |
|
| 515 | + } |
|
| 470 | 516 | // Get module_srl |
| 471 | 517 | $module_srls = array(); |
| 472 | 518 | foreach($target_module_info as $key => $val) |
| 473 | 519 | { |
| 474 | 520 | $module_srl = $val->module_srl; |
| 475 | - if(!$module_srl) continue; |
|
| 521 | + if(!$module_srl) { |
|
| 522 | + continue; |
|
| 523 | + } |
|
| 476 | 524 | $module_srls[] = $val->module_srl; |
| 477 | 525 | } |
| 478 | 526 | // Extract extra information of the module and skin |
| 479 | 527 | $extra_vars = $this->getModuleExtraVars($module_srls); |
| 480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 528 | + if(!count($module_srls) || !count($extra_vars)) { |
|
| 529 | + return $module_info; |
|
| 530 | + } |
|
| 481 | 531 | |
| 482 | 532 | foreach($target_module_info as $key => $val) |
| 483 | 533 | { |
| 484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 534 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
| 535 | + continue; |
|
| 536 | + } |
|
| 485 | 537 | foreach($extra_vars[$val->module_srl] as $k => $v) |
| 486 | 538 | { |
| 487 | - if($target_module_info[$key]->{$k}) continue; |
|
| 539 | + if($target_module_info[$key]->{$k}) { |
|
| 540 | + continue; |
|
| 541 | + } |
|
| 488 | 542 | $target_module_info[$key]->{$k} = $v; |
| 489 | 543 | } |
| 490 | 544 | } |
| 491 | 545 | |
| 492 | - if(is_array($module_info)) return $target_module_info; |
|
| 546 | + if(is_array($module_info)) { |
|
| 547 | + return $target_module_info; |
|
| 548 | + } |
|
| 493 | 549 | return $target_module_info[0]; |
| 494 | 550 | } |
| 495 | 551 | |
@@ -518,7 +574,9 @@ discard block |
||
| 518 | 574 | } |
| 519 | 575 | |
| 520 | 576 | $output = executeQuery('module.getMidList', $args, $columnList); |
| 521 | - if(!$output->toBool()) return $output; |
|
| 577 | + if(!$output->toBool()) { |
|
| 578 | + return $output; |
|
| 579 | + } |
|
| 522 | 580 | $list = $output->data; |
| 523 | 581 | |
| 524 | 582 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -526,9 +584,13 @@ discard block |
||
| 526 | 584 | $oCacheHandler->put($cache_key, $list); |
| 527 | 585 | } |
| 528 | 586 | } |
| 529 | - if(!$list) return; |
|
| 587 | + if(!$list) { |
|
| 588 | + return; |
|
| 589 | + } |
|
| 530 | 590 | |
| 531 | - if(!is_array($list)) $list = array($list); |
|
| 591 | + if(!is_array($list)) { |
|
| 592 | + $list = array($list); |
|
| 593 | + } |
|
| 532 | 594 | |
| 533 | 595 | foreach($list as $val) |
| 534 | 596 | { |
@@ -544,10 +606,14 @@ discard block |
||
| 544 | 606 | function getModuleSrlList($args = null, $columnList = array()) |
| 545 | 607 | { |
| 546 | 608 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
| 547 | - if(!$output->toBool()) return $output; |
|
| 609 | + if(!$output->toBool()) { |
|
| 610 | + return $output; |
|
| 611 | + } |
|
| 548 | 612 | |
| 549 | 613 | $list = $output->data; |
| 550 | - if(!$list) return; |
|
| 614 | + if(!$list) { |
|
| 615 | + return; |
|
| 616 | + } |
|
| 551 | 617 | |
| 552 | 618 | return $list; |
| 553 | 619 | } |
@@ -557,20 +623,32 @@ discard block |
||
| 557 | 623 | */ |
| 558 | 624 | function getModuleSrlByMid($mid) |
| 559 | 625 | { |
| 560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
| 561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
| 626 | + if($mid && !is_array($mid)) { |
|
| 627 | + $mid = explode(',',$mid); |
|
| 628 | + } |
|
| 629 | + if(is_array($mid)) { |
|
| 630 | + $mid = "'".implode("','",$mid)."'"; |
|
| 631 | + } |
|
| 562 | 632 | |
| 563 | 633 | $site_module_info = Context::get('site_module_info'); |
| 564 | 634 | |
| 565 | 635 | $args = new stdClass; |
| 566 | 636 | $args->mid = $mid; |
| 567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 637 | + if($site_module_info) { |
|
| 638 | + $args->site_srl = $site_module_info->site_srl; |
|
| 639 | + } |
|
| 568 | 640 | $output = executeQuery('module.getModuleSrlByMid', $args); |
| 569 | - if(!$output->toBool()) return $output; |
|
| 641 | + if(!$output->toBool()) { |
|
| 642 | + return $output; |
|
| 643 | + } |
|
| 570 | 644 | |
| 571 | 645 | $list = $output->data; |
| 572 | - if(!$list) return; |
|
| 573 | - if(!is_array($list)) $list = array($list); |
|
| 646 | + if(!$list) { |
|
| 647 | + return; |
|
| 648 | + } |
|
| 649 | + if(!is_array($list)) { |
|
| 650 | + $list = array($list); |
|
| 651 | + } |
|
| 574 | 652 | |
| 575 | 653 | foreach($list as $key => $val) |
| 576 | 654 | { |
@@ -599,8 +677,12 @@ discard block |
||
| 599 | 677 | { |
| 600 | 678 | $args = new stdClass(); |
| 601 | 679 | $output = executeQueryArray('module.getActionForward',$args); |
| 602 | - if(!$output->toBool()) return new stdClass; |
|
| 603 | - if(!$output->data) $output->data = array(); |
|
| 680 | + if(!$output->toBool()) { |
|
| 681 | + return new stdClass; |
|
| 682 | + } |
|
| 683 | + if(!$output->data) { |
|
| 684 | + $output->data = array(); |
|
| 685 | + } |
|
| 604 | 686 | |
| 605 | 687 | $action_forward = array(); |
| 606 | 688 | foreach($output->data as $item) |
@@ -617,8 +699,7 @@ discard block |
||
| 617 | 699 | if($action_forward[$act]) |
| 618 | 700 | { |
| 619 | 701 | return $action_forward[$act]; |
| 620 | - } |
|
| 621 | - else |
|
| 702 | + } else |
|
| 622 | 703 | { |
| 623 | 704 | return new stdClass(); |
| 624 | 705 | } |
@@ -726,8 +807,7 @@ discard block |
||
| 726 | 807 | if(file_exists($cache_file)) |
| 727 | 808 | { |
| 728 | 809 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
| 729 | - } |
|
| 730 | - else |
|
| 810 | + } else |
|
| 731 | 811 | { |
| 732 | 812 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
| 733 | 813 | } |
@@ -743,16 +823,22 @@ discard block |
||
| 743 | 823 | { |
| 744 | 824 | // Get a path of the requested module. Return if not exists. |
| 745 | 825 | $module_path = ModuleHandler::getModulePath($module); |
| 746 | - if(!$module_path) return; |
|
| 826 | + if(!$module_path) { |
|
| 827 | + return; |
|
| 828 | + } |
|
| 747 | 829 | // Read the xml file for module skin information |
| 748 | 830 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
| 749 | - if(!file_exists($xml_file)) return; |
|
| 831 | + if(!file_exists($xml_file)) { |
|
| 832 | + return; |
|
| 833 | + } |
|
| 750 | 834 | |
| 751 | 835 | $oXmlParser = new XmlParser(); |
| 752 | 836 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 753 | 837 | $xml_obj = $tmp_xml_obj->module; |
| 754 | 838 | |
| 755 | - if(!$xml_obj) return; |
|
| 839 | + if(!$xml_obj) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 756 | 842 | |
| 757 | 843 | // Module Information |
| 758 | 844 | $module_info = new stdClass(); |
@@ -764,14 +850,19 @@ discard block |
||
| 764 | 850 | $module_info->version = $xml_obj->version->body; |
| 765 | 851 | $module_info->homepage = $xml_obj->link->body; |
| 766 | 852 | $module_info->category = $xml_obj->category->body; |
| 767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 853 | + if(!$module_info->category) { |
|
| 854 | + $module_info->category = 'service'; |
|
| 855 | + } |
|
| 768 | 856 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 769 | 857 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 770 | 858 | $module_info->license = $xml_obj->license->body; |
| 771 | 859 | $module_info->license_link = $xml_obj->license->attrs->link; |
| 772 | 860 | |
| 773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 774 | - else $author_list = $xml_obj->author; |
|
| 861 | + if(!is_array($xml_obj->author)) { |
|
| 862 | + $author_list[] = $xml_obj->author; |
|
| 863 | + } else { |
|
| 864 | + $author_list = $xml_obj->author; |
|
| 865 | + } |
|
| 775 | 866 | |
| 776 | 867 | foreach($author_list as $author) |
| 777 | 868 | { |
@@ -781,15 +872,16 @@ discard block |
||
| 781 | 872 | $author_obj->homepage = $author->attrs->link; |
| 782 | 873 | $module_info->author[] = $author_obj; |
| 783 | 874 | } |
| 784 | - } |
|
| 785 | - else |
|
| 875 | + } else |
|
| 786 | 876 | { |
| 787 | 877 | // module format 0.1 |
| 788 | 878 | $module_info->title = $xml_obj->title->body; |
| 789 | 879 | $module_info->description = $xml_obj->author->description->body; |
| 790 | 880 | $module_info->version = $xml_obj->attrs->version; |
| 791 | 881 | $module_info->category = $xml_obj->attrs->category; |
| 792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 882 | + if(!$module_info->category) { |
|
| 883 | + $module_info->category = 'service'; |
|
| 884 | + } |
|
| 793 | 885 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 794 | 886 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 795 | 887 | $author_obj = new stdClass(); |
@@ -818,11 +910,15 @@ discard block |
||
| 818 | 910 | { |
| 819 | 911 | // Get a path of the requested module. Return if not exists. |
| 820 | 912 | $class_path = ModuleHandler::getModulePath($module); |
| 821 | - if(!$class_path) return; |
|
| 913 | + if(!$class_path) { |
|
| 914 | + return; |
|
| 915 | + } |
|
| 822 | 916 | |
| 823 | 917 | // Check if module.xml exists in the path. Return if not exist |
| 824 | 918 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
| 825 | - if(!file_exists($xml_file)) return; |
|
| 919 | + if(!file_exists($xml_file)) { |
|
| 920 | + return; |
|
| 921 | + } |
|
| 826 | 922 | |
| 827 | 923 | // Check if cached file exists |
| 828 | 924 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -841,7 +937,10 @@ discard block |
||
| 841 | 937 | |
| 842 | 938 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
| 843 | 939 | |
| 844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 940 | + if(!count($xml_obj->module)) { |
|
| 941 | + return; |
|
| 942 | + } |
|
| 943 | + // /< Error occurs if module tag doesn't included in the xml |
|
| 845 | 944 | |
| 846 | 945 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
| 847 | 946 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -853,8 +952,11 @@ discard block |
||
| 853 | 952 | // Arrange permission information |
| 854 | 953 | if($grants) |
| 855 | 954 | { |
| 856 | - if(is_array($grants)) $grant_list = $grants; |
|
| 857 | - else $grant_list[] = $grants; |
|
| 955 | + if(is_array($grants)) { |
|
| 956 | + $grant_list = $grants; |
|
| 957 | + } else { |
|
| 958 | + $grant_list[] = $grants; |
|
| 959 | + } |
|
| 858 | 960 | |
| 859 | 961 | $info->grant = new stdClass(); |
| 860 | 962 | $buff[] = '$info->grant = new stdClass;'; |
@@ -876,8 +978,11 @@ discard block |
||
| 876 | 978 | // Permissions to grant |
| 877 | 979 | if($permissions) |
| 878 | 980 | { |
| 879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
| 880 | - else $permission_list[] = $permissions; |
|
| 981 | + if(is_array($permissions)) { |
|
| 982 | + $permission_list = $permissions; |
|
| 983 | + } else { |
|
| 984 | + $permission_list[] = $permissions; |
|
| 985 | + } |
|
| 881 | 986 | |
| 882 | 987 | $buff[] = '$info->permission = new stdClass;'; |
| 883 | 988 | |
@@ -895,8 +1000,11 @@ discard block |
||
| 895 | 1000 | // for admin menus |
| 896 | 1001 | if($menus) |
| 897 | 1002 | { |
| 898 | - if(is_array($menus)) $menu_list = $menus; |
|
| 899 | - else $menu_list[] = $menus; |
|
| 1003 | + if(is_array($menus)) { |
|
| 1004 | + $menu_list = $menus; |
|
| 1005 | + } else { |
|
| 1006 | + $menu_list[] = $menus; |
|
| 1007 | + } |
|
| 900 | 1008 | |
| 901 | 1009 | $buff[] = '$info->menu = new stdClass;'; |
| 902 | 1010 | $info->menu = new stdClass(); |
@@ -920,8 +1028,11 @@ discard block |
||
| 920 | 1028 | // actions |
| 921 | 1029 | if($actions) |
| 922 | 1030 | { |
| 923 | - if(is_array($actions)) $action_list = $actions; |
|
| 924 | - else $action_list[] = $actions; |
|
| 1031 | + if(is_array($actions)) { |
|
| 1032 | + $action_list = $actions; |
|
| 1033 | + } else { |
|
| 1034 | + $action_list[] = $actions; |
|
| 1035 | + } |
|
| 925 | 1036 | |
| 926 | 1037 | $buff[] = '$info->action = new stdClass;'; |
| 927 | 1038 | $info->action = new stdClass(); |
@@ -1007,7 +1118,9 @@ discard block |
||
| 1007 | 1118 | return $info; |
| 1008 | 1119 | } |
| 1009 | 1120 | |
| 1010 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1121 | + if(file_exists($cache_file)) { |
|
| 1122 | + return include($cache_file); |
|
| 1123 | + } |
|
| 1011 | 1124 | } |
| 1012 | 1125 | |
| 1013 | 1126 | /** |
@@ -1045,7 +1158,9 @@ discard block |
||
| 1045 | 1158 | |
| 1046 | 1159 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1047 | 1160 | $list = FileHandler::readDir($skin_path); |
| 1048 | - if(!count($list)) return; |
|
| 1161 | + if(!count($list)) { |
|
| 1162 | + return; |
|
| 1163 | + } |
|
| 1049 | 1164 | |
| 1050 | 1165 | natcasesort($list); |
| 1051 | 1166 | |
@@ -1099,8 +1214,7 @@ discard block |
||
| 1099 | 1214 | if($dir == 'skins') |
| 1100 | 1215 | { |
| 1101 | 1216 | $type = 'P'; |
| 1102 | - } |
|
| 1103 | - else |
|
| 1217 | + } else |
|
| 1104 | 1218 | { |
| 1105 | 1219 | $type = 'M'; |
| 1106 | 1220 | } |
@@ -1128,14 +1242,20 @@ discard block |
||
| 1128 | 1242 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1129 | 1243 | { |
| 1130 | 1244 | // Read xml file having skin information |
| 1131 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1245 | + if(substr($path,-1)!='/') { |
|
| 1246 | + $path .= '/'; |
|
| 1247 | + } |
|
| 1132 | 1248 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1133 | - if(!file_exists($skin_xml_file)) return; |
|
| 1249 | + if(!file_exists($skin_xml_file)) { |
|
| 1250 | + return; |
|
| 1251 | + } |
|
| 1134 | 1252 | // Create XmlParser object |
| 1135 | 1253 | $oXmlParser = new XmlParser(); |
| 1136 | 1254 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1137 | 1255 | // Return if no skin information is |
| 1138 | - if(!$_xml_obj->skin) return; |
|
| 1256 | + if(!$_xml_obj->skin) { |
|
| 1257 | + return; |
|
| 1258 | + } |
|
| 1139 | 1259 | $xml_obj = $_xml_obj->skin; |
| 1140 | 1260 | // Skin Name |
| 1141 | 1261 | $skin_info = new stdClass(); |
@@ -1152,8 +1272,11 @@ discard block |
||
| 1152 | 1272 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1153 | 1273 | $skin_info->description = $xml_obj->description->body; |
| 1154 | 1274 | |
| 1155 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1156 | - else $author_list = $xml_obj->author; |
|
| 1275 | + if(!is_array($xml_obj->author)) { |
|
| 1276 | + $author_list[] = $xml_obj->author; |
|
| 1277 | + } else { |
|
| 1278 | + $author_list = $xml_obj->author; |
|
| 1279 | + } |
|
| 1157 | 1280 | |
| 1158 | 1281 | foreach($author_list as $author) |
| 1159 | 1282 | { |
@@ -1167,8 +1290,12 @@ discard block |
||
| 1167 | 1290 | if($xml_obj->extra_vars) |
| 1168 | 1291 | { |
| 1169 | 1292 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1170 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1171 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1293 | + if(!$extra_var_groups) { |
|
| 1294 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1295 | + } |
|
| 1296 | + if(!is_array($extra_var_groups)) { |
|
| 1297 | + $extra_var_groups = array($extra_var_groups); |
|
| 1298 | + } |
|
| 1172 | 1299 | |
| 1173 | 1300 | foreach($extra_var_groups as $group) |
| 1174 | 1301 | { |
@@ -1177,7 +1304,9 @@ discard block |
||
| 1177 | 1304 | { |
| 1178 | 1305 | continue; |
| 1179 | 1306 | } |
| 1180 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1307 | + if(!is_array($group->var)) { |
|
| 1308 | + $extra_vars = array($group->var); |
|
| 1309 | + } |
|
| 1181 | 1310 | |
| 1182 | 1311 | foreach($extra_vars as $key => $val) |
| 1183 | 1312 | { |
@@ -1204,8 +1333,7 @@ discard block |
||
| 1204 | 1333 | $obj->options[$i]->title = $val->options[$i]->title->body; |
| 1205 | 1334 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
| 1206 | 1335 | } |
| 1207 | - } |
|
| 1208 | - else |
|
| 1336 | + } else |
|
| 1209 | 1337 | { |
| 1210 | 1338 | $obj->options[0] = new stdClass(); |
| 1211 | 1339 | $obj->options[0]->title = $val->options->title->body; |
@@ -1216,8 +1344,7 @@ discard block |
||
| 1216 | 1344 | } |
| 1217 | 1345 | } |
| 1218 | 1346 | } |
| 1219 | - } |
|
| 1220 | - else |
|
| 1347 | + } else |
|
| 1221 | 1348 | { |
| 1222 | 1349 | // skin format v0.1 |
| 1223 | 1350 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1235,8 +1362,12 @@ discard block |
||
| 1235 | 1362 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1236 | 1363 | // Variables used in the skin |
| 1237 | 1364 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1238 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1239 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1365 | + if(!$extra_var_groups) { |
|
| 1366 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1367 | + } |
|
| 1368 | + if(!is_array($extra_var_groups)) { |
|
| 1369 | + $extra_var_groups = array($extra_var_groups); |
|
| 1370 | + } |
|
| 1240 | 1371 | |
| 1241 | 1372 | foreach($extra_var_groups as $group) |
| 1242 | 1373 | { |
@@ -1244,7 +1375,9 @@ discard block |
||
| 1244 | 1375 | |
| 1245 | 1376 | if($extra_vars) |
| 1246 | 1377 | { |
| 1247 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1378 | + if(!is_array($extra_vars)) { |
|
| 1379 | + $extra_vars = array($extra_vars); |
|
| 1380 | + } |
|
| 1248 | 1381 | |
| 1249 | 1382 | foreach($extra_vars as $var) |
| 1250 | 1383 | { |
@@ -1266,8 +1399,7 @@ discard block |
||
| 1266 | 1399 | $options[$i]->title = $var->default[$i]->body; |
| 1267 | 1400 | $options[$i]->value = $var->default[$i]->body; |
| 1268 | 1401 | } |
| 1269 | - } |
|
| 1270 | - else |
|
| 1402 | + } else |
|
| 1271 | 1403 | { |
| 1272 | 1404 | $options[0]->title = $var->default->body; |
| 1273 | 1405 | $options[0]->value = $var->default->body; |
@@ -1297,7 +1429,9 @@ discard block |
||
| 1297 | 1429 | $colorset = $xml_obj->colorset->color; |
| 1298 | 1430 | if($colorset) |
| 1299 | 1431 | { |
| 1300 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1432 | + if(!is_array($colorset)) { |
|
| 1433 | + $colorset = array($colorset); |
|
| 1434 | + } |
|
| 1301 | 1435 | |
| 1302 | 1436 | foreach($colorset as $color) |
| 1303 | 1437 | { |
@@ -1307,9 +1441,12 @@ discard block |
||
| 1307 | 1441 | if($screenshot) |
| 1308 | 1442 | { |
| 1309 | 1443 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1310 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1444 | + if(!file_exists($screenshot)) { |
|
| 1445 | + $screenshot = ""; |
|
| 1446 | + } |
|
| 1447 | + } else { |
|
| 1448 | + $screenshot = ""; |
|
| 1311 | 1449 | } |
| 1312 | - else $screenshot = ""; |
|
| 1313 | 1450 | |
| 1314 | 1451 | $obj = new stdClass(); |
| 1315 | 1452 | $obj->name = $name; |
@@ -1322,7 +1459,9 @@ discard block |
||
| 1322 | 1459 | if($xml_obj->menus->menu) |
| 1323 | 1460 | { |
| 1324 | 1461 | $menus = $xml_obj->menus->menu; |
| 1325 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1462 | + if(!is_array($menus)) { |
|
| 1463 | + $menus = array($menus); |
|
| 1464 | + } |
|
| 1326 | 1465 | |
| 1327 | 1466 | $menu_count = count($menus); |
| 1328 | 1467 | $skin_info->menu_count = $menu_count; |
@@ -1331,7 +1470,9 @@ discard block |
||
| 1331 | 1470 | unset($obj); |
| 1332 | 1471 | |
| 1333 | 1472 | $obj->name = $menus[$i]->attrs->name; |
| 1334 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1473 | + if($menus[$i]->attrs->default == "true") { |
|
| 1474 | + $obj->default = true; |
|
| 1475 | + } |
|
| 1335 | 1476 | $obj->title = $menus[$i]->title->body; |
| 1336 | 1477 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1337 | 1478 | |
@@ -1351,7 +1492,9 @@ discard block |
||
| 1351 | 1492 | { |
| 1352 | 1493 | $args = new stdClass; |
| 1353 | 1494 | $args->site_srl = $site_srl; |
| 1354 | - if(!is_null($module)) $args->module = $module; |
|
| 1495 | + if(!is_null($module)) { |
|
| 1496 | + $args->module = $module; |
|
| 1497 | + } |
|
| 1355 | 1498 | $output = executeQuery('module.getModuleCount', $args); |
| 1356 | 1499 | return $output->data->count; |
| 1357 | 1500 | } |
@@ -1380,8 +1523,11 @@ discard block |
||
| 1380 | 1523 | $args->module = $module; |
| 1381 | 1524 | $args->site_srl = $site_srl; |
| 1382 | 1525 | $output = executeQuery('module.getModuleConfig', $args); |
| 1383 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1384 | - else $config = new stdClass(); |
|
| 1526 | + if($output->data->config) { |
|
| 1527 | + $config = unserialize($output->data->config); |
|
| 1528 | + } else { |
|
| 1529 | + $config = new stdClass(); |
|
| 1530 | + } |
|
| 1385 | 1531 | |
| 1386 | 1532 | //insert in cache |
| 1387 | 1533 | if($oCacheHandler->isSupport()) |
@@ -1420,8 +1566,11 @@ discard block |
||
| 1420 | 1566 | $args->module = $module; |
| 1421 | 1567 | $args->module_srl = $module_srl; |
| 1422 | 1568 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1423 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1424 | - else $config = null; |
|
| 1569 | + if($output->data->config) { |
|
| 1570 | + $config = unserialize($output->data->config); |
|
| 1571 | + } else { |
|
| 1572 | + $config = null; |
|
| 1573 | + } |
|
| 1425 | 1574 | |
| 1426 | 1575 | //insert in cache |
| 1427 | 1576 | if($oCacheHandler->isSupport()) |
@@ -1443,9 +1592,13 @@ discard block |
||
| 1443 | 1592 | { |
| 1444 | 1593 | $args = new stdClass(); |
| 1445 | 1594 | $args->module = $module; |
| 1446 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1595 | + if($site_srl) { |
|
| 1596 | + $args->site_srl = $site_srl; |
|
| 1597 | + } |
|
| 1447 | 1598 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1448 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1599 | + if(!$output->toBool() || !$output->data) { |
|
| 1600 | + return array(); |
|
| 1601 | + } |
|
| 1449 | 1602 | |
| 1450 | 1603 | foreach($output->data as $key => $val) |
| 1451 | 1604 | { |
@@ -1463,10 +1616,16 @@ discard block |
||
| 1463 | 1616 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1464 | 1617 | // Get data from the DB |
| 1465 | 1618 | $output = executeQuery('module.getModuleCategories', $args); |
| 1466 | - if(!$output->toBool()) return $output; |
|
| 1619 | + if(!$output->toBool()) { |
|
| 1620 | + return $output; |
|
| 1621 | + } |
|
| 1467 | 1622 | $list = $output->data; |
| 1468 | - if(!$list) return; |
|
| 1469 | - if(!is_array($list)) $list = array($list); |
|
| 1623 | + if(!$list) { |
|
| 1624 | + return; |
|
| 1625 | + } |
|
| 1626 | + if(!is_array($list)) { |
|
| 1627 | + $list = array($list); |
|
| 1628 | + } |
|
| 1470 | 1629 | |
| 1471 | 1630 | foreach($list as $val) |
| 1472 | 1631 | { |
@@ -1484,7 +1643,9 @@ discard block |
||
| 1484 | 1643 | $args = new stdClass; |
| 1485 | 1644 | $args->module_category_srl = $module_category_srl; |
| 1486 | 1645 | $output = executeQuery('module.getModuleCategory', $args); |
| 1487 | - if(!$output->toBool()) return $output; |
|
| 1646 | + if(!$output->toBool()) { |
|
| 1647 | + return $output; |
|
| 1648 | + } |
|
| 1488 | 1649 | return $output->data; |
| 1489 | 1650 | } |
| 1490 | 1651 | |
@@ -1496,7 +1657,9 @@ discard block |
||
| 1496 | 1657 | // Get a list of downloaded and installed modules |
| 1497 | 1658 | $searched_list = FileHandler::readDir('./modules'); |
| 1498 | 1659 | $searched_count = count($searched_list); |
| 1499 | - if(!$searched_count) return; |
|
| 1660 | + if(!$searched_count) { |
|
| 1661 | + return; |
|
| 1662 | + } |
|
| 1500 | 1663 | sort($searched_list); |
| 1501 | 1664 | |
| 1502 | 1665 | for($i=0;$i<$searched_count;$i++) |
@@ -1509,7 +1672,9 @@ discard block |
||
| 1509 | 1672 | $info = $this->getModuleInfoXml($module_name); |
| 1510 | 1673 | unset($obj); |
| 1511 | 1674 | |
| 1512 | - if(!isset($info)) continue; |
|
| 1675 | + if(!isset($info)) { |
|
| 1676 | + continue; |
|
| 1677 | + } |
|
| 1513 | 1678 | $info->module = $module_name; |
| 1514 | 1679 | $info->created_table_count = $created_table_count; |
| 1515 | 1680 | $info->table_count = $table_count; |
@@ -1535,11 +1700,16 @@ discard block |
||
| 1535 | 1700 | for($j=0;$j<count($tmp_files);$j++) |
| 1536 | 1701 | { |
| 1537 | 1702 | list($table_name) = explode(".",$tmp_files[$j]); |
| 1538 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1703 | + if($oDB->isTableExists($table_name)) { |
|
| 1704 | + $created_table_count ++; |
|
| 1705 | + } |
|
| 1539 | 1706 | } |
| 1540 | 1707 | // Check if DB is installed |
| 1541 | - if($table_count > $created_table_count) return true; |
|
| 1542 | - else return false; |
|
| 1708 | + if($table_count > $created_table_count) { |
|
| 1709 | + return true; |
|
| 1710 | + } else { |
|
| 1711 | + return false; |
|
| 1712 | + } |
|
| 1543 | 1713 | } |
| 1544 | 1714 | return false; |
| 1545 | 1715 | } |
@@ -1567,7 +1737,9 @@ discard block |
||
| 1567 | 1737 | sort($searched_list); |
| 1568 | 1738 | |
| 1569 | 1739 | $searched_count = count($searched_list); |
| 1570 | - if(!$searched_count) return; |
|
| 1740 | + if(!$searched_count) { |
|
| 1741 | + return; |
|
| 1742 | + } |
|
| 1571 | 1743 | |
| 1572 | 1744 | for($i=0;$i<$searched_count;$i++) |
| 1573 | 1745 | { |
@@ -1575,7 +1747,9 @@ discard block |
||
| 1575 | 1747 | $module_name = $searched_list[$i]; |
| 1576 | 1748 | |
| 1577 | 1749 | $path = ModuleHandler::getModulePath($module_name); |
| 1578 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1750 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
| 1751 | + continue; |
|
| 1752 | + } |
|
| 1579 | 1753 | |
| 1580 | 1754 | // Get the number of xml files to create a table in schemas |
| 1581 | 1755 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1585,13 +1759,17 @@ discard block |
||
| 1585 | 1759 | for($j=0;$j<$table_count;$j++) |
| 1586 | 1760 | { |
| 1587 | 1761 | list($table_name) = explode('.',$tmp_files[$j]); |
| 1588 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1762 | + if($oDB->isTableExists($table_name)) { |
|
| 1763 | + $created_table_count ++; |
|
| 1764 | + } |
|
| 1589 | 1765 | } |
| 1590 | 1766 | // Get information of the module |
| 1591 | 1767 | $info = NULL; |
| 1592 | 1768 | $info = $this->getModuleInfoXml($module_name); |
| 1593 | 1769 | |
| 1594 | - if(!$info) continue; |
|
| 1770 | + if(!$info) { |
|
| 1771 | + continue; |
|
| 1772 | + } |
|
| 1595 | 1773 | |
| 1596 | 1774 | $info->module = $module_name; |
| 1597 | 1775 | $info->category = $info->category; |
@@ -1600,16 +1778,18 @@ discard block |
||
| 1600 | 1778 | $info->path = $path; |
| 1601 | 1779 | $info->admin_index_act = $info->admin_index_act; |
| 1602 | 1780 | // Check if DB is installed |
| 1603 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1604 | - else $info->need_install = false; |
|
| 1781 | + if($table_count > $created_table_count) { |
|
| 1782 | + $info->need_install = true; |
|
| 1783 | + } else { |
|
| 1784 | + $info->need_install = false; |
|
| 1785 | + } |
|
| 1605 | 1786 | // Check if it is upgraded to module.class.php on each module |
| 1606 | 1787 | $oDummy = null; |
| 1607 | 1788 | $oDummy = getModule($module_name, 'class'); |
| 1608 | 1789 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
| 1609 | 1790 | { |
| 1610 | 1791 | $info->need_update = $oDummy->checkUpdate(); |
| 1611 | - } |
|
| 1612 | - else |
|
| 1792 | + } else |
|
| 1613 | 1793 | { |
| 1614 | 1794 | continue; |
| 1615 | 1795 | } |
@@ -1626,7 +1806,9 @@ discard block |
||
| 1626 | 1806 | */ |
| 1627 | 1807 | function syncModuleToSite(&$data) |
| 1628 | 1808 | { |
| 1629 | - if(!$data) return; |
|
| 1809 | + if(!$data) { |
|
| 1810 | + return; |
|
| 1811 | + } |
|
| 1630 | 1812 | |
| 1631 | 1813 | if(is_array($data)) |
| 1632 | 1814 | { |
@@ -1634,9 +1816,10 @@ discard block |
||
| 1634 | 1816 | { |
| 1635 | 1817 | $module_srls[] = $val->module_srl; |
| 1636 | 1818 | } |
| 1637 | - if(!count($module_srls)) return; |
|
| 1638 | - } |
|
| 1639 | - else |
|
| 1819 | + if(!count($module_srls)) { |
|
| 1820 | + return; |
|
| 1821 | + } |
|
| 1822 | + } else |
|
| 1640 | 1823 | { |
| 1641 | 1824 | $module_srls[] = $data->module_srl; |
| 1642 | 1825 | } |
@@ -1644,7 +1827,9 @@ discard block |
||
| 1644 | 1827 | $args = new stdClass(); |
| 1645 | 1828 | $args->module_srls = implode(',',$module_srls); |
| 1646 | 1829 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1647 | - if(!$output->data) return array(); |
|
| 1830 | + if(!$output->data) { |
|
| 1831 | + return array(); |
|
| 1832 | + } |
|
| 1648 | 1833 | foreach($output->data as $key => $val) |
| 1649 | 1834 | { |
| 1650 | 1835 | $modules[$val->module_srl] = $val; |
@@ -1656,8 +1841,7 @@ discard block |
||
| 1656 | 1841 | { |
| 1657 | 1842 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1658 | 1843 | } |
| 1659 | - } |
|
| 1660 | - else |
|
| 1844 | + } else |
|
| 1661 | 1845 | { |
| 1662 | 1846 | $data->domain = $modules[$data->module_srl]->domain; |
| 1663 | 1847 | } |
@@ -1668,24 +1852,31 @@ discard block |
||
| 1668 | 1852 | */ |
| 1669 | 1853 | function isSiteAdmin($member_info, $site_srl = null) |
| 1670 | 1854 | { |
| 1671 | - if(!$member_info->member_srl) return false; |
|
| 1672 | - if($member_info->is_admin == 'Y') return true; |
|
| 1855 | + if(!$member_info->member_srl) { |
|
| 1856 | + return false; |
|
| 1857 | + } |
|
| 1858 | + if($member_info->is_admin == 'Y') { |
|
| 1859 | + return true; |
|
| 1860 | + } |
|
| 1673 | 1861 | |
| 1674 | 1862 | $args = new stdClass(); |
| 1675 | 1863 | if(!isset($site_srl)) |
| 1676 | 1864 | { |
| 1677 | 1865 | $site_module_info = Context::get('site_module_info'); |
| 1678 | - if(!$site_module_info) return; |
|
| 1866 | + if(!$site_module_info) { |
|
| 1867 | + return; |
|
| 1868 | + } |
|
| 1679 | 1869 | $args->site_srl = $site_module_info->site_srl; |
| 1680 | - } |
|
| 1681 | - else |
|
| 1870 | + } else |
|
| 1682 | 1871 | { |
| 1683 | 1872 | $args->site_srl = $site_srl; |
| 1684 | 1873 | } |
| 1685 | 1874 | |
| 1686 | 1875 | $args->member_srl = $member_info->member_srl; |
| 1687 | 1876 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1688 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1877 | + if($output->data->member_srl == $args->member_srl) { |
|
| 1878 | + return true; |
|
| 1879 | + } |
|
| 1689 | 1880 | return false; |
| 1690 | 1881 | } |
| 1691 | 1882 | |
@@ -1708,7 +1899,9 @@ discard block |
||
| 1708 | 1899 | $obj = new stdClass(); |
| 1709 | 1900 | $obj->module_srl = $module_srl; |
| 1710 | 1901 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1711 | - if(!$output->toBool() || !$output->data) return; |
|
| 1902 | + if(!$output->toBool() || !$output->data) { |
|
| 1903 | + return; |
|
| 1904 | + } |
|
| 1712 | 1905 | |
| 1713 | 1906 | return $output->data; |
| 1714 | 1907 | } |
@@ -1721,7 +1914,9 @@ discard block |
||
| 1721 | 1914 | { |
| 1722 | 1915 | $extra_vars = array(); |
| 1723 | 1916 | $get_module_srls = array(); |
| 1724 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1917 | + if(!is_array($list_module_srl)) { |
|
| 1918 | + $list_module_srl = array($list_module_srl); |
|
| 1919 | + } |
|
| 1725 | 1920 | |
| 1726 | 1921 | $vars = false; |
| 1727 | 1922 | // cache controll |
@@ -1737,14 +1932,12 @@ discard block |
||
| 1737 | 1932 | if($vars) |
| 1738 | 1933 | { |
| 1739 | 1934 | $extra_vars[$module_srl] = $vars; |
| 1740 | - } |
|
| 1741 | - else |
|
| 1935 | + } else |
|
| 1742 | 1936 | { |
| 1743 | 1937 | $get_module_srls[] = $module_srl; |
| 1744 | 1938 | } |
| 1745 | 1939 | } |
| 1746 | - } |
|
| 1747 | - else |
|
| 1940 | + } else |
|
| 1748 | 1941 | { |
| 1749 | 1942 | $get_module_srls = $list_module_srl; |
| 1750 | 1943 | } |
@@ -1769,7 +1962,9 @@ discard block |
||
| 1769 | 1962 | } |
| 1770 | 1963 | foreach($output->data as $key => $val) |
| 1771 | 1964 | { |
| 1772 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1965 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
| 1966 | + continue; |
|
| 1967 | + } |
|
| 1773 | 1968 | |
| 1774 | 1969 | if(!isset($extra_vars[$val->module_srl])) |
| 1775 | 1970 | { |
@@ -1808,7 +2003,9 @@ discard block |
||
| 1808 | 2003 | $args = new stdClass(); |
| 1809 | 2004 | $args->module_srl = $module_srl; |
| 1810 | 2005 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
| 1811 | - if(!$output->toBool()) return; |
|
| 2006 | + if(!$output->toBool()) { |
|
| 2007 | + return; |
|
| 2008 | + } |
|
| 1812 | 2009 | |
| 1813 | 2010 | $skin_vars = array(); |
| 1814 | 2011 | foreach($output->data as $vars) |
@@ -1816,7 +2013,9 @@ discard block |
||
| 1816 | 2013 | $skin_vars[$vars->name] = $vars; |
| 1817 | 2014 | } |
| 1818 | 2015 | |
| 1819 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2016 | + if($oCacheHandler->isSupport()) { |
|
| 2017 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2018 | + } |
|
| 1820 | 2019 | } |
| 1821 | 2020 | |
| 1822 | 2021 | return $skin_vars; |
@@ -1828,7 +2027,9 @@ discard block |
||
| 1828 | 2027 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1829 | 2028 | { |
| 1830 | 2029 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1831 | - if(!$site_srl) $site_srl = 0; |
|
| 2030 | + if(!$site_srl) { |
|
| 2031 | + $site_srl = 0; |
|
| 2032 | + } |
|
| 1832 | 2033 | |
| 1833 | 2034 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1834 | 2035 | if(is_readable($designInfoFile)) |
@@ -1845,19 +2046,16 @@ discard block |
||
| 1845 | 2046 | if(is_dir($moduleSkinPath.'default')) |
| 1846 | 2047 | { |
| 1847 | 2048 | $skinName = 'default'; |
| 1848 | - } |
|
| 1849 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 2049 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1850 | 2050 | { |
| 1851 | 2051 | $skinName = 'xe_default'; |
| 1852 | - } |
|
| 1853 | - else |
|
| 2052 | + } else |
|
| 1854 | 2053 | { |
| 1855 | 2054 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1856 | 2055 | if(count($skins) > 0) |
| 1857 | 2056 | { |
| 1858 | 2057 | $skinName = $skins[0]; |
| 1859 | - } |
|
| 1860 | - else |
|
| 2058 | + } else |
|
| 1861 | 2059 | { |
| 1862 | 2060 | $skinName = NULL; |
| 1863 | 2061 | } |
@@ -1865,7 +2063,9 @@ discard block |
||
| 1865 | 2063 | |
| 1866 | 2064 | if($updateCache && $skinName) |
| 1867 | 2065 | { |
| 1868 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 2066 | + if(!isset($designInfo->module->{$module_name})) { |
|
| 2067 | + $designInfo->module->{$module_name} = new stdClass(); |
|
| 2068 | + } |
|
| 1869 | 2069 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1870 | 2070 | |
| 1871 | 2071 | $oAdminController = getAdminController('admin'); |
@@ -1881,23 +2081,28 @@ discard block |
||
| 1881 | 2081 | */ |
| 1882 | 2082 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1883 | 2083 | { |
| 1884 | - if(!$module_info->module_srl) return; |
|
| 2084 | + if(!$module_info->module_srl) { |
|
| 2085 | + return; |
|
| 2086 | + } |
|
| 1885 | 2087 | |
| 1886 | 2088 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1887 | 2089 | if(Mobile::isFromMobilePhone()) |
| 1888 | 2090 | { |
| 1889 | 2091 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1890 | - } |
|
| 1891 | - else |
|
| 2092 | + } else |
|
| 1892 | 2093 | { |
| 1893 | 2094 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1894 | 2095 | } |
| 1895 | 2096 | |
| 1896 | - if(!$skin_vars) return; |
|
| 2097 | + if(!$skin_vars) { |
|
| 2098 | + return; |
|
| 2099 | + } |
|
| 1897 | 2100 | |
| 1898 | 2101 | foreach($skin_vars as $name => $val) |
| 1899 | 2102 | { |
| 1900 | - if(isset($module_info->{$name})) continue; |
|
| 2103 | + if(isset($module_info->{$name})) { |
|
| 2104 | + continue; |
|
| 2105 | + } |
|
| 1901 | 2106 | $module_info->{$name} = $val->value; |
| 1902 | 2107 | } |
| 1903 | 2108 | } |
@@ -1923,7 +2128,9 @@ discard block |
||
| 1923 | 2128 | $args = new stdClass(); |
| 1924 | 2129 | $args->module_srl = $module_srl; |
| 1925 | 2130 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1926 | - if(!$output->toBool() || !$output->data) return; |
|
| 2131 | + if(!$output->toBool() || !$output->data) { |
|
| 2132 | + return; |
|
| 2133 | + } |
|
| 1927 | 2134 | |
| 1928 | 2135 | $skin_vars = array(); |
| 1929 | 2136 | foreach($output->data as $vars) |
@@ -1931,7 +2138,9 @@ discard block |
||
| 1931 | 2138 | $skin_vars[$vars->name] = $vars; |
| 1932 | 2139 | } |
| 1933 | 2140 | |
| 1934 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2141 | + if($oCacheHandler->isSupport()) { |
|
| 2142 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2143 | + } |
|
| 1935 | 2144 | } |
| 1936 | 2145 | |
| 1937 | 2146 | return $skin_vars; |
@@ -1943,7 +2152,9 @@ discard block |
||
| 1943 | 2152 | */ |
| 1944 | 2153 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1945 | 2154 | { |
| 1946 | - if(!$module_info->module_srl) return; |
|
| 2155 | + if(!$module_info->module_srl) { |
|
| 2156 | + return; |
|
| 2157 | + } |
|
| 1947 | 2158 | $skin_vars = false; |
| 1948 | 2159 | // cache controll |
| 1949 | 2160 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1958,17 +2169,25 @@ discard block |
||
| 1958 | 2169 | $args = new stdClass; |
| 1959 | 2170 | $args->module_srl = $module_info->module_srl; |
| 1960 | 2171 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1961 | - if(!$output->toBool()) return; |
|
| 2172 | + if(!$output->toBool()) { |
|
| 2173 | + return; |
|
| 2174 | + } |
|
| 1962 | 2175 | $skin_vars = $output->data; |
| 1963 | 2176 | |
| 1964 | 2177 | //insert in cache |
| 1965 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2178 | + if($oCacheHandler->isSupport()) { |
|
| 2179 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2180 | + } |
|
| 2181 | + } |
|
| 2182 | + if(!$skin_vars) { |
|
| 2183 | + return; |
|
| 1966 | 2184 | } |
| 1967 | - if(!$skin_vars) return; |
|
| 1968 | 2185 | |
| 1969 | 2186 | foreach($output->data as $val) |
| 1970 | 2187 | { |
| 1971 | - if(isset($module_info->{$val->name})) continue; |
|
| 2188 | + if(isset($module_info->{$val->name})) { |
|
| 2189 | + continue; |
|
| 2190 | + } |
|
| 1972 | 2191 | $module_info->{$val->name} = $val->value; |
| 1973 | 2192 | } |
| 1974 | 2193 | } |
@@ -1990,10 +2209,12 @@ discard block |
||
| 1990 | 2209 | $grant_info = $xml_info->grant; |
| 1991 | 2210 | if($member_info->member_srl) |
| 1992 | 2211 | { |
| 1993 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 1994 | - else $group_list = array(); |
|
| 1995 | - } |
|
| 1996 | - else |
|
| 2212 | + if(is_array($member_info->group_list)) { |
|
| 2213 | + $group_list = array_keys($member_info->group_list); |
|
| 2214 | + } else { |
|
| 2215 | + $group_list = array(); |
|
| 2216 | + } |
|
| 2217 | + } else |
|
| 1997 | 2218 | { |
| 1998 | 2219 | $group_list = array(); |
| 1999 | 2220 | } |
@@ -2007,8 +2228,7 @@ discard block |
||
| 2007 | 2228 | } |
| 2008 | 2229 | |
| 2009 | 2230 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
| 2010 | - } |
|
| 2011 | - else |
|
| 2231 | + } else |
|
| 2012 | 2232 | { |
| 2013 | 2233 | // If module_srl exists |
| 2014 | 2234 | // Get a type of granted permission |
@@ -2021,7 +2241,9 @@ discard block |
||
| 2021 | 2241 | $args->module_srl = $module_srl; |
| 2022 | 2242 | $args->member_srl = $member_info->member_srl; |
| 2023 | 2243 | $output = executeQuery('module.getModuleAdmin',$args); |
| 2024 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2244 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
| 2245 | + $grant->manager = true; |
|
| 2246 | + } |
|
| 2025 | 2247 | } |
| 2026 | 2248 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2027 | 2249 | if(!$grant->manager) |
@@ -2031,8 +2253,7 @@ discard block |
||
| 2031 | 2253 | if($module_info->module == 'planet') |
| 2032 | 2254 | { |
| 2033 | 2255 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2034 | - } |
|
| 2035 | - else |
|
| 2256 | + } else |
|
| 2036 | 2257 | { |
| 2037 | 2258 | $args = new stdClass; |
| 2038 | 2259 | $args->module_srl = $module_srl; |
@@ -2047,37 +2268,44 @@ discard block |
||
| 2047 | 2268 | foreach($output->data as $val) |
| 2048 | 2269 | { |
| 2049 | 2270 | $grant_exists[$val->name] = true; |
| 2050 | - if($granted[$val->name]) continue; |
|
| 2271 | + if($granted[$val->name]) { |
|
| 2272 | + continue; |
|
| 2273 | + } |
|
| 2051 | 2274 | // Log-in member only |
| 2052 | 2275 | if($val->group_srl == -1) |
| 2053 | 2276 | { |
| 2054 | 2277 | $granted[$val->name] = true; |
| 2055 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2278 | + if($member_info->member_srl) { |
|
| 2279 | + $grant->{$val->name} = true; |
|
| 2280 | + } |
|
| 2056 | 2281 | // Site-joined member only |
| 2057 | - } |
|
| 2058 | - elseif($val->group_srl == -2) |
|
| 2282 | + } elseif($val->group_srl == -2) |
|
| 2059 | 2283 | { |
| 2060 | 2284 | $granted[$val->name] = true; |
| 2061 | 2285 | // Do not grant any permission for non-logged member |
| 2062 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2286 | + if(!$member_info->member_srl) { |
|
| 2287 | + $grant->{$val->name} = false; |
|
| 2288 | + } |
|
| 2063 | 2289 | // Log-in member |
| 2064 | 2290 | else |
| 2065 | 2291 | { |
| 2066 | 2292 | $site_module_info = Context::get('site_module_info'); |
| 2067 | 2293 | // Permission granted if no information of the currently connected site exists |
| 2068 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2294 | + if(!$site_module_info->site_srl) { |
|
| 2295 | + $grant->{$val->name} = true; |
|
| 2296 | + } |
|
| 2069 | 2297 | // Permission is not granted if information of the currently connected site exists |
| 2070 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2298 | + elseif(count($group_list)) { |
|
| 2299 | + $grant->{$val->name} = true; |
|
| 2300 | + } |
|
| 2071 | 2301 | } |
| 2072 | 2302 | // All of non-logged members |
| 2073 | - } |
|
| 2074 | - elseif($val->group_srl == 0) |
|
| 2303 | + } elseif($val->group_srl == 0) |
|
| 2075 | 2304 | { |
| 2076 | 2305 | $granted[$val->name] = true; |
| 2077 | 2306 | $grant->{$val->name} = true; |
| 2078 | 2307 | // If a target is a group |
| 2079 | - } |
|
| 2080 | - else |
|
| 2308 | + } else |
|
| 2081 | 2309 | { |
| 2082 | 2310 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
| 2083 | 2311 | { |
@@ -2088,30 +2316,43 @@ discard block |
||
| 2088 | 2316 | } |
| 2089 | 2317 | } |
| 2090 | 2318 | // Separate processing for the virtual group access |
| 2091 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2319 | + if(!$grant_exists['access']) { |
|
| 2320 | + $grant->access = true; |
|
| 2321 | + } |
|
| 2092 | 2322 | if(count($grant_info)) |
| 2093 | 2323 | { |
| 2094 | 2324 | foreach($grant_info as $grant_name => $grant_item) |
| 2095 | 2325 | { |
| 2096 | - if($grant_exists[$grant_name]) continue; |
|
| 2326 | + if($grant_exists[$grant_name]) { |
|
| 2327 | + continue; |
|
| 2328 | + } |
|
| 2097 | 2329 | switch($grant_item->default) |
| 2098 | 2330 | { |
| 2099 | 2331 | case 'guest' : |
| 2100 | 2332 | $grant->{$grant_name} = true; |
| 2101 | 2333 | break; |
| 2102 | 2334 | case 'member' : |
| 2103 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2104 | - else $grant->{$grant_name} = false; |
|
| 2335 | + if($member_info->member_srl) { |
|
| 2336 | + $grant->{$grant_name} = true; |
|
| 2337 | + } else { |
|
| 2338 | + $grant->{$grant_name} = false; |
|
| 2339 | + } |
|
| 2105 | 2340 | break; |
| 2106 | 2341 | case 'site' : |
| 2107 | 2342 | $site_module_info = Context::get('site_module_info'); |
| 2108 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2109 | - else $grant->{$grant_name} = false; |
|
| 2343 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
| 2344 | + $grant->{$grant_name} = true; |
|
| 2345 | + } else { |
|
| 2346 | + $grant->{$grant_name} = false; |
|
| 2347 | + } |
|
| 2110 | 2348 | break; |
| 2111 | 2349 | case 'manager' : |
| 2112 | 2350 | case 'root' : |
| 2113 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2114 | - else $grant->{$grant_name} = false; |
|
| 2351 | + if($member_info->is_admin == 'Y') { |
|
| 2352 | + $grant->{$grant_name} = true; |
|
| 2353 | + } else { |
|
| 2354 | + $grant->{$grant_name} = false; |
|
| 2355 | + } |
|
| 2115 | 2356 | break; |
| 2116 | 2357 | } |
| 2117 | 2358 | } |
@@ -2187,16 +2428,22 @@ discard block |
||
| 2187 | 2428 | function getFileBoxListHtml() |
| 2188 | 2429 | { |
| 2189 | 2430 | $logged_info = Context::get('logged_info'); |
| 2190 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2431 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 2432 | + return new Object(-1, 'msg_not_permitted'); |
|
| 2433 | + } |
|
| 2191 | 2434 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2192 | 2435 | $link_params = explode('&',$link['query']); |
| 2193 | 2436 | foreach ($link_params as $param) |
| 2194 | 2437 | { |
| 2195 | 2438 | $param = explode("=",$param); |
| 2196 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2439 | + if($param[0] == 'selected_widget') { |
|
| 2440 | + $selected_widget = $param[1]; |
|
| 2441 | + } |
|
| 2197 | 2442 | } |
| 2198 | 2443 | $oWidgetModel = getModel('widget'); |
| 2199 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2444 | + if($selected_widget) { |
|
| 2445 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2446 | + } |
|
| 2200 | 2447 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2201 | 2448 | |
| 2202 | 2449 | $oModuleModel = getModel('module'); |
@@ -2204,7 +2451,9 @@ discard block |
||
| 2204 | 2451 | Context::set('filebox_list', $output->data); |
| 2205 | 2452 | |
| 2206 | 2453 | $page = Context::get('page'); |
| 2207 | - if (!$page) $page = 1; |
|
| 2454 | + if (!$page) { |
|
| 2455 | + $page = 1; |
|
| 2456 | + } |
|
| 2208 | 2457 | Context::set('page', $page); |
| 2209 | 2458 | Context::set('page_navigation', $output->page_navigation); |
| 2210 | 2459 | |
@@ -2234,25 +2483,28 @@ discard block |
||
| 2234 | 2483 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2235 | 2484 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2236 | 2485 | return FileHandler::getRealPath($xml_file); |
| 2237 | - } |
|
| 2238 | - else if (strpos($ruleset, '#') !== false) |
|
| 2486 | + } else if (strpos($ruleset, '#') !== false) |
|
| 2239 | 2487 | { |
| 2240 | 2488 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2241 | 2489 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2242 | - if(is_readable($xml_file)) |
|
| 2243 | - return FileHandler::getRealPath($xml_file); |
|
| 2244 | - else{ |
|
| 2490 | + if(is_readable($xml_file)) { |
|
| 2491 | + return FileHandler::getRealPath($xml_file); |
|
| 2492 | + } else{ |
|
| 2245 | 2493 | $ruleset = str_replace('#', '', $ruleset); |
| 2246 | 2494 | } |
| 2247 | 2495 | |
| 2248 | 2496 | } |
| 2249 | 2497 | // Get a path of the requested module. Return if not exists. |
| 2250 | 2498 | $class_path = ModuleHandler::getModulePath($module); |
| 2251 | - if(!$class_path) return; |
|
| 2499 | + if(!$class_path) { |
|
| 2500 | + return; |
|
| 2501 | + } |
|
| 2252 | 2502 | |
| 2253 | 2503 | // Check if module.xml exists in the path. Return if not exist |
| 2254 | 2504 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2255 | - if(!file_exists($xml_file)) return; |
|
| 2505 | + if(!file_exists($xml_file)) { |
|
| 2506 | + return; |
|
| 2507 | + } |
|
| 2256 | 2508 | |
| 2257 | 2509 | return $xml_file; |
| 2258 | 2510 | } |
@@ -2302,7 +2554,9 @@ discard block |
||
| 2302 | 2554 | function getLangByLangcode() |
| 2303 | 2555 | { |
| 2304 | 2556 | $langCode = Context::get('langCode'); |
| 2305 | - if (!$langCode) return; |
|
| 2557 | + if (!$langCode) { |
|
| 2558 | + return; |
|
| 2559 | + } |
|
| 2306 | 2560 | |
| 2307 | 2561 | $oModuleController = getController('module'); |
| 2308 | 2562 | $oModuleController->replaceDefinedLangCode($langCode); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) { |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) { |
|
| 205 | 205 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 206 | - if(!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA'])) |
|
| 206 | + if (!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA'])) |
|
| 207 | 207 | { |
| 208 | 208 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 209 | 209 | } |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | $this->_setUploadedArgument(); |
| 226 | 226 | |
| 227 | 227 | $this->loadDBInfo(); |
| 228 | - if($this->db_info->use_sitelock == 'Y') |
|
| 228 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 229 | 229 | { |
| 230 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 230 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 231 | 231 | |
| 232 | - if(!IpFilter::filter($whitelist)) |
|
| 232 | + if (!IpFilter::filter($whitelist)) |
|
| 233 | 233 | { |
| 234 | 234 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 235 | 235 | $message = $this->db_info->sitelock_message; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 240 | 240 | |
| 241 | 241 | header("HTTP/1.1 403 Forbidden"); |
| 242 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 242 | + if (FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 243 | 243 | { |
| 244 | 244 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 245 | 245 | } |
@@ -252,39 +252,39 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // If XE is installed, get virtual site information |
| 255 | - if(self::isInstalled()) |
|
| 255 | + if (self::isInstalled()) |
|
| 256 | 256 | { |
| 257 | 257 | $oModuleModel = getModel('module'); |
| 258 | 258 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 259 | 259 | |
| 260 | - if(!isset($site_module_info)) |
|
| 260 | + if (!isset($site_module_info)) |
|
| 261 | 261 | { |
| 262 | 262 | $site_module_info = new stdClass(); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 266 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 266 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 267 | 267 | { |
| 268 | 268 | $site_module_info->domain = $this->db_info->default_url; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $this->set('site_module_info', $site_module_info); |
| 272 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 272 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 273 | 273 | { |
| 274 | 274 | $this->set('vid', $site_module_info->domain, TRUE); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if(!isset($this->db_info)) |
|
| 277 | + if (!isset($this->db_info)) |
|
| 278 | 278 | { |
| 279 | 279 | $this->db_info = new stdClass(); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $this->db_info->lang_type = $site_module_info->default_language; |
| 283 | - if(!$this->db_info->lang_type) |
|
| 283 | + if (!$this->db_info->lang_type) |
|
| 284 | 284 | { |
| 285 | 285 | $this->db_info->lang_type = 'en'; |
| 286 | 286 | } |
| 287 | - if(!$this->db_info->use_db_session) |
|
| 287 | + if (!$this->db_info->use_db_session) |
|
| 288 | 288 | { |
| 289 | 289 | $this->db_info->use_db_session = 'N'; |
| 290 | 290 | } |
@@ -294,30 +294,30 @@ discard block |
||
| 294 | 294 | $lang_supported = $this->loadLangSelected(); |
| 295 | 295 | |
| 296 | 296 | // Retrieve language type set in user's cookie |
| 297 | - if($this->lang_type = $this->get('l')) |
|
| 297 | + if ($this->lang_type = $this->get('l')) |
|
| 298 | 298 | { |
| 299 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 299 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 300 | 300 | { |
| 301 | 301 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | - elseif($_COOKIE['lang_type']) |
|
| 304 | + elseif ($_COOKIE['lang_type']) |
|
| 305 | 305 | { |
| 306 | 306 | $this->lang_type = $_COOKIE['lang_type']; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // If it's not exists, follow default language type set in db_info |
| 310 | - if(!$this->lang_type) |
|
| 310 | + if (!$this->lang_type) |
|
| 311 | 311 | { |
| 312 | 312 | $this->lang_type = $this->db_info->lang_type; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // if still lang_type has not been set or has not-supported type , set as English. |
| 316 | - if(!$this->lang_type) |
|
| 316 | + if (!$this->lang_type) |
|
| 317 | 317 | { |
| 318 | 318 | $this->lang_type = 'en'; |
| 319 | 319 | } |
| 320 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 320 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 321 | 321 | { |
| 322 | 322 | $this->lang_type = 'en'; |
| 323 | 323 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
| 330 | 330 | |
| 331 | 331 | // set session handler |
| 332 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 332 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 333 | 333 | { |
| 334 | 334 | $oSessionModel = getModel('session'); |
| 335 | 335 | $oSessionController = getController('session'); |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | ); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 341 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 342 | 342 | session_start(); |
| 343 | 343 | |
| 344 | 344 | // set authentication information in Context and session |
| 345 | - if(self::isInstalled()) |
|
| 345 | + if (self::isInstalled()) |
|
| 346 | 346 | { |
| 347 | 347 | $oModuleModel = getModel('module'); |
| 348 | 348 | $oModuleModel->loadModuleExtends(); |
@@ -350,15 +350,15 @@ discard block |
||
| 350 | 350 | $oMemberModel = getModel('member'); |
| 351 | 351 | $oMemberController = getController('member'); |
| 352 | 352 | |
| 353 | - if($oMemberController && $oMemberModel) |
|
| 353 | + if ($oMemberController && $oMemberModel) |
|
| 354 | 354 | { |
| 355 | 355 | // if signed in, validate it. |
| 356 | - if($oMemberModel->isLogged()) |
|
| 356 | + if ($oMemberModel->isLogged()) |
|
| 357 | 357 | { |
| 358 | 358 | $oMemberController->setSessionInfo(); |
| 359 | 359 | } |
| 360 | 360 | // check auto sign-in |
| 361 | - elseif($_COOKIE['xeak']) |
|
| 361 | + elseif ($_COOKIE['xeak']) |
|
| 362 | 362 | { |
| 363 | 363 | $oMemberController->doAutologin(); |
| 364 | 364 | } |
@@ -378,28 +378,28 @@ discard block |
||
| 378 | 378 | // set locations for javascript use |
| 379 | 379 | $url = array(); |
| 380 | 380 | $current_url = self::getRequestUri(); |
| 381 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 381 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 382 | 382 | { |
| 383 | - if($this->get_vars) |
|
| 383 | + if ($this->get_vars) |
|
| 384 | 384 | { |
| 385 | 385 | $url = array(); |
| 386 | - foreach($this->get_vars as $key => $val) |
|
| 386 | + foreach ($this->get_vars as $key => $val) |
|
| 387 | 387 | { |
| 388 | - if(is_array($val) && count($val) > 0) |
|
| 388 | + if (is_array($val) && count($val) > 0) |
|
| 389 | 389 | { |
| 390 | - foreach($val as $k => $v) |
|
| 390 | + foreach ($val as $k => $v) |
|
| 391 | 391 | { |
| 392 | 392 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | - elseif($val) |
|
| 395 | + elseif ($val) |
|
| 396 | 396 | { |
| 397 | 397 | $url[] = $key . '=' . urlencode($val); |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $current_url = self::getRequestUri(); |
| 402 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 402 | + if ($url) $current_url .= '?' . join('&', $url); |
|
| 403 | 403 | } |
| 404 | 404 | else |
| 405 | 405 | { |
@@ -414,12 +414,12 @@ discard block |
||
| 414 | 414 | $this->set('current_url', $current_url); |
| 415 | 415 | $this->set('request_uri', self::getRequestUri()); |
| 416 | 416 | |
| 417 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 417 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 418 | 418 | { |
| 419 | 419 | $this->set('current_url', self::decodeIdna($current_url)); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 422 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 423 | 423 | { |
| 424 | 424 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 425 | 425 | } |
@@ -444,19 +444,19 @@ discard block |
||
| 444 | 444 | { |
| 445 | 445 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 446 | 446 | |
| 447 | - if(!$self->isInstalled()) |
|
| 447 | + if (!$self->isInstalled()) |
|
| 448 | 448 | { |
| 449 | 449 | return; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | $config_file = $self->getConfigFile(); |
| 453 | - if(is_readable($config_file)) |
|
| 453 | + if (is_readable($config_file)) |
|
| 454 | 454 | { |
| 455 | 455 | include($config_file); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // If master_db information does not exist, the config file needs to be updated |
| 459 | - if(!isset($db_info->master_db)) |
|
| 459 | + if (!isset($db_info->master_db)) |
|
| 460 | 460 | { |
| 461 | 461 | $db_info->master_db = array(); |
| 462 | 462 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 475 | 475 | unset($db_info->db_table_prefix); |
| 476 | 476 | |
| 477 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 477 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 478 | 478 | { |
| 479 | 479 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 480 | 480 | } |
@@ -486,33 +486,33 @@ discard block |
||
| 486 | 486 | $oInstallController->makeConfigFile(); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - if(!$db_info->use_prepared_statements) |
|
| 489 | + if (!$db_info->use_prepared_statements) |
|
| 490 | 490 | { |
| 491 | 491 | $db_info->use_prepared_statements = 'Y'; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - if(!$db_info->time_zone) |
|
| 494 | + if (!$db_info->time_zone) |
|
| 495 | 495 | $db_info->time_zone = date('O'); |
| 496 | 496 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 497 | 497 | |
| 498 | - if($db_info->qmail_compatibility != 'Y') |
|
| 498 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 499 | 499 | $db_info->qmail_compatibility = 'N'; |
| 500 | 500 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 501 | 501 | |
| 502 | - if(!$db_info->use_db_session) |
|
| 502 | + if (!$db_info->use_db_session) |
|
| 503 | 503 | $db_info->use_db_session = 'N'; |
| 504 | - if(!$db_info->use_ssl) |
|
| 504 | + if (!$db_info->use_ssl) |
|
| 505 | 505 | $db_info->use_ssl = 'none'; |
| 506 | 506 | $this->set('_use_ssl', $db_info->use_ssl); |
| 507 | 507 | |
| 508 | 508 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 509 | 509 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 510 | 510 | |
| 511 | - if(!$db_info->sitelock_whitelist) { |
|
| 511 | + if (!$db_info->sitelock_whitelist) { |
|
| 512 | 512 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 515 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 516 | 516 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 517 | 517 | } |
| 518 | 518 | |
@@ -583,10 +583,10 @@ discard block |
||
| 583 | 583 | function loadLangSupported() |
| 584 | 584 | { |
| 585 | 585 | static $lang_supported = null; |
| 586 | - if(!$lang_supported) |
|
| 586 | + if (!$lang_supported) |
|
| 587 | 587 | { |
| 588 | 588 | $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
| 589 | - foreach($langs as $val) |
|
| 589 | + foreach ($langs as $val) |
|
| 590 | 590 | { |
| 591 | 591 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 592 | 592 | $lang_text = trim($lang_text); |
@@ -604,17 +604,17 @@ discard block |
||
| 604 | 604 | function loadLangSelected() |
| 605 | 605 | { |
| 606 | 606 | static $lang_selected = null; |
| 607 | - if(!$lang_selected) |
|
| 607 | + if (!$lang_selected) |
|
| 608 | 608 | { |
| 609 | 609 | $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
| 610 | 610 | $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
| 611 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 611 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 612 | 612 | { |
| 613 | 613 | $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
| 614 | 614 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 617 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 618 | 618 | { |
| 619 | 619 | $buff = FileHandler::readFile($orig_lang_file); |
| 620 | 620 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | else |
| 624 | 624 | { |
| 625 | 625 | $langs = file($selected_lang_file); |
| 626 | - foreach($langs as $val) |
|
| 626 | + foreach ($langs as $val) |
|
| 627 | 627 | { |
| 628 | 628 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 629 | 629 | $lang_text = trim($lang_text); |
@@ -642,32 +642,32 @@ discard block |
||
| 642 | 642 | function checkSSO() |
| 643 | 643 | { |
| 644 | 644 | // pass if it's not GET request or XE is not yet installed |
| 645 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 645 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 646 | 646 | { |
| 647 | 647 | return TRUE; |
| 648 | 648 | } |
| 649 | 649 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 650 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 650 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 651 | 651 | { |
| 652 | 652 | return TRUE; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | // pass if default URL is not set |
| 656 | 656 | $default_url = trim($this->db_info->default_url); |
| 657 | - if(!$default_url) |
|
| 657 | + if (!$default_url) |
|
| 658 | 658 | { |
| 659 | 659 | return TRUE; |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 662 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 663 | 663 | { |
| 664 | 664 | $default_url .= '/'; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // for sites recieving SSO valdiation |
| 668 | - if($default_url == self::getRequestUri()) |
|
| 668 | + if ($default_url == self::getRequestUri()) |
|
| 669 | 669 | { |
| 670 | - if(self::get('default_url')) |
|
| 670 | + if (self::get('default_url')) |
|
| 671 | 671 | { |
| 672 | 672 | $url = base64_decode(self::get('default_url')); |
| 673 | 673 | $url_info = parse_url($url); |
@@ -675,14 +675,14 @@ discard block |
||
| 675 | 675 | $oModuleModel = getModel('module'); |
| 676 | 676 | $target_domain = (stripos($url, $default_url) !== 0) ? $url_info['host'] : $default_url; |
| 677 | 677 | $site_info = $oModuleModel->getSiteInfoByDomain($target_domain); |
| 678 | - if(!$site_info->site_srl) { |
|
| 678 | + if (!$site_info->site_srl) { |
|
| 679 | 679 | $oModuleObject = new ModuleObject(); |
| 680 | 680 | $oModuleObject->stop('msg_invalid_request'); |
| 681 | 681 | |
| 682 | 682 | return false; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); |
|
| 685 | + $url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); |
|
| 686 | 686 | $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
| 687 | 687 | header('location:' . $redirect_url); |
| 688 | 688 | |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | else |
| 694 | 694 | { |
| 695 | 695 | // result handling : set session_name() |
| 696 | - if($session_name = self::get('SSOID')) |
|
| 696 | + if ($session_name = self::get('SSOID')) |
|
| 697 | 697 | { |
| 698 | 698 | setcookie(session_name(), $session_name); |
| 699 | 699 | |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | return FALSE; |
| 703 | 703 | // send SSO request |
| 704 | 704 | } |
| 705 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 705 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 706 | 706 | { |
| 707 | 707 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 708 | 708 | $url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl())); |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | { |
| 734 | 734 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 735 | 735 | |
| 736 | - if(!$self->isFTPRegisted()) |
|
| 736 | + if (!$self->isFTPRegisted()) |
|
| 737 | 737 | { |
| 738 | 738 | return null; |
| 739 | 739 | } |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | */ |
| 752 | 752 | function addBrowserTitle($site_title) |
| 753 | 753 | { |
| 754 | - if(!$site_title) |
|
| 754 | + if (!$site_title) |
|
| 755 | 755 | { |
| 756 | 756 | return; |
| 757 | 757 | } |
| 758 | 758 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 759 | 759 | |
| 760 | - if($self->site_title) |
|
| 760 | + if ($self->site_title) |
|
| 761 | 761 | { |
| 762 | 762 | $self->site_title .= ' - ' . $site_title; |
| 763 | 763 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | */ |
| 776 | 776 | function setBrowserTitle($site_title) |
| 777 | 777 | { |
| 778 | - if(!$site_title) |
|
| 778 | + if (!$site_title) |
|
| 779 | 779 | { |
| 780 | 780 | return; |
| 781 | 781 | } |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | $oModuleModel = getModel('module'); |
| 808 | 808 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 809 | 809 | |
| 810 | - if(isset($moduleConfig->siteTitle)) |
|
| 810 | + if (isset($moduleConfig->siteTitle)) |
|
| 811 | 811 | { |
| 812 | 812 | return $moduleConfig->siteTitle; |
| 813 | 813 | } |
@@ -834,30 +834,30 @@ discard block |
||
| 834 | 834 | global $lang; |
| 835 | 835 | |
| 836 | 836 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 837 | - if(!$self->lang_type) |
|
| 837 | + if (!$self->lang_type) |
|
| 838 | 838 | { |
| 839 | 839 | return; |
| 840 | 840 | } |
| 841 | - if(!is_object($lang)) |
|
| 841 | + if (!is_object($lang)) |
|
| 842 | 842 | { |
| 843 | 843 | $lang = new stdClass; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 846 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 847 | 847 | { |
| 848 | 848 | $filename = $self->_loadPhpLang($path); |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - if(!is_array($self->loaded_lang_files)) |
|
| 851 | + if (!is_array($self->loaded_lang_files)) |
|
| 852 | 852 | { |
| 853 | 853 | $self->loaded_lang_files = array(); |
| 854 | 854 | } |
| 855 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 855 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 856 | 856 | { |
| 857 | 857 | return; |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - if($filename && is_readable($filename)) |
|
| 860 | + if ($filename && is_readable($filename)) |
|
| 861 | 861 | { |
| 862 | 862 | $self->loaded_lang_files[] = $filename; |
| 863 | 863 | include($filename); |
@@ -878,16 +878,16 @@ discard block |
||
| 878 | 878 | { |
| 879 | 879 | global $lang; |
| 880 | 880 | |
| 881 | - if(!$path) return; |
|
| 881 | + if (!$path) return; |
|
| 882 | 882 | |
| 883 | 883 | $_path = 'eval://' . $path; |
| 884 | 884 | |
| 885 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 885 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 886 | 886 | { |
| 887 | 887 | return; |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 890 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 891 | 891 | { |
| 892 | 892 | $path .= '/'; |
| 893 | 893 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
| 896 | 896 | $content = $oXmlLangParser->getCompileContent(); |
| 897 | 897 | |
| 898 | - if($content) |
|
| 898 | + if ($content) |
|
| 899 | 899 | { |
| 900 | 900 | $this->loaded_lang_files[] = $_path; |
| 901 | 901 | eval($content); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | */ |
| 911 | 911 | function _loadXmlLang($path) |
| 912 | 912 | { |
| 913 | - if(!$path) return; |
|
| 913 | + if (!$path) return; |
|
| 914 | 914 | |
| 915 | 915 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 916 | 916 | return $oXmlLangParser->compile(); |
@@ -924,9 +924,9 @@ discard block |
||
| 924 | 924 | */ |
| 925 | 925 | function _loadPhpLang($path) |
| 926 | 926 | { |
| 927 | - if(!$path) return; |
|
| 927 | + if (!$path) return; |
|
| 928 | 928 | |
| 929 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 929 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 930 | 930 | { |
| 931 | 931 | $path .= '/'; |
| 932 | 932 | } |
@@ -934,12 +934,12 @@ discard block |
||
| 934 | 934 | $file = sprintf($path_tpl, $this->lang_type); |
| 935 | 935 | |
| 936 | 936 | $langs = array('ko', 'en'); // this will be configurable. |
| 937 | - while(!is_readable($file) && $langs[0]) |
|
| 937 | + while (!is_readable($file) && $langs[0]) |
|
| 938 | 938 | { |
| 939 | 939 | $file = sprintf($path_tpl, array_shift($langs)); |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | - if(!is_readable($file)) |
|
| 942 | + if (!is_readable($file)) |
|
| 943 | 943 | { |
| 944 | 944 | return FALSE; |
| 945 | 945 | } |
@@ -981,11 +981,11 @@ discard block |
||
| 981 | 981 | */ |
| 982 | 982 | function getLang($code) |
| 983 | 983 | { |
| 984 | - if(!$code) |
|
| 984 | + if (!$code) |
|
| 985 | 985 | { |
| 986 | 986 | return; |
| 987 | 987 | } |
| 988 | - if($GLOBALS['lang']->{$code}) |
|
| 988 | + if ($GLOBALS['lang']->{$code}) |
|
| 989 | 989 | { |
| 990 | 990 | return $GLOBALS['lang']->{$code}; |
| 991 | 991 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | */ |
| 1002 | 1002 | function setLang($code, $val) |
| 1003 | 1003 | { |
| 1004 | - if(!isset($GLOBALS['lang'])) |
|
| 1004 | + if (!isset($GLOBALS['lang'])) |
|
| 1005 | 1005 | { |
| 1006 | 1006 | $GLOBALS['lang'] = new stdClass(); |
| 1007 | 1007 | } |
@@ -1029,17 +1029,17 @@ discard block |
||
| 1029 | 1029 | |
| 1030 | 1030 | $obj = clone $source_obj; |
| 1031 | 1031 | |
| 1032 | - foreach($charset_list as $charset) |
|
| 1032 | + foreach ($charset_list as $charset) |
|
| 1033 | 1033 | { |
| 1034 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1034 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1035 | 1035 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1036 | - if($flag) |
|
| 1036 | + if ($flag) |
|
| 1037 | 1037 | { |
| 1038 | - if($charset == 'UTF-8') |
|
| 1038 | + if ($charset == 'UTF-8') |
|
| 1039 | 1039 | { |
| 1040 | 1040 | return $obj; |
| 1041 | 1041 | } |
| 1042 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1042 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1043 | 1043 | return $obj; |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -1058,11 +1058,11 @@ discard block |
||
| 1058 | 1058 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1059 | 1059 | { |
| 1060 | 1060 | static $flag = TRUE; |
| 1061 | - if($charset) |
|
| 1061 | + if ($charset) |
|
| 1062 | 1062 | { |
| 1063 | - if(is_array($val)) |
|
| 1064 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1065 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1063 | + if (is_array($val)) |
|
| 1064 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1065 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1066 | 1066 | else $flag = FALSE; |
| 1067 | 1067 | } |
| 1068 | 1068 | else |
@@ -1086,9 +1086,9 @@ discard block |
||
| 1086 | 1086 | { |
| 1087 | 1087 | if (is_array($val)) |
| 1088 | 1088 | { |
| 1089 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1089 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1090 | 1090 | } |
| 1091 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1091 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | 1094 | /** |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | */ |
| 1100 | 1100 | function convertEncodingStr($str) |
| 1101 | 1101 | { |
| 1102 | - if(!$str) return null; |
|
| 1102 | + if (!$str) return null; |
|
| 1103 | 1103 | $obj = new stdClass(); |
| 1104 | 1104 | $obj->str = $str; |
| 1105 | 1105 | $obj = self::convertEncoding($obj); |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | |
| 1109 | 1109 | function decodeIdna($domain) |
| 1110 | 1110 | { |
| 1111 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1111 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1112 | 1112 | { |
| 1113 | 1113 | require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
| 1114 | 1114 | $IDN = new idna_convert(array('idn_version' => 2008)); |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | { |
| 1142 | 1142 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1143 | 1143 | |
| 1144 | - if($self->response_method) |
|
| 1144 | + if ($self->response_method) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | return $self->response_method; |
| 1147 | 1147 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1182 | 1182 | |
| 1183 | 1183 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1184 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1184 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | $this->isSuccessInit = FALSE; |
| 1187 | 1187 | } |
@@ -1194,30 +1194,30 @@ discard block |
||
| 1194 | 1194 | */ |
| 1195 | 1195 | function _setRequestArgument() |
| 1196 | 1196 | { |
| 1197 | - if(!count($_REQUEST)) |
|
| 1197 | + if (!count($_REQUEST)) |
|
| 1198 | 1198 | { |
| 1199 | 1199 | return; |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | $requestMethod = $this->getRequestMethod(); |
| 1203 | - foreach($_REQUEST as $key => $val) |
|
| 1203 | + foreach ($_REQUEST as $key => $val) |
|
| 1204 | 1204 | { |
| 1205 | - if($val === '' || self::get($key)) |
|
| 1205 | + if ($val === '' || self::get($key)) |
|
| 1206 | 1206 | { |
| 1207 | 1207 | continue; |
| 1208 | 1208 | } |
| 1209 | 1209 | $key = htmlentities($key); |
| 1210 | 1210 | $val = $this->_filterRequestVar($key, $val); |
| 1211 | 1211 | |
| 1212 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1212 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1213 | 1213 | { |
| 1214 | 1214 | $set_to_vars = TRUE; |
| 1215 | 1215 | } |
| 1216 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1216 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1217 | 1217 | { |
| 1218 | 1218 | $set_to_vars = TRUE; |
| 1219 | 1219 | } |
| 1220 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1220 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | $set_to_vars = TRUE; |
| 1223 | 1223 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | $set_to_vars = FALSE; |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - if($set_to_vars) |
|
| 1229 | + if ($set_to_vars) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | $this->_recursiveCheckVar($val); |
| 1232 | 1232 | } |
@@ -1237,20 +1237,20 @@ discard block |
||
| 1237 | 1237 | |
| 1238 | 1238 | function _recursiveCheckVar($val) |
| 1239 | 1239 | { |
| 1240 | - if(is_string($val)) |
|
| 1240 | + if (is_string($val)) |
|
| 1241 | 1241 | { |
| 1242 | - foreach($this->patterns as $pattern) |
|
| 1242 | + foreach ($this->patterns as $pattern) |
|
| 1243 | 1243 | { |
| 1244 | - if(preg_match($pattern, $val)) |
|
| 1244 | + if (preg_match($pattern, $val)) |
|
| 1245 | 1245 | { |
| 1246 | 1246 | $this->isSuccessInit = FALSE; |
| 1247 | 1247 | return; |
| 1248 | 1248 | } |
| 1249 | 1249 | } |
| 1250 | 1250 | } |
| 1251 | - else if(is_array($val)) |
|
| 1251 | + else if (is_array($val)) |
|
| 1252 | 1252 | { |
| 1253 | - foreach($val as $val2) |
|
| 1253 | + foreach ($val as $val2) |
|
| 1254 | 1254 | { |
| 1255 | 1255 | $this->_recursiveCheckVar($val2); |
| 1256 | 1256 | } |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | */ |
| 1265 | 1265 | function _setJSONRequestArgument() |
| 1266 | 1266 | { |
| 1267 | - if($this->getRequestMethod() != 'JSON') |
|
| 1267 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1268 | 1268 | { |
| 1269 | 1269 | return; |
| 1270 | 1270 | } |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $params = array(); |
| 1273 | 1273 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1274 | 1274 | |
| 1275 | - foreach($params as $key => $val) |
|
| 1275 | + foreach ($params as $key => $val) |
|
| 1276 | 1276 | { |
| 1277 | 1277 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1278 | 1278 | } |
@@ -1285,13 +1285,13 @@ discard block |
||
| 1285 | 1285 | */ |
| 1286 | 1286 | function _setXmlRpcArgument() |
| 1287 | 1287 | { |
| 1288 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1288 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1289 | 1289 | { |
| 1290 | 1290 | return; |
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1294 | - if(Security::detectingXEE($xml)) |
|
| 1294 | + if (Security::detectingXEE($xml)) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | header("HTTP/1.0 400 Bad Request"); |
| 1297 | 1297 | exit; |
@@ -1303,12 +1303,12 @@ discard block |
||
| 1303 | 1303 | $params = $xml_obj->methodcall->params; |
| 1304 | 1304 | unset($params->node_name, $params->attrs, $params->body); |
| 1305 | 1305 | |
| 1306 | - if(!count(get_object_vars($params))) |
|
| 1306 | + if (!count(get_object_vars($params))) |
|
| 1307 | 1307 | { |
| 1308 | 1308 | return; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - foreach($params as $key => $val) |
|
| 1311 | + foreach ($params as $key => $val) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1314 | 1314 | } |
@@ -1323,10 +1323,10 @@ discard block |
||
| 1323 | 1323 | */ |
| 1324 | 1324 | function _filterXmlVars($key, $val) |
| 1325 | 1325 | { |
| 1326 | - if(is_array($val)) |
|
| 1326 | + if (is_array($val)) |
|
| 1327 | 1327 | { |
| 1328 | 1328 | $stack = array(); |
| 1329 | - foreach($val as $k => $v) |
|
| 1329 | + foreach ($val as $k => $v) |
|
| 1330 | 1330 | { |
| 1331 | 1331 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1332 | 1332 | } |
@@ -1336,20 +1336,20 @@ discard block |
||
| 1336 | 1336 | |
| 1337 | 1337 | $body = $val->body; |
| 1338 | 1338 | unset($val->node_name, $val->attrs, $val->body); |
| 1339 | - if(!count(get_object_vars($val))) |
|
| 1339 | + if (!count(get_object_vars($val))) |
|
| 1340 | 1340 | { |
| 1341 | 1341 | return $this->_filterRequestVar($key, $body, 0); |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | $stack = new stdClass(); |
| 1345 | - foreach($val as $k => $v) |
|
| 1345 | + foreach ($val as $k => $v) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | $output = $this->_filterXmlVars($k, $v); |
| 1348 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1348 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1349 | 1349 | { |
| 1350 | 1350 | $output = array($output); |
| 1351 | 1351 | } |
| 1352 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1352 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1353 | 1353 | { |
| 1354 | 1354 | return $output; |
| 1355 | 1355 | } |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | $stack->{$k} = $output; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | - if(!count(get_object_vars($stack))) |
|
| 1360 | + if (!count(get_object_vars($stack))) |
|
| 1361 | 1361 | { |
| 1362 | 1362 | return NULL; |
| 1363 | 1363 | } |
@@ -1376,24 +1376,24 @@ discard block |
||
| 1376 | 1376 | */ |
| 1377 | 1377 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
| 1378 | 1378 | { |
| 1379 | - if(!($isArray = is_array($val))) |
|
| 1379 | + if (!($isArray = is_array($val))) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | $val = array($val); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | $result = array(); |
| 1385 | - foreach($val as $k => $v) |
|
| 1385 | + foreach ($val as $k => $v) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | $k = htmlentities($k); |
| 1388 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1388 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1389 | 1389 | { |
| 1390 | 1390 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1391 | 1391 | } |
| 1392 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1392 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
| 1393 | 1393 | { |
| 1394 | 1394 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1395 | 1395 | } |
| 1396 | - elseif($key === 'vid') |
|
| 1396 | + elseif ($key === 'vid') |
|
| 1397 | 1397 | { |
| 1398 | 1398 | $result[$k] = urlencode($v); |
| 1399 | 1399 | } |
@@ -1401,12 +1401,12 @@ discard block |
||
| 1401 | 1401 | { |
| 1402 | 1402 | $result[$k] = $v; |
| 1403 | 1403 | |
| 1404 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1404 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1405 | 1405 | { |
| 1406 | 1406 | $result[$k] = stripslashes($result[$k]); |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | - if(!is_array($result[$k])) |
|
| 1409 | + if (!is_array($result[$k])) |
|
| 1410 | 1410 | { |
| 1411 | 1411 | $result[$k] = trim($result[$k]); |
| 1412 | 1412 | } |
@@ -1434,17 +1434,17 @@ discard block |
||
| 1434 | 1434 | */ |
| 1435 | 1435 | function _setUploadedArgument() |
| 1436 | 1436 | { |
| 1437 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1437 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1438 | 1438 | { |
| 1439 | 1439 | return; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | - foreach($_FILES as $key => $val) |
|
| 1442 | + foreach ($_FILES as $key => $val) |
|
| 1443 | 1443 | { |
| 1444 | 1444 | $tmp_name = $val['tmp_name']; |
| 1445 | - if(!is_array($tmp_name)) |
|
| 1445 | + if (!is_array($tmp_name)) |
|
| 1446 | 1446 | { |
| 1447 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1447 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1448 | 1448 | { |
| 1449 | 1449 | continue; |
| 1450 | 1450 | } |
@@ -1454,9 +1454,9 @@ discard block |
||
| 1454 | 1454 | } |
| 1455 | 1455 | else |
| 1456 | 1456 | { |
| 1457 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1457 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1458 | 1458 | { |
| 1459 | - if($val['size'][$i] > 0) |
|
| 1459 | + if ($val['size'][$i] > 0) |
|
| 1460 | 1460 | { |
| 1461 | 1461 | $file['name'] = $val['name'][$i]; |
| 1462 | 1462 | $file['type'] = $val['type'][$i]; |
@@ -1488,12 +1488,12 @@ discard block |
||
| 1488 | 1488 | function getRequestUrl() |
| 1489 | 1489 | { |
| 1490 | 1490 | static $url = null; |
| 1491 | - if(is_null($url)) |
|
| 1491 | + if (is_null($url)) |
|
| 1492 | 1492 | { |
| 1493 | 1493 | $url = self::getRequestUri(); |
| 1494 | - if(count($_GET) > 0) |
|
| 1494 | + if (count($_GET) > 0) |
|
| 1495 | 1495 | { |
| 1496 | - foreach($_GET as $key => $val) |
|
| 1496 | + foreach ($_GET as $key => $val) |
|
| 1497 | 1497 | { |
| 1498 | 1498 | $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
| 1499 | 1499 | } |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1513 | 1513 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1514 | 1514 | |
| 1515 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1515 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1516 | 1516 | { |
| 1517 | 1517 | unset($js_callback_func); |
| 1518 | 1518 | unset($_GET['xe_js_callback']); |
@@ -1540,22 +1540,22 @@ discard block |
||
| 1540 | 1540 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1541 | 1541 | |
| 1542 | 1542 | // retrieve virtual site information |
| 1543 | - if(is_null($site_module_info)) |
|
| 1543 | + if (is_null($site_module_info)) |
|
| 1544 | 1544 | { |
| 1545 | 1545 | $site_module_info = self::get('site_module_info'); |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1549 | - if($domain && isSiteID($domain)) |
|
| 1549 | + if ($domain && isSiteID($domain)) |
|
| 1550 | 1550 | { |
| 1551 | 1551 | $vid = $domain; |
| 1552 | 1552 | $domain = ''; |
| 1553 | 1553 | } |
| 1554 | 1554 | |
| 1555 | 1555 | // If $domain, $vid are not set, use current site information |
| 1556 | - if(!$domain && !$vid) |
|
| 1556 | + if (!$domain && !$vid) |
|
| 1557 | 1557 | { |
| 1558 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1558 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1559 | 1559 | { |
| 1560 | 1560 | $vid = $site_module_info->domain; |
| 1561 | 1561 | } |
@@ -1566,21 +1566,21 @@ discard block |
||
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1569 | - if($domain) |
|
| 1569 | + if ($domain) |
|
| 1570 | 1570 | { |
| 1571 | 1571 | $domain_info = parse_url($domain); |
| 1572 | - if(is_null($current_info)) |
|
| 1572 | + if (is_null($current_info)) |
|
| 1573 | 1573 | { |
| 1574 | 1574 | $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
| 1575 | 1575 | } |
| 1576 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1576 | + if ($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1577 | 1577 | { |
| 1578 | 1578 | unset($domain); |
| 1579 | 1579 | } |
| 1580 | 1580 | else |
| 1581 | 1581 | { |
| 1582 | 1582 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1583 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1583 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | $domain .= '/'; |
| 1586 | 1586 | } |
@@ -1590,10 +1590,10 @@ discard block |
||
| 1590 | 1590 | $get_vars = array(); |
| 1591 | 1591 | |
| 1592 | 1592 | // If there is no GET variables or first argument is '' to reset variables |
| 1593 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1593 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1594 | 1594 | { |
| 1595 | 1595 | // rearrange args_list |
| 1596 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1596 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1597 | 1597 | { |
| 1598 | 1598 | array_shift($args_list); |
| 1599 | 1599 | } |
@@ -1605,13 +1605,13 @@ discard block |
||
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | 1607 | // arrange args_list |
| 1608 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1608 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1609 | 1609 | { |
| 1610 | 1610 | $key = $args_list[$i]; |
| 1611 | 1611 | $val = trim($args_list[$i + 1]); |
| 1612 | 1612 | |
| 1613 | 1613 | // If value is not set, remove the key |
| 1614 | - if(!isset($val) || !strlen($val)) |
|
| 1614 | + if (!isset($val) || !strlen($val)) |
|
| 1615 | 1615 | { |
| 1616 | 1616 | unset($get_vars[$key]); |
| 1617 | 1617 | continue; |
@@ -1622,7 +1622,7 @@ discard block |
||
| 1622 | 1622 | |
| 1623 | 1623 | // remove vid, rnd |
| 1624 | 1624 | unset($get_vars['rnd']); |
| 1625 | - if($vid) |
|
| 1625 | + if ($vid) |
|
| 1626 | 1626 | { |
| 1627 | 1627 | $get_vars['vid'] = $vid; |
| 1628 | 1628 | } |
@@ -1639,17 +1639,17 @@ discard block |
||
| 1639 | 1639 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1640 | 1640 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1641 | 1641 | ); |
| 1642 | - if($act_alias[$act]) |
|
| 1642 | + if ($act_alias[$act]) |
|
| 1643 | 1643 | { |
| 1644 | 1644 | $get_vars['act'] = $act_alias[$act]; |
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | // organize URL |
| 1648 | 1648 | $query = ''; |
| 1649 | - if(count($get_vars) > 0) |
|
| 1649 | + if (count($get_vars) > 0) |
|
| 1650 | 1650 | { |
| 1651 | 1651 | // if using rewrite mod |
| 1652 | - if($self->allow_rewrite) |
|
| 1652 | + if ($self->allow_rewrite) |
|
| 1653 | 1653 | { |
| 1654 | 1654 | $var_keys = array_keys($get_vars); |
| 1655 | 1655 | sort($var_keys); |
@@ -1687,24 +1687,24 @@ discard block |
||
| 1687 | 1687 | $query = $target_map[$target]; |
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | - if(!$query) |
|
| 1690 | + if (!$query) |
|
| 1691 | 1691 | { |
| 1692 | 1692 | $queries = array(); |
| 1693 | - foreach($get_vars as $key => $val) |
|
| 1693 | + foreach ($get_vars as $key => $val) |
|
| 1694 | 1694 | { |
| 1695 | - if(is_array($val) && count($val) > 0) |
|
| 1695 | + if (is_array($val) && count($val) > 0) |
|
| 1696 | 1696 | { |
| 1697 | - foreach($val as $k => $v) |
|
| 1697 | + foreach ($val as $k => $v) |
|
| 1698 | 1698 | { |
| 1699 | 1699 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | - elseif(!is_array($val)) |
|
| 1702 | + elseif (!is_array($val)) |
|
| 1703 | 1703 | { |
| 1704 | 1704 | $queries[] = $key . '=' . urlencode($val); |
| 1705 | 1705 | } |
| 1706 | 1706 | } |
| 1707 | - if(count($queries) > 0) |
|
| 1707 | + if (count($queries) > 0) |
|
| 1708 | 1708 | { |
| 1709 | 1709 | $query = 'index.php?' . join('&', $queries); |
| 1710 | 1710 | } |
@@ -1713,12 +1713,12 @@ discard block |
||
| 1713 | 1713 | |
| 1714 | 1714 | // If using SSL always |
| 1715 | 1715 | $_use_ssl = $self->get('_use_ssl'); |
| 1716 | - if($_use_ssl == 'always') |
|
| 1716 | + if ($_use_ssl == 'always') |
|
| 1717 | 1717 | { |
| 1718 | 1718 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1719 | 1719 | // optional SSL use |
| 1720 | 1720 | } |
| 1721 | - elseif($_use_ssl == 'optional') |
|
| 1721 | + elseif ($_use_ssl == 'optional') |
|
| 1722 | 1722 | { |
| 1723 | 1723 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1724 | 1724 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
@@ -1727,11 +1727,11 @@ discard block |
||
| 1727 | 1727 | else |
| 1728 | 1728 | { |
| 1729 | 1729 | // currently on SSL but target is not based on SSL |
| 1730 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1730 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1731 | 1731 | { |
| 1732 | 1732 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1733 | 1733 | } |
| 1734 | - else if($domain) // if $domain is set |
|
| 1734 | + else if ($domain) // if $domain is set |
|
| 1735 | 1735 | { |
| 1736 | 1736 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1737 | 1737 | } |
@@ -1741,12 +1741,12 @@ discard block |
||
| 1741 | 1741 | } |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | - if(!$encode) |
|
| 1744 | + if (!$encode) |
|
| 1745 | 1745 | { |
| 1746 | 1746 | return $query; |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | - if(!$autoEncode) |
|
| 1749 | + if (!$autoEncode) |
|
| 1750 | 1750 | { |
| 1751 | 1751 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1752 | 1752 | } |
@@ -1755,9 +1755,9 @@ discard block |
||
| 1755 | 1755 | $encode_queries = array(); |
| 1756 | 1756 | $parsedUrl = parse_url($query); |
| 1757 | 1757 | parse_str($parsedUrl['query'], $output); |
| 1758 | - foreach($output as $key => $value) |
|
| 1758 | + foreach ($output as $key => $value) |
|
| 1759 | 1759 | { |
| 1760 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1760 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1761 | 1761 | { |
| 1762 | 1762 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1763 | 1763 | } |
@@ -1779,17 +1779,17 @@ discard block |
||
| 1779 | 1779 | static $url = array(); |
| 1780 | 1780 | |
| 1781 | 1781 | // Check HTTP Request |
| 1782 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1782 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1783 | 1783 | { |
| 1784 | 1784 | return; |
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | - if(self::get('_use_ssl') == 'always') |
|
| 1787 | + if (self::get('_use_ssl') == 'always') |
|
| 1788 | 1788 | { |
| 1789 | 1789 | $ssl_mode = ENFORCE_SSL; |
| 1790 | 1790 | } |
| 1791 | 1791 | |
| 1792 | - if($domain) |
|
| 1792 | + if ($domain) |
|
| 1793 | 1793 | { |
| 1794 | 1794 | $domain_key = md5($domain); |
| 1795 | 1795 | } |
@@ -1798,14 +1798,14 @@ discard block |
||
| 1798 | 1798 | $domain_key = 'default'; |
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1801 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1802 | 1802 | { |
| 1803 | 1803 | return $url[$ssl_mode][$domain_key]; |
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | 1806 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1807 | 1807 | |
| 1808 | - switch($ssl_mode) |
|
| 1808 | + switch ($ssl_mode) |
|
| 1809 | 1809 | { |
| 1810 | 1810 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1811 | 1811 | break; |
@@ -1815,12 +1815,12 @@ discard block |
||
| 1815 | 1815 | break; |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | - if($domain) |
|
| 1818 | + if ($domain) |
|
| 1819 | 1819 | { |
| 1820 | 1820 | $target_url = trim($domain); |
| 1821 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1821 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1822 | 1822 | { |
| 1823 | - $target_url.= '/'; |
|
| 1823 | + $target_url .= '/'; |
|
| 1824 | 1824 | } |
| 1825 | 1825 | } |
| 1826 | 1826 | else |
@@ -1830,19 +1830,19 @@ discard block |
||
| 1830 | 1830 | |
| 1831 | 1831 | $url_info = parse_url('http://' . $target_url); |
| 1832 | 1832 | |
| 1833 | - if($current_use_ssl != $use_ssl) |
|
| 1833 | + if ($current_use_ssl != $use_ssl) |
|
| 1834 | 1834 | { |
| 1835 | 1835 | unset($url_info['port']); |
| 1836 | 1836 | } |
| 1837 | 1837 | |
| 1838 | - if($use_ssl) |
|
| 1838 | + if ($use_ssl) |
|
| 1839 | 1839 | { |
| 1840 | 1840 | $port = self::get('_https_port'); |
| 1841 | - if($port && $port != 443) |
|
| 1841 | + if ($port && $port != 443) |
|
| 1842 | 1842 | { |
| 1843 | 1843 | $url_info['port'] = $port; |
| 1844 | 1844 | } |
| 1845 | - elseif($url_info['port'] == 443) |
|
| 1845 | + elseif ($url_info['port'] == 443) |
|
| 1846 | 1846 | { |
| 1847 | 1847 | unset($url_info['port']); |
| 1848 | 1848 | } |
@@ -1850,11 +1850,11 @@ discard block |
||
| 1850 | 1850 | else |
| 1851 | 1851 | { |
| 1852 | 1852 | $port = self::get('_http_port'); |
| 1853 | - if($port && $port != 80) |
|
| 1853 | + if ($port && $port != 80) |
|
| 1854 | 1854 | { |
| 1855 | 1855 | $url_info['port'] = $port; |
| 1856 | 1856 | } |
| 1857 | - elseif($url_info['port'] == 80) |
|
| 1857 | + elseif ($url_info['port'] == 80) |
|
| 1858 | 1858 | { |
| 1859 | 1859 | unset($url_info['port']); |
| 1860 | 1860 | } |
@@ -1877,16 +1877,16 @@ discard block |
||
| 1877 | 1877 | { |
| 1878 | 1878 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1879 | 1879 | $self->context->{$key} = $val; |
| 1880 | - if($set_to_get_vars === FALSE) |
|
| 1880 | + if ($set_to_get_vars === FALSE) |
|
| 1881 | 1881 | { |
| 1882 | 1882 | return; |
| 1883 | 1883 | } |
| 1884 | - if($val === NULL || $val === '') |
|
| 1884 | + if ($val === NULL || $val === '') |
|
| 1885 | 1885 | { |
| 1886 | 1886 | unset($self->get_vars->{$key}); |
| 1887 | 1887 | return; |
| 1888 | 1888 | } |
| 1889 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1889 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1890 | 1890 | { |
| 1891 | 1891 | $self->get_vars->{$key} = $val; |
| 1892 | 1892 | } |
@@ -1902,7 +1902,7 @@ discard block |
||
| 1902 | 1902 | { |
| 1903 | 1903 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1904 | 1904 | |
| 1905 | - if(!isset($self->context->{$key})) |
|
| 1905 | + if (!isset($self->context->{$key})) |
|
| 1906 | 1906 | { |
| 1907 | 1907 | return null; |
| 1908 | 1908 | } |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | function gets() |
| 1918 | 1918 | { |
| 1919 | 1919 | $num_args = func_num_args(); |
| 1920 | - if($num_args < 1) |
|
| 1920 | + if ($num_args < 1) |
|
| 1921 | 1921 | { |
| 1922 | 1922 | return; |
| 1923 | 1923 | } |
@@ -1925,7 +1925,7 @@ discard block |
||
| 1925 | 1925 | |
| 1926 | 1926 | $args_list = func_get_args(); |
| 1927 | 1927 | $output = new stdClass(); |
| 1928 | - foreach($args_list as $v) |
|
| 1928 | + foreach ($args_list as $v) |
|
| 1929 | 1929 | { |
| 1930 | 1930 | $output->{$v} = $self->get($v); |
| 1931 | 1931 | } |
@@ -1951,7 +1951,7 @@ discard block |
||
| 1951 | 1951 | function getRequestVars() |
| 1952 | 1952 | { |
| 1953 | 1953 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1954 | - if($self->get_vars) |
|
| 1954 | + if ($self->get_vars) |
|
| 1955 | 1955 | { |
| 1956 | 1956 | return clone($self->get_vars); |
| 1957 | 1957 | } |
@@ -1968,13 +1968,13 @@ discard block |
||
| 1968 | 1968 | { |
| 1969 | 1969 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1970 | 1970 | |
| 1971 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 1971 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 1972 | 1972 | { |
| 1973 | 1973 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 1974 | 1974 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 1975 | 1975 | } |
| 1976 | 1976 | |
| 1977 | - if(!isset($self->ssl_actions[$action])) |
|
| 1977 | + if (!isset($self->ssl_actions[$action])) |
|
| 1978 | 1978 | { |
| 1979 | 1979 | $self->ssl_actions[$action] = 1; |
| 1980 | 1980 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -1992,16 +1992,16 @@ discard block |
||
| 1992 | 1992 | { |
| 1993 | 1993 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 1994 | 1994 | |
| 1995 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 1995 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 1996 | 1996 | { |
| 1997 | 1997 | unset($self->ssl_actions); |
| 1998 | 1998 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 1999 | 1999 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2000 | 2000 | } |
| 2001 | 2001 | |
| 2002 | - foreach($action_array as $action) |
|
| 2002 | + foreach ($action_array as $action) |
|
| 2003 | 2003 | { |
| 2004 | - if(!isset($self->ssl_actions[$action])) |
|
| 2004 | + if (!isset($self->ssl_actions[$action])) |
|
| 2005 | 2005 | { |
| 2006 | 2006 | $self->ssl_actions[$action] = 1; |
| 2007 | 2007 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | { |
| 2021 | 2021 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 2022 | 2022 | |
| 2023 | - if($self->isExistsSSLAction($action)) |
|
| 2023 | + if ($self->isExistsSSLAction($action)) |
|
| 2024 | 2024 | { |
| 2025 | 2025 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2026 | 2026 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | function getSSLActions() |
| 2038 | 2038 | { |
| 2039 | 2039 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 2040 | - if($self->getSslStatus() == 'optional') |
|
| 2040 | + if ($self->getSslStatus() == 'optional') |
|
| 2041 | 2041 | { |
| 2042 | 2042 | return $self->ssl_actions; |
| 2043 | 2043 | } |
@@ -2064,12 +2064,12 @@ discard block |
||
| 2064 | 2064 | */ |
| 2065 | 2065 | function normalizeFilePath($file) |
| 2066 | 2066 | { |
| 2067 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2067 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2068 | 2068 | { |
| 2069 | 2069 | $file = './' . $file; |
| 2070 | 2070 | } |
| 2071 | 2071 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2072 | - while(strpos($file, '/../') !== FALSE) |
|
| 2072 | + while (strpos($file, '/../') !== FALSE) |
|
| 2073 | 2073 | { |
| 2074 | 2074 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2075 | 2075 | } |
@@ -2087,11 +2087,11 @@ discard block |
||
| 2087 | 2087 | function getAbsFileUrl($file) |
| 2088 | 2088 | { |
| 2089 | 2089 | $file = self::normalizeFilePath($file); |
| 2090 | - if(strpos($file, './') === 0) |
|
| 2090 | + if (strpos($file, './') === 0) |
|
| 2091 | 2091 | { |
| 2092 | 2092 | $file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2); |
| 2093 | 2093 | } |
| 2094 | - elseif(strpos($file, '../') === 0) |
|
| 2094 | + elseif (strpos($file, '../') === 0) |
|
| 2095 | 2095 | { |
| 2096 | 2096 | $file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}"); |
| 2097 | 2097 | } |
@@ -2163,12 +2163,12 @@ discard block |
||
| 2163 | 2163 | */ |
| 2164 | 2164 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2165 | 2165 | { |
| 2166 | - if($isRuleset) |
|
| 2166 | + if ($isRuleset) |
|
| 2167 | 2167 | { |
| 2168 | - if(strpos($file, '#') !== FALSE) |
|
| 2168 | + if (strpos($file, '#') !== FALSE) |
|
| 2169 | 2169 | { |
| 2170 | 2170 | $file = str_replace('#', '', $file); |
| 2171 | - if(!is_readable($file)) |
|
| 2171 | + if (!is_readable($file)) |
|
| 2172 | 2172 | { |
| 2173 | 2173 | $file = $autoPath; |
| 2174 | 2174 | } |
@@ -2233,9 +2233,9 @@ discard block |
||
| 2233 | 2233 | ksort($files); |
| 2234 | 2234 | $files = array_values($files); |
| 2235 | 2235 | $filenames = array(); |
| 2236 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2236 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2237 | 2237 | { |
| 2238 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2238 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2239 | 2239 | { |
| 2240 | 2240 | unset($files[$i]); |
| 2241 | 2241 | } |
@@ -2320,14 +2320,14 @@ discard block |
||
| 2320 | 2320 | */ |
| 2321 | 2321 | function getJavascriptPluginInfo($pluginName) |
| 2322 | 2322 | { |
| 2323 | - if($plugin_name == 'ui.datepicker') |
|
| 2323 | + if ($plugin_name == 'ui.datepicker') |
|
| 2324 | 2324 | { |
| 2325 | 2325 | $plugin_name = 'ui'; |
| 2326 | 2326 | } |
| 2327 | 2327 | |
| 2328 | 2328 | $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
| 2329 | 2329 | $info_file = $plugin_path . 'plugin.load'; |
| 2330 | - if(!is_readable($info_file)) |
|
| 2330 | + if (!is_readable($info_file)) |
|
| 2331 | 2331 | { |
| 2332 | 2332 | return; |
| 2333 | 2333 | } |
@@ -2337,30 +2337,30 @@ discard block |
||
| 2337 | 2337 | $result->jsList = array(); |
| 2338 | 2338 | $result->cssList = array(); |
| 2339 | 2339 | |
| 2340 | - foreach($list as $filename) |
|
| 2340 | + foreach ($list as $filename) |
|
| 2341 | 2341 | { |
| 2342 | 2342 | $filename = trim($filename); |
| 2343 | - if(!$filename) |
|
| 2343 | + if (!$filename) |
|
| 2344 | 2344 | { |
| 2345 | 2345 | continue; |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2348 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2349 | 2349 | { |
| 2350 | 2350 | $filename = substr($filename, 2); |
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2353 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2354 | 2354 | { |
| 2355 | 2355 | $result->jsList[] = $plugin_path . $filename; |
| 2356 | 2356 | } |
| 2357 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2357 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2358 | 2358 | { |
| 2359 | 2359 | $result->cssList[] = $plugin_path . $filename; |
| 2360 | 2360 | } |
| 2361 | 2361 | } |
| 2362 | 2362 | |
| 2363 | - if(is_dir($plugin_path . 'lang')) |
|
| 2363 | + if (is_dir($plugin_path . 'lang')) |
|
| 2364 | 2364 | { |
| 2365 | 2365 | $result->langPath = $plugin_path . 'lang'; |
| 2366 | 2366 | } |
@@ -2378,12 +2378,12 @@ discard block |
||
| 2378 | 2378 | static $loaded_plugins = array(); |
| 2379 | 2379 | |
| 2380 | 2380 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 2381 | - if($plugin_name == 'ui.datepicker') |
|
| 2381 | + if ($plugin_name == 'ui.datepicker') |
|
| 2382 | 2382 | { |
| 2383 | 2383 | $plugin_name = 'ui'; |
| 2384 | 2384 | } |
| 2385 | 2385 | |
| 2386 | - if($loaded_plugins[$plugin_name]) |
|
| 2386 | + if ($loaded_plugins[$plugin_name]) |
|
| 2387 | 2387 | { |
| 2388 | 2388 | return; |
| 2389 | 2389 | } |
@@ -2391,35 +2391,35 @@ discard block |
||
| 2391 | 2391 | |
| 2392 | 2392 | $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
| 2393 | 2393 | $info_file = $plugin_path . 'plugin.load'; |
| 2394 | - if(!is_readable($info_file)) |
|
| 2394 | + if (!is_readable($info_file)) |
|
| 2395 | 2395 | { |
| 2396 | 2396 | return; |
| 2397 | 2397 | } |
| 2398 | 2398 | |
| 2399 | 2399 | $list = file($info_file); |
| 2400 | - foreach($list as $filename) |
|
| 2400 | + foreach ($list as $filename) |
|
| 2401 | 2401 | { |
| 2402 | 2402 | $filename = trim($filename); |
| 2403 | - if(!$filename) |
|
| 2403 | + if (!$filename) |
|
| 2404 | 2404 | { |
| 2405 | 2405 | continue; |
| 2406 | 2406 | } |
| 2407 | 2407 | |
| 2408 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2408 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2409 | 2409 | { |
| 2410 | 2410 | $filename = substr($filename, 2); |
| 2411 | 2411 | } |
| 2412 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2412 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2413 | 2413 | { |
| 2414 | 2414 | $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
| 2415 | 2415 | } |
| 2416 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2416 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2417 | 2417 | { |
| 2418 | 2418 | $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
| 2419 | 2419 | } |
| 2420 | 2420 | } |
| 2421 | 2421 | |
| 2422 | - if(is_dir($plugin_path . 'lang')) |
|
| 2422 | + if (is_dir($plugin_path . 'lang')) |
|
| 2423 | 2423 | { |
| 2424 | 2424 | $self->loadLang($plugin_path . 'lang'); |
| 2425 | 2425 | } |
@@ -2591,14 +2591,14 @@ discard block |
||
| 2591 | 2591 | $_path = explode('/', $path); |
| 2592 | 2592 | $_base = explode('/', $base_url); |
| 2593 | 2593 | |
| 2594 | - if(!$_base[count($_base) - 1]) |
|
| 2594 | + if (!$_base[count($_base) - 1]) |
|
| 2595 | 2595 | { |
| 2596 | 2596 | array_pop($_base); |
| 2597 | 2597 | } |
| 2598 | 2598 | |
| 2599 | - foreach($_xe as $idx => $dir) |
|
| 2599 | + foreach ($_xe as $idx => $dir) |
|
| 2600 | 2600 | { |
| 2601 | - if($_path[0] != $dir) |
|
| 2601 | + if ($_path[0] != $dir) |
|
| 2602 | 2602 | { |
| 2603 | 2603 | break; |
| 2604 | 2604 | } |
@@ -2606,9 +2606,9 @@ discard block |
||
| 2606 | 2606 | } |
| 2607 | 2607 | |
| 2608 | 2608 | $idx = count($_xe) - $idx - 1; |
| 2609 | - while($idx--) |
|
| 2609 | + while ($idx--) |
|
| 2610 | 2610 | { |
| 2611 | - if(count($_base) > 0) |
|
| 2611 | + if (count($_base) > 0) |
|
| 2612 | 2612 | { |
| 2613 | 2613 | array_shift($_base); |
| 2614 | 2614 | } |
@@ -2618,13 +2618,13 @@ discard block |
||
| 2618 | 2618 | } |
| 2619 | 2619 | } |
| 2620 | 2620 | |
| 2621 | - if(count($_base) > 0) |
|
| 2621 | + if (count($_base) > 0) |
|
| 2622 | 2622 | { |
| 2623 | 2623 | array_unshift($_path, join('/', $_base)); |
| 2624 | 2624 | } |
| 2625 | 2625 | |
| 2626 | 2626 | $path = '/' . join('/', $_path); |
| 2627 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2627 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2628 | 2628 | { |
| 2629 | 2629 | $path .= '/'; |
| 2630 | 2630 | } |
@@ -2639,13 +2639,13 @@ discard block |
||
| 2639 | 2639 | { |
| 2640 | 2640 | is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); |
| 2641 | 2641 | |
| 2642 | - if(!is_array($self->meta_tags)) |
|
| 2642 | + if (!is_array($self->meta_tags)) |
|
| 2643 | 2643 | { |
| 2644 | 2644 | $self->meta_tags = array(); |
| 2645 | 2645 | } |
| 2646 | 2646 | |
| 2647 | 2647 | $ret = array(); |
| 2648 | - foreach($self->meta_tags as $key => $val) |
|
| 2648 | + foreach ($self->meta_tags as $key => $val) |
|
| 2649 | 2649 | { |
| 2650 | 2650 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2651 | 2651 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -227,7 +227,9 @@ discard block |
||
| 227 | 227 | $this->loadDBInfo(); |
| 228 | 228 | if($this->db_info->use_sitelock == 'Y') |
| 229 | 229 | { |
| 230 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 230 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
| 231 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 232 | + } |
|
| 231 | 233 | |
| 232 | 234 | if(!IpFilter::filter($whitelist)) |
| 233 | 235 | { |
@@ -242,8 +244,7 @@ discard block |
||
| 242 | 244 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 243 | 245 | { |
| 244 | 246 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 245 | - } |
|
| 246 | - else |
|
| 247 | + } else |
|
| 247 | 248 | { |
| 248 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 249 | 250 | } |
@@ -300,8 +301,7 @@ discard block |
||
| 300 | 301 | { |
| 301 | 302 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 302 | 303 | } |
| 303 | - } |
|
| 304 | - elseif($_COOKIE['lang_type']) |
|
| 304 | + } elseif($_COOKIE['lang_type']) |
|
| 305 | 305 | { |
| 306 | 306 | $this->lang_type = $_COOKIE['lang_type']; |
| 307 | 307 | } |
@@ -338,7 +338,9 @@ discard block |
||
| 338 | 338 | ); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 341 | + if($sess = $_POST[session_name()]) { |
|
| 342 | + session_id($sess); |
|
| 343 | + } |
|
| 342 | 344 | session_start(); |
| 343 | 345 | |
| 344 | 346 | // set authentication information in Context and session |
@@ -391,22 +393,21 @@ discard block |
||
| 391 | 393 | { |
| 392 | 394 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 393 | 395 | } |
| 394 | - } |
|
| 395 | - elseif($val) |
|
| 396 | + } elseif($val) |
|
| 396 | 397 | { |
| 397 | 398 | $url[] = $key . '=' . urlencode($val); |
| 398 | 399 | } |
| 399 | 400 | } |
| 400 | 401 | |
| 401 | 402 | $current_url = self::getRequestUri(); |
| 402 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 403 | - } |
|
| 404 | - else |
|
| 403 | + if($url) { |
|
| 404 | + $current_url .= '?' . join('&', $url); |
|
| 405 | + } |
|
| 406 | + } else |
|
| 405 | 407 | { |
| 406 | 408 | $current_url = $this->getUrl(); |
| 407 | 409 | } |
| 408 | - } |
|
| 409 | - else |
|
| 410 | + } else |
|
| 410 | 411 | { |
| 411 | 412 | $current_url = self::getRequestUri(); |
| 412 | 413 | } |
@@ -491,18 +492,22 @@ discard block |
||
| 491 | 492 | $db_info->use_prepared_statements = 'Y'; |
| 492 | 493 | } |
| 493 | 494 | |
| 494 | - if(!$db_info->time_zone) |
|
| 495 | - $db_info->time_zone = date('O'); |
|
| 495 | + if(!$db_info->time_zone) { |
|
| 496 | + $db_info->time_zone = date('O'); |
|
| 497 | + } |
|
| 496 | 498 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 497 | 499 | |
| 498 | - if($db_info->qmail_compatibility != 'Y') |
|
| 499 | - $db_info->qmail_compatibility = 'N'; |
|
| 500 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 501 | + $db_info->qmail_compatibility = 'N'; |
|
| 502 | + } |
|
| 500 | 503 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 501 | 504 | |
| 502 | - if(!$db_info->use_db_session) |
|
| 503 | - $db_info->use_db_session = 'N'; |
|
| 504 | - if(!$db_info->use_ssl) |
|
| 505 | - $db_info->use_ssl = 'none'; |
|
| 505 | + if(!$db_info->use_db_session) { |
|
| 506 | + $db_info->use_db_session = 'N'; |
|
| 507 | + } |
|
| 508 | + if(!$db_info->use_ssl) { |
|
| 509 | + $db_info->use_ssl = 'none'; |
|
| 510 | + } |
|
| 506 | 511 | $this->set('_use_ssl', $db_info->use_ssl); |
| 507 | 512 | |
| 508 | 513 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -619,8 +624,7 @@ discard block |
||
| 619 | 624 | $buff = FileHandler::readFile($orig_lang_file); |
| 620 | 625 | FileHandler::writeFile($selected_lang_file, $buff); |
| 621 | 626 | $lang_selected = self::loadLangSupported(); |
| 622 | - } |
|
| 623 | - else |
|
| 627 | + } else |
|
| 624 | 628 | { |
| 625 | 629 | $langs = file($selected_lang_file); |
| 626 | 630 | foreach($langs as $val) |
@@ -689,8 +693,7 @@ discard block |
||
| 689 | 693 | return FALSE; |
| 690 | 694 | } |
| 691 | 695 | // for sites requesting SSO validation |
| 692 | - } |
|
| 693 | - else |
|
| 696 | + } else |
|
| 694 | 697 | { |
| 695 | 698 | // result handling : set session_name() |
| 696 | 699 | if($session_name = self::get('SSOID')) |
@@ -701,8 +704,7 @@ discard block |
||
| 701 | 704 | header('location:' . $url); |
| 702 | 705 | return FALSE; |
| 703 | 706 | // send SSO request |
| 704 | - } |
|
| 705 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 707 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 706 | 708 | { |
| 707 | 709 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 708 | 710 | $url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl())); |
@@ -760,8 +762,7 @@ discard block |
||
| 760 | 762 | if($self->site_title) |
| 761 | 763 | { |
| 762 | 764 | $self->site_title .= ' - ' . $site_title; |
| 763 | - } |
|
| 764 | - else |
|
| 765 | + } else |
|
| 765 | 766 | { |
| 766 | 767 | $self->site_title = $site_title; |
| 767 | 768 | } |
@@ -861,8 +862,7 @@ discard block |
||
| 861 | 862 | { |
| 862 | 863 | $self->loaded_lang_files[] = $filename; |
| 863 | 864 | include($filename); |
| 864 | - } |
|
| 865 | - else |
|
| 865 | + } else |
|
| 866 | 866 | { |
| 867 | 867 | $self->_evalxmlLang($path); |
| 868 | 868 | } |
@@ -878,7 +878,9 @@ discard block |
||
| 878 | 878 | { |
| 879 | 879 | global $lang; |
| 880 | 880 | |
| 881 | - if(!$path) return; |
|
| 881 | + if(!$path) { |
|
| 882 | + return; |
|
| 883 | + } |
|
| 882 | 884 | |
| 883 | 885 | $_path = 'eval://' . $path; |
| 884 | 886 | |
@@ -910,7 +912,9 @@ discard block |
||
| 910 | 912 | */ |
| 911 | 913 | function _loadXmlLang($path) |
| 912 | 914 | { |
| 913 | - if(!$path) return; |
|
| 915 | + if(!$path) { |
|
| 916 | + return; |
|
| 917 | + } |
|
| 914 | 918 | |
| 915 | 919 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 916 | 920 | return $oXmlLangParser->compile(); |
@@ -924,7 +928,9 @@ discard block |
||
| 924 | 928 | */ |
| 925 | 929 | function _loadPhpLang($path) |
| 926 | 930 | { |
| 927 | - if(!$path) return; |
|
| 931 | + if(!$path) { |
|
| 932 | + return; |
|
| 933 | + } |
|
| 928 | 934 | |
| 929 | 935 | if(substr_compare($path, '/', -1) !== 0) |
| 930 | 936 | { |
@@ -1060,12 +1066,14 @@ discard block |
||
| 1060 | 1066 | static $flag = TRUE; |
| 1061 | 1067 | if($charset) |
| 1062 | 1068 | { |
| 1063 | - if(is_array($val)) |
|
| 1064 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1065 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1066 | - else $flag = FALSE; |
|
| 1067 | - } |
|
| 1068 | - else |
|
| 1069 | + if(is_array($val)) { |
|
| 1070 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1072 | + $flag = FALSE; |
|
| 1073 | + } else { |
|
| 1074 | + $flag = FALSE; |
|
| 1075 | + } |
|
| 1076 | + } else |
|
| 1069 | 1077 | { |
| 1070 | 1078 | $return = $flag; |
| 1071 | 1079 | $flag = TRUE; |
@@ -1087,8 +1095,9 @@ discard block |
||
| 1087 | 1095 | if (is_array($val)) |
| 1088 | 1096 | { |
| 1089 | 1097 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1098 | + } else { |
|
| 1099 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1090 | 1100 | } |
| 1091 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1092 | 1101 | } |
| 1093 | 1102 | |
| 1094 | 1103 | /** |
@@ -1099,7 +1108,9 @@ discard block |
||
| 1099 | 1108 | */ |
| 1100 | 1109 | function convertEncodingStr($str) |
| 1101 | 1110 | { |
| 1102 | - if(!$str) return null; |
|
| 1111 | + if(!$str) { |
|
| 1112 | + return null; |
|
| 1113 | + } |
|
| 1103 | 1114 | $obj = new stdClass(); |
| 1104 | 1115 | $obj->str = $str; |
| 1105 | 1116 | $obj = self::convertEncoding($obj); |
@@ -1212,16 +1223,13 @@ discard block |
||
| 1212 | 1223 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1213 | 1224 | { |
| 1214 | 1225 | $set_to_vars = TRUE; |
| 1215 | - } |
|
| 1216 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1226 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1217 | 1227 | { |
| 1218 | 1228 | $set_to_vars = TRUE; |
| 1219 | - } |
|
| 1220 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1229 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1221 | 1230 | { |
| 1222 | 1231 | $set_to_vars = TRUE; |
| 1223 | - } |
|
| 1224 | - else |
|
| 1232 | + } else |
|
| 1225 | 1233 | { |
| 1226 | 1234 | $set_to_vars = FALSE; |
| 1227 | 1235 | } |
@@ -1247,8 +1255,7 @@ discard block |
||
| 1247 | 1255 | return; |
| 1248 | 1256 | } |
| 1249 | 1257 | } |
| 1250 | - } |
|
| 1251 | - else if(is_array($val)) |
|
| 1258 | + } else if(is_array($val)) |
|
| 1252 | 1259 | { |
| 1253 | 1260 | foreach($val as $val2) |
| 1254 | 1261 | { |
@@ -1388,16 +1395,13 @@ discard block |
||
| 1388 | 1395 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1389 | 1396 | { |
| 1390 | 1397 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1391 | - } |
|
| 1392 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1398 | + } elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1393 | 1399 | { |
| 1394 | 1400 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1395 | - } |
|
| 1396 | - elseif($key === 'vid') |
|
| 1401 | + } elseif($key === 'vid') |
|
| 1397 | 1402 | { |
| 1398 | 1403 | $result[$k] = urlencode($v); |
| 1399 | - } |
|
| 1400 | - else |
|
| 1404 | + } else |
|
| 1401 | 1405 | { |
| 1402 | 1406 | $result[$k] = $v; |
| 1403 | 1407 | |
@@ -1451,8 +1455,7 @@ discard block |
||
| 1451 | 1455 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1452 | 1456 | $this->set($key, $val, TRUE); |
| 1453 | 1457 | $this->is_uploaded = TRUE; |
| 1454 | - } |
|
| 1455 | - else |
|
| 1458 | + } else |
|
| 1456 | 1459 | { |
| 1457 | 1460 | for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
| 1458 | 1461 | { |
@@ -1558,8 +1561,7 @@ discard block |
||
| 1558 | 1561 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1559 | 1562 | { |
| 1560 | 1563 | $vid = $site_module_info->domain; |
| 1561 | - } |
|
| 1562 | - else |
|
| 1564 | + } else |
|
| 1563 | 1565 | { |
| 1564 | 1566 | $domain = $site_module_info->domain; |
| 1565 | 1567 | } |
@@ -1576,8 +1578,7 @@ discard block |
||
| 1576 | 1578 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1577 | 1579 | { |
| 1578 | 1580 | unset($domain); |
| 1579 | - } |
|
| 1580 | - else |
|
| 1581 | + } else |
|
| 1581 | 1582 | { |
| 1582 | 1583 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1583 | 1584 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1597,8 +1598,7 @@ discard block |
||
| 1597 | 1598 | { |
| 1598 | 1599 | array_shift($args_list); |
| 1599 | 1600 | } |
| 1600 | - } |
|
| 1601 | - else |
|
| 1601 | + } else |
|
| 1602 | 1602 | { |
| 1603 | 1603 | // Otherwise, make GET variables into array |
| 1604 | 1604 | $get_vars = get_object_vars($self->get_vars); |
@@ -1625,8 +1625,7 @@ discard block |
||
| 1625 | 1625 | if($vid) |
| 1626 | 1626 | { |
| 1627 | 1627 | $get_vars['vid'] = $vid; |
| 1628 | - } |
|
| 1629 | - else |
|
| 1628 | + } else |
|
| 1630 | 1629 | { |
| 1631 | 1630 | unset($get_vars['vid']); |
| 1632 | 1631 | } |
@@ -1698,8 +1697,7 @@ discard block |
||
| 1698 | 1697 | { |
| 1699 | 1698 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1700 | 1699 | } |
| 1701 | - } |
|
| 1702 | - elseif(!is_array($val)) |
|
| 1700 | + } elseif(!is_array($val)) |
|
| 1703 | 1701 | { |
| 1704 | 1702 | $queries[] = $key . '=' . urlencode($val); |
| 1705 | 1703 | } |
@@ -1717,25 +1715,23 @@ discard block |
||
| 1717 | 1715 | { |
| 1718 | 1716 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1719 | 1717 | // optional SSL use |
| 1720 | - } |
|
| 1721 | - elseif($_use_ssl == 'optional') |
|
| 1718 | + } elseif($_use_ssl == 'optional') |
|
| 1722 | 1719 | { |
| 1723 | 1720 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1724 | 1721 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1725 | 1722 | // no SSL |
| 1726 | - } |
|
| 1727 | - else |
|
| 1723 | + } else |
|
| 1728 | 1724 | { |
| 1729 | 1725 | // currently on SSL but target is not based on SSL |
| 1730 | 1726 | if($_SERVER['HTTPS'] == 'on') |
| 1731 | 1727 | { |
| 1732 | 1728 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1733 | - } |
|
| 1734 | - else if($domain) // if $domain is set |
|
| 1729 | + } else if($domain) { |
|
| 1730 | + // if $domain is set |
|
| 1735 | 1731 | { |
| 1736 | 1732 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1737 | 1733 | } |
| 1738 | - else |
|
| 1734 | + } else |
|
| 1739 | 1735 | { |
| 1740 | 1736 | $query = getScriptPath() . $query; |
| 1741 | 1737 | } |
@@ -1792,8 +1788,7 @@ discard block |
||
| 1792 | 1788 | if($domain) |
| 1793 | 1789 | { |
| 1794 | 1790 | $domain_key = md5($domain); |
| 1795 | - } |
|
| 1796 | - else |
|
| 1791 | + } else |
|
| 1797 | 1792 | { |
| 1798 | 1793 | $domain_key = 'default'; |
| 1799 | 1794 | } |
@@ -1822,8 +1817,7 @@ discard block |
||
| 1822 | 1817 | { |
| 1823 | 1818 | $target_url.= '/'; |
| 1824 | 1819 | } |
| 1825 | - } |
|
| 1826 | - else |
|
| 1820 | + } else |
|
| 1827 | 1821 | { |
| 1828 | 1822 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1829 | 1823 | } |
@@ -1841,20 +1835,17 @@ discard block |
||
| 1841 | 1835 | if($port && $port != 443) |
| 1842 | 1836 | { |
| 1843 | 1837 | $url_info['port'] = $port; |
| 1844 | - } |
|
| 1845 | - elseif($url_info['port'] == 443) |
|
| 1838 | + } elseif($url_info['port'] == 443) |
|
| 1846 | 1839 | { |
| 1847 | 1840 | unset($url_info['port']); |
| 1848 | 1841 | } |
| 1849 | - } |
|
| 1850 | - else |
|
| 1842 | + } else |
|
| 1851 | 1843 | { |
| 1852 | 1844 | $port = self::get('_http_port'); |
| 1853 | 1845 | if($port && $port != 80) |
| 1854 | 1846 | { |
| 1855 | 1847 | $url_info['port'] = $port; |
| 1856 | - } |
|
| 1857 | - elseif($url_info['port'] == 80) |
|
| 1848 | + } elseif($url_info['port'] == 80) |
|
| 1858 | 1849 | { |
| 1859 | 1850 | unset($url_info['port']); |
| 1860 | 1851 | } |
@@ -2090,8 +2081,7 @@ discard block |
||
| 2090 | 2081 | if(strpos($file, './') === 0) |
| 2091 | 2082 | { |
| 2092 | 2083 | $file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2); |
| 2093 | - } |
|
| 2094 | - elseif(strpos($file, '../') === 0) |
|
| 2084 | + } elseif(strpos($file, '../') === 0) |
|
| 2095 | 2085 | { |
| 2096 | 2086 | $file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}"); |
| 2097 | 2087 | } |
@@ -2353,8 +2343,7 @@ discard block |
||
| 2353 | 2343 | if(substr_compare($filename, '.js', -3) === 0) |
| 2354 | 2344 | { |
| 2355 | 2345 | $result->jsList[] = $plugin_path . $filename; |
| 2356 | - } |
|
| 2357 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2346 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2358 | 2347 | { |
| 2359 | 2348 | $result->cssList[] = $plugin_path . $filename; |
| 2360 | 2349 | } |
@@ -2611,8 +2600,7 @@ discard block |
||
| 2611 | 2600 | if(count($_base) > 0) |
| 2612 | 2601 | { |
| 2613 | 2602 | array_shift($_base); |
| 2614 | - } |
|
| 2615 | - else |
|
| 2603 | + } else |
|
| 2616 | 2604 | { |
| 2617 | 2605 | array_unshift($_base, '..'); |
| 2618 | 2606 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * Returns counter cache data |
| 672 | 672 | * @param array|string $tables tables to get data |
| 673 | 673 | * @param string $condition condition to get data |
| 674 | - * @return int count of cache data |
|
| 674 | + * @return boolean count of cache data |
|
| 675 | 675 | */ |
| 676 | 676 | function getCountCache($tables, $condition) |
| 677 | 677 | { |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * @param array|string $tables tables to save data |
| 732 | 732 | * @param string $condition condition to save data |
| 733 | 733 | * @param int $count count of cache data to save |
| 734 | - * @return void |
|
| 734 | + * @return boolean |
|
| 735 | 735 | */ |
| 736 | 736 | function putCountCache($tables, $condition, $count = 0) |
| 737 | 737 | { |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | * DB Connect |
| 1243 | 1243 | * this method is protected |
| 1244 | 1244 | * @param array $connection |
| 1245 | - * @return void |
|
| 1245 | + * @return resource |
|
| 1246 | 1246 | */ |
| 1247 | 1247 | function __connect($connection) |
| 1248 | 1248 | { |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * */ |
| 45 | 45 | function setModulePath($path) |
| 46 | 46 | { |
| 47 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 47 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 48 | 48 | { |
| 49 | - $path.='/'; |
|
| 49 | + $path .= '/'; |
|
| 50 | 50 | } |
| 51 | 51 | $this->module_path = $path; |
| 52 | 52 | } |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | function setRedirectUrl($url = './', $output = NULL) |
| 61 | 61 | { |
| 62 | 62 | $ajaxRequestMethod = array_flip($this->ajaxRequestMethod); |
| 63 | - if(!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
| 63 | + if (!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
| 64 | 64 | { |
| 65 | 65 | $this->add('redirect_url', $url); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if($output !== NULL && is_object($output)) |
|
| 68 | + if ($output !== NULL && is_object($output)) |
|
| 69 | 69 | { |
| 70 | 70 | return $output; |
| 71 | 71 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $type = $this->get('message_type'); |
| 112 | 112 | $typeList = array('error' => 1, 'info' => 1, 'update' => 1); |
| 113 | - if(!isset($typeList[$type])) |
|
| 113 | + if (!isset($typeList[$type])) |
|
| 114 | 114 | { |
| 115 | 115 | $type = $this->getError() ? 'error' : 'info'; |
| 116 | 116 | } |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | $oModuleModel = getModel('module'); |
| 162 | 162 | // permission settings. access, manager(== is_admin) are fixed and privilege name in XE |
| 163 | 163 | $module_srl = Context::get('module_srl'); |
| 164 | - if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
| 164 | + if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
| 165 | 165 | { |
| 166 | 166 | $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 167 | - if($request_module->module_srl == $module_srl) |
|
| 167 | + if ($request_module->module_srl == $module_srl) |
|
| 168 | 168 | { |
| 169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
| 170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
| 175 | 175 | // have at least access grant |
| 176 | - if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
| 176 | + if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
| 177 | 177 | { |
| 178 | 178 | $grant->access = 1; |
| 179 | 179 | } |
@@ -181,24 +181,24 @@ discard block |
||
| 181 | 181 | // display no permission if the current module doesn't have an access privilege |
| 182 | 182 | //if(!$grant->access) return $this->stop("msg_not_permitted"); |
| 183 | 183 | // checks permission and action if you don't have an admin privilege |
| 184 | - if(!$grant->manager) |
|
| 184 | + if (!$grant->manager) |
|
| 185 | 185 | { |
| 186 | 186 | // get permission types(guest, member, manager, root) of the currently requested action |
| 187 | 187 | $permission_target = $xml_info->permission->{$this->act}; |
| 188 | 188 | // check manager if a permission in module.xml otherwise action if no permission |
| 189 | - if(!$permission_target && substr_count($this->act, 'Admin')) |
|
| 189 | + if (!$permission_target && substr_count($this->act, 'Admin')) |
|
| 190 | 190 | { |
| 191 | 191 | $permission_target = 'manager'; |
| 192 | 192 | } |
| 193 | 193 | // Check permissions |
| 194 | - switch($permission_target) |
|
| 194 | + switch ($permission_target) |
|
| 195 | 195 | { |
| 196 | 196 | case 'root' : |
| 197 | 197 | case 'manager' : |
| 198 | 198 | $this->stop('msg_is_not_administrator'); |
| 199 | 199 | return; |
| 200 | 200 | case 'member' : |
| 201 | - if(!$is_logged) |
|
| 201 | + if (!$is_logged) |
|
| 202 | 202 | { |
| 203 | 203 | $this->stop('msg_not_permitted_act'); |
| 204 | 204 | return; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl); |
| 215 | 215 | |
| 216 | - if(method_exists($this, 'init')) |
|
| 216 | + if (method_exists($this, 'init')) |
|
| 217 | 217 | { |
| 218 | 218 | $this->init(); |
| 219 | 219 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * */ |
| 252 | 252 | function setTemplateFile($filename) |
| 253 | 253 | { |
| 254 | - if(isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
| 254 | + if (isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
| 255 | 255 | { |
| 256 | 256 | $filename .= '.html'; |
| 257 | 257 | } |
@@ -274,14 +274,14 @@ discard block |
||
| 274 | 274 | * */ |
| 275 | 275 | function setTemplatePath($path) |
| 276 | 276 | { |
| 277 | - if(!$path) return; |
|
| 277 | + if (!$path) return; |
|
| 278 | 278 | |
| 279 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 279 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 280 | 280 | { |
| 281 | 281 | $path = './' . $path; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 284 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 285 | 285 | { |
| 286 | 286 | $path .= '/'; |
| 287 | 287 | } |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | * */ |
| 305 | 305 | function setEditedLayoutFile($filename) |
| 306 | 306 | { |
| 307 | - if(!$filename) return; |
|
| 307 | + if (!$filename) return; |
|
| 308 | 308 | |
| 309 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
| 309 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
| 310 | 310 | { |
| 311 | 311 | $filename .= '.html'; |
| 312 | 312 | } |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | * */ |
| 330 | 330 | function setLayoutFile($filename) |
| 331 | 331 | { |
| 332 | - if(!$filename) return; |
|
| 332 | + if (!$filename) return; |
|
| 333 | 333 | |
| 334 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
| 334 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
| 335 | 335 | { |
| 336 | 336 | $filename .= '.html'; |
| 337 | 337 | } |
@@ -353,13 +353,13 @@ discard block |
||
| 353 | 353 | * */ |
| 354 | 354 | function setLayoutPath($path) |
| 355 | 355 | { |
| 356 | - if(!$path) return; |
|
| 356 | + if (!$path) return; |
|
| 357 | 357 | |
| 358 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 358 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
| 359 | 359 | { |
| 360 | 360 | $path = './' . $path; |
| 361 | 361 | } |
| 362 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 362 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 363 | 363 | { |
| 364 | 364 | $path .= '/'; |
| 365 | 365 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | function proc() |
| 383 | 383 | { |
| 384 | 384 | // pass if stop_proc is true |
| 385 | - if($this->stop_proc) |
|
| 385 | + if ($this->stop_proc) |
|
| 386 | 386 | { |
| 387 | 387 | debugPrint($this->message, 'ERROR'); |
| 388 | 388 | return FALSE; |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // trigger call |
| 392 | 392 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); |
| 393 | - if(!$triggerOutput->toBool()) |
|
| 393 | + if (!$triggerOutput->toBool()) |
|
| 394 | 394 | { |
| 395 | 395 | $this->setError($triggerOutput->getError()); |
| 396 | 396 | $this->setMessage($triggerOutput->getMessage()); |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | $called_position = 'before_module_proc'; |
| 402 | 402 | $oAddonController = getController('addon'); |
| 403 | 403 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 404 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
| 405 | 405 | |
| 406 | - if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
| 406 | + if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
| 407 | 407 | { |
| 408 | 408 | // Check permissions |
| 409 | - if($this->module_srl && !$this->grant->access) |
|
| 409 | + if ($this->module_srl && !$this->grant->access) |
|
| 410 | 410 | { |
| 411 | 411 | $this->stop("msg_not_permitted_act"); |
| 412 | 412 | return FALSE; |
@@ -415,21 +415,21 @@ discard block |
||
| 415 | 415 | // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) |
| 416 | 416 | $is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N')); |
| 417 | 417 | $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); |
| 418 | - if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
| 418 | + if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
| 419 | 419 | { |
| 420 | 420 | $dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins'; |
| 421 | 421 | $valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin'; |
| 422 | 422 | $oModuleModel = getModel('module'); |
| 423 | 423 | $skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 424 | 424 | $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); |
| 425 | - if($this->module == 'page') |
|
| 425 | + if ($this->module == 'page') |
|
| 426 | 426 | { |
| 427 | 427 | $this->module_info->{$valueName} = $skinName; |
| 428 | 428 | } |
| 429 | 429 | else |
| 430 | 430 | { |
| 431 | 431 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
| 432 | - if(!$isTemplatPath) |
|
| 432 | + if (!$isTemplatPath) |
|
| 433 | 433 | { |
| 434 | 434 | $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); |
| 435 | 435 | } |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // trigger call |
| 451 | 451 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); |
| 452 | - if(!$triggerOutput->toBool()) |
|
| 452 | + if (!$triggerOutput->toBool()) |
|
| 453 | 453 | { |
| 454 | 454 | $this->setError($triggerOutput->getError()); |
| 455 | 455 | $this->setMessage($triggerOutput->getMessage()); |
@@ -460,25 +460,25 @@ discard block |
||
| 460 | 460 | $called_position = 'after_module_proc'; |
| 461 | 461 | $oAddonController = getController('addon'); |
| 462 | 462 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
| 463 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
| 464 | 464 | |
| 465 | - if(is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) |
|
| 465 | + if (is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) |
|
| 466 | 466 | { |
| 467 | 467 | $this->setError($output->getError()); |
| 468 | 468 | $this->setMessage($output->getMessage()); |
| 469 | 469 | |
| 470 | - if(!$output->toBool()) |
|
| 470 | + if (!$output->toBool()) |
|
| 471 | 471 | { |
| 472 | 472 | return FALSE; |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | // execute api methos of the module if view action is and result is XMLRPC or JSON |
| 476 | - if($this->module_info->module_type == 'view') |
|
| 476 | + if ($this->module_info->module_type == 'view') |
|
| 477 | 477 | { |
| 478 | - if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
| 478 | + if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
| 479 | 479 | { |
| 480 | 480 | $oAPI = getAPI($this->module_info->module, 'api'); |
| 481 | - if(method_exists($oAPI, $this->act)) |
|
| 481 | + if (method_exists($oAPI, $this->act)) |
|
| 482 | 482 | { |
| 483 | 483 | $oAPI->{$this->act}($this); |
| 484 | 484 | } |