@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $module_name The module name to get a instance |
75 | 75 | * @param string $type disp, proc, controller, class |
76 | 76 | * @param string $kind admin, null |
77 | - * @return mixed Module instance |
|
77 | + * @return ModuleObject Module instance |
|
78 | 78 | */ |
79 | 79 | function getModule($module_name, $type = 'view', $kind = '') |
80 | 80 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * Create a controller instance of the module |
86 | 86 | * |
87 | 87 | * @param string $module_name The module name to get a controller instance |
88 | - * @return mixed Module controller instance |
|
88 | + * @return ModuleObject Module controller instance |
|
89 | 89 | */ |
90 | 90 | function getController($module_name) |
91 | 91 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * Create a admin controller instance of the module |
97 | 97 | * |
98 | 98 | * @param string $module_name The module name to get a admin controller instance |
99 | - * @return mixed Module admin controller instance |
|
99 | + * @return ModuleObject Module admin controller instance |
|
100 | 100 | */ |
101 | 101 | function getAdminController($module_name) |
102 | 102 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Create a view instance of the module |
108 | 108 | * |
109 | 109 | * @param string $module_name The module name to get a view instance |
110 | - * @return mixed Module view instance |
|
110 | + * @return ModuleObject Module view instance |
|
111 | 111 | */ |
112 | 112 | function getView($module_name) |
113 | 113 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * Create a mobile instance of the module |
119 | 119 | * |
120 | 120 | * @param string $module_name The module name to get a mobile instance |
121 | - * @return mixed Module mobile instance |
|
121 | + * @return ModuleObject Module mobile instance |
|
122 | 122 | */ |
123 | 123 | function &getMobile($module_name) |
124 | 124 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * Create a admin view instance of the module |
130 | 130 | * |
131 | 131 | * @param string $module_name The module name to get a admin view instance |
132 | - * @return mixed Module admin view instance |
|
132 | + * @return ModuleObject Module admin view instance |
|
133 | 133 | */ |
134 | 134 | function getAdminView($module_name) |
135 | 135 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Create a model instance of the module |
141 | 141 | * |
142 | 142 | * @param string $module_name The module name to get a model instance |
143 | - * @return mixed Module model instance |
|
143 | + * @return ModuleObject Module model instance |
|
144 | 144 | */ |
145 | 145 | function getModel($module_name) |
146 | 146 | { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * Create an admin model instance of the module |
152 | 152 | * |
153 | 153 | * @param string $module_name The module name to get a admin model instance |
154 | - * @return mixed Module admin model instance |
|
154 | + * @return ModuleObject Module admin model instance |
|
155 | 155 | */ |
156 | 156 | function getAdminModel($module_name) |
157 | 157 | { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Create an api instance of the module |
163 | 163 | * |
164 | 164 | * @param string $module_name The module name to get a api instance |
165 | - * @return mixed Module api class instance |
|
165 | + * @return ModuleObject Module api class instance |
|
166 | 166 | */ |
167 | 167 | function getAPI($module_name) |
168 | 168 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * Create a wap instance of the module |
174 | 174 | * |
175 | 175 | * @param string $module_name The module name to get a wap instance |
176 | - * @return mixed Module wap class instance |
|
176 | + * @return ModuleObject Module wap class instance |
|
177 | 177 | */ |
178 | 178 | function getWAP($module_name) |
179 | 179 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * Create a class instance of the module |
185 | 185 | * |
186 | 186 | * @param string $module_name The module name to get a class instance |
187 | - * @return mixed Module class instance |
|
187 | + * @return ModuleObject Module class instance |
|
188 | 188 | */ |
189 | 189 | function getClass($module_name) |
190 | 190 | { |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * Return if domain of the virtual site is url type or id type |
491 | 491 | * |
492 | 492 | * @param string $domain |
493 | - * @return bool |
|
493 | + * @return integer |
|
494 | 494 | */ |
495 | 495 | function isSiteID($domain) |
496 | 496 | { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | /** |
560 | 560 | * Get a time gap between server's timezone and XE's timezone |
561 | 561 | * |
562 | - * @return int |
|
562 | + * @return double |
|
563 | 563 | */ |
564 | 564 | function zgap() |
565 | 565 | { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | * Display $buff contents into the file ./files/_debug_message.php. |
798 | 798 | * You can see the file on your prompt by command: tail-f./files/_debug_message.php |
799 | 799 | * |
800 | - * @param mixed $debug_output Target object to be printed |
|
800 | + * @param string $debug_output Target object to be printed |
|
801 | 801 | * @param bool $display_option boolean Flag whether to print seperator (default:true) |
802 | 802 | * @param string $file Target file name |
803 | 803 | * @return void |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | /** |
905 | 905 | * @param string $type query, trigger |
906 | 906 | * @param float $elapsed_time |
907 | - * @param object $obj |
|
907 | + * @param stdClass $obj |
|
908 | 908 | */ |
909 | 909 | function writeSlowlog($type, $elapsed_time, $obj) |
910 | 910 | { |
@@ -1685,6 +1685,9 @@ discard block |
||
1685 | 1685 | } |
1686 | 1686 | } |
1687 | 1687 | |
1688 | +/** |
|
1689 | + * @param string $key |
|
1690 | + */ |
|
1688 | 1691 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1689 | 1692 | { |
1690 | 1693 | if($requestKey != $dbKey) |
@@ -1781,6 +1784,9 @@ discard block |
||
1781 | 1784 | } |
1782 | 1785 | |
1783 | 1786 | |
1787 | +/** |
|
1788 | + * @param string $str |
|
1789 | + */ |
|
1784 | 1790 | function isDefinedLangCode($str) |
1785 | 1791 | { |
1786 | 1792 | return preg_match('!\$user_lang->([a-z0-9\_]+)$!is', trim($str)); |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author NAVER ([email protected]) |
8 | 8 | */ |
9 | -if(!defined('__XE__')) |
|
9 | +if (!defined('__XE__')) |
|
10 | 10 | { |
11 | 11 | exit(); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
15 | -if(!function_exists('iconv')) |
|
15 | +if (!function_exists('iconv')) |
|
16 | 16 | { |
17 | 17 | eval(' |
18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $oDB = DB::getInstance(); |
222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
224 | 224 | { |
225 | 225 | $output->data = array($output->data); |
226 | 226 | } |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | function setUserSequence($seq) |
251 | 251 | { |
252 | 252 | $arr_seq = array(); |
253 | - if(isset($_SESSION['seq'])) |
|
253 | + if (isset($_SESSION['seq'])) |
|
254 | 254 | { |
255 | - if(!is_array($_SESSION['seq'])) { |
|
255 | + if (!is_array($_SESSION['seq'])) { |
|
256 | 256 | $_SESSION['seq'] = array($_SESSION['seq']); |
257 | 257 | } |
258 | 258 | $arr_seq = $_SESSION['seq']; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function checkUserSequence($seq) |
271 | 271 | { |
272 | - if(!isset($_SESSION['seq'])) |
|
272 | + if (!isset($_SESSION['seq'])) |
|
273 | 273 | { |
274 | 274 | return false; |
275 | 275 | } |
276 | - if(!in_array($seq, $_SESSION['seq'])) |
|
276 | + if (!in_array($seq, $_SESSION['seq'])) |
|
277 | 277 | { |
278 | 278 | return false; |
279 | 279 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $num_args = func_num_args(); |
300 | 300 | $args_list = func_get_args(); |
301 | 301 | |
302 | - if($num_args) |
|
302 | + if ($num_args) |
|
303 | 303 | $url = Context::getUrl($num_args, $args_list); |
304 | 304 | else |
305 | 305 | $url = Context::getRequestUri(); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $num_args = func_num_args(); |
319 | 319 | $args_list = func_get_args(); |
320 | 320 | |
321 | - if($num_args) |
|
321 | + if ($num_args) |
|
322 | 322 | { |
323 | 323 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
324 | 324 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $num_args = func_num_args(); |
342 | 342 | $args_list = func_get_args(); |
343 | 343 | |
344 | - if($num_args) |
|
344 | + if ($num_args) |
|
345 | 345 | { |
346 | 346 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
363 | 363 | $num_args = func_num_args(); |
364 | 364 | $args_list = func_get_args(); |
365 | 365 | $request_uri = Context::getRequestUri(); |
366 | - if(!$num_args) |
|
366 | + if (!$num_args) |
|
367 | 367 | { |
368 | 368 | return $request_uri; |
369 | 369 | } |
370 | 370 | |
371 | 371 | $url = Context::getUrl($num_args, $args_list); |
372 | - if(strncasecmp('http', $url, 4) !== 0) |
|
372 | + if (strncasecmp('http', $url, 4) !== 0) |
|
373 | 373 | { |
374 | 374 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
375 | - return substr($match[0], 0, -1) . $url; |
|
375 | + return substr($match[0], 0, -1).$url; |
|
376 | 376 | } |
377 | 377 | return $url; |
378 | 378 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | $num_args = func_num_args(); |
388 | 388 | $args_list = func_get_args(); |
389 | 389 | $request_uri = Context::getRequestUri(); |
390 | - if(!$num_args) |
|
390 | + if (!$num_args) |
|
391 | 391 | { |
392 | 392 | return $request_uri; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
396 | - if(strncasecmp('http', $url, 4) !== 0) |
|
396 | + if (strncasecmp('http', $url, 4) !== 0) |
|
397 | 397 | { |
398 | 398 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
399 | 399 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
400 | - return substr($match[0], 0, -1) . $url; |
|
400 | + return substr($match[0], 0, -1).$url; |
|
401 | 401 | } |
402 | 402 | return $url; |
403 | 403 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $num_args = func_num_args(); |
414 | 414 | $args_list = func_get_args(); |
415 | 415 | |
416 | - if(!$num_args) |
|
416 | + if (!$num_args) |
|
417 | 417 | { |
418 | 418 | return Context::getRequestUri(); |
419 | 419 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $num_args = func_num_args(); |
436 | 436 | $args_list = func_get_args(); |
437 | 437 | |
438 | - if(!$num_args) |
|
438 | + if (!$num_args) |
|
439 | 439 | { |
440 | 440 | return Context::getRequestUri(); |
441 | 441 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $args_list = func_get_args(); |
458 | 458 | |
459 | 459 | $request_uri = Context::getRequestUri(); |
460 | - if(!$num_args) |
|
460 | + if (!$num_args) |
|
461 | 461 | { |
462 | 462 | return $request_uri; |
463 | 463 | } |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $num_args = count($args_list); |
467 | 467 | |
468 | 468 | $url = Context::getUrl($num_args, $args_list, $domain); |
469 | - if(strncasecmp('http', $url, 4) !== 0) |
|
469 | + if (strncasecmp('http', $url, 4) !== 0) |
|
470 | 470 | { |
471 | 471 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
472 | - return substr($match[0], 0, -1) . $url; |
|
472 | + return substr($match[0], 0, -1).$url; |
|
473 | 473 | } |
474 | 474 | return $url; |
475 | 475 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | function getCurrentPageUrl() |
483 | 483 | { |
484 | 484 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
485 | - $url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
485 | + $url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
486 | 486 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
487 | 487 | } |
488 | 488 | |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function cut_str($string, $cut_size = 0, $tail = '...') |
509 | 509 | { |
510 | - if($cut_size < 1 || !$string) |
|
510 | + if ($cut_size < 1 || !$string) |
|
511 | 511 | { |
512 | 512 | return $string; |
513 | 513 | } |
514 | 514 | |
515 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
515 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
516 | 516 | { |
517 | 517 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
518 | 518 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -526,16 +526,16 @@ discard block |
||
526 | 526 | $char_count = 0; |
527 | 527 | |
528 | 528 | $idx = 0; |
529 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
529 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
530 | 530 | { |
531 | 531 | $c = ord(substr($string, $idx, 1)); |
532 | 532 | $char_count++; |
533 | - if($c < 128) |
|
533 | + if ($c < 128) |
|
534 | 534 | { |
535 | 535 | $char_width += (int) $chars[$c - 32]; |
536 | 536 | $idx++; |
537 | 537 | } |
538 | - else if(191 < $c && $c < 224) |
|
538 | + else if (191 < $c && $c < 224) |
|
539 | 539 | { |
540 | 540 | $char_width += $chars[4]; |
541 | 541 | $idx += 2; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | $output = substr($string, 0, $idx); |
551 | - if(strlen($output) < $string_length) |
|
551 | + if (strlen($output) < $string_length) |
|
552 | 552 | { |
553 | 553 | $output .= $tail; |
554 | 554 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | function zgap() |
565 | 565 | { |
566 | 566 | $time_zone = $GLOBALS['_time_zone']; |
567 | - if($time_zone < 0) |
|
567 | + if ($time_zone < 0) |
|
568 | 568 | { |
569 | 569 | $to = -1; |
570 | 570 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $t_min = substr($time_zone, 3, 2) * $to; |
578 | 578 | |
579 | 579 | $server_time_zone = date("O"); |
580 | - if($server_time_zone < 0) |
|
580 | + if ($server_time_zone < 0) |
|
581 | 581 | { |
582 | 582 | $so = -1; |
583 | 583 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | function ztime($str) |
606 | 606 | { |
607 | - if(!$str) |
|
607 | + if (!$str) |
|
608 | 608 | { |
609 | 609 | return; |
610 | 610 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $year = (int) substr($str, 0, 4); |
620 | 620 | $month = (int) substr($str, 4, 2); |
621 | 621 | $day = (int) substr($str, 6, 2); |
622 | - if(strlen($str) <= 8) |
|
622 | + if (strlen($str) <= 8) |
|
623 | 623 | { |
624 | 624 | $gap = 0; |
625 | 625 | } |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
644 | 644 | |
645 | 645 | $lang_time_gap = Context::getLang('time_gap'); |
646 | - if($gap < 60) |
|
646 | + if ($gap < 60) |
|
647 | 647 | { |
648 | 648 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
649 | 649 | } |
650 | - elseif($gap < 60 * 60) |
|
650 | + elseif ($gap < 60 * 60) |
|
651 | 651 | { |
652 | 652 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
653 | 653 | } |
654 | - elseif($gap < 60 * 60 * 2) |
|
654 | + elseif ($gap < 60 * 60 * 2) |
|
655 | 655 | { |
656 | 656 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
657 | 657 | } |
658 | - elseif($gap < 60 * 60 * 24) |
|
658 | + elseif ($gap < 60 * 60 * 24) |
|
659 | 659 | { |
660 | 660 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
661 | 661 | } |
@@ -692,40 +692,40 @@ discard block |
||
692 | 692 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
693 | 693 | { |
694 | 694 | // return null if no target time is specified |
695 | - if(!$str) |
|
695 | + if (!$str) |
|
696 | 696 | { |
697 | 697 | return; |
698 | 698 | } |
699 | 699 | // convert the date format according to the language |
700 | - if($conversion == TRUE) |
|
700 | + if ($conversion == TRUE) |
|
701 | 701 | { |
702 | - switch(Context::getLangType()) |
|
702 | + switch (Context::getLangType()) |
|
703 | 703 | { |
704 | 704 | case 'en' : |
705 | 705 | case 'es' : |
706 | - if($format == 'Y-m-d') |
|
706 | + if ($format == 'Y-m-d') |
|
707 | 707 | { |
708 | 708 | $format = 'M d, Y'; |
709 | 709 | } |
710 | - elseif($format == 'Y-m-d H:i:s') |
|
710 | + elseif ($format == 'Y-m-d H:i:s') |
|
711 | 711 | { |
712 | 712 | $format = 'M d, Y H:i:s'; |
713 | 713 | } |
714 | - elseif($format == 'Y-m-d H:i') |
|
714 | + elseif ($format == 'Y-m-d H:i') |
|
715 | 715 | { |
716 | 716 | $format = 'M d, Y H:i'; |
717 | 717 | } |
718 | 718 | break; |
719 | 719 | case 'vi' : |
720 | - if($format == 'Y-m-d') |
|
720 | + if ($format == 'Y-m-d') |
|
721 | 721 | { |
722 | 722 | $format = 'd-m-Y'; |
723 | 723 | } |
724 | - elseif($format == 'Y-m-d H:i:s') |
|
724 | + elseif ($format == 'Y-m-d H:i:s') |
|
725 | 725 | { |
726 | 726 | $format = 'H:i:s d-m-Y'; |
727 | 727 | } |
728 | - elseif($format == 'Y-m-d H:i') |
|
728 | + elseif ($format == 'Y-m-d H:i') |
|
729 | 729 | { |
730 | 730 | $format = 'H:i d-m-Y'; |
731 | 731 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | |
736 | 736 | // If year value is less than 1970, handle it separately. |
737 | - if((int) substr($str, 0, 4) < 1970) |
|
737 | + if ((int) substr($str, 0, 4) < 1970) |
|
738 | 738 | { |
739 | 739 | $hour = (int) substr($str, 8, 2); |
740 | 740 | $min = (int) substr($str, 10, 2); |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | function getEncodeEmailAddress($email) |
785 | 785 | { |
786 | 786 | $return = ''; |
787 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
787 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
788 | 788 | { |
789 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
789 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
790 | 790 | } |
791 | 791 | return $return; |
792 | 792 | } |
@@ -806,25 +806,25 @@ discard block |
||
806 | 806 | { |
807 | 807 | static $debug_file; |
808 | 808 | |
809 | - if(!(__DEBUG__ & 1)) |
|
809 | + if (!(__DEBUG__ & 1)) |
|
810 | 810 | { |
811 | 811 | return; |
812 | 812 | } |
813 | 813 | |
814 | 814 | static $firephp; |
815 | 815 | $bt = debug_backtrace(); |
816 | - if(is_array($bt)) |
|
816 | + if (is_array($bt)) |
|
817 | 817 | { |
818 | 818 | $bt_debug_print = array_shift($bt); |
819 | 819 | $bt_called_function = array_shift($bt); |
820 | 820 | } |
821 | 821 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
822 | 822 | $line_num = $bt_debug_print['line']; |
823 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
823 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
824 | 824 | |
825 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
825 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
826 | 826 | { |
827 | - if(!isset($firephp)) |
|
827 | + if (!isset($firephp)) |
|
828 | 828 | { |
829 | 829 | $firephp = FirePHP::getInstance(TRUE); |
830 | 830 | } |
@@ -833,16 +833,16 @@ discard block |
||
833 | 833 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
834 | 834 | |
835 | 835 | // Check a FirePHP option |
836 | - if($display_option === 'TABLE') |
|
836 | + if ($display_option === 'TABLE') |
|
837 | 837 | { |
838 | 838 | $label = $display_option; |
839 | 839 | } |
840 | - if($display_option === 'ERROR') |
|
840 | + if ($display_option === 'ERROR') |
|
841 | 841 | { |
842 | 842 | $type = $display_option; |
843 | 843 | } |
844 | 844 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
845 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
845 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
846 | 846 | { |
847 | 847 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
848 | 848 | $label = NULL; |
@@ -852,52 +852,52 @@ discard block |
||
852 | 852 | } |
853 | 853 | else |
854 | 854 | { |
855 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
855 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
856 | 856 | { |
857 | 857 | return; |
858 | 858 | } |
859 | 859 | |
860 | 860 | $print = array(); |
861 | - if(!$debug_file) |
|
861 | + if (!$debug_file) |
|
862 | 862 | { |
863 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
863 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
864 | 864 | } |
865 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
865 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
866 | 866 | |
867 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
867 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
868 | 868 | { |
869 | - $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; |
|
869 | + $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; |
|
870 | 870 | $print[] = str_repeat('=', 80); |
871 | 871 | } |
872 | 872 | $type = gettype($debug_output); |
873 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
873 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
874 | 874 | { |
875 | - if($display_option === 'ERROR') |
|
875 | + if ($display_option === 'ERROR') |
|
876 | 876 | { |
877 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
877 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
878 | 878 | } |
879 | 879 | else |
880 | 880 | { |
881 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
881 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | else |
885 | 885 | { |
886 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
886 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
887 | 887 | } |
888 | 888 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
889 | 889 | $backtrace = debug_backtrace($backtrace_args); |
890 | 890 | |
891 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
891 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
892 | 892 | { |
893 | 893 | array_shift($backtrace); |
894 | 894 | } |
895 | - foreach($backtrace as $val) |
|
895 | + foreach ($backtrace as $val) |
|
896 | 896 | { |
897 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
897 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
898 | 898 | } |
899 | 899 | $print[] = PHP_EOL; |
900 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
900 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | */ |
909 | 909 | function writeSlowlog($type, $elapsed_time, $obj) |
910 | 910 | { |
911 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
911 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
912 | 912 | |
913 | 913 | static $log_filename = array( |
914 | 914 | 'query' => 'files/_slowlog_query.php', |
@@ -918,47 +918,47 @@ discard block |
||
918 | 918 | ); |
919 | 919 | $write_file = true; |
920 | 920 | |
921 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
921 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
922 | 922 | |
923 | 923 | $buff = array(); |
924 | 924 | $buff[] = '<?php exit(); ?>'; |
925 | 925 | $buff[] = date('c'); |
926 | 926 | |
927 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
927 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
928 | 928 | { |
929 | - $buff[] = "\tCaller : " . $obj->caller; |
|
930 | - $buff[] = "\tCalled : " . $obj->called; |
|
929 | + $buff[] = "\tCaller : ".$obj->caller; |
|
930 | + $buff[] = "\tCalled : ".$obj->called; |
|
931 | 931 | } |
932 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
932 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
933 | 933 | { |
934 | - $buff[] = "\tAddon : " . $obj->called; |
|
935 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
934 | + $buff[] = "\tAddon : ".$obj->called; |
|
935 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
936 | 936 | } |
937 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
937 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
938 | 938 | { |
939 | - $buff[] = "\tWidget : " . $obj->called; |
|
939 | + $buff[] = "\tWidget : ".$obj->called; |
|
940 | 940 | } |
941 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
941 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
942 | 942 | { |
943 | 943 | |
944 | 944 | $buff[] = $obj->query; |
945 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
946 | - $buff[] = "\tCaller : " . $obj->caller; |
|
947 | - $buff[] = "\tConnection : " . $obj->connection; |
|
945 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
946 | + $buff[] = "\tCaller : ".$obj->caller; |
|
947 | + $buff[] = "\tConnection : ".$obj->connection; |
|
948 | 948 | } |
949 | 949 | else |
950 | 950 | { |
951 | 951 | $write_file = false; |
952 | 952 | } |
953 | 953 | |
954 | - if($write_file) |
|
954 | + if ($write_file) |
|
955 | 955 | { |
956 | 956 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
957 | - $buff[] = PHP_EOL . PHP_EOL; |
|
957 | + $buff[] = PHP_EOL.PHP_EOL; |
|
958 | 958 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
959 | 959 | } |
960 | 960 | |
961 | - if($type != 'query') |
|
961 | + if ($type != 'query') |
|
962 | 962 | { |
963 | 963 | $trigger_args = $obj; |
964 | 964 | $trigger_args->_log_type = $type; |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | */ |
999 | 999 | function delObjectVars($target_obj, $del_obj) |
1000 | 1000 | { |
1001 | - if(!is_object($target_obj)) |
|
1001 | + if (!is_object($target_obj)) |
|
1002 | 1002 | { |
1003 | 1003 | return; |
1004 | 1004 | } |
1005 | - if(!is_object($del_obj)) |
|
1005 | + if (!is_object($del_obj)) |
|
1006 | 1006 | { |
1007 | 1007 | return; |
1008 | 1008 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | $target = array_keys($target_vars); |
1014 | 1014 | $del = array_keys($del_vars); |
1015 | - if(!count($target) || !count($del)) |
|
1015 | + if (!count($target) || !count($del)) |
|
1016 | 1016 | { |
1017 | 1017 | return $target_obj; |
1018 | 1018 | } |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | $return_obj = new stdClass(); |
1021 | 1021 | |
1022 | 1022 | $target_count = count($target); |
1023 | - for($i = 0; $i < $target_count; $i++) |
|
1023 | + for ($i = 0; $i < $target_count; $i++) |
|
1024 | 1024 | { |
1025 | 1025 | $target_key = $target[$i]; |
1026 | - if(!in_array($target_key, $del)) |
|
1026 | + if (!in_array($target_key, $del)) |
|
1027 | 1027 | { |
1028 | 1028 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
1029 | 1029 | } |
@@ -1036,10 +1036,10 @@ discard block |
||
1036 | 1036 | { |
1037 | 1037 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
1038 | 1038 | |
1039 | - foreach($del_vars as $var) |
|
1039 | + foreach ($del_vars as $var) |
|
1040 | 1040 | { |
1041 | - if(is_array($vars)) unset($vars[$var]); |
|
1042 | - else if(is_object($vars)) unset($vars->$var); |
|
1041 | + if (is_array($vars)) unset($vars[$var]); |
|
1042 | + else if (is_object($vars)) unset($vars->$var); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | return $vars; |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | */ |
1057 | 1057 | function handleError($errno, $errstr, $file, $line) |
1058 | 1058 | { |
1059 | - if(!__DEBUG__) |
|
1059 | + if (!__DEBUG__) |
|
1060 | 1060 | { |
1061 | 1061 | return; |
1062 | 1062 | } |
1063 | 1063 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
1064 | - if(!in_array($errno, $errors)) |
|
1064 | + if (!in_array($errno, $errors)) |
|
1065 | 1065 | { |
1066 | 1066 | return; |
1067 | 1067 | } |
@@ -1081,8 +1081,8 @@ discard block |
||
1081 | 1081 | function getNumberingPath($no, $size = 3) |
1082 | 1082 | { |
1083 | 1083 | $mod = pow(10, $size); |
1084 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
1085 | - if($no >= $mod) |
|
1084 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
1085 | + if ($no >= $mod) |
|
1086 | 1086 | { |
1087 | 1087 | $output .= getNumberingPath((int) $no / $mod, $size); |
1088 | 1088 | } |
@@ -1102,12 +1102,12 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | function purifierHtml(&$content) |
1104 | 1104 | { |
1105 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
1105 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
1106 | 1106 | $oPurifier = Purifier::getInstance(); |
1107 | 1107 | |
1108 | 1108 | // @see https://github.com/xpressengine/xe-core/issues/2278 |
1109 | 1109 | $logged_info = Context::get('logged_info'); |
1110 | - if($logged_info->is_admin !== 'Y') { |
|
1110 | + if ($logged_info->is_admin !== 'Y') { |
|
1111 | 1111 | $oPurifier->setConfig('HTML.Nofollow', true); |
1112 | 1112 | } |
1113 | 1113 | |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | function removeHackTag($content) |
1124 | 1124 | { |
1125 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
1125 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
1126 | 1126 | $oEmbedFilter = EmbedFilter::getInstance(); |
1127 | 1127 | $oEmbedFilter->check($content); |
1128 | 1128 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | function checkUploadedFile($file) |
1166 | 1166 | { |
1167 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
1167 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
1168 | 1168 | return UploadFileFilter::check($file); |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,13 +1178,13 @@ discard block |
||
1178 | 1178 | { |
1179 | 1179 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
1180 | 1180 | |
1181 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1181 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1182 | 1182 | { |
1183 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1183 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1184 | 1184 | { |
1185 | 1185 | $content .= '</xmp>'; |
1186 | 1186 | } |
1187 | - else if($close_xmp < $start_xmp) |
|
1187 | + else if ($close_xmp < $start_xmp) |
|
1188 | 1188 | { |
1189 | 1189 | $content .= '</xmp>'; |
1190 | 1190 | } |
@@ -1204,33 +1204,33 @@ discard block |
||
1204 | 1204 | $tag = strtolower($match[2]); |
1205 | 1205 | |
1206 | 1206 | // xmp tag ?뺣━ |
1207 | - if($tag == 'xmp') |
|
1207 | + if ($tag == 'xmp') |
|
1208 | 1208 | { |
1209 | 1209 | return "<{$match[1]}xmp>"; |
1210 | 1210 | } |
1211 | - if($match[1]) |
|
1211 | + if ($match[1]) |
|
1212 | 1212 | { |
1213 | 1213 | return $match[0]; |
1214 | 1214 | } |
1215 | - if($match[4]) |
|
1215 | + if ($match[4]) |
|
1216 | 1216 | { |
1217 | - $match[4] = ' ' . $match[4]; |
|
1217 | + $match[4] = ' '.$match[4]; |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | $attrs = array(); |
1221 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1221 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1222 | 1222 | { |
1223 | - foreach($m[1] as $idx => $name) |
|
1223 | + foreach ($m[1] as $idx => $name) |
|
1224 | 1224 | { |
1225 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1225 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1226 | 1226 | { |
1227 | 1227 | continue; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
1230 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
1231 | 1231 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
1232 | 1232 | |
1233 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
1233 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
1234 | 1234 | { |
1235 | 1235 | continue; |
1236 | 1236 | } |
@@ -1241,60 +1241,60 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | $filter_arrts = array('style', 'src', 'href'); |
1243 | 1243 | |
1244 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1245 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1244 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
1245 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
1246 | 1246 | |
1247 | - foreach($filter_arrts as $attr) |
|
1247 | + foreach ($filter_arrts as $attr) |
|
1248 | 1248 | { |
1249 | - if(!isset($attrs[$attr])) continue; |
|
1249 | + if (!isset($attrs[$attr])) continue; |
|
1250 | 1250 | |
1251 | 1251 | $attr_value = rawurldecode($attrs[$attr]); |
1252 | 1252 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
1253 | 1253 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
1254 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1254 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1255 | 1255 | { |
1256 | 1256 | unset($attrs[$attr]); |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1260 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1261 | 1261 | { |
1262 | 1262 | unset($attrs['style']); |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | $attr = array(); |
1266 | - foreach($attrs as $name => $val) |
|
1266 | + foreach ($attrs as $name => $val) |
|
1267 | 1267 | { |
1268 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1268 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1269 | 1269 | { |
1270 | 1270 | $attribute = strtolower(trim($name)); |
1271 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1271 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1272 | 1272 | { |
1273 | - if(stripos($val, 'data:') === 0) |
|
1273 | + if (stripos($val, 'data:') === 0) |
|
1274 | 1274 | { |
1275 | 1275 | continue; |
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | |
1280 | - if($tag == 'img') |
|
1280 | + if ($tag == 'img') |
|
1281 | 1281 | { |
1282 | 1282 | $attribute = strtolower(trim($name)); |
1283 | - if(stripos($val, 'data:') === 0) |
|
1283 | + if (stripos($val, 'data:') === 0) |
|
1284 | 1284 | { |
1285 | 1285 | continue; |
1286 | 1286 | } |
1287 | 1287 | } |
1288 | 1288 | $val = str_replace('"', '"', $val); |
1289 | - $attr[] = $name . "=\"{$val}\""; |
|
1289 | + $attr[] = $name."=\"{$val}\""; |
|
1290 | 1290 | } |
1291 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
1291 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
1292 | 1292 | |
1293 | 1293 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | // convert hexa value to RGB |
1297 | -if(!function_exists('hexrgb')) |
|
1297 | +if (!function_exists('hexrgb')) |
|
1298 | 1298 | { |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1330,9 +1330,9 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | settype($password, "string"); |
1332 | 1332 | |
1333 | - for($i = 0; $i < strlen($password); $i++) |
|
1333 | + for ($i = 0; $i < strlen($password); $i++) |
|
1334 | 1334 | { |
1335 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
1335 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
1336 | 1336 | { |
1337 | 1337 | continue; |
1338 | 1338 | } |
@@ -1344,11 +1344,11 @@ discard block |
||
1344 | 1344 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
1345 | 1345 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
1346 | 1346 | |
1347 | - if($result1 == '80000000') |
|
1347 | + if ($result1 == '80000000') |
|
1348 | 1348 | { |
1349 | 1349 | $nr += 0x80000000; |
1350 | 1350 | } |
1351 | - if($result2 == '80000000') |
|
1351 | + if ($result2 == '80000000') |
|
1352 | 1352 | { |
1353 | 1353 | $nr2 += 0x80000000; |
1354 | 1354 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | function getScriptPath() |
1365 | 1365 | { |
1366 | 1366 | static $url = NULL; |
1367 | - if($url == NULL) |
|
1367 | + if ($url == NULL) |
|
1368 | 1368 | { |
1369 | 1369 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
1370 | 1370 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1395,14 +1395,14 @@ discard block |
||
1395 | 1395 | $decodedStr = ''; |
1396 | 1396 | $pos = 0; |
1397 | 1397 | $len = strlen($source); |
1398 | - while($pos < $len) |
|
1398 | + while ($pos < $len) |
|
1399 | 1399 | { |
1400 | 1400 | $charAt = substr($source, $pos, 1); |
1401 | - if($charAt == '%') |
|
1401 | + if ($charAt == '%') |
|
1402 | 1402 | { |
1403 | 1403 | $pos++; |
1404 | 1404 | $charAt = substr($source, $pos, 1); |
1405 | - if($charAt == 'u') |
|
1405 | + if ($charAt == 'u') |
|
1406 | 1406 | { |
1407 | 1407 | // we got a unicode character |
1408 | 1408 | $pos++; |
@@ -1436,21 +1436,21 @@ discard block |
||
1436 | 1436 | */ |
1437 | 1437 | function _code2utf($num) |
1438 | 1438 | { |
1439 | - if($num < 128) |
|
1439 | + if ($num < 128) |
|
1440 | 1440 | { |
1441 | 1441 | return chr($num); |
1442 | 1442 | } |
1443 | - if($num < 2048) |
|
1443 | + if ($num < 2048) |
|
1444 | 1444 | { |
1445 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1445 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
1446 | 1446 | } |
1447 | - if($num < 65536) |
|
1447 | + if ($num < 65536) |
|
1448 | 1448 | { |
1449 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1449 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1450 | 1450 | } |
1451 | - if($num < 2097152) |
|
1451 | + if ($num < 2097152) |
|
1452 | 1452 | { |
1453 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1453 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1454 | 1454 | } |
1455 | 1455 | return ''; |
1456 | 1456 | } |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | */ |
1466 | 1466 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
1467 | 1467 | { |
1468 | - if($urldecode) |
|
1468 | + if ($urldecode) |
|
1469 | 1469 | { |
1470 | 1470 | $string = urldecode($string); |
1471 | 1471 | } |
@@ -1473,12 +1473,12 @@ discard block |
||
1473 | 1473 | $sample = iconv('utf-8', 'utf-8', $string); |
1474 | 1474 | $is_utf8 = (md5($sample) === md5($string)); |
1475 | 1475 | |
1476 | - if(!$urldecode) |
|
1476 | + if (!$urldecode) |
|
1477 | 1477 | { |
1478 | 1478 | $string = urldecode($string); |
1479 | 1479 | } |
1480 | 1480 | |
1481 | - if($return_convert) |
|
1481 | + if ($return_convert) |
|
1482 | 1482 | { |
1483 | 1483 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
1484 | 1484 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | function json_encode2($data) |
1496 | 1496 | { |
1497 | - switch(gettype($data)) |
|
1497 | + switch (gettype($data)) |
|
1498 | 1498 | { |
1499 | 1499 | case 'boolean': |
1500 | 1500 | return $data ? 'true' : 'false'; |
@@ -1502,15 +1502,15 @@ discard block |
||
1502 | 1502 | case 'double': |
1503 | 1503 | return $data; |
1504 | 1504 | case 'string': |
1505 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
1505 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
1506 | 1506 | case 'object': |
1507 | 1507 | $data = get_object_vars($data); |
1508 | 1508 | case 'array': |
1509 | 1509 | $rel = FALSE; // relative array? |
1510 | 1510 | $key = array_keys($data); |
1511 | - foreach($key as $v) |
|
1511 | + foreach ($key as $v) |
|
1512 | 1512 | { |
1513 | - if(!is_int($v)) |
|
1513 | + if (!is_int($v)) |
|
1514 | 1514 | { |
1515 | 1515 | $rel = TRUE; |
1516 | 1516 | break; |
@@ -1518,12 +1518,12 @@ discard block |
||
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | $arr = array(); |
1521 | - foreach($data as $k => $v) |
|
1521 | + foreach ($data as $k => $v) |
|
1522 | 1522 | { |
1523 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
1523 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
1526 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
1527 | 1527 | default: |
1528 | 1528 | return '""'; |
1529 | 1529 | } |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | */ |
1538 | 1538 | function isCrawler($agent = NULL) |
1539 | 1539 | { |
1540 | - if(!$agent) |
|
1540 | + if (!$agent) |
|
1541 | 1541 | { |
1542 | 1542 | $agent = $_SERVER['HTTP_USER_AGENT']; |
1543 | 1543 | } |
@@ -1547,9 +1547,9 @@ discard block |
||
1547 | 1547 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
1548 | 1548 | ); |
1549 | 1549 | |
1550 | - foreach($check_agent as $str) |
|
1550 | + foreach ($check_agent as $str) |
|
1551 | 1551 | { |
1552 | - if(stristr($agent, $str) != FALSE) |
|
1552 | + if (stristr($agent, $str) != FALSE) |
|
1553 | 1553 | { |
1554 | 1554 | return TRUE; |
1555 | 1555 | } |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | */ |
1568 | 1568 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
1569 | 1569 | { |
1570 | - if(!Context::get('is_logged')) |
|
1570 | + if (!Context::get('is_logged')) |
|
1571 | 1571 | { |
1572 | 1572 | return; |
1573 | 1573 | } |
@@ -1575,18 +1575,18 @@ discard block |
||
1575 | 1575 | $oModuleModel = getModel('module'); |
1576 | 1576 | $logged_info = Context::get('logged_info'); |
1577 | 1577 | |
1578 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1578 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1579 | 1579 | { |
1580 | - if($writer_member_srl) |
|
1580 | + if ($writer_member_srl) |
|
1581 | 1581 | { |
1582 | 1582 | $oMemberModel = getModel('member'); |
1583 | 1583 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
1584 | - if($member_info->is_admin == "Y") |
|
1584 | + if ($member_info->is_admin == "Y") |
|
1585 | 1585 | { |
1586 | 1586 | return; |
1587 | 1587 | } |
1588 | 1588 | } |
1589 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
1589 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
1590 | 1590 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
1591 | 1591 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
1592 | 1592 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1603,18 +1603,18 @@ discard block |
||
1603 | 1603 | function requirePear() |
1604 | 1604 | { |
1605 | 1605 | static $required = false; |
1606 | - if($required) |
|
1606 | + if ($required) |
|
1607 | 1607 | { |
1608 | 1608 | return; |
1609 | 1609 | } |
1610 | 1610 | |
1611 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1611 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1612 | 1612 | { |
1613 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
1613 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
1614 | 1614 | } |
1615 | 1615 | else |
1616 | 1616 | { |
1617 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
1617 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | $required = true; |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | function checkCSRF() |
1624 | 1624 | { |
1625 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1625 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1626 | 1626 | { |
1627 | 1627 | return FALSE; |
1628 | 1628 | } |
@@ -1630,9 +1630,9 @@ discard block |
||
1630 | 1630 | $default_url = Context::getDefaultUrl(); |
1631 | 1631 | $referer = $_SERVER["HTTP_REFERER"]; |
1632 | 1632 | |
1633 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1633 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1634 | 1634 | { |
1635 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1635 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1636 | 1636 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1637 | 1637 | $referer = $IDN->encode($referer); |
1638 | 1638 | } |
@@ -1643,9 +1643,9 @@ discard block |
||
1643 | 1643 | $oModuleModel = getModel('module'); |
1644 | 1644 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
1645 | 1645 | |
1646 | - if($siteModuleInfo->site_srl == 0) |
|
1646 | + if ($siteModuleInfo->site_srl == 0) |
|
1647 | 1647 | { |
1648 | - if($default_url['host'] !== $referer['host']) |
|
1648 | + if ($default_url['host'] !== $referer['host']) |
|
1649 | 1649 | { |
1650 | 1650 | return FALSE; |
1651 | 1651 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | else |
1654 | 1654 | { |
1655 | 1655 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1656 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1656 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1657 | 1657 | { |
1658 | 1658 | return FALSE; |
1659 | 1659 | } |
@@ -1669,15 +1669,15 @@ discard block |
||
1669 | 1669 | */ |
1670 | 1670 | function recurciveExposureCheck(&$menu) |
1671 | 1671 | { |
1672 | - if(is_array($menu)) |
|
1672 | + if (is_array($menu)) |
|
1673 | 1673 | { |
1674 | - foreach($menu AS $key=>$value) |
|
1674 | + foreach ($menu AS $key=>$value) |
|
1675 | 1675 | { |
1676 | - if(!$value['isShow']) |
|
1676 | + if (!$value['isShow']) |
|
1677 | 1677 | { |
1678 | 1678 | unset($menu[$key]); |
1679 | 1679 | } |
1680 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
1680 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
1681 | 1681 | { |
1682 | 1682 | recurciveExposureCheck($menu[$key]['list']); |
1683 | 1683 | } |
@@ -1687,14 +1687,14 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1689 | 1689 | { |
1690 | - if($requestKey != $dbKey) |
|
1690 | + if ($requestKey != $dbKey) |
|
1691 | 1691 | { |
1692 | 1692 | $arrayUrl = parse_url(Context::get('success_return_url')); |
1693 | - if($arrayUrl['query']) |
|
1693 | + if ($arrayUrl['query']) |
|
1694 | 1694 | { |
1695 | 1695 | parse_str($arrayUrl['query'], $parsedStr); |
1696 | 1696 | |
1697 | - if(isset($parsedStr[$key])) |
|
1697 | + if (isset($parsedStr[$key])) |
|
1698 | 1698 | { |
1699 | 1699 | $parsedStr[$key] = $requestKey; |
1700 | 1700 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1737,14 +1737,14 @@ discard block |
||
1737 | 1737 | */ |
1738 | 1738 | function alertScript($msg) |
1739 | 1739 | { |
1740 | - if(!$msg) |
|
1740 | + if (!$msg) |
|
1741 | 1741 | { |
1742 | 1742 | return; |
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | echo '<script type="text/javascript"> |
1746 | 1746 | //<![CDATA[ |
1747 | -alert("' . $msg . '"); |
|
1747 | +alert("' . $msg.'"); |
|
1748 | 1748 | //]]> |
1749 | 1749 | </script>'; |
1750 | 1750 | } |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | |
1776 | 1776 | echo '<script type="text/javascript"> |
1777 | 1777 | //<![CDATA[ |
1778 | -' . $reloadScript . ' |
|
1778 | +' . $reloadScript.' |
|
1779 | 1779 | //]]> |
1780 | 1780 | </script>'; |
1781 | 1781 | } |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | */ |
1799 | 1799 | function escape($str, $double_escape = true, $escape_defined_lang_code = false) |
1800 | 1800 | { |
1801 | - if(!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1801 | + if (!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1802 | 1802 | |
1803 | 1803 | $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
1804 | 1804 | return htmlspecialchars($str, $flags, 'UTF-8', $double_escape); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | function escape_js($str) |
1831 | 1831 | { |
1832 | 1832 | $flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE; |
1833 | - $str = json_encode((string)$str, $flags); |
|
1833 | + $str = json_encode((string) $str, $flags); |
|
1834 | 1834 | return substr($str, 1, strlen($str) - 2); |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1882,12 +1882,12 @@ discard block |
||
1882 | 1882 | { |
1883 | 1883 | if ($limit < 1) $limit = null; |
1884 | 1884 | $result = array(); |
1885 | - $split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); |
|
1885 | + $split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit); |
|
1886 | 1886 | foreach ($split as $piece) |
1887 | 1887 | { |
1888 | 1888 | if (trim($piece) !== '') |
1889 | 1889 | { |
1890 | - $result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece)); |
|
1890 | + $result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece)); |
|
1891 | 1891 | } |
1892 | 1892 | } |
1893 | 1893 | return $result; |
@@ -299,10 +299,11 @@ discard block |
||
299 | 299 | $num_args = func_num_args(); |
300 | 300 | $args_list = func_get_args(); |
301 | 301 | |
302 | - if($num_args) |
|
303 | - $url = Context::getUrl($num_args, $args_list); |
|
304 | - else |
|
305 | - $url = Context::getRequestUri(); |
|
302 | + if($num_args) { |
|
303 | + $url = Context::getUrl($num_args, $args_list); |
|
304 | + } else { |
|
305 | + $url = Context::getRequestUri(); |
|
306 | + } |
|
306 | 307 | |
307 | 308 | return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url); |
308 | 309 | } |
@@ -321,8 +322,7 @@ discard block |
||
321 | 322 | if($num_args) |
322 | 323 | { |
323 | 324 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
324 | - } |
|
325 | - else |
|
325 | + } else |
|
326 | 326 | { |
327 | 327 | $url = Context::getRequestUri(); |
328 | 328 | } |
@@ -344,8 +344,7 @@ discard block |
||
344 | 344 | if($num_args) |
345 | 345 | { |
346 | 346 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
347 | - } |
|
348 | - else |
|
347 | + } else |
|
349 | 348 | { |
350 | 349 | $url = Context::getRequestUri(); |
351 | 350 | } |
@@ -534,13 +533,11 @@ discard block |
||
534 | 533 | { |
535 | 534 | $char_width += (int) $chars[$c - 32]; |
536 | 535 | $idx++; |
537 | - } |
|
538 | - else if(191 < $c && $c < 224) |
|
536 | + } else if(191 < $c && $c < 224) |
|
539 | 537 | { |
540 | 538 | $char_width += $chars[4]; |
541 | 539 | $idx += 2; |
542 | - } |
|
543 | - else |
|
540 | + } else |
|
544 | 541 | { |
545 | 542 | $char_width += $chars[0]; |
546 | 543 | $idx += 3; |
@@ -567,8 +564,7 @@ discard block |
||
567 | 564 | if($time_zone < 0) |
568 | 565 | { |
569 | 566 | $to = -1; |
570 | - } |
|
571 | - else |
|
567 | + } else |
|
572 | 568 | { |
573 | 569 | $to = 1; |
574 | 570 | } |
@@ -580,8 +576,7 @@ discard block |
||
580 | 576 | if($server_time_zone < 0) |
581 | 577 | { |
582 | 578 | $so = -1; |
583 | - } |
|
584 | - else |
|
579 | + } else |
|
585 | 580 | { |
586 | 581 | $so = 1; |
587 | 582 | } |
@@ -622,8 +617,7 @@ discard block |
||
622 | 617 | if(strlen($str) <= 8) |
623 | 618 | { |
624 | 619 | $gap = 0; |
625 | - } |
|
626 | - else |
|
620 | + } else |
|
627 | 621 | { |
628 | 622 | $gap = zgap(); |
629 | 623 | } |
@@ -646,20 +640,16 @@ discard block |
||
646 | 640 | if($gap < 60) |
647 | 641 | { |
648 | 642 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
649 | - } |
|
650 | - elseif($gap < 60 * 60) |
|
643 | + } elseif($gap < 60 * 60) |
|
651 | 644 | { |
652 | 645 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
653 | - } |
|
654 | - elseif($gap < 60 * 60 * 2) |
|
646 | + } elseif($gap < 60 * 60 * 2) |
|
655 | 647 | { |
656 | 648 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
657 | - } |
|
658 | - elseif($gap < 60 * 60 * 24) |
|
649 | + } elseif($gap < 60 * 60 * 24) |
|
659 | 650 | { |
660 | 651 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
661 | - } |
|
662 | - else |
|
652 | + } else |
|
663 | 653 | { |
664 | 654 | $buff = zdate($date, $format); |
665 | 655 | } |
@@ -706,12 +696,10 @@ discard block |
||
706 | 696 | if($format == 'Y-m-d') |
707 | 697 | { |
708 | 698 | $format = 'M d, Y'; |
709 | - } |
|
710 | - elseif($format == 'Y-m-d H:i:s') |
|
699 | + } elseif($format == 'Y-m-d H:i:s') |
|
711 | 700 | { |
712 | 701 | $format = 'M d, Y H:i:s'; |
713 | - } |
|
714 | - elseif($format == 'Y-m-d H:i') |
|
702 | + } elseif($format == 'Y-m-d H:i') |
|
715 | 703 | { |
716 | 704 | $format = 'M d, Y H:i'; |
717 | 705 | } |
@@ -720,12 +708,10 @@ discard block |
||
720 | 708 | if($format == 'Y-m-d') |
721 | 709 | { |
722 | 710 | $format = 'd-m-Y'; |
723 | - } |
|
724 | - elseif($format == 'Y-m-d H:i:s') |
|
711 | + } elseif($format == 'Y-m-d H:i:s') |
|
725 | 712 | { |
726 | 713 | $format = 'H:i:s d-m-Y'; |
727 | - } |
|
728 | - elseif($format == 'Y-m-d H:i') |
|
714 | + } elseif($format == 'Y-m-d H:i') |
|
729 | 715 | { |
730 | 716 | $format = 'H:i d-m-Y'; |
731 | 717 | } |
@@ -761,8 +747,7 @@ discard block |
||
761 | 747 | ); |
762 | 748 | |
763 | 749 | $string = strtr($format, $trans); |
764 | - } |
|
765 | - else |
|
750 | + } else |
|
766 | 751 | { |
767 | 752 | // if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. |
768 | 753 | $string = date($format, ztime($str)); |
@@ -849,8 +834,7 @@ discard block |
||
849 | 834 | } |
850 | 835 | |
851 | 836 | $firephp->fb($debug_output, $label, $type); |
852 | - } |
|
853 | - else |
|
837 | + } else |
|
854 | 838 | { |
855 | 839 | if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
856 | 840 | { |
@@ -862,7 +846,9 @@ discard block |
||
862 | 846 | { |
863 | 847 | $debug_file = _XE_PATH_ . 'files/' . $file; |
864 | 848 | } |
865 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
849 | + if(!file_exists($debug_file)) { |
|
850 | + $print[] = '<?php exit() ?>'; |
|
851 | + } |
|
866 | 852 | |
867 | 853 | if($display_option === TRUE || $display_option === 'ERROR') |
868 | 854 | { |
@@ -875,13 +861,11 @@ discard block |
||
875 | 861 | if($display_option === 'ERROR') |
876 | 862 | { |
877 | 863 | $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
878 | - } |
|
879 | - else |
|
864 | + } else |
|
880 | 865 | { |
881 | 866 | $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
882 | 867 | } |
883 | - } |
|
884 | - else |
|
868 | + } else |
|
885 | 869 | { |
886 | 870 | $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
887 | 871 | } |
@@ -908,7 +892,9 @@ discard block |
||
908 | 892 | */ |
909 | 893 | function writeSlowlog($type, $elapsed_time, $obj) |
910 | 894 | { |
911 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
895 | + if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) { |
|
896 | + return; |
|
897 | + } |
|
912 | 898 | |
913 | 899 | static $log_filename = array( |
914 | 900 | 'query' => 'files/_slowlog_query.php', |
@@ -928,25 +914,21 @@ discard block |
||
928 | 914 | { |
929 | 915 | $buff[] = "\tCaller : " . $obj->caller; |
930 | 916 | $buff[] = "\tCalled : " . $obj->called; |
931 | - } |
|
932 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
917 | + } else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
933 | 918 | { |
934 | 919 | $buff[] = "\tAddon : " . $obj->called; |
935 | 920 | $buff[] = "\tCalled position : " . $obj->caller; |
936 | - } |
|
937 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
921 | + } else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
938 | 922 | { |
939 | 923 | $buff[] = "\tWidget : " . $obj->called; |
940 | - } |
|
941 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
924 | + } else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
942 | 925 | { |
943 | 926 | |
944 | 927 | $buff[] = $obj->query; |
945 | 928 | $buff[] = "\tQuery ID : " . $obj->query_id; |
946 | 929 | $buff[] = "\tCaller : " . $obj->caller; |
947 | 930 | $buff[] = "\tConnection : " . $obj->connection; |
948 | - } |
|
949 | - else |
|
931 | + } else |
|
950 | 932 | { |
951 | 933 | $write_file = false; |
952 | 934 | } |
@@ -1038,8 +1020,11 @@ discard block |
||
1038 | 1020 | |
1039 | 1021 | foreach($del_vars as $var) |
1040 | 1022 | { |
1041 | - if(is_array($vars)) unset($vars[$var]); |
|
1042 | - else if(is_object($vars)) unset($vars->$var); |
|
1023 | + if(is_array($vars)) { |
|
1024 | + unset($vars[$var]); |
|
1025 | + } else if(is_object($vars)) { |
|
1026 | + unset($vars->$var); |
|
1027 | + } |
|
1043 | 1028 | } |
1044 | 1029 | |
1045 | 1030 | return $vars; |
@@ -1183,8 +1168,7 @@ discard block |
||
1183 | 1168 | if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
1184 | 1169 | { |
1185 | 1170 | $content .= '</xmp>'; |
1186 | - } |
|
1187 | - else if($close_xmp < $start_xmp) |
|
1171 | + } else if($close_xmp < $start_xmp) |
|
1188 | 1172 | { |
1189 | 1173 | $content .= '</xmp>'; |
1190 | 1174 | } |
@@ -1241,12 +1225,18 @@ discard block |
||
1241 | 1225 | |
1242 | 1226 | $filter_arrts = array('style', 'src', 'href'); |
1243 | 1227 | |
1244 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1245 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1228 | + if($tag === 'object') { |
|
1229 | + array_push($filter_arrts, 'data'); |
|
1230 | + } |
|
1231 | + if($tag === 'param') { |
|
1232 | + array_push($filter_arrts, 'value'); |
|
1233 | + } |
|
1246 | 1234 | |
1247 | 1235 | foreach($filter_arrts as $attr) |
1248 | 1236 | { |
1249 | - if(!isset($attrs[$attr])) continue; |
|
1237 | + if(!isset($attrs[$attr])) { |
|
1238 | + continue; |
|
1239 | + } |
|
1250 | 1240 | |
1251 | 1241 | $attr_value = rawurldecode($attrs[$attr]); |
1252 | 1242 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
@@ -1410,16 +1400,14 @@ discard block |
||
1410 | 1400 | $unicode = hexdec($unicodeHexVal); |
1411 | 1401 | $decodedStr .= _code2utf($unicode); |
1412 | 1402 | $pos += 4; |
1413 | - } |
|
1414 | - else |
|
1403 | + } else |
|
1415 | 1404 | { |
1416 | 1405 | // we have an escaped ascii character |
1417 | 1406 | $hexVal = substr($source, $pos, 2); |
1418 | 1407 | $decodedStr .= chr(hexdec($hexVal)); |
1419 | 1408 | $pos += 2; |
1420 | 1409 | } |
1421 | - } |
|
1422 | - else |
|
1410 | + } else |
|
1423 | 1411 | { |
1424 | 1412 | $decodedStr .= $charAt; |
1425 | 1413 | $pos++; |
@@ -1611,8 +1599,7 @@ discard block |
||
1611 | 1599 | if(version_compare(PHP_VERSION, "5.3.0") < 0) |
1612 | 1600 | { |
1613 | 1601 | set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
1614 | - } |
|
1615 | - else |
|
1602 | + } else |
|
1616 | 1603 | { |
1617 | 1604 | set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
1618 | 1605 | } |
@@ -1649,8 +1636,7 @@ discard block |
||
1649 | 1636 | { |
1650 | 1637 | return FALSE; |
1651 | 1638 | } |
1652 | - } |
|
1653 | - else |
|
1639 | + } else |
|
1654 | 1640 | { |
1655 | 1641 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1656 | 1642 | if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
@@ -1798,7 +1784,9 @@ discard block |
||
1798 | 1784 | */ |
1799 | 1785 | function escape($str, $double_escape = true, $escape_defined_lang_code = false) |
1800 | 1786 | { |
1801 | - if(!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1787 | + if(!$escape_defined_lang_code && isDefinedLangCode($str)) { |
|
1788 | + return $str; |
|
1789 | + } |
|
1802 | 1790 | |
1803 | 1791 | $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
1804 | 1792 | return htmlspecialchars($str, $flags, 'UTF-8', $double_escape); |
@@ -1880,7 +1868,9 @@ discard block |
||
1880 | 1868 | */ |
1881 | 1869 | function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\') |
1882 | 1870 | { |
1883 | - if ($limit < 1) $limit = null; |
|
1871 | + if ($limit < 1) { |
|
1872 | + $limit = null; |
|
1873 | + } |
|
1884 | 1874 | $result = array(); |
1885 | 1875 | $split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); |
1886 | 1876 | foreach ($split as $piece) |
@@ -19,26 +19,26 @@ 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)) return true; |
|
23 | 23 | // directory and rss/atom/api reserved checking, etc. |
24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 25 | $dirs[] = 'rss'; |
26 | 26 | $dirs[] = 'atom'; |
27 | 27 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
28 | + if (in_array($id, $dirs)) return true; |
|
29 | 29 | // mid test |
30 | 30 | $args = new stdClass(); |
31 | 31 | $args->mid = $id; |
32 | 32 | $args->site_srl = $site_srl; |
33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
34 | + if ($output->data->count) return true; |
|
35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_args = new stdClass(); |
39 | 39 | $site_args->domain = $id; |
40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
41 | + if ($output->data->count) return true; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | function getDefaultMid() |
83 | 83 | { |
84 | 84 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
86 | 86 | |
87 | 87 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
89 | 89 | |
90 | 90 | $default_url_parse = parse_url($default_url); |
91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | // Set up |
96 | 96 | $domain = ''; |
97 | 97 | $site_info = NULL; |
98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
99 | 99 | { |
100 | 100 | $hostname = $request_url_parse['host']; |
101 | 101 | $path = $request_url_parse['path']; |
102 | 102 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
104 | 104 | |
105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
106 | 106 | } |
107 | 107 | |
108 | - if($domain === '') |
|
108 | + if ($domain === '') |
|
109 | 109 | { |
110 | - if(!$vid) $vid = $mid; |
|
111 | - if($vid) |
|
110 | + if (!$vid) $vid = $mid; |
|
111 | + if ($vid) |
|
112 | 112 | { |
113 | 113 | $domain = $vid; |
114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
116 | 116 | |
117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
118 | 118 | // If domain is set, look for subsite |
119 | - if($domain !== '') |
|
119 | + if ($domain !== '') |
|
120 | 120 | { |
121 | 121 | $site_info = false; |
122 | - if($oCacheHandler->isSupport()) |
|
122 | + if ($oCacheHandler->isSupport()) |
|
123 | 123 | { |
124 | - $object_key = 'site_info:' . md5($domain); |
|
124 | + $object_key = 'site_info:'.md5($domain); |
|
125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
127 | 127 | } |
128 | 128 | |
129 | - if($site_info === false) |
|
129 | + if ($site_info === false) |
|
130 | 130 | { |
131 | 131 | $args = new stdClass(); |
132 | 132 | $args->domain = $domain; |
133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 134 | $site_info = $output->data; |
135 | 135 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
137 | 137 | } |
138 | 138 | |
139 | - if($site_info && $vid) |
|
139 | + if ($site_info && $vid) |
|
140 | 140 | { |
141 | 141 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
143 | 143 | } |
144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // If no virtual website was found, get default website |
148 | - if($domain === '') |
|
148 | + if ($domain === '') |
|
149 | 149 | { |
150 | 150 | $site_info = false; |
151 | - if($oCacheHandler->isSupport()) |
|
151 | + if ($oCacheHandler->isSupport()) |
|
152 | 152 | { |
153 | 153 | $object_key = 'default_site'; |
154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
156 | 156 | } |
157 | 157 | |
158 | - if($site_info === false) |
|
158 | + if ($site_info === false) |
|
159 | 159 | { |
160 | 160 | $args = new stdClass(); |
161 | 161 | $args->site_srl = 0; |
162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
163 | 163 | // Update the related informaion if there is no default site info |
164 | - if(!$output->data) |
|
164 | + if (!$output->data) |
|
165 | 165 | { |
166 | 166 | // Create a table if sites table doesn't exist |
167 | 167 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | + if (!$oDB->isTableExists('sites')) return; |
|
170 | 170 | |
171 | 171 | // Get mid, language |
172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
173 | 173 | $db_info = Context::getDBInfo(); |
174 | 174 | $domain = Context::getDefaultUrl(); |
175 | 175 | $url_info = parse_url($domain); |
176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
177 | 177 | |
178 | 178 | $site_args = new stdClass; |
179 | 179 | $site_args->site_srl = 0; |
180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
181 | 181 | $site_args->domain = $domain; |
182 | 182 | $site_args->default_language = $db_info->lang_type; |
183 | 183 | |
184 | - if($output->data && !$output->data->index_module_srl) |
|
184 | + if ($output->data && !$output->data->index_module_srl) |
|
185 | 185 | { |
186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
187 | 187 | } |
188 | 188 | else |
189 | 189 | { |
190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
191 | + if (!$output->toBool()) return $output; |
|
192 | 192 | } |
193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 194 | } |
195 | 195 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
200 | + if (!$site_info->module_srl) return $site_info; |
|
201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
202 | 202 | return $this->addModuleExtraVars($site_info); |
203 | 203 | } |
204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
207 | 207 | */ |
208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
209 | 209 | { |
210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
211 | 211 | { |
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $args = new stdClass(); |
216 | 216 | $args->mid = $mid; |
217 | - $args->site_srl = (int)$site_srl; |
|
217 | + $args->site_srl = (int) $site_srl; |
|
218 | 218 | |
219 | 219 | $module_srl = false; |
220 | 220 | $module_info = false; |
221 | 221 | |
222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
223 | - if($oCacheHandler->isSupport()) |
|
223 | + if ($oCacheHandler->isSupport()) |
|
224 | 224 | { |
225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
228 | - if($module_srl) |
|
228 | + if ($module_srl) |
|
229 | 229 | { |
230 | - $object_key = 'mid_info:' . $module_srl; |
|
230 | + $object_key = 'mid_info:'.$module_srl; |
|
231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if($module_info === false) |
|
236 | + if ($module_info === false) |
|
237 | 237 | { |
238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
239 | 239 | $module_info = $output->data; |
240 | - if($oCacheHandler->isSupport()) |
|
240 | + if ($oCacheHandler->isSupport()) |
|
241 | 241 | { |
242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
243 | 243 | |
244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
252 | 252 | return $this->addModuleExtraVars($module_info); |
253 | 253 | } |
254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
266 | 266 | |
267 | - if(!$menuItemSrl) |
|
267 | + if (!$menuItemSrl) |
|
268 | 268 | { |
269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $args = new stdClass(); |
274 | 274 | $args->menu_item_srl = $menuItemSrl; |
275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
276 | - if(!$output->toBool()) |
|
276 | + if (!$output->toBool()) |
|
277 | 277 | { |
278 | 278 | return $output; |
279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
300 | - if(!$skinInfoPc) |
|
300 | + if (!$skinInfoPc) |
|
301 | 301 | { |
302 | 302 | $skinInfoPc = new stdClass(); |
303 | 303 | $skinInfoPc->title = $skinNamePc; |
304 | 304 | } |
305 | - if(!$skinInfoMobile) |
|
305 | + if (!$skinInfoMobile) |
|
306 | 306 | { |
307 | 307 | $skinInfoMobile = new stdClass(); |
308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
321 | 321 | $mid_info = false; |
322 | 322 | |
323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
324 | - if($oCacheHandler->isSupport()) |
|
324 | + if ($oCacheHandler->isSupport()) |
|
325 | 325 | { |
326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
329 | - if($module_srl) |
|
329 | + if ($module_srl) |
|
330 | 330 | { |
331 | - $object_key = 'mid_info:' . $module_srl; |
|
331 | + $object_key = 'mid_info:'.$module_srl; |
|
332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
334 | 334 | } |
335 | 335 | |
336 | - if($mid_info === false) |
|
336 | + if ($mid_info === false) |
|
337 | 337 | { |
338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
339 | 339 | |
340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
352 | 352 | |
353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
354 | 354 | { |
355 | 355 | unset($moduleInfo->skin); |
356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
369 | 369 | $mid_info = false; |
370 | 370 | |
371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
372 | - if($oCacheHandler->isSupport()) |
|
372 | + if ($oCacheHandler->isSupport()) |
|
373 | 373 | { |
374 | - $object_key = 'mid_info:' . $module_srl; |
|
374 | + $object_key = 'mid_info:'.$module_srl; |
|
375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
377 | 377 | } |
378 | 378 | |
379 | - if($mid_info === false) |
|
379 | + if ($mid_info === false) |
|
380 | 380 | { |
381 | 381 | // Get data |
382 | 382 | $args = new stdClass(); |
383 | 383 | $args->module_srl = $module_srl; |
384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
385 | + if (!$output->toBool()) return; |
|
386 | 386 | |
387 | 387 | $mid_info = $output->data; |
388 | 388 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
390 | 390 | } |
391 | 391 | |
392 | - if($mid_info && count($columnList)) |
|
392 | + if ($mid_info && count($columnList)) |
|
393 | 393 | { |
394 | 394 | $module_info = new stdClass(); |
395 | - foreach($mid_info as $key => $item) |
|
395 | + foreach ($mid_info as $key => $item) |
|
396 | 396 | { |
397 | - if(in_array($key, $columnList)) |
|
397 | + if (in_array($key, $columnList)) |
|
398 | 398 | { |
399 | 399 | $module_info->$key = $item; |
400 | 400 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | */ |
416 | 416 | private function applyDefaultSkin(&$moduleInfo) |
417 | 417 | { |
418 | - if($moduleInfo->is_skin_fix == 'N') |
|
418 | + if ($moduleInfo->is_skin_fix == 'N') |
|
419 | 419 | { |
420 | 420 | $moduleInfo->skin = '/USE_DEFAULT/'; |
421 | 421 | } |
422 | 422 | |
423 | - if($moduleInfo->is_mskin_fix == 'N') |
|
423 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
424 | 424 | { |
425 | 425 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
426 | 426 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $count = count($output->data); |
439 | 439 | |
440 | 440 | $modules = array(); |
441 | - for($i=0;$i<$count;$i++) |
|
441 | + for ($i = 0; $i < $count; $i++) |
|
442 | 442 | { |
443 | 443 | $modules[] = $output->data[$i]; |
444 | 444 | } |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | */ |
451 | 451 | function getModulesInfo($module_srls, $columnList = array()) |
452 | 452 | { |
453 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
453 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
454 | 454 | $args = new stdClass(); |
455 | 455 | $args->module_srls = $module_srls; |
456 | 456 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
457 | - if(!$output->toBool()) return; |
|
457 | + if (!$output->toBool()) return; |
|
458 | 458 | return $this->addModuleExtraVars($output->data); |
459 | 459 | } |
460 | 460 | |
@@ -464,31 +464,31 @@ discard block |
||
464 | 464 | function addModuleExtraVars($module_info) |
465 | 465 | { |
466 | 466 | // Process although one or more module informaion is requested |
467 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
467 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | 468 | else $target_module_info = $module_info; |
469 | 469 | // Get module_srl |
470 | 470 | $module_srls = array(); |
471 | - foreach($target_module_info as $key => $val) |
|
471 | + foreach ($target_module_info as $key => $val) |
|
472 | 472 | { |
473 | 473 | $module_srl = $val->module_srl; |
474 | - if(!$module_srl) continue; |
|
474 | + if (!$module_srl) continue; |
|
475 | 475 | $module_srls[] = $val->module_srl; |
476 | 476 | } |
477 | 477 | // Extract extra information of the module and skin |
478 | 478 | $extra_vars = $this->getModuleExtraVars($module_srls); |
479 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
479 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
480 | 480 | |
481 | - foreach($target_module_info as $key => $val) |
|
481 | + foreach ($target_module_info as $key => $val) |
|
482 | 482 | { |
483 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
484 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
483 | + if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
484 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
485 | 485 | { |
486 | - if($target_module_info[$key]->{$k}) continue; |
|
486 | + if ($target_module_info[$key]->{$k}) continue; |
|
487 | 487 | $target_module_info[$key]->{$k} = $v; |
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
491 | - if(is_array($module_info)) return $target_module_info; |
|
491 | + if (is_array($module_info)) return $target_module_info; |
|
492 | 492 | return $target_module_info[0]; |
493 | 493 | } |
494 | 494 | |
@@ -499,37 +499,37 @@ discard block |
||
499 | 499 | { |
500 | 500 | $list = false; |
501 | 501 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
502 | - if($oCacheHandler->isSupport()) |
|
502 | + if ($oCacheHandler->isSupport()) |
|
503 | 503 | { |
504 | - if(count($args) === 1 && isset($args->site_srl)) |
|
504 | + if (count($args) === 1 && isset($args->site_srl)) |
|
505 | 505 | { |
506 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
506 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
507 | 507 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
508 | 508 | $list = $oCacheHandler->get($cache_key); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - if($list === false) |
|
512 | + if ($list === false) |
|
513 | 513 | { |
514 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
514 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
515 | 515 | { |
516 | 516 | $columnList = array(); |
517 | 517 | } |
518 | 518 | |
519 | 519 | $output = executeQuery('module.getMidList', $args, $columnList); |
520 | - if(!$output->toBool()) return $output; |
|
520 | + if (!$output->toBool()) return $output; |
|
521 | 521 | $list = $output->data; |
522 | 522 | |
523 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
523 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
524 | 524 | { |
525 | 525 | $oCacheHandler->put($cache_key, $list); |
526 | 526 | } |
527 | 527 | } |
528 | - if(!$list) return; |
|
528 | + if (!$list) return; |
|
529 | 529 | |
530 | - if(!is_array($list)) $list = array($list); |
|
530 | + if (!is_array($list)) $list = array($list); |
|
531 | 531 | |
532 | - foreach($list as $val) |
|
532 | + foreach ($list as $val) |
|
533 | 533 | { |
534 | 534 | $mid_list[$val->mid] = $val; |
535 | 535 | } |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | function getModuleSrlList($args = null, $columnList = array()) |
544 | 544 | { |
545 | 545 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
546 | - if(!$output->toBool()) return $output; |
|
546 | + if (!$output->toBool()) return $output; |
|
547 | 547 | |
548 | 548 | $list = $output->data; |
549 | - if(!$list) return; |
|
549 | + if (!$list) return; |
|
550 | 550 | |
551 | 551 | return $list; |
552 | 552 | } |
@@ -556,22 +556,22 @@ discard block |
||
556 | 556 | */ |
557 | 557 | function getModuleSrlByMid($mid) |
558 | 558 | { |
559 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
560 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
559 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
560 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
561 | 561 | |
562 | 562 | $site_module_info = Context::get('site_module_info'); |
563 | 563 | |
564 | 564 | $args = new stdClass; |
565 | 565 | $args->mid = $mid; |
566 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
566 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
567 | 567 | $output = executeQuery('module.getModuleSrlByMid', $args); |
568 | - if(!$output->toBool()) return $output; |
|
568 | + if (!$output->toBool()) return $output; |
|
569 | 569 | |
570 | 570 | $list = $output->data; |
571 | - if(!$list) return; |
|
572 | - if(!is_array($list)) $list = array($list); |
|
571 | + if (!$list) return; |
|
572 | + if (!is_array($list)) $list = array($list); |
|
573 | 573 | |
574 | - foreach($list as $key => $val) |
|
574 | + foreach ($list as $key => $val) |
|
575 | 575 | { |
576 | 576 | $module_srl_list[] = $val->module_srl; |
577 | 577 | } |
@@ -587,33 +587,33 @@ discard block |
||
587 | 587 | $action_forward = false; |
588 | 588 | // cache controll |
589 | 589 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
590 | - if($oCacheHandler->isSupport()) |
|
590 | + if ($oCacheHandler->isSupport()) |
|
591 | 591 | { |
592 | 592 | $cache_key = 'action_forward'; |
593 | 593 | $action_forward = $oCacheHandler->get($cache_key); |
594 | 594 | } |
595 | 595 | |
596 | 596 | // retrieve and caching all registered action_forward |
597 | - if($action_forward === false) |
|
597 | + if ($action_forward === false) |
|
598 | 598 | { |
599 | 599 | $args = new stdClass(); |
600 | - $output = executeQueryArray('module.getActionForward',$args); |
|
601 | - if(!$output->toBool()) return new stdClass; |
|
602 | - if(!$output->data) $output->data = array(); |
|
600 | + $output = executeQueryArray('module.getActionForward', $args); |
|
601 | + if (!$output->toBool()) return new stdClass; |
|
602 | + if (!$output->data) $output->data = array(); |
|
603 | 603 | |
604 | 604 | $action_forward = array(); |
605 | - foreach($output->data as $item) |
|
605 | + foreach ($output->data as $item) |
|
606 | 606 | { |
607 | 607 | $action_forward[$item->act] = $item; |
608 | 608 | } |
609 | 609 | |
610 | - if($oCacheHandler->isSupport()) |
|
610 | + if ($oCacheHandler->isSupport()) |
|
611 | 611 | { |
612 | 612 | $oCacheHandler->put($cache_key, $action_forward); |
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | - if($action_forward[$act]) |
|
616 | + if ($action_forward[$act]) |
|
617 | 617 | { |
618 | 618 | return $action_forward[$act]; |
619 | 619 | } |
@@ -628,25 +628,25 @@ discard block |
||
628 | 628 | */ |
629 | 629 | function getTriggers($trigger_name, $called_position) |
630 | 630 | { |
631 | - if(is_null($GLOBALS['__triggers__'])) |
|
631 | + if (is_null($GLOBALS['__triggers__'])) |
|
632 | 632 | { |
633 | 633 | $triggers = FALSE; |
634 | 634 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
635 | - if($oCacheHandler->isSupport()) |
|
635 | + if ($oCacheHandler->isSupport()) |
|
636 | 636 | { |
637 | 637 | $cache_key = 'triggers'; |
638 | 638 | $triggers = $oCacheHandler->get($cache_key); |
639 | 639 | } |
640 | - if($triggers === FALSE) |
|
640 | + if ($triggers === FALSE) |
|
641 | 641 | { |
642 | 642 | $output = executeQueryArray('module.getTriggers'); |
643 | 643 | $triggers = $output->data; |
644 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
644 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
645 | 645 | { |
646 | 646 | $oCacheHandler->put($cache_key, $triggers); |
647 | 647 | } |
648 | 648 | } |
649 | - foreach($triggers as $item) |
|
649 | + foreach ($triggers as $item) |
|
650 | 650 | { |
651 | 651 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
652 | 652 | } |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | { |
663 | 663 | $triggers = $this->getTriggers($trigger_name, $called_position); |
664 | 664 | |
665 | - if($triggers && is_array($triggers)) |
|
665 | + if ($triggers && is_array($triggers)) |
|
666 | 666 | { |
667 | - foreach($triggers as $item) |
|
667 | + foreach ($triggers as $item) |
|
668 | 668 | { |
669 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
669 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
670 | 670 | { |
671 | 671 | return $item; |
672 | 672 | } |
@@ -679,12 +679,12 @@ discard block |
||
679 | 679 | /** |
680 | 680 | * @brief Get module extend |
681 | 681 | */ |
682 | - function getModuleExtend($parent_module, $type, $kind='') |
|
682 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
683 | 683 | { |
684 | 684 | $key = $parent_module.'.'.$kind.'.'.$type; |
685 | 685 | |
686 | 686 | $module_extend_info = $this->loadModuleExtends(); |
687 | - if(array_key_exists($key, $module_extend_info)) |
|
687 | + if (array_key_exists($key, $module_extend_info)) |
|
688 | 688 | { |
689 | 689 | return $module_extend_info[$key]; |
690 | 690 | } |
@@ -700,29 +700,29 @@ discard block |
||
700 | 700 | $cache_file = './files/config/module_extend.php'; |
701 | 701 | $cache_file = FileHandler::getRealPath($cache_file); |
702 | 702 | |
703 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
703 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
704 | 704 | { |
705 | 705 | // check pre install |
706 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
706 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
707 | 707 | { |
708 | 708 | $arr = array(); |
709 | 709 | $output = executeQueryArray('module.getModuleExtend'); |
710 | - if($output->data) |
|
710 | + if ($output->data) |
|
711 | 711 | { |
712 | - foreach($output->data as $v) |
|
712 | + foreach ($output->data as $v) |
|
713 | 713 | { |
714 | 714 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | 718 | $str = '<?PHP return array(%s); ?>'; |
719 | - $str = sprintf($str, join(',',$arr)); |
|
719 | + $str = sprintf($str, join(',', $arr)); |
|
720 | 720 | |
721 | 721 | FileHandler::writeFile($cache_file, $str); |
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | - if(file_exists($cache_file)) |
|
725 | + if (file_exists($cache_file)) |
|
726 | 726 | { |
727 | 727 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
728 | 728 | } |
@@ -742,20 +742,20 @@ discard block |
||
742 | 742 | { |
743 | 743 | // Get a path of the requested module. Return if not exists. |
744 | 744 | $module_path = ModuleHandler::getModulePath($module); |
745 | - if(!$module_path) return; |
|
745 | + if (!$module_path) return; |
|
746 | 746 | // Read the xml file for module skin information |
747 | 747 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
748 | - if(!file_exists($xml_file)) return; |
|
748 | + if (!file_exists($xml_file)) return; |
|
749 | 749 | |
750 | 750 | $oXmlParser = new XmlParser(); |
751 | 751 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
752 | 752 | $xml_obj = $tmp_xml_obj->module; |
753 | 753 | |
754 | - if(!$xml_obj) return; |
|
754 | + if (!$xml_obj) return; |
|
755 | 755 | |
756 | 756 | // Module Information |
757 | 757 | $module_info = new stdClass(); |
758 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
758 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
759 | 759 | { |
760 | 760 | // module format 0.2 |
761 | 761 | $module_info->title = $xml_obj->title->body; |
@@ -763,16 +763,16 @@ discard block |
||
763 | 763 | $module_info->version = $xml_obj->version->body; |
764 | 764 | $module_info->homepage = $xml_obj->link->body; |
765 | 765 | $module_info->category = $xml_obj->category->body; |
766 | - if(!$module_info->category) $module_info->category = 'service'; |
|
766 | + if (!$module_info->category) $module_info->category = 'service'; |
|
767 | 767 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
768 | 768 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 769 | $module_info->license = $xml_obj->license->body; |
770 | 770 | $module_info->license_link = $xml_obj->license->attrs->link; |
771 | 771 | |
772 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
772 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | 773 | else $author_list = $xml_obj->author; |
774 | 774 | |
775 | - foreach($author_list as $author) |
|
775 | + foreach ($author_list as $author) |
|
776 | 776 | { |
777 | 777 | $author_obj = new stdClass(); |
778 | 778 | $author_obj->name = $author->name->body; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | $module_info->description = $xml_obj->author->description->body; |
789 | 789 | $module_info->version = $xml_obj->attrs->version; |
790 | 790 | $module_info->category = $xml_obj->attrs->category; |
791 | - if(!$module_info->category) $module_info->category = 'service'; |
|
791 | + if (!$module_info->category) $module_info->category = 'service'; |
|
792 | 792 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
793 | 793 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 794 | $author_obj = new stdClass(); |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | { |
818 | 818 | // Get a path of the requested module. Return if not exists. |
819 | 819 | $class_path = ModuleHandler::getModulePath($module); |
820 | - if(!$class_path) return; |
|
820 | + if (!$class_path) return; |
|
821 | 821 | |
822 | 822 | // Check if module.xml exists in the path. Return if not exist |
823 | 823 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
824 | - if(!file_exists($xml_file)) return; |
|
824 | + if (!file_exists($xml_file)) return; |
|
825 | 825 | |
826 | 826 | // Check if cached file exists |
827 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
827 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
828 | 828 | |
829 | 829 | // Update if no cache file exists or it is older than xml file |
830 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
830 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
831 | 831 | { |
832 | 832 | $info = new stdClass(); |
833 | 833 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | |
841 | 841 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
842 | 842 | |
843 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
843 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
844 | 844 | |
845 | 845 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
846 | 846 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -850,17 +850,17 @@ discard block |
||
850 | 850 | $default_index = $admin_index = ''; |
851 | 851 | |
852 | 852 | // Arrange permission information |
853 | - if($grants) |
|
853 | + if ($grants) |
|
854 | 854 | { |
855 | - if(is_array($grants)) $grant_list = $grants; |
|
855 | + if (is_array($grants)) $grant_list = $grants; |
|
856 | 856 | else $grant_list[] = $grants; |
857 | 857 | |
858 | 858 | $info->grant = new stdClass(); |
859 | 859 | $buff[] = '$info->grant = new stdClass;'; |
860 | - foreach($grant_list as $grant) |
|
860 | + foreach ($grant_list as $grant) |
|
861 | 861 | { |
862 | 862 | $name = $grant->attrs->name; |
863 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
863 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
864 | 864 | $title = $grant->title->body; |
865 | 865 | |
866 | 866 | $info->grant->{$name} = new stdClass(); |
@@ -873,15 +873,15 @@ discard block |
||
873 | 873 | } |
874 | 874 | } |
875 | 875 | // Permissions to grant |
876 | - if($permissions) |
|
876 | + if ($permissions) |
|
877 | 877 | { |
878 | - if(is_array($permissions)) $permission_list = $permissions; |
|
878 | + if (is_array($permissions)) $permission_list = $permissions; |
|
879 | 879 | else $permission_list[] = $permissions; |
880 | 880 | |
881 | 881 | $buff[] = '$info->permission = new stdClass;'; |
882 | 882 | |
883 | 883 | $info->permission = new stdClass(); |
884 | - foreach($permission_list as $permission) |
|
884 | + foreach ($permission_list as $permission) |
|
885 | 885 | { |
886 | 886 | $action = $permission->attrs->action; |
887 | 887 | $target = $permission->attrs->target; |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | } |
893 | 893 | } |
894 | 894 | // for admin menus |
895 | - if($menus) |
|
895 | + if ($menus) |
|
896 | 896 | { |
897 | - if(is_array($menus)) $menu_list = $menus; |
|
897 | + if (is_array($menus)) $menu_list = $menus; |
|
898 | 898 | else $menu_list[] = $menus; |
899 | 899 | |
900 | 900 | $buff[] = '$info->menu = new stdClass;'; |
901 | 901 | $info->menu = new stdClass(); |
902 | - foreach($menu_list as $menu) |
|
902 | + foreach ($menu_list as $menu) |
|
903 | 903 | { |
904 | 904 | $menu_name = $menu->attrs->name; |
905 | 905 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -917,23 +917,23 @@ discard block |
||
917 | 917 | } |
918 | 918 | |
919 | 919 | // actions |
920 | - if($actions) |
|
920 | + if ($actions) |
|
921 | 921 | { |
922 | - if(is_array($actions)) $action_list = $actions; |
|
922 | + if (is_array($actions)) $action_list = $actions; |
|
923 | 923 | else $action_list[] = $actions; |
924 | 924 | |
925 | 925 | $buff[] = '$info->action = new stdClass;'; |
926 | 926 | $info->action = new stdClass(); |
927 | - foreach($action_list as $action) |
|
927 | + foreach ($action_list as $action) |
|
928 | 928 | { |
929 | 929 | $name = $action->attrs->name; |
930 | 930 | |
931 | 931 | $type = $action->attrs->type; |
932 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
933 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
934 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
935 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
936 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
932 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
933 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
934 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
935 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
936 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
937 | 937 | $meta_noindex = $action->attrs->{'meta-noindex'} === 'true' ? 'true' : 'false'; |
938 | 938 | |
939 | 939 | $index = $action->attrs->index; |
@@ -950,14 +950,14 @@ discard block |
||
950 | 950 | $info->action->{$name}->method = $method; |
951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
952 | 952 | $info->action->{$name}->meta_noindex = $meta_noindex; |
953 | - if($action->attrs->menu_name) |
|
953 | + if ($action->attrs->menu_name) |
|
954 | 954 | { |
955 | - if($menu_index == 'true') |
|
955 | + if ($menu_index == 'true') |
|
956 | 956 | { |
957 | 957 | $info->menu->{$action->attrs->menu_name}->index = $name; |
958 | 958 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
959 | 959 | } |
960 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
960 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
961 | 961 | { |
962 | 962 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
963 | 963 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -976,22 +976,22 @@ discard block |
||
976 | 976 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
977 | 977 | $buff[] = sprintf('$info->action->%s->meta_noindex=\'%s\';', $name, $meta_noindex); |
978 | 978 | |
979 | - if($index=='true') |
|
979 | + if ($index == 'true') |
|
980 | 980 | { |
981 | 981 | $default_index_act = $name; |
982 | 982 | $info->default_index_act = $name; |
983 | 983 | } |
984 | - if($admin_index=='true') |
|
984 | + if ($admin_index == 'true') |
|
985 | 985 | { |
986 | 986 | $admin_index_act = $name; |
987 | 987 | $info->admin_index_act = $name; |
988 | 988 | } |
989 | - if($setup_index=='true') |
|
989 | + if ($setup_index == 'true') |
|
990 | 990 | { |
991 | 991 | $setup_index_act = $name; |
992 | 992 | $info->setup_index_act = $name; |
993 | 993 | } |
994 | - if($simple_setup_index=='true') |
|
994 | + if ($simple_setup_index == 'true') |
|
995 | 995 | { |
996 | 996 | $simple_setup_index_act = $name; |
997 | 997 | $info->simple_setup_index_act = $name; |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | return $info; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - if(file_exists($cache_file)) return include($cache_file); |
|
1015 | + if (file_exists($cache_file)) return include($cache_file); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | /** |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | { |
1024 | 1024 | $module = Context::get('module_type'); |
1025 | 1025 | |
1026 | - if($module == 'ARTICLE') |
|
1026 | + if ($module == 'ARTICLE') |
|
1027 | 1027 | { |
1028 | 1028 | $module = 'page'; |
1029 | 1029 | } |
@@ -1043,26 +1043,26 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | function getSkins($path, $dir = 'skins') |
1045 | 1045 | { |
1046 | - if(substr($path, -1) == '/') |
|
1046 | + if (substr($path, -1) == '/') |
|
1047 | 1047 | { |
1048 | 1048 | $path = substr($path, 0, -1); |
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1052 | 1052 | $list = FileHandler::readDir($skin_path); |
1053 | - if(!count($list)) return; |
|
1053 | + if (!count($list)) return; |
|
1054 | 1054 | |
1055 | 1055 | natcasesort($list); |
1056 | 1056 | |
1057 | - foreach($list as $skin_name) |
|
1057 | + foreach ($list as $skin_name) |
|
1058 | 1058 | { |
1059 | - if(!is_dir($skin_path . $skin_name)) |
|
1059 | + if (!is_dir($skin_path.$skin_name)) |
|
1060 | 1060 | { |
1061 | 1061 | continue; |
1062 | 1062 | } |
1063 | 1063 | unset($skin_info); |
1064 | 1064 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
1065 | - if(!$skin_info) |
|
1065 | + if (!$skin_info) |
|
1066 | 1066 | { |
1067 | 1067 | $skin_info = new stdClass(); |
1068 | 1068 | $skin_info->title = $skin_name; |
@@ -1075,15 +1075,15 @@ discard block |
||
1075 | 1075 | $tmpPath = trim($tmpPath); |
1076 | 1076 | $module = array_pop(explode(' ', $tmpPath)); |
1077 | 1077 | |
1078 | - if($dir == 'skins') |
|
1078 | + if ($dir == 'skins') |
|
1079 | 1079 | { |
1080 | 1080 | $oAdminModel = getAdminModel('admin'); |
1081 | 1081 | $themesInfo = $oAdminModel->getThemeList(); |
1082 | 1082 | |
1083 | - foreach($themesInfo as $themeName => $info) |
|
1083 | + foreach ($themesInfo as $themeName => $info) |
|
1084 | 1084 | { |
1085 | 1085 | $skinInfos = $info->skin_infos; |
1086 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1086 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1087 | 1087 | { |
1088 | 1088 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
1089 | 1089 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1095,13 +1095,13 @@ discard block |
||
1095 | 1095 | $oMenuAdminModel = getAdminModel('menu'); |
1096 | 1096 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
1097 | 1097 | $moduleName = $module; |
1098 | - if($moduleName === 'page') |
|
1098 | + if ($moduleName === 'page') |
|
1099 | 1099 | { |
1100 | 1100 | $moduleName = 'ARTICLE'; |
1101 | 1101 | } |
1102 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
1102 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
1103 | 1103 | { |
1104 | - if($dir == 'skins') |
|
1104 | + if ($dir == 'skins') |
|
1105 | 1105 | { |
1106 | 1106 | $type = 'P'; |
1107 | 1107 | } |
@@ -1111,12 +1111,12 @@ discard block |
||
1111 | 1111 | } |
1112 | 1112 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
1113 | 1113 | |
1114 | - if(isset($defaultSkinName)) |
|
1114 | + if (isset($defaultSkinName)) |
|
1115 | 1115 | { |
1116 | 1116 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
1117 | 1117 | |
1118 | 1118 | $useDefault = new stdClass(); |
1119 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
1119 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
1120 | 1120 | |
1121 | 1121 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
1122 | 1122 | |
@@ -1133,20 +1133,20 @@ discard block |
||
1133 | 1133 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1134 | 1134 | { |
1135 | 1135 | // Read xml file having skin information |
1136 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1136 | + if (substr($path, -1) != '/') $path .= '/'; |
|
1137 | 1137 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1138 | - if(!file_exists($skin_xml_file)) return; |
|
1138 | + if (!file_exists($skin_xml_file)) return; |
|
1139 | 1139 | // Create XmlParser object |
1140 | 1140 | $oXmlParser = new XmlParser(); |
1141 | 1141 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1142 | 1142 | // Return if no skin information is |
1143 | - if(!$_xml_obj->skin) return; |
|
1143 | + if (!$_xml_obj->skin) return; |
|
1144 | 1144 | $xml_obj = $_xml_obj->skin; |
1145 | 1145 | // Skin Name |
1146 | 1146 | $skin_info = new stdClass(); |
1147 | 1147 | $skin_info->title = $xml_obj->title->body; |
1148 | 1148 | // Author information |
1149 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1149 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1150 | 1150 | { |
1151 | 1151 | // skin format v0.2 |
1152 | 1152 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1157,10 +1157,10 @@ discard block |
||
1157 | 1157 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1158 | 1158 | $skin_info->description = $xml_obj->description->body; |
1159 | 1159 | |
1160 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1160 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1161 | 1161 | else $author_list = $xml_obj->author; |
1162 | 1162 | |
1163 | - foreach($author_list as $author) |
|
1163 | + foreach ($author_list as $author) |
|
1164 | 1164 | { |
1165 | 1165 | $author_obj = new stdClass(); |
1166 | 1166 | $author_obj->name = $author->name->body; |
@@ -1169,25 +1169,25 @@ discard block |
||
1169 | 1169 | $skin_info->author[] = $author_obj; |
1170 | 1170 | } |
1171 | 1171 | // List extra vars |
1172 | - if($xml_obj->extra_vars) |
|
1172 | + if ($xml_obj->extra_vars) |
|
1173 | 1173 | { |
1174 | 1174 | $extra_var_groups = $xml_obj->extra_vars->group; |
1175 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1175 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1177 | 1177 | |
1178 | - foreach($extra_var_groups as $group) |
|
1178 | + foreach ($extra_var_groups as $group) |
|
1179 | 1179 | { |
1180 | 1180 | $extra_vars = $group->var; |
1181 | - if(!$extra_vars) |
|
1181 | + if (!$extra_vars) |
|
1182 | 1182 | { |
1183 | 1183 | continue; |
1184 | 1184 | } |
1185 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1185 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
1186 | 1186 | |
1187 | - foreach($extra_vars as $key => $val) |
|
1187 | + foreach ($extra_vars as $key => $val) |
|
1188 | 1188 | { |
1189 | 1189 | $obj = new stdClass(); |
1190 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1190 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1191 | 1191 | |
1192 | 1192 | $obj->group = $group->title->body; |
1193 | 1193 | $obj->name = $val->attrs->name; |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | $obj->description = $val->description->body; |
1197 | 1197 | $obj->value = $extra_vals->{$obj->name}; |
1198 | 1198 | $obj->default = $val->attrs->default; |
1199 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1200 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1199 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1200 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1201 | 1201 | // Get an option list from 'select'type |
1202 | - if(is_array($val->options)) |
|
1202 | + if (is_array($val->options)) |
|
1203 | 1203 | { |
1204 | 1204 | $option_count = count($val->options); |
1205 | 1205 | |
1206 | - for($i = 0; $i < $option_count; $i++) |
|
1206 | + for ($i = 0; $i < $option_count; $i++) |
|
1207 | 1207 | { |
1208 | 1208 | $obj->options[$i] = new stdClass(); |
1209 | 1209 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1240,18 +1240,18 @@ discard block |
||
1240 | 1240 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1241 | 1241 | // Variables used in the skin |
1242 | 1242 | $extra_var_groups = $xml_obj->extra_vars->group; |
1243 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1243 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1245 | 1245 | |
1246 | - foreach($extra_var_groups as $group) |
|
1246 | + foreach ($extra_var_groups as $group) |
|
1247 | 1247 | { |
1248 | 1248 | $extra_vars = $group->var; |
1249 | 1249 | |
1250 | - if($extra_vars) |
|
1250 | + if ($extra_vars) |
|
1251 | 1251 | { |
1252 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1252 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1253 | 1253 | |
1254 | - foreach($extra_vars as $var) |
|
1254 | + foreach ($extra_vars as $var) |
|
1255 | 1255 | { |
1256 | 1256 | unset($obj); |
1257 | 1257 | unset($options); |
@@ -1262,11 +1262,11 @@ discard block |
||
1262 | 1262 | $title = $var->title->body; |
1263 | 1263 | $description = $var->description->body; |
1264 | 1264 | // Get an option list from 'select'type. |
1265 | - if(is_array($var->default)) |
|
1265 | + if (is_array($var->default)) |
|
1266 | 1266 | { |
1267 | 1267 | $option_count = count($var->default); |
1268 | 1268 | |
1269 | - for($i = 0; $i < $option_count; $i++) |
|
1269 | + for ($i = 0; $i < $option_count; $i++) |
|
1270 | 1270 | { |
1271 | 1271 | $options[$i]->title = $var->default[$i]->body; |
1272 | 1272 | $options[$i]->value = $var->default[$i]->body; |
@@ -1300,19 +1300,19 @@ discard block |
||
1300 | 1300 | |
1301 | 1301 | // colorset |
1302 | 1302 | $colorset = $xml_obj->colorset->color; |
1303 | - if($colorset) |
|
1303 | + if ($colorset) |
|
1304 | 1304 | { |
1305 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1305 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
1306 | 1306 | |
1307 | - foreach($colorset as $color) |
|
1307 | + foreach ($colorset as $color) |
|
1308 | 1308 | { |
1309 | 1309 | $name = $color->attrs->name; |
1310 | 1310 | $title = $color->title->body; |
1311 | 1311 | $screenshot = $color->attrs->src; |
1312 | - if($screenshot) |
|
1312 | + if ($screenshot) |
|
1313 | 1313 | { |
1314 | 1314 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1315 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1315 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
1316 | 1316 | } |
1317 | 1317 | else $screenshot = ""; |
1318 | 1318 | |
@@ -1324,19 +1324,19 @@ discard block |
||
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | // Menu type (settings for layout) |
1327 | - if($xml_obj->menus->menu) |
|
1327 | + if ($xml_obj->menus->menu) |
|
1328 | 1328 | { |
1329 | 1329 | $menus = $xml_obj->menus->menu; |
1330 | - if(!is_array($menus)) $menus = array($menus); |
|
1330 | + if (!is_array($menus)) $menus = array($menus); |
|
1331 | 1331 | |
1332 | 1332 | $menu_count = count($menus); |
1333 | 1333 | $skin_info->menu_count = $menu_count; |
1334 | - for($i=0;$i<$menu_count;$i++) |
|
1334 | + for ($i = 0; $i < $menu_count; $i++) |
|
1335 | 1335 | { |
1336 | 1336 | unset($obj); |
1337 | 1337 | |
1338 | 1338 | $obj->name = $menus[$i]->attrs->name; |
1339 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1339 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1340 | 1340 | $obj->title = $menus[$i]->title->body; |
1341 | 1341 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1342 | 1342 | |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
1348 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
1348 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
1349 | 1349 | return $skin_info; |
1350 | 1350 | } |
1351 | 1351 | |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | { |
1357 | 1357 | $args = new stdClass; |
1358 | 1358 | $args->site_srl = $site_srl; |
1359 | - if(!is_null($module)) $args->module = $module; |
|
1359 | + if (!is_null($module)) $args->module = $module; |
|
1360 | 1360 | $output = executeQuery('module.getModuleCount', $args); |
1361 | 1361 | return $output->data->count; |
1362 | 1362 | } |
@@ -1370,26 +1370,26 @@ discard block |
||
1370 | 1370 | $config = false; |
1371 | 1371 | // cache controll |
1372 | 1372 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1373 | - if($oCacheHandler->isSupport()) |
|
1373 | + if ($oCacheHandler->isSupport()) |
|
1374 | 1374 | { |
1375 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
1375 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
1376 | 1376 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1377 | 1377 | $config = $oCacheHandler->get($cache_key); |
1378 | 1378 | } |
1379 | 1379 | |
1380 | - if($config === false) |
|
1380 | + if ($config === false) |
|
1381 | 1381 | { |
1382 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1382 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1383 | 1383 | { |
1384 | 1384 | $args = new stdClass(); |
1385 | 1385 | $args->module = $module; |
1386 | 1386 | $args->site_srl = $site_srl; |
1387 | 1387 | $output = executeQuery('module.getModuleConfig', $args); |
1388 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1388 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1389 | 1389 | else $config = null; |
1390 | 1390 | |
1391 | 1391 | //insert in cache |
1392 | - if($oCacheHandler->isSupport()) |
|
1392 | + if ($oCacheHandler->isSupport()) |
|
1393 | 1393 | { |
1394 | 1394 | $oCacheHandler->put($cache_key, $config); |
1395 | 1395 | } |
@@ -1410,26 +1410,26 @@ discard block |
||
1410 | 1410 | $config = false; |
1411 | 1411 | // cache controll |
1412 | 1412 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1413 | - if($oCacheHandler->isSupport()) |
|
1413 | + if ($oCacheHandler->isSupport()) |
|
1414 | 1414 | { |
1415 | 1415 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
1416 | 1416 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1417 | 1417 | $config = $oCacheHandler->get($cache_key); |
1418 | 1418 | } |
1419 | 1419 | |
1420 | - if($config === false) |
|
1420 | + if ($config === false) |
|
1421 | 1421 | { |
1422 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1422 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1423 | 1423 | { |
1424 | 1424 | $args = new stdClass(); |
1425 | 1425 | $args->module = $module; |
1426 | 1426 | $args->module_srl = $module_srl; |
1427 | 1427 | $output = executeQuery('module.getModulePartConfig', $args); |
1428 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1428 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1429 | 1429 | else $config = null; |
1430 | 1430 | |
1431 | 1431 | //insert in cache |
1432 | - if($oCacheHandler->isSupport()) |
|
1432 | + if ($oCacheHandler->isSupport()) |
|
1433 | 1433 | { |
1434 | 1434 | $oCacheHandler->put($cache_key, $config); |
1435 | 1435 | } |
@@ -1448,11 +1448,11 @@ discard block |
||
1448 | 1448 | { |
1449 | 1449 | $args = new stdClass(); |
1450 | 1450 | $args->module = $module; |
1451 | - if($site_srl) $args->site_srl = $site_srl; |
|
1451 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1452 | 1452 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1453 | - if(!$output->toBool() || !$output->data) return array(); |
|
1453 | + if (!$output->toBool() || !$output->data) return array(); |
|
1454 | 1454 | |
1455 | - foreach($output->data as $key => $val) |
|
1455 | + foreach ($output->data as $key => $val) |
|
1456 | 1456 | { |
1457 | 1457 | $result[$val->module_srl] = unserialize($val->config); |
1458 | 1458 | } |
@@ -1468,12 +1468,12 @@ discard block |
||
1468 | 1468 | $args->moduleCategorySrl = $moduleCategorySrl; |
1469 | 1469 | // Get data from the DB |
1470 | 1470 | $output = executeQuery('module.getModuleCategories', $args); |
1471 | - if(!$output->toBool()) return $output; |
|
1471 | + if (!$output->toBool()) return $output; |
|
1472 | 1472 | $list = $output->data; |
1473 | - if(!$list) return; |
|
1474 | - if(!is_array($list)) $list = array($list); |
|
1473 | + if (!$list) return; |
|
1474 | + if (!is_array($list)) $list = array($list); |
|
1475 | 1475 | |
1476 | - foreach($list as $val) |
|
1476 | + foreach ($list as $val) |
|
1477 | 1477 | { |
1478 | 1478 | $category_list[$val->module_category_srl] = $val; |
1479 | 1479 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | $args = new stdClass; |
1490 | 1490 | $args->module_category_srl = $module_category_srl; |
1491 | 1491 | $output = executeQuery('module.getModuleCategory', $args); |
1492 | - if(!$output->toBool()) return $output; |
|
1492 | + if (!$output->toBool()) return $output; |
|
1493 | 1493 | return $output->data; |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1501,10 +1501,10 @@ discard block |
||
1501 | 1501 | // Get a list of downloaded and installed modules |
1502 | 1502 | $searched_list = FileHandler::readDir('./modules'); |
1503 | 1503 | $searched_count = count($searched_list); |
1504 | - if(!$searched_count) return; |
|
1504 | + if (!$searched_count) return; |
|
1505 | 1505 | sort($searched_list); |
1506 | 1506 | |
1507 | - for($i=0;$i<$searched_count;$i++) |
|
1507 | + for ($i = 0; $i < $searched_count; $i++) |
|
1508 | 1508 | { |
1509 | 1509 | // Module name |
1510 | 1510 | $module_name = $searched_list[$i]; |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | $info = $this->getModuleInfoXml($module_name); |
1515 | 1515 | unset($obj); |
1516 | 1516 | |
1517 | - if(!isset($info)) continue; |
|
1517 | + if (!isset($info)) continue; |
|
1518 | 1518 | $info->module = $module_name; |
1519 | 1519 | $info->created_table_count = $created_table_count; |
1520 | 1520 | $info->table_count = $table_count; |
@@ -1531,19 +1531,19 @@ discard block |
||
1531 | 1531 | $info = null; |
1532 | 1532 | |
1533 | 1533 | $moduledir = ModuleHandler::getModulePath($module_name); |
1534 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1534 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1535 | 1535 | { |
1536 | 1536 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
1537 | 1537 | $table_count = count($tmp_files); |
1538 | 1538 | // Check if the table is created |
1539 | 1539 | $created_table_count = 0; |
1540 | - for($j=0;$j<count($tmp_files);$j++) |
|
1540 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
1541 | 1541 | { |
1542 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
1543 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1542 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
1543 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1544 | 1544 | } |
1545 | 1545 | // Check if DB is installed |
1546 | - if($table_count > $created_table_count) return true; |
|
1546 | + if ($table_count > $created_table_count) return true; |
|
1547 | 1547 | else return false; |
1548 | 1548 | } |
1549 | 1549 | return false; |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | { |
1554 | 1554 | // Check if it is upgraded to module.class.php on each module |
1555 | 1555 | $oDummy = getModule($module_name, 'class'); |
1556 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1556 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1557 | 1557 | { |
1558 | 1558 | return $oDummy->checkUpdate(); |
1559 | 1559 | } |
@@ -1567,15 +1567,15 @@ discard block |
||
1567 | 1567 | */ |
1568 | 1568 | public function needUpdate($update_id) |
1569 | 1569 | { |
1570 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
1570 | + if (!is_array($update_id)) $update_id = array($update_id); |
|
1571 | 1571 | |
1572 | 1572 | $args = new stdClass(); |
1573 | 1573 | $args->update_id = implode(',', $update_id); |
1574 | 1574 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
1575 | 1575 | |
1576 | - if(!!$output->error) return false; |
|
1577 | - if(!$output->data) $output->data = array(); |
|
1578 | - if(count($update_id) === count($output->data)) return false; |
|
1576 | + if (!!$output->error) return false; |
|
1577 | + if (!$output->data) $output->data = array(); |
|
1578 | + if (count($update_id) === count($output->data)) return false; |
|
1579 | 1579 | |
1580 | 1580 | return true; |
1581 | 1581 | } |
@@ -1592,31 +1592,31 @@ discard block |
||
1592 | 1592 | sort($searched_list); |
1593 | 1593 | |
1594 | 1594 | $searched_count = count($searched_list); |
1595 | - if(!$searched_count) return; |
|
1595 | + if (!$searched_count) return; |
|
1596 | 1596 | |
1597 | - for($i=0;$i<$searched_count;$i++) |
|
1597 | + for ($i = 0; $i < $searched_count; $i++) |
|
1598 | 1598 | { |
1599 | 1599 | // module name |
1600 | 1600 | $module_name = $searched_list[$i]; |
1601 | 1601 | |
1602 | 1602 | $path = ModuleHandler::getModulePath($module_name); |
1603 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1603 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
1604 | 1604 | |
1605 | 1605 | // Get the number of xml files to create a table in schemas |
1606 | 1606 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
1607 | 1607 | $table_count = count($tmp_files); |
1608 | 1608 | // Check if the table is created |
1609 | 1609 | $created_table_count = 0; |
1610 | - for($j=0;$j<$table_count;$j++) |
|
1610 | + for ($j = 0; $j < $table_count; $j++) |
|
1611 | 1611 | { |
1612 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
1613 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1612 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
1613 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1614 | 1614 | } |
1615 | 1615 | // Get information of the module |
1616 | 1616 | $info = NULL; |
1617 | 1617 | $info = $this->getModuleInfoXml($module_name); |
1618 | 1618 | |
1619 | - if(!$info) continue; |
|
1619 | + if (!$info) continue; |
|
1620 | 1620 | |
1621 | 1621 | $info->module = $module_name; |
1622 | 1622 | $info->category = $info->category; |
@@ -1625,12 +1625,12 @@ discard block |
||
1625 | 1625 | $info->path = $path; |
1626 | 1626 | $info->admin_index_act = $info->admin_index_act; |
1627 | 1627 | // Check if DB is installed |
1628 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1628 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
1629 | 1629 | else $info->need_install = false; |
1630 | 1630 | // Check if it is upgraded to module.class.php on each module |
1631 | 1631 | $oDummy = null; |
1632 | 1632 | $oDummy = getModule($module_name, 'class'); |
1633 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1633 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1634 | 1634 | { |
1635 | 1635 | $info->need_update = $oDummy->checkUpdate(); |
1636 | 1636 | } |
@@ -1651,15 +1651,15 @@ discard block |
||
1651 | 1651 | */ |
1652 | 1652 | function syncModuleToSite(&$data) |
1653 | 1653 | { |
1654 | - if(!$data) return; |
|
1654 | + if (!$data) return; |
|
1655 | 1655 | |
1656 | - if(is_array($data)) |
|
1656 | + if (is_array($data)) |
|
1657 | 1657 | { |
1658 | - foreach($data as $key => $val) |
|
1658 | + foreach ($data as $key => $val) |
|
1659 | 1659 | { |
1660 | 1660 | $module_srls[] = $val->module_srl; |
1661 | 1661 | } |
1662 | - if(!count($module_srls)) return; |
|
1662 | + if (!count($module_srls)) return; |
|
1663 | 1663 | } |
1664 | 1664 | else |
1665 | 1665 | { |
@@ -1667,17 +1667,17 @@ discard block |
||
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | $args = new stdClass(); |
1670 | - $args->module_srls = implode(',',$module_srls); |
|
1670 | + $args->module_srls = implode(',', $module_srls); |
|
1671 | 1671 | $output = executeQueryArray('module.getModuleSites', $args); |
1672 | - if(!$output->data) return array(); |
|
1673 | - foreach($output->data as $key => $val) |
|
1672 | + if (!$output->data) return array(); |
|
1673 | + foreach ($output->data as $key => $val) |
|
1674 | 1674 | { |
1675 | 1675 | $modules[$val->module_srl] = $val; |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - if(is_array($data)) |
|
1678 | + if (is_array($data)) |
|
1679 | 1679 | { |
1680 | - foreach($data as $key => $val) |
|
1680 | + foreach ($data as $key => $val) |
|
1681 | 1681 | { |
1682 | 1682 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1683 | 1683 | } |
@@ -1693,14 +1693,14 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | function isSiteAdmin($member_info, $site_srl = null) |
1695 | 1695 | { |
1696 | - if(!$member_info->member_srl) return false; |
|
1697 | - if($member_info->is_admin == 'Y') return true; |
|
1696 | + if (!$member_info->member_srl) return false; |
|
1697 | + if ($member_info->is_admin == 'Y') return true; |
|
1698 | 1698 | |
1699 | 1699 | $args = new stdClass(); |
1700 | - if(!isset($site_srl)) |
|
1700 | + if (!isset($site_srl)) |
|
1701 | 1701 | { |
1702 | 1702 | $site_module_info = Context::get('site_module_info'); |
1703 | - if(!$site_module_info) return; |
|
1703 | + if (!$site_module_info) return; |
|
1704 | 1704 | $args->site_srl = $site_module_info->site_srl; |
1705 | 1705 | } |
1706 | 1706 | else |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | |
1711 | 1711 | $args->member_srl = $member_info->member_srl; |
1712 | 1712 | $output = executeQuery('module.isSiteAdmin', $args); |
1713 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1713 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
1714 | 1714 | return false; |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | $obj = new stdClass(); |
1734 | 1734 | $obj->module_srl = $module_srl; |
1735 | 1735 | $output = executeQueryArray('module.getAdminID', $obj); |
1736 | - if(!$output->toBool() || !$output->data) return; |
|
1736 | + if (!$output->toBool() || !$output->data) return; |
|
1737 | 1737 | |
1738 | 1738 | return $output->data; |
1739 | 1739 | } |
@@ -1746,20 +1746,20 @@ discard block |
||
1746 | 1746 | { |
1747 | 1747 | $extra_vars = array(); |
1748 | 1748 | $get_module_srls = array(); |
1749 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1749 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1750 | 1750 | |
1751 | 1751 | $vars = false; |
1752 | 1752 | // cache controll |
1753 | 1753 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1754 | - if($oCacheHandler->isSupport()) |
|
1754 | + if ($oCacheHandler->isSupport()) |
|
1755 | 1755 | { |
1756 | - foreach($list_module_srl as $module_srl) |
|
1756 | + foreach ($list_module_srl as $module_srl) |
|
1757 | 1757 | { |
1758 | 1758 | $object_key = 'module_extra_vars:'.$module_srl; |
1759 | 1759 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1760 | 1760 | $vars = $oCacheHandler->get($cache_key); |
1761 | 1761 | |
1762 | - if($vars) |
|
1762 | + if ($vars) |
|
1763 | 1763 | { |
1764 | 1764 | $extra_vars[$module_srl] = $vars; |
1765 | 1765 | } |
@@ -1774,35 +1774,35 @@ discard block |
||
1774 | 1774 | $get_module_srls = $list_module_srl; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | - if(count($get_module_srls) > 0) |
|
1777 | + if (count($get_module_srls) > 0) |
|
1778 | 1778 | { |
1779 | 1779 | $args = new stdClass(); |
1780 | 1780 | $args->module_srl = implode(',', $get_module_srls); |
1781 | 1781 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
1782 | 1782 | |
1783 | - if(!$output->toBool()) |
|
1783 | + if (!$output->toBool()) |
|
1784 | 1784 | { |
1785 | 1785 | return; |
1786 | 1786 | } |
1787 | 1787 | |
1788 | - if(!$output->data) |
|
1788 | + if (!$output->data) |
|
1789 | 1789 | { |
1790 | - foreach($get_module_srls as $module_srl) |
|
1790 | + foreach ($get_module_srls as $module_srl) |
|
1791 | 1791 | { |
1792 | 1792 | $extra_vars[$module_srl] = new stdClass; |
1793 | 1793 | } |
1794 | 1794 | } |
1795 | - foreach($output->data as $key => $val) |
|
1795 | + foreach ($output->data as $key => $val) |
|
1796 | 1796 | { |
1797 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1797 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
1798 | 1798 | |
1799 | - if(!isset($extra_vars[$val->module_srl])) |
|
1799 | + if (!isset($extra_vars[$val->module_srl])) |
|
1800 | 1800 | { |
1801 | 1801 | $extra_vars[$val->module_srl] = new stdClass(); |
1802 | 1802 | } |
1803 | 1803 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
1804 | 1804 | |
1805 | - if($oCacheHandler->isSupport()) |
|
1805 | + if ($oCacheHandler->isSupport()) |
|
1806 | 1806 | { |
1807 | 1807 | $object_key = 'module_extra_vars:'.$val->module_srl; |
1808 | 1808 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1821,27 +1821,27 @@ discard block |
||
1821 | 1821 | { |
1822 | 1822 | $skin_vars = false; |
1823 | 1823 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1824 | - if($oCacheHandler->isSupport()) |
|
1824 | + if ($oCacheHandler->isSupport()) |
|
1825 | 1825 | { |
1826 | 1826 | $object_key = 'module_skin_vars:'.$module_srl; |
1827 | 1827 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1828 | 1828 | $skin_vars = $oCacheHandler->get($cache_key); |
1829 | 1829 | } |
1830 | 1830 | |
1831 | - if($skin_vars === false) |
|
1831 | + if ($skin_vars === false) |
|
1832 | 1832 | { |
1833 | 1833 | $args = new stdClass(); |
1834 | 1834 | $args->module_srl = $module_srl; |
1835 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
1836 | - if(!$output->toBool()) return; |
|
1835 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
1836 | + if (!$output->toBool()) return; |
|
1837 | 1837 | |
1838 | 1838 | $skin_vars = array(); |
1839 | - foreach($output->data as $vars) |
|
1839 | + foreach ($output->data as $vars) |
|
1840 | 1840 | { |
1841 | 1841 | $skin_vars[$vars->name] = $vars; |
1842 | 1842 | } |
1843 | 1843 | |
1844 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1844 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | return $skin_vars; |
@@ -1853,32 +1853,32 @@ discard block |
||
1853 | 1853 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1854 | 1854 | { |
1855 | 1855 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1856 | - if(!$site_srl) $site_srl = 0; |
|
1856 | + if (!$site_srl) $site_srl = 0; |
|
1857 | 1857 | |
1858 | 1858 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1859 | - if(is_readable($designInfoFile)) |
|
1859 | + if (is_readable($designInfoFile)) |
|
1860 | 1860 | { |
1861 | 1861 | include($designInfoFile); |
1862 | 1862 | |
1863 | 1863 | $skinName = $designInfo->module->{$module_name}->{$target}; |
1864 | 1864 | } |
1865 | - if(!$skinName) |
|
1865 | + if (!$skinName) |
|
1866 | 1866 | { |
1867 | 1867 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
1868 | 1868 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
1869 | 1869 | |
1870 | - if(is_dir($moduleSkinPath.'default')) |
|
1870 | + if (is_dir($moduleSkinPath.'default')) |
|
1871 | 1871 | { |
1872 | 1872 | $skinName = 'default'; |
1873 | 1873 | } |
1874 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
1874 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
1875 | 1875 | { |
1876 | 1876 | $skinName = 'xe_default'; |
1877 | 1877 | } |
1878 | 1878 | else |
1879 | 1879 | { |
1880 | 1880 | $skins = FileHandler::readDir($moduleSkinPath); |
1881 | - if(count($skins) > 0) |
|
1881 | + if (count($skins) > 0) |
|
1882 | 1882 | { |
1883 | 1883 | $skinName = $skins[0]; |
1884 | 1884 | } |
@@ -1888,9 +1888,9 @@ discard block |
||
1888 | 1888 | } |
1889 | 1889 | } |
1890 | 1890 | |
1891 | - if($updateCache && $skinName) |
|
1891 | + if ($updateCache && $skinName) |
|
1892 | 1892 | { |
1893 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1893 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1894 | 1894 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1895 | 1895 | |
1896 | 1896 | $oAdminController = getAdminController('admin'); |
@@ -1906,10 +1906,10 @@ discard block |
||
1906 | 1906 | */ |
1907 | 1907 | function syncSkinInfoToModuleInfo(&$module_info) |
1908 | 1908 | { |
1909 | - if(!$module_info->module_srl) return; |
|
1909 | + if (!$module_info->module_srl) return; |
|
1910 | 1910 | |
1911 | 1911 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1912 | - if(Mobile::isFromMobilePhone()) |
|
1912 | + if (Mobile::isFromMobilePhone()) |
|
1913 | 1913 | { |
1914 | 1914 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1915 | 1915 | } |
@@ -1918,11 +1918,11 @@ discard block |
||
1918 | 1918 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1919 | 1919 | } |
1920 | 1920 | |
1921 | - if(!$skin_vars) return; |
|
1921 | + if (!$skin_vars) return; |
|
1922 | 1922 | |
1923 | - foreach($skin_vars as $name => $val) |
|
1923 | + foreach ($skin_vars as $name => $val) |
|
1924 | 1924 | { |
1925 | - if(isset($module_info->{$name})) continue; |
|
1925 | + if (isset($module_info->{$name})) continue; |
|
1926 | 1926 | $module_info->{$name} = $val->value; |
1927 | 1927 | } |
1928 | 1928 | } |
@@ -1936,27 +1936,27 @@ discard block |
||
1936 | 1936 | { |
1937 | 1937 | $skin_vars = false; |
1938 | 1938 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1939 | - if($oCacheHandler->isSupport()) |
|
1939 | + if ($oCacheHandler->isSupport()) |
|
1940 | 1940 | { |
1941 | 1941 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1942 | 1942 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1943 | 1943 | $skin_vars = $oCacheHandler->get($cache_key); |
1944 | 1944 | } |
1945 | 1945 | |
1946 | - if($skin_vars === false) |
|
1946 | + if ($skin_vars === false) |
|
1947 | 1947 | { |
1948 | 1948 | $args = new stdClass(); |
1949 | 1949 | $args->module_srl = $module_srl; |
1950 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1951 | - if(!$output->toBool() || !$output->data) return; |
|
1950 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1951 | + if (!$output->toBool() || !$output->data) return; |
|
1952 | 1952 | |
1953 | 1953 | $skin_vars = array(); |
1954 | - foreach($output->data as $vars) |
|
1954 | + foreach ($output->data as $vars) |
|
1955 | 1955 | { |
1956 | 1956 | $skin_vars[$vars->name] = $vars; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1959 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1960 | 1960 | } |
1961 | 1961 | |
1962 | 1962 | return $skin_vars; |
@@ -1968,32 +1968,32 @@ discard block |
||
1968 | 1968 | */ |
1969 | 1969 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1970 | 1970 | { |
1971 | - if(!$module_info->module_srl) return; |
|
1971 | + if (!$module_info->module_srl) return; |
|
1972 | 1972 | $skin_vars = false; |
1973 | 1973 | // cache controll |
1974 | 1974 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1975 | - if($oCacheHandler->isSupport()) |
|
1975 | + if ($oCacheHandler->isSupport()) |
|
1976 | 1976 | { |
1977 | 1977 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
1978 | 1978 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1979 | 1979 | $skin_vars = $oCacheHandler->get($cache_key); |
1980 | 1980 | } |
1981 | - if($skin_vars === false) |
|
1981 | + if ($skin_vars === false) |
|
1982 | 1982 | { |
1983 | 1983 | $args = new stdClass; |
1984 | 1984 | $args->module_srl = $module_info->module_srl; |
1985 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1986 | - if(!$output->toBool()) return; |
|
1985 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1986 | + if (!$output->toBool()) return; |
|
1987 | 1987 | $skin_vars = $output->data; |
1988 | 1988 | |
1989 | 1989 | //insert in cache |
1990 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1990 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1991 | 1991 | } |
1992 | - if(!$skin_vars) return; |
|
1992 | + if (!$skin_vars) return; |
|
1993 | 1993 | |
1994 | - foreach($output->data as $val) |
|
1994 | + foreach ($output->data as $val) |
|
1995 | 1995 | { |
1996 | - if(isset($module_info->{$val->name})) continue; |
|
1996 | + if (isset($module_info->{$val->name})) continue; |
|
1997 | 1997 | $module_info->{$val->name} = $val->value; |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | { |
2006 | 2006 | $grant = new stdClass(); |
2007 | 2007 | |
2008 | - if(!$xml_info) |
|
2008 | + if (!$xml_info) |
|
2009 | 2009 | { |
2010 | 2010 | $module = $module_info->module; |
2011 | 2011 | $xml_info = $this->getModuleActionXml($module); |
@@ -2013,9 +2013,9 @@ discard block |
||
2013 | 2013 | // Set variables to grant group permission |
2014 | 2014 | $module_srl = $module_info->module_srl; |
2015 | 2015 | $grant_info = $xml_info->grant; |
2016 | - if($member_info->member_srl) |
|
2016 | + if ($member_info->member_srl) |
|
2017 | 2017 | { |
2018 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2018 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2019 | 2019 | else $group_list = array(); |
2020 | 2020 | } |
2021 | 2021 | else |
@@ -2023,10 +2023,10 @@ discard block |
||
2023 | 2023 | $group_list = array(); |
2024 | 2024 | } |
2025 | 2025 | // If module_srl doesn't exist(if unable to set permissions) |
2026 | - if(!$module_srl) |
|
2026 | + if (!$module_srl) |
|
2027 | 2027 | { |
2028 | 2028 | $grant->access = true; |
2029 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2029 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2030 | 2030 | { |
2031 | 2031 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
2032 | 2032 | } |
@@ -2037,23 +2037,23 @@ discard block |
||
2037 | 2037 | { |
2038 | 2038 | // If module_srl exists |
2039 | 2039 | // Get a type of granted permission |
2040 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
2040 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false; |
|
2041 | 2041 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
2042 | 2042 | // If a just logged-in member is, check if the member is a module administrator |
2043 | - if(!$grant->manager && $member_info->member_srl) |
|
2043 | + if (!$grant->manager && $member_info->member_srl) |
|
2044 | 2044 | { |
2045 | 2045 | $args = new stdClass(); |
2046 | 2046 | $args->module_srl = $module_srl; |
2047 | 2047 | $args->member_srl = $member_info->member_srl; |
2048 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
2049 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2048 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
2049 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2050 | 2050 | } |
2051 | 2051 | // If not an administrator, get information from the DB and grant manager privilege. |
2052 | - if(!$grant->manager) |
|
2052 | + if (!$grant->manager) |
|
2053 | 2053 | { |
2054 | 2054 | $args = new stdClass(); |
2055 | 2055 | // If planet, get permission settings from the planet home |
2056 | - if($module_info->module == 'planet') |
|
2056 | + if ($module_info->module == 'planet') |
|
2057 | 2057 | { |
2058 | 2058 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2059 | 2059 | } |
@@ -2066,42 +2066,42 @@ discard block |
||
2066 | 2066 | |
2067 | 2067 | $grant_exists = $granted = array(); |
2068 | 2068 | |
2069 | - if($output->data) |
|
2069 | + if ($output->data) |
|
2070 | 2070 | { |
2071 | 2071 | // Arrange names and groups who has privileges |
2072 | - foreach($output->data as $val) |
|
2072 | + foreach ($output->data as $val) |
|
2073 | 2073 | { |
2074 | 2074 | $grant_exists[$val->name] = true; |
2075 | - if($granted[$val->name]) continue; |
|
2075 | + if ($granted[$val->name]) continue; |
|
2076 | 2076 | // Log-in member only |
2077 | - if($val->group_srl == -1) |
|
2077 | + if ($val->group_srl == -1) |
|
2078 | 2078 | { |
2079 | 2079 | $granted[$val->name] = true; |
2080 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2080 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
2081 | 2081 | // Site-joined member only |
2082 | 2082 | } |
2083 | - elseif($val->group_srl == -2) |
|
2083 | + elseif ($val->group_srl == -2) |
|
2084 | 2084 | { |
2085 | 2085 | $granted[$val->name] = true; |
2086 | 2086 | // Do not grant any permission for non-logged member |
2087 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2087 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
2088 | 2088 | // Log-in member |
2089 | 2089 | else |
2090 | 2090 | { |
2091 | 2091 | $site_module_info = Context::get('site_module_info'); |
2092 | 2092 | // Permission granted if no information of the currently connected site exists |
2093 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2093 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2094 | 2094 | // Permission is not granted if information of the currently connected site exists |
2095 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2095 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
2096 | 2096 | } |
2097 | 2097 | // All of non-logged members |
2098 | 2098 | } |
2099 | - elseif($val->group_srl == -3) |
|
2099 | + elseif ($val->group_srl == -3) |
|
2100 | 2100 | { |
2101 | 2101 | $granted[$val->name] = true; |
2102 | 2102 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2103 | 2103 | } |
2104 | - elseif($val->group_srl == 0) |
|
2104 | + elseif ($val->group_srl == 0) |
|
2105 | 2105 | { |
2106 | 2106 | $granted[$val->name] = true; |
2107 | 2107 | $grant->{$val->name} = true; |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | } |
2110 | 2110 | else |
2111 | 2111 | { |
2112 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2112 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2113 | 2113 | { |
2114 | 2114 | $grant->{$val->name} = true; |
2115 | 2115 | $granted[$val->name] = true; |
@@ -2118,29 +2118,29 @@ discard block |
||
2118 | 2118 | } |
2119 | 2119 | } |
2120 | 2120 | // Separate processing for the virtual group access |
2121 | - if(!$grant_exists['access']) $grant->access = true; |
|
2122 | - if(count($grant_info)) |
|
2121 | + if (!$grant_exists['access']) $grant->access = true; |
|
2122 | + if (count($grant_info)) |
|
2123 | 2123 | { |
2124 | - foreach($grant_info as $grant_name => $grant_item) |
|
2124 | + foreach ($grant_info as $grant_name => $grant_item) |
|
2125 | 2125 | { |
2126 | - if($grant_exists[$grant_name]) continue; |
|
2127 | - switch($grant_item->default) |
|
2126 | + if ($grant_exists[$grant_name]) continue; |
|
2127 | + switch ($grant_item->default) |
|
2128 | 2128 | { |
2129 | 2129 | case 'guest' : |
2130 | 2130 | $grant->{$grant_name} = true; |
2131 | 2131 | break; |
2132 | 2132 | case 'member' : |
2133 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2133 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
2134 | 2134 | else $grant->{$grant_name} = false; |
2135 | 2135 | break; |
2136 | 2136 | case 'site' : |
2137 | 2137 | $site_module_info = Context::get('site_module_info'); |
2138 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2138 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2139 | 2139 | else $grant->{$grant_name} = false; |
2140 | 2140 | break; |
2141 | 2141 | case 'manager' : |
2142 | 2142 | case 'root' : |
2143 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2143 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2144 | 2144 | else $grant->{$grant_name} = false; |
2145 | 2145 | break; |
2146 | 2146 | } |
@@ -2148,12 +2148,12 @@ discard block |
||
2148 | 2148 | } |
2149 | 2149 | } |
2150 | 2150 | // Set true to grant all privileges if an administrator is |
2151 | - if($grant->manager) |
|
2151 | + if ($grant->manager) |
|
2152 | 2152 | { |
2153 | 2153 | $grant->access = true; |
2154 | - if(count($grant_info)) |
|
2154 | + if (count($grant_info)) |
|
2155 | 2155 | { |
2156 | - foreach($grant_info as $key => $val) |
|
2156 | + foreach ($grant_info as $key => $val) |
|
2157 | 2157 | { |
2158 | 2158 | $grant->{$key} = true; |
2159 | 2159 | } |
@@ -2185,27 +2185,27 @@ discard block |
||
2185 | 2185 | |
2186 | 2186 | function unserializeAttributes($module_filebox_list) |
2187 | 2187 | { |
2188 | - if(is_array($module_filebox_list->data)) |
|
2188 | + if (is_array($module_filebox_list->data)) |
|
2189 | 2189 | { |
2190 | - foreach($module_filebox_list->data as &$item) |
|
2190 | + foreach ($module_filebox_list->data as &$item) |
|
2191 | 2191 | { |
2192 | - if(empty($item->comment)) |
|
2192 | + if (empty($item->comment)) |
|
2193 | 2193 | { |
2194 | 2194 | continue; |
2195 | 2195 | } |
2196 | 2196 | |
2197 | 2197 | $attributes = explode(';', $item->comment); |
2198 | - foreach($attributes as $attribute) |
|
2198 | + foreach ($attributes as $attribute) |
|
2199 | 2199 | { |
2200 | 2200 | $values = explode(':', $attribute); |
2201 | - if((count($values) % 2) ==1) |
|
2201 | + if ((count($values) % 2) == 1) |
|
2202 | 2202 | { |
2203 | - for($i=2;$i<count($values);$i++) |
|
2203 | + for ($i = 2; $i < count($values); $i++) |
|
2204 | 2204 | { |
2205 | - $values[1].=":".$values[$i]; |
|
2205 | + $values[1] .= ":".$values[$i]; |
|
2206 | 2206 | } |
2207 | 2207 | } |
2208 | - $atts[$values[0]]=$values[1]; |
|
2208 | + $atts[$values[0]] = $values[1]; |
|
2209 | 2209 | } |
2210 | 2210 | $item->attributes = $atts; |
2211 | 2211 | unset($atts); |
@@ -2217,16 +2217,16 @@ discard block |
||
2217 | 2217 | function getFileBoxListHtml() |
2218 | 2218 | { |
2219 | 2219 | $logged_info = Context::get('logged_info'); |
2220 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2220 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2221 | 2221 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2222 | - $link_params = explode('&',$link['query']); |
|
2222 | + $link_params = explode('&', $link['query']); |
|
2223 | 2223 | foreach ($link_params as $param) |
2224 | 2224 | { |
2225 | - $param = explode("=",$param); |
|
2226 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2225 | + $param = explode("=", $param); |
|
2226 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2227 | 2227 | } |
2228 | 2228 | $oWidgetModel = getModel('widget'); |
2229 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2229 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2230 | 2230 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2231 | 2231 | |
2232 | 2232 | $oModuleModel = getModel('module'); |
@@ -2242,24 +2242,24 @@ discard block |
||
2242 | 2242 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
2243 | 2243 | |
2244 | 2244 | $oTemplate = &TemplateHandler::getInstance(); |
2245 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
2245 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
2246 | 2246 | |
2247 | 2247 | $this->add('html', $html); |
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | function getModuleFileBoxPath($module_filebox_srl) |
2251 | 2251 | { |
2252 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
2252 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
2253 | 2253 | } |
2254 | 2254 | |
2255 | 2255 | /** |
2256 | 2256 | * @brief Return ruleset cache file path |
2257 | 2257 | * @param module, act |
2258 | 2258 | */ |
2259 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
2259 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
2260 | 2260 | { |
2261 | 2261 | // load dynamic ruleset xml file |
2262 | - if(strpos($ruleset, '@') !== false) |
|
2262 | + if (strpos($ruleset, '@') !== false) |
|
2263 | 2263 | { |
2264 | 2264 | $rulsetFile = str_replace('@', '', $ruleset); |
2265 | 2265 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2269,20 +2269,20 @@ discard block |
||
2269 | 2269 | { |
2270 | 2270 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2271 | 2271 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2272 | - if(is_readable($xml_file)) |
|
2272 | + if (is_readable($xml_file)) |
|
2273 | 2273 | return FileHandler::getRealPath($xml_file); |
2274 | - else{ |
|
2274 | + else { |
|
2275 | 2275 | $ruleset = str_replace('#', '', $ruleset); |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | } |
2279 | 2279 | // Get a path of the requested module. Return if not exists. |
2280 | 2280 | $class_path = ModuleHandler::getModulePath($module); |
2281 | - if(!$class_path) return; |
|
2281 | + if (!$class_path) return; |
|
2282 | 2282 | |
2283 | 2283 | // Check if module.xml exists in the path. Return if not exist |
2284 | 2284 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2285 | - if(!file_exists($xml_file)) return; |
|
2285 | + if (!file_exists($xml_file)) return; |
|
2286 | 2286 | |
2287 | 2287 | return $xml_file; |
2288 | 2288 | } |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | $requestVars = Context::getRequestVars(); |
2295 | 2295 | |
2296 | 2296 | $args = new stdClass; |
2297 | - $args->site_srl = (int)$requestVars->site_srl; |
|
2297 | + $args->site_srl = (int) $requestVars->site_srl; |
|
2298 | 2298 | $args->page = 1; // /< Page |
2299 | 2299 | $args->list_count = 100; // /< the number of posts to display on a single page |
2300 | 2300 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2306,9 +2306,9 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | $list = array(); |
2308 | 2308 | |
2309 | - if($output->toBool()) |
|
2309 | + if ($output->toBool()) |
|
2310 | 2310 | { |
2311 | - foreach((array)$output->data as $code_info) |
|
2311 | + foreach ((array) $output->data as $code_info) |
|
2312 | 2312 | { |
2313 | 2313 | unset($codeInfo); |
2314 | 2314 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -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 | $hostname = $request_url_parse['host']; |
101 | 113 | $path = $request_url_parse['path']; |
102 | 114 | $port = $request_url_parse['port']; |
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, $port && ($port != 80 )? ':'.$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,8 +435,9 @@ 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 | 443 | |
@@ -450,11 +487,15 @@ discard block |
||
450 | 487 | */ |
451 | 488 | function getModulesInfo($module_srls, $columnList = array()) |
452 | 489 | { |
453 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
490 | + if(is_array($module_srls)) { |
|
491 | + $module_srls = implode(',',$module_srls); |
|
492 | + } |
|
454 | 493 | $args = new stdClass(); |
455 | 494 | $args->module_srls = $module_srls; |
456 | 495 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
457 | - if(!$output->toBool()) return; |
|
496 | + if(!$output->toBool()) { |
|
497 | + return; |
|
498 | + } |
|
458 | 499 | return $this->addModuleExtraVars($output->data); |
459 | 500 | } |
460 | 501 | |
@@ -464,31 +505,44 @@ discard block |
||
464 | 505 | function addModuleExtraVars($module_info) |
465 | 506 | { |
466 | 507 | // Process although one or more module informaion is requested |
467 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | - else $target_module_info = $module_info; |
|
508 | + if(!is_array($module_info)) { |
|
509 | + $target_module_info = array($module_info); |
|
510 | + } else { |
|
511 | + $target_module_info = $module_info; |
|
512 | + } |
|
469 | 513 | // Get module_srl |
470 | 514 | $module_srls = array(); |
471 | 515 | foreach($target_module_info as $key => $val) |
472 | 516 | { |
473 | 517 | $module_srl = $val->module_srl; |
474 | - if(!$module_srl) continue; |
|
518 | + if(!$module_srl) { |
|
519 | + continue; |
|
520 | + } |
|
475 | 521 | $module_srls[] = $val->module_srl; |
476 | 522 | } |
477 | 523 | // Extract extra information of the module and skin |
478 | 524 | $extra_vars = $this->getModuleExtraVars($module_srls); |
479 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
525 | + if(!count($module_srls) || !count($extra_vars)) { |
|
526 | + return $module_info; |
|
527 | + } |
|
480 | 528 | |
481 | 529 | foreach($target_module_info as $key => $val) |
482 | 530 | { |
483 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
531 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
532 | + continue; |
|
533 | + } |
|
484 | 534 | foreach($extra_vars[$val->module_srl] as $k => $v) |
485 | 535 | { |
486 | - if($target_module_info[$key]->{$k}) continue; |
|
536 | + if($target_module_info[$key]->{$k}) { |
|
537 | + continue; |
|
538 | + } |
|
487 | 539 | $target_module_info[$key]->{$k} = $v; |
488 | 540 | } |
489 | 541 | } |
490 | 542 | |
491 | - if(is_array($module_info)) return $target_module_info; |
|
543 | + if(is_array($module_info)) { |
|
544 | + return $target_module_info; |
|
545 | + } |
|
492 | 546 | return $target_module_info[0]; |
493 | 547 | } |
494 | 548 | |
@@ -517,7 +571,9 @@ discard block |
||
517 | 571 | } |
518 | 572 | |
519 | 573 | $output = executeQuery('module.getMidList', $args, $columnList); |
520 | - if(!$output->toBool()) return $output; |
|
574 | + if(!$output->toBool()) { |
|
575 | + return $output; |
|
576 | + } |
|
521 | 577 | $list = $output->data; |
522 | 578 | |
523 | 579 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -525,9 +581,13 @@ discard block |
||
525 | 581 | $oCacheHandler->put($cache_key, $list); |
526 | 582 | } |
527 | 583 | } |
528 | - if(!$list) return; |
|
584 | + if(!$list) { |
|
585 | + return; |
|
586 | + } |
|
529 | 587 | |
530 | - if(!is_array($list)) $list = array($list); |
|
588 | + if(!is_array($list)) { |
|
589 | + $list = array($list); |
|
590 | + } |
|
531 | 591 | |
532 | 592 | foreach($list as $val) |
533 | 593 | { |
@@ -543,10 +603,14 @@ discard block |
||
543 | 603 | function getModuleSrlList($args = null, $columnList = array()) |
544 | 604 | { |
545 | 605 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
546 | - if(!$output->toBool()) return $output; |
|
606 | + if(!$output->toBool()) { |
|
607 | + return $output; |
|
608 | + } |
|
547 | 609 | |
548 | 610 | $list = $output->data; |
549 | - if(!$list) return; |
|
611 | + if(!$list) { |
|
612 | + return; |
|
613 | + } |
|
550 | 614 | |
551 | 615 | return $list; |
552 | 616 | } |
@@ -556,20 +620,32 @@ discard block |
||
556 | 620 | */ |
557 | 621 | function getModuleSrlByMid($mid) |
558 | 622 | { |
559 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
560 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
623 | + if($mid && !is_array($mid)) { |
|
624 | + $mid = explode(',',$mid); |
|
625 | + } |
|
626 | + if(is_array($mid)) { |
|
627 | + $mid = "'".implode("','",$mid)."'"; |
|
628 | + } |
|
561 | 629 | |
562 | 630 | $site_module_info = Context::get('site_module_info'); |
563 | 631 | |
564 | 632 | $args = new stdClass; |
565 | 633 | $args->mid = $mid; |
566 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
634 | + if($site_module_info) { |
|
635 | + $args->site_srl = $site_module_info->site_srl; |
|
636 | + } |
|
567 | 637 | $output = executeQuery('module.getModuleSrlByMid', $args); |
568 | - if(!$output->toBool()) return $output; |
|
638 | + if(!$output->toBool()) { |
|
639 | + return $output; |
|
640 | + } |
|
569 | 641 | |
570 | 642 | $list = $output->data; |
571 | - if(!$list) return; |
|
572 | - if(!is_array($list)) $list = array($list); |
|
643 | + if(!$list) { |
|
644 | + return; |
|
645 | + } |
|
646 | + if(!is_array($list)) { |
|
647 | + $list = array($list); |
|
648 | + } |
|
573 | 649 | |
574 | 650 | foreach($list as $key => $val) |
575 | 651 | { |
@@ -598,8 +674,12 @@ discard block |
||
598 | 674 | { |
599 | 675 | $args = new stdClass(); |
600 | 676 | $output = executeQueryArray('module.getActionForward',$args); |
601 | - if(!$output->toBool()) return new stdClass; |
|
602 | - if(!$output->data) $output->data = array(); |
|
677 | + if(!$output->toBool()) { |
|
678 | + return new stdClass; |
|
679 | + } |
|
680 | + if(!$output->data) { |
|
681 | + $output->data = array(); |
|
682 | + } |
|
603 | 683 | |
604 | 684 | $action_forward = array(); |
605 | 685 | foreach($output->data as $item) |
@@ -616,8 +696,7 @@ discard block |
||
616 | 696 | if($action_forward[$act]) |
617 | 697 | { |
618 | 698 | return $action_forward[$act]; |
619 | - } |
|
620 | - else |
|
699 | + } else |
|
621 | 700 | { |
622 | 701 | return new stdClass(); |
623 | 702 | } |
@@ -725,8 +804,7 @@ discard block |
||
725 | 804 | if(file_exists($cache_file)) |
726 | 805 | { |
727 | 806 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
728 | - } |
|
729 | - else |
|
807 | + } else |
|
730 | 808 | { |
731 | 809 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
732 | 810 | } |
@@ -742,16 +820,22 @@ discard block |
||
742 | 820 | { |
743 | 821 | // Get a path of the requested module. Return if not exists. |
744 | 822 | $module_path = ModuleHandler::getModulePath($module); |
745 | - if(!$module_path) return; |
|
823 | + if(!$module_path) { |
|
824 | + return; |
|
825 | + } |
|
746 | 826 | // Read the xml file for module skin information |
747 | 827 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
748 | - if(!file_exists($xml_file)) return; |
|
828 | + if(!file_exists($xml_file)) { |
|
829 | + return; |
|
830 | + } |
|
749 | 831 | |
750 | 832 | $oXmlParser = new XmlParser(); |
751 | 833 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
752 | 834 | $xml_obj = $tmp_xml_obj->module; |
753 | 835 | |
754 | - if(!$xml_obj) return; |
|
836 | + if(!$xml_obj) { |
|
837 | + return; |
|
838 | + } |
|
755 | 839 | |
756 | 840 | // Module Information |
757 | 841 | $module_info = new stdClass(); |
@@ -763,14 +847,19 @@ discard block |
||
763 | 847 | $module_info->version = $xml_obj->version->body; |
764 | 848 | $module_info->homepage = $xml_obj->link->body; |
765 | 849 | $module_info->category = $xml_obj->category->body; |
766 | - if(!$module_info->category) $module_info->category = 'service'; |
|
850 | + if(!$module_info->category) { |
|
851 | + $module_info->category = 'service'; |
|
852 | + } |
|
767 | 853 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
768 | 854 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 855 | $module_info->license = $xml_obj->license->body; |
770 | 856 | $module_info->license_link = $xml_obj->license->attrs->link; |
771 | 857 | |
772 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | - else $author_list = $xml_obj->author; |
|
858 | + if(!is_array($xml_obj->author)) { |
|
859 | + $author_list[] = $xml_obj->author; |
|
860 | + } else { |
|
861 | + $author_list = $xml_obj->author; |
|
862 | + } |
|
774 | 863 | |
775 | 864 | foreach($author_list as $author) |
776 | 865 | { |
@@ -780,15 +869,16 @@ discard block |
||
780 | 869 | $author_obj->homepage = $author->attrs->link; |
781 | 870 | $module_info->author[] = $author_obj; |
782 | 871 | } |
783 | - } |
|
784 | - else |
|
872 | + } else |
|
785 | 873 | { |
786 | 874 | // module format 0.1 |
787 | 875 | $module_info->title = $xml_obj->title->body; |
788 | 876 | $module_info->description = $xml_obj->author->description->body; |
789 | 877 | $module_info->version = $xml_obj->attrs->version; |
790 | 878 | $module_info->category = $xml_obj->attrs->category; |
791 | - if(!$module_info->category) $module_info->category = 'service'; |
|
879 | + if(!$module_info->category) { |
|
880 | + $module_info->category = 'service'; |
|
881 | + } |
|
792 | 882 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
793 | 883 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 884 | $author_obj = new stdClass(); |
@@ -817,11 +907,15 @@ discard block |
||
817 | 907 | { |
818 | 908 | // Get a path of the requested module. Return if not exists. |
819 | 909 | $class_path = ModuleHandler::getModulePath($module); |
820 | - if(!$class_path) return; |
|
910 | + if(!$class_path) { |
|
911 | + return; |
|
912 | + } |
|
821 | 913 | |
822 | 914 | // Check if module.xml exists in the path. Return if not exist |
823 | 915 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
824 | - if(!file_exists($xml_file)) return; |
|
916 | + if(!file_exists($xml_file)) { |
|
917 | + return; |
|
918 | + } |
|
825 | 919 | |
826 | 920 | // Check if cached file exists |
827 | 921 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -840,7 +934,10 @@ discard block |
||
840 | 934 | |
841 | 935 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
842 | 936 | |
843 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
937 | + if(!count($xml_obj->module)) { |
|
938 | + return; |
|
939 | + } |
|
940 | + // /< Error occurs if module tag doesn't included in the xml |
|
844 | 941 | |
845 | 942 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
846 | 943 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -852,8 +949,11 @@ discard block |
||
852 | 949 | // Arrange permission information |
853 | 950 | if($grants) |
854 | 951 | { |
855 | - if(is_array($grants)) $grant_list = $grants; |
|
856 | - else $grant_list[] = $grants; |
|
952 | + if(is_array($grants)) { |
|
953 | + $grant_list = $grants; |
|
954 | + } else { |
|
955 | + $grant_list[] = $grants; |
|
956 | + } |
|
857 | 957 | |
858 | 958 | $info->grant = new stdClass(); |
859 | 959 | $buff[] = '$info->grant = new stdClass;'; |
@@ -875,8 +975,11 @@ discard block |
||
875 | 975 | // Permissions to grant |
876 | 976 | if($permissions) |
877 | 977 | { |
878 | - if(is_array($permissions)) $permission_list = $permissions; |
|
879 | - else $permission_list[] = $permissions; |
|
978 | + if(is_array($permissions)) { |
|
979 | + $permission_list = $permissions; |
|
980 | + } else { |
|
981 | + $permission_list[] = $permissions; |
|
982 | + } |
|
880 | 983 | |
881 | 984 | $buff[] = '$info->permission = new stdClass;'; |
882 | 985 | |
@@ -894,8 +997,11 @@ discard block |
||
894 | 997 | // for admin menus |
895 | 998 | if($menus) |
896 | 999 | { |
897 | - if(is_array($menus)) $menu_list = $menus; |
|
898 | - else $menu_list[] = $menus; |
|
1000 | + if(is_array($menus)) { |
|
1001 | + $menu_list = $menus; |
|
1002 | + } else { |
|
1003 | + $menu_list[] = $menus; |
|
1004 | + } |
|
899 | 1005 | |
900 | 1006 | $buff[] = '$info->menu = new stdClass;'; |
901 | 1007 | $info->menu = new stdClass(); |
@@ -919,8 +1025,11 @@ discard block |
||
919 | 1025 | // actions |
920 | 1026 | if($actions) |
921 | 1027 | { |
922 | - if(is_array($actions)) $action_list = $actions; |
|
923 | - else $action_list[] = $actions; |
|
1028 | + if(is_array($actions)) { |
|
1029 | + $action_list = $actions; |
|
1030 | + } else { |
|
1031 | + $action_list[] = $actions; |
|
1032 | + } |
|
924 | 1033 | |
925 | 1034 | $buff[] = '$info->action = new stdClass;'; |
926 | 1035 | $info->action = new stdClass(); |
@@ -1012,7 +1121,9 @@ discard block |
||
1012 | 1121 | return $info; |
1013 | 1122 | } |
1014 | 1123 | |
1015 | - if(file_exists($cache_file)) return include($cache_file); |
|
1124 | + if(file_exists($cache_file)) { |
|
1125 | + return include($cache_file); |
|
1126 | + } |
|
1016 | 1127 | } |
1017 | 1128 | |
1018 | 1129 | /** |
@@ -1050,7 +1161,9 @@ discard block |
||
1050 | 1161 | |
1051 | 1162 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1052 | 1163 | $list = FileHandler::readDir($skin_path); |
1053 | - if(!count($list)) return; |
|
1164 | + if(!count($list)) { |
|
1165 | + return; |
|
1166 | + } |
|
1054 | 1167 | |
1055 | 1168 | natcasesort($list); |
1056 | 1169 | |
@@ -1104,8 +1217,7 @@ discard block |
||
1104 | 1217 | if($dir == 'skins') |
1105 | 1218 | { |
1106 | 1219 | $type = 'P'; |
1107 | - } |
|
1108 | - else |
|
1220 | + } else |
|
1109 | 1221 | { |
1110 | 1222 | $type = 'M'; |
1111 | 1223 | } |
@@ -1133,14 +1245,20 @@ discard block |
||
1133 | 1245 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1134 | 1246 | { |
1135 | 1247 | // Read xml file having skin information |
1136 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1248 | + if(substr($path,-1)!='/') { |
|
1249 | + $path .= '/'; |
|
1250 | + } |
|
1137 | 1251 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1138 | - if(!file_exists($skin_xml_file)) return; |
|
1252 | + if(!file_exists($skin_xml_file)) { |
|
1253 | + return; |
|
1254 | + } |
|
1139 | 1255 | // Create XmlParser object |
1140 | 1256 | $oXmlParser = new XmlParser(); |
1141 | 1257 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1142 | 1258 | // Return if no skin information is |
1143 | - if(!$_xml_obj->skin) return; |
|
1259 | + if(!$_xml_obj->skin) { |
|
1260 | + return; |
|
1261 | + } |
|
1144 | 1262 | $xml_obj = $_xml_obj->skin; |
1145 | 1263 | // Skin Name |
1146 | 1264 | $skin_info = new stdClass(); |
@@ -1157,8 +1275,11 @@ discard block |
||
1157 | 1275 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1158 | 1276 | $skin_info->description = $xml_obj->description->body; |
1159 | 1277 | |
1160 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1161 | - else $author_list = $xml_obj->author; |
|
1278 | + if(!is_array($xml_obj->author)) { |
|
1279 | + $author_list[] = $xml_obj->author; |
|
1280 | + } else { |
|
1281 | + $author_list = $xml_obj->author; |
|
1282 | + } |
|
1162 | 1283 | |
1163 | 1284 | foreach($author_list as $author) |
1164 | 1285 | { |
@@ -1172,8 +1293,12 @@ discard block |
||
1172 | 1293 | if($xml_obj->extra_vars) |
1173 | 1294 | { |
1174 | 1295 | $extra_var_groups = $xml_obj->extra_vars->group; |
1175 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1296 | + if(!$extra_var_groups) { |
|
1297 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1298 | + } |
|
1299 | + if(!is_array($extra_var_groups)) { |
|
1300 | + $extra_var_groups = array($extra_var_groups); |
|
1301 | + } |
|
1177 | 1302 | |
1178 | 1303 | foreach($extra_var_groups as $group) |
1179 | 1304 | { |
@@ -1182,7 +1307,9 @@ discard block |
||
1182 | 1307 | { |
1183 | 1308 | continue; |
1184 | 1309 | } |
1185 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1310 | + if(!is_array($group->var)) { |
|
1311 | + $extra_vars = array($group->var); |
|
1312 | + } |
|
1186 | 1313 | |
1187 | 1314 | foreach($extra_vars as $key => $val) |
1188 | 1315 | { |
@@ -1209,8 +1336,7 @@ discard block |
||
1209 | 1336 | $obj->options[$i]->title = $val->options[$i]->title->body; |
1210 | 1337 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
1211 | 1338 | } |
1212 | - } |
|
1213 | - else |
|
1339 | + } else |
|
1214 | 1340 | { |
1215 | 1341 | $obj->options[0] = new stdClass(); |
1216 | 1342 | $obj->options[0]->title = $val->options->title->body; |
@@ -1221,8 +1347,7 @@ discard block |
||
1221 | 1347 | } |
1222 | 1348 | } |
1223 | 1349 | } |
1224 | - } |
|
1225 | - else |
|
1350 | + } else |
|
1226 | 1351 | { |
1227 | 1352 | // skin format v0.1 |
1228 | 1353 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1240,8 +1365,12 @@ discard block |
||
1240 | 1365 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1241 | 1366 | // Variables used in the skin |
1242 | 1367 | $extra_var_groups = $xml_obj->extra_vars->group; |
1243 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1368 | + if(!$extra_var_groups) { |
|
1369 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1370 | + } |
|
1371 | + if(!is_array($extra_var_groups)) { |
|
1372 | + $extra_var_groups = array($extra_var_groups); |
|
1373 | + } |
|
1245 | 1374 | |
1246 | 1375 | foreach($extra_var_groups as $group) |
1247 | 1376 | { |
@@ -1249,7 +1378,9 @@ discard block |
||
1249 | 1378 | |
1250 | 1379 | if($extra_vars) |
1251 | 1380 | { |
1252 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1381 | + if(!is_array($extra_vars)) { |
|
1382 | + $extra_vars = array($extra_vars); |
|
1383 | + } |
|
1253 | 1384 | |
1254 | 1385 | foreach($extra_vars as $var) |
1255 | 1386 | { |
@@ -1271,8 +1402,7 @@ discard block |
||
1271 | 1402 | $options[$i]->title = $var->default[$i]->body; |
1272 | 1403 | $options[$i]->value = $var->default[$i]->body; |
1273 | 1404 | } |
1274 | - } |
|
1275 | - else |
|
1405 | + } else |
|
1276 | 1406 | { |
1277 | 1407 | $options[0]->title = $var->default->body; |
1278 | 1408 | $options[0]->value = $var->default->body; |
@@ -1302,7 +1432,9 @@ discard block |
||
1302 | 1432 | $colorset = $xml_obj->colorset->color; |
1303 | 1433 | if($colorset) |
1304 | 1434 | { |
1305 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1435 | + if(!is_array($colorset)) { |
|
1436 | + $colorset = array($colorset); |
|
1437 | + } |
|
1306 | 1438 | |
1307 | 1439 | foreach($colorset as $color) |
1308 | 1440 | { |
@@ -1312,9 +1444,12 @@ discard block |
||
1312 | 1444 | if($screenshot) |
1313 | 1445 | { |
1314 | 1446 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1315 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1447 | + if(!file_exists($screenshot)) { |
|
1448 | + $screenshot = ""; |
|
1449 | + } |
|
1450 | + } else { |
|
1451 | + $screenshot = ""; |
|
1316 | 1452 | } |
1317 | - else $screenshot = ""; |
|
1318 | 1453 | |
1319 | 1454 | $obj = new stdClass(); |
1320 | 1455 | $obj->name = $name; |
@@ -1327,7 +1462,9 @@ discard block |
||
1327 | 1462 | if($xml_obj->menus->menu) |
1328 | 1463 | { |
1329 | 1464 | $menus = $xml_obj->menus->menu; |
1330 | - if(!is_array($menus)) $menus = array($menus); |
|
1465 | + if(!is_array($menus)) { |
|
1466 | + $menus = array($menus); |
|
1467 | + } |
|
1331 | 1468 | |
1332 | 1469 | $menu_count = count($menus); |
1333 | 1470 | $skin_info->menu_count = $menu_count; |
@@ -1336,7 +1473,9 @@ discard block |
||
1336 | 1473 | unset($obj); |
1337 | 1474 | |
1338 | 1475 | $obj->name = $menus[$i]->attrs->name; |
1339 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1476 | + if($menus[$i]->attrs->default == "true") { |
|
1477 | + $obj->default = true; |
|
1478 | + } |
|
1340 | 1479 | $obj->title = $menus[$i]->title->body; |
1341 | 1480 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1342 | 1481 | |
@@ -1356,7 +1495,9 @@ discard block |
||
1356 | 1495 | { |
1357 | 1496 | $args = new stdClass; |
1358 | 1497 | $args->site_srl = $site_srl; |
1359 | - if(!is_null($module)) $args->module = $module; |
|
1498 | + if(!is_null($module)) { |
|
1499 | + $args->module = $module; |
|
1500 | + } |
|
1360 | 1501 | $output = executeQuery('module.getModuleCount', $args); |
1361 | 1502 | return $output->data->count; |
1362 | 1503 | } |
@@ -1385,8 +1526,11 @@ discard block |
||
1385 | 1526 | $args->module = $module; |
1386 | 1527 | $args->site_srl = $site_srl; |
1387 | 1528 | $output = executeQuery('module.getModuleConfig', $args); |
1388 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1389 | - else $config = null; |
|
1529 | + if($output->data->config) { |
|
1530 | + $config = unserialize($output->data->config); |
|
1531 | + } else { |
|
1532 | + $config = null; |
|
1533 | + } |
|
1390 | 1534 | |
1391 | 1535 | //insert in cache |
1392 | 1536 | if($oCacheHandler->isSupport()) |
@@ -1425,8 +1569,11 @@ discard block |
||
1425 | 1569 | $args->module = $module; |
1426 | 1570 | $args->module_srl = $module_srl; |
1427 | 1571 | $output = executeQuery('module.getModulePartConfig', $args); |
1428 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1429 | - else $config = null; |
|
1572 | + if($output->data->config) { |
|
1573 | + $config = unserialize($output->data->config); |
|
1574 | + } else { |
|
1575 | + $config = null; |
|
1576 | + } |
|
1430 | 1577 | |
1431 | 1578 | //insert in cache |
1432 | 1579 | if($oCacheHandler->isSupport()) |
@@ -1448,9 +1595,13 @@ discard block |
||
1448 | 1595 | { |
1449 | 1596 | $args = new stdClass(); |
1450 | 1597 | $args->module = $module; |
1451 | - if($site_srl) $args->site_srl = $site_srl; |
|
1598 | + if($site_srl) { |
|
1599 | + $args->site_srl = $site_srl; |
|
1600 | + } |
|
1452 | 1601 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1453 | - if(!$output->toBool() || !$output->data) return array(); |
|
1602 | + if(!$output->toBool() || !$output->data) { |
|
1603 | + return array(); |
|
1604 | + } |
|
1454 | 1605 | |
1455 | 1606 | foreach($output->data as $key => $val) |
1456 | 1607 | { |
@@ -1468,10 +1619,16 @@ discard block |
||
1468 | 1619 | $args->moduleCategorySrl = $moduleCategorySrl; |
1469 | 1620 | // Get data from the DB |
1470 | 1621 | $output = executeQuery('module.getModuleCategories', $args); |
1471 | - if(!$output->toBool()) return $output; |
|
1622 | + if(!$output->toBool()) { |
|
1623 | + return $output; |
|
1624 | + } |
|
1472 | 1625 | $list = $output->data; |
1473 | - if(!$list) return; |
|
1474 | - if(!is_array($list)) $list = array($list); |
|
1626 | + if(!$list) { |
|
1627 | + return; |
|
1628 | + } |
|
1629 | + if(!is_array($list)) { |
|
1630 | + $list = array($list); |
|
1631 | + } |
|
1475 | 1632 | |
1476 | 1633 | foreach($list as $val) |
1477 | 1634 | { |
@@ -1489,7 +1646,9 @@ discard block |
||
1489 | 1646 | $args = new stdClass; |
1490 | 1647 | $args->module_category_srl = $module_category_srl; |
1491 | 1648 | $output = executeQuery('module.getModuleCategory', $args); |
1492 | - if(!$output->toBool()) return $output; |
|
1649 | + if(!$output->toBool()) { |
|
1650 | + return $output; |
|
1651 | + } |
|
1493 | 1652 | return $output->data; |
1494 | 1653 | } |
1495 | 1654 | |
@@ -1501,7 +1660,9 @@ discard block |
||
1501 | 1660 | // Get a list of downloaded and installed modules |
1502 | 1661 | $searched_list = FileHandler::readDir('./modules'); |
1503 | 1662 | $searched_count = count($searched_list); |
1504 | - if(!$searched_count) return; |
|
1663 | + if(!$searched_count) { |
|
1664 | + return; |
|
1665 | + } |
|
1505 | 1666 | sort($searched_list); |
1506 | 1667 | |
1507 | 1668 | for($i=0;$i<$searched_count;$i++) |
@@ -1514,7 +1675,9 @@ discard block |
||
1514 | 1675 | $info = $this->getModuleInfoXml($module_name); |
1515 | 1676 | unset($obj); |
1516 | 1677 | |
1517 | - if(!isset($info)) continue; |
|
1678 | + if(!isset($info)) { |
|
1679 | + continue; |
|
1680 | + } |
|
1518 | 1681 | $info->module = $module_name; |
1519 | 1682 | $info->created_table_count = $created_table_count; |
1520 | 1683 | $info->table_count = $table_count; |
@@ -1540,11 +1703,16 @@ discard block |
||
1540 | 1703 | for($j=0;$j<count($tmp_files);$j++) |
1541 | 1704 | { |
1542 | 1705 | list($table_name) = explode(".",$tmp_files[$j]); |
1543 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1706 | + if($oDB->isTableExists($table_name)) { |
|
1707 | + $created_table_count ++; |
|
1708 | + } |
|
1544 | 1709 | } |
1545 | 1710 | // Check if DB is installed |
1546 | - if($table_count > $created_table_count) return true; |
|
1547 | - else return false; |
|
1711 | + if($table_count > $created_table_count) { |
|
1712 | + return true; |
|
1713 | + } else { |
|
1714 | + return false; |
|
1715 | + } |
|
1548 | 1716 | } |
1549 | 1717 | return false; |
1550 | 1718 | } |
@@ -1567,15 +1735,23 @@ discard block |
||
1567 | 1735 | */ |
1568 | 1736 | public function needUpdate($update_id) |
1569 | 1737 | { |
1570 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
1738 | + if(!is_array($update_id)) { |
|
1739 | + $update_id = array($update_id); |
|
1740 | + } |
|
1571 | 1741 | |
1572 | 1742 | $args = new stdClass(); |
1573 | 1743 | $args->update_id = implode(',', $update_id); |
1574 | 1744 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
1575 | 1745 | |
1576 | - if(!!$output->error) return false; |
|
1577 | - if(!$output->data) $output->data = array(); |
|
1578 | - if(count($update_id) === count($output->data)) return false; |
|
1746 | + if(!!$output->error) { |
|
1747 | + return false; |
|
1748 | + } |
|
1749 | + if(!$output->data) { |
|
1750 | + $output->data = array(); |
|
1751 | + } |
|
1752 | + if(count($update_id) === count($output->data)) { |
|
1753 | + return false; |
|
1754 | + } |
|
1579 | 1755 | |
1580 | 1756 | return true; |
1581 | 1757 | } |
@@ -1592,7 +1768,9 @@ discard block |
||
1592 | 1768 | sort($searched_list); |
1593 | 1769 | |
1594 | 1770 | $searched_count = count($searched_list); |
1595 | - if(!$searched_count) return; |
|
1771 | + if(!$searched_count) { |
|
1772 | + return; |
|
1773 | + } |
|
1596 | 1774 | |
1597 | 1775 | for($i=0;$i<$searched_count;$i++) |
1598 | 1776 | { |
@@ -1600,7 +1778,9 @@ discard block |
||
1600 | 1778 | $module_name = $searched_list[$i]; |
1601 | 1779 | |
1602 | 1780 | $path = ModuleHandler::getModulePath($module_name); |
1603 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1781 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
1782 | + continue; |
|
1783 | + } |
|
1604 | 1784 | |
1605 | 1785 | // Get the number of xml files to create a table in schemas |
1606 | 1786 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1610,13 +1790,17 @@ discard block |
||
1610 | 1790 | for($j=0;$j<$table_count;$j++) |
1611 | 1791 | { |
1612 | 1792 | list($table_name) = explode('.',$tmp_files[$j]); |
1613 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1793 | + if($oDB->isTableExists($table_name)) { |
|
1794 | + $created_table_count ++; |
|
1795 | + } |
|
1614 | 1796 | } |
1615 | 1797 | // Get information of the module |
1616 | 1798 | $info = NULL; |
1617 | 1799 | $info = $this->getModuleInfoXml($module_name); |
1618 | 1800 | |
1619 | - if(!$info) continue; |
|
1801 | + if(!$info) { |
|
1802 | + continue; |
|
1803 | + } |
|
1620 | 1804 | |
1621 | 1805 | $info->module = $module_name; |
1622 | 1806 | $info->category = $info->category; |
@@ -1625,16 +1809,18 @@ discard block |
||
1625 | 1809 | $info->path = $path; |
1626 | 1810 | $info->admin_index_act = $info->admin_index_act; |
1627 | 1811 | // Check if DB is installed |
1628 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1629 | - else $info->need_install = false; |
|
1812 | + if($table_count > $created_table_count) { |
|
1813 | + $info->need_install = true; |
|
1814 | + } else { |
|
1815 | + $info->need_install = false; |
|
1816 | + } |
|
1630 | 1817 | // Check if it is upgraded to module.class.php on each module |
1631 | 1818 | $oDummy = null; |
1632 | 1819 | $oDummy = getModule($module_name, 'class'); |
1633 | 1820 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
1634 | 1821 | { |
1635 | 1822 | $info->need_update = $oDummy->checkUpdate(); |
1636 | - } |
|
1637 | - else |
|
1823 | + } else |
|
1638 | 1824 | { |
1639 | 1825 | continue; |
1640 | 1826 | } |
@@ -1651,7 +1837,9 @@ discard block |
||
1651 | 1837 | */ |
1652 | 1838 | function syncModuleToSite(&$data) |
1653 | 1839 | { |
1654 | - if(!$data) return; |
|
1840 | + if(!$data) { |
|
1841 | + return; |
|
1842 | + } |
|
1655 | 1843 | |
1656 | 1844 | if(is_array($data)) |
1657 | 1845 | { |
@@ -1659,9 +1847,10 @@ discard block |
||
1659 | 1847 | { |
1660 | 1848 | $module_srls[] = $val->module_srl; |
1661 | 1849 | } |
1662 | - if(!count($module_srls)) return; |
|
1663 | - } |
|
1664 | - else |
|
1850 | + if(!count($module_srls)) { |
|
1851 | + return; |
|
1852 | + } |
|
1853 | + } else |
|
1665 | 1854 | { |
1666 | 1855 | $module_srls[] = $data->module_srl; |
1667 | 1856 | } |
@@ -1669,7 +1858,9 @@ discard block |
||
1669 | 1858 | $args = new stdClass(); |
1670 | 1859 | $args->module_srls = implode(',',$module_srls); |
1671 | 1860 | $output = executeQueryArray('module.getModuleSites', $args); |
1672 | - if(!$output->data) return array(); |
|
1861 | + if(!$output->data) { |
|
1862 | + return array(); |
|
1863 | + } |
|
1673 | 1864 | foreach($output->data as $key => $val) |
1674 | 1865 | { |
1675 | 1866 | $modules[$val->module_srl] = $val; |
@@ -1681,8 +1872,7 @@ discard block |
||
1681 | 1872 | { |
1682 | 1873 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1683 | 1874 | } |
1684 | - } |
|
1685 | - else |
|
1875 | + } else |
|
1686 | 1876 | { |
1687 | 1877 | $data->domain = $modules[$data->module_srl]->domain; |
1688 | 1878 | } |
@@ -1693,24 +1883,31 @@ discard block |
||
1693 | 1883 | */ |
1694 | 1884 | function isSiteAdmin($member_info, $site_srl = null) |
1695 | 1885 | { |
1696 | - if(!$member_info->member_srl) return false; |
|
1697 | - if($member_info->is_admin == 'Y') return true; |
|
1886 | + if(!$member_info->member_srl) { |
|
1887 | + return false; |
|
1888 | + } |
|
1889 | + if($member_info->is_admin == 'Y') { |
|
1890 | + return true; |
|
1891 | + } |
|
1698 | 1892 | |
1699 | 1893 | $args = new stdClass(); |
1700 | 1894 | if(!isset($site_srl)) |
1701 | 1895 | { |
1702 | 1896 | $site_module_info = Context::get('site_module_info'); |
1703 | - if(!$site_module_info) return; |
|
1897 | + if(!$site_module_info) { |
|
1898 | + return; |
|
1899 | + } |
|
1704 | 1900 | $args->site_srl = $site_module_info->site_srl; |
1705 | - } |
|
1706 | - else |
|
1901 | + } else |
|
1707 | 1902 | { |
1708 | 1903 | $args->site_srl = $site_srl; |
1709 | 1904 | } |
1710 | 1905 | |
1711 | 1906 | $args->member_srl = $member_info->member_srl; |
1712 | 1907 | $output = executeQuery('module.isSiteAdmin', $args); |
1713 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1908 | + if($output->data->member_srl == $args->member_srl) { |
|
1909 | + return true; |
|
1910 | + } |
|
1714 | 1911 | return false; |
1715 | 1912 | } |
1716 | 1913 | |
@@ -1733,7 +1930,9 @@ discard block |
||
1733 | 1930 | $obj = new stdClass(); |
1734 | 1931 | $obj->module_srl = $module_srl; |
1735 | 1932 | $output = executeQueryArray('module.getAdminID', $obj); |
1736 | - if(!$output->toBool() || !$output->data) return; |
|
1933 | + if(!$output->toBool() || !$output->data) { |
|
1934 | + return; |
|
1935 | + } |
|
1737 | 1936 | |
1738 | 1937 | return $output->data; |
1739 | 1938 | } |
@@ -1746,7 +1945,9 @@ discard block |
||
1746 | 1945 | { |
1747 | 1946 | $extra_vars = array(); |
1748 | 1947 | $get_module_srls = array(); |
1749 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1948 | + if(!is_array($list_module_srl)) { |
|
1949 | + $list_module_srl = array($list_module_srl); |
|
1950 | + } |
|
1750 | 1951 | |
1751 | 1952 | $vars = false; |
1752 | 1953 | // cache controll |
@@ -1762,14 +1963,12 @@ discard block |
||
1762 | 1963 | if($vars) |
1763 | 1964 | { |
1764 | 1965 | $extra_vars[$module_srl] = $vars; |
1765 | - } |
|
1766 | - else |
|
1966 | + } else |
|
1767 | 1967 | { |
1768 | 1968 | $get_module_srls[] = $module_srl; |
1769 | 1969 | } |
1770 | 1970 | } |
1771 | - } |
|
1772 | - else |
|
1971 | + } else |
|
1773 | 1972 | { |
1774 | 1973 | $get_module_srls = $list_module_srl; |
1775 | 1974 | } |
@@ -1794,7 +1993,9 @@ discard block |
||
1794 | 1993 | } |
1795 | 1994 | foreach($output->data as $key => $val) |
1796 | 1995 | { |
1797 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1996 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
1997 | + continue; |
|
1998 | + } |
|
1798 | 1999 | |
1799 | 2000 | if(!isset($extra_vars[$val->module_srl])) |
1800 | 2001 | { |
@@ -1833,7 +2034,9 @@ discard block |
||
1833 | 2034 | $args = new stdClass(); |
1834 | 2035 | $args->module_srl = $module_srl; |
1835 | 2036 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
1836 | - if(!$output->toBool()) return; |
|
2037 | + if(!$output->toBool()) { |
|
2038 | + return; |
|
2039 | + } |
|
1837 | 2040 | |
1838 | 2041 | $skin_vars = array(); |
1839 | 2042 | foreach($output->data as $vars) |
@@ -1841,7 +2044,9 @@ discard block |
||
1841 | 2044 | $skin_vars[$vars->name] = $vars; |
1842 | 2045 | } |
1843 | 2046 | |
1844 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2047 | + if($oCacheHandler->isSupport()) { |
|
2048 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2049 | + } |
|
1845 | 2050 | } |
1846 | 2051 | |
1847 | 2052 | return $skin_vars; |
@@ -1853,7 +2058,9 @@ discard block |
||
1853 | 2058 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1854 | 2059 | { |
1855 | 2060 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1856 | - if(!$site_srl) $site_srl = 0; |
|
2061 | + if(!$site_srl) { |
|
2062 | + $site_srl = 0; |
|
2063 | + } |
|
1857 | 2064 | |
1858 | 2065 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1859 | 2066 | if(is_readable($designInfoFile)) |
@@ -1870,19 +2077,16 @@ discard block |
||
1870 | 2077 | if(is_dir($moduleSkinPath.'default')) |
1871 | 2078 | { |
1872 | 2079 | $skinName = 'default'; |
1873 | - } |
|
1874 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
2080 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
1875 | 2081 | { |
1876 | 2082 | $skinName = 'xe_default'; |
1877 | - } |
|
1878 | - else |
|
2083 | + } else |
|
1879 | 2084 | { |
1880 | 2085 | $skins = FileHandler::readDir($moduleSkinPath); |
1881 | 2086 | if(count($skins) > 0) |
1882 | 2087 | { |
1883 | 2088 | $skinName = $skins[0]; |
1884 | - } |
|
1885 | - else |
|
2089 | + } else |
|
1886 | 2090 | { |
1887 | 2091 | $skinName = NULL; |
1888 | 2092 | } |
@@ -1890,7 +2094,9 @@ discard block |
||
1890 | 2094 | |
1891 | 2095 | if($updateCache && $skinName) |
1892 | 2096 | { |
1893 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
2097 | + if(!isset($designInfo->module->{$module_name})) { |
|
2098 | + $designInfo->module->{$module_name} = new stdClass(); |
|
2099 | + } |
|
1894 | 2100 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1895 | 2101 | |
1896 | 2102 | $oAdminController = getAdminController('admin'); |
@@ -1906,23 +2112,28 @@ discard block |
||
1906 | 2112 | */ |
1907 | 2113 | function syncSkinInfoToModuleInfo(&$module_info) |
1908 | 2114 | { |
1909 | - if(!$module_info->module_srl) return; |
|
2115 | + if(!$module_info->module_srl) { |
|
2116 | + return; |
|
2117 | + } |
|
1910 | 2118 | |
1911 | 2119 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1912 | 2120 | if(Mobile::isFromMobilePhone()) |
1913 | 2121 | { |
1914 | 2122 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1915 | - } |
|
1916 | - else |
|
2123 | + } else |
|
1917 | 2124 | { |
1918 | 2125 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1919 | 2126 | } |
1920 | 2127 | |
1921 | - if(!$skin_vars) return; |
|
2128 | + if(!$skin_vars) { |
|
2129 | + return; |
|
2130 | + } |
|
1922 | 2131 | |
1923 | 2132 | foreach($skin_vars as $name => $val) |
1924 | 2133 | { |
1925 | - if(isset($module_info->{$name})) continue; |
|
2134 | + if(isset($module_info->{$name})) { |
|
2135 | + continue; |
|
2136 | + } |
|
1926 | 2137 | $module_info->{$name} = $val->value; |
1927 | 2138 | } |
1928 | 2139 | } |
@@ -1948,7 +2159,9 @@ discard block |
||
1948 | 2159 | $args = new stdClass(); |
1949 | 2160 | $args->module_srl = $module_srl; |
1950 | 2161 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1951 | - if(!$output->toBool() || !$output->data) return; |
|
2162 | + if(!$output->toBool() || !$output->data) { |
|
2163 | + return; |
|
2164 | + } |
|
1952 | 2165 | |
1953 | 2166 | $skin_vars = array(); |
1954 | 2167 | foreach($output->data as $vars) |
@@ -1956,7 +2169,9 @@ discard block |
||
1956 | 2169 | $skin_vars[$vars->name] = $vars; |
1957 | 2170 | } |
1958 | 2171 | |
1959 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2172 | + if($oCacheHandler->isSupport()) { |
|
2173 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2174 | + } |
|
1960 | 2175 | } |
1961 | 2176 | |
1962 | 2177 | return $skin_vars; |
@@ -1968,7 +2183,9 @@ discard block |
||
1968 | 2183 | */ |
1969 | 2184 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1970 | 2185 | { |
1971 | - if(!$module_info->module_srl) return; |
|
2186 | + if(!$module_info->module_srl) { |
|
2187 | + return; |
|
2188 | + } |
|
1972 | 2189 | $skin_vars = false; |
1973 | 2190 | // cache controll |
1974 | 2191 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1983,17 +2200,25 @@ discard block |
||
1983 | 2200 | $args = new stdClass; |
1984 | 2201 | $args->module_srl = $module_info->module_srl; |
1985 | 2202 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1986 | - if(!$output->toBool()) return; |
|
2203 | + if(!$output->toBool()) { |
|
2204 | + return; |
|
2205 | + } |
|
1987 | 2206 | $skin_vars = $output->data; |
1988 | 2207 | |
1989 | 2208 | //insert in cache |
1990 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2209 | + if($oCacheHandler->isSupport()) { |
|
2210 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2211 | + } |
|
2212 | + } |
|
2213 | + if(!$skin_vars) { |
|
2214 | + return; |
|
1991 | 2215 | } |
1992 | - if(!$skin_vars) return; |
|
1993 | 2216 | |
1994 | 2217 | foreach($output->data as $val) |
1995 | 2218 | { |
1996 | - if(isset($module_info->{$val->name})) continue; |
|
2219 | + if(isset($module_info->{$val->name})) { |
|
2220 | + continue; |
|
2221 | + } |
|
1997 | 2222 | $module_info->{$val->name} = $val->value; |
1998 | 2223 | } |
1999 | 2224 | } |
@@ -2015,10 +2240,12 @@ discard block |
||
2015 | 2240 | $grant_info = $xml_info->grant; |
2016 | 2241 | if($member_info->member_srl) |
2017 | 2242 | { |
2018 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2019 | - else $group_list = array(); |
|
2020 | - } |
|
2021 | - else |
|
2243 | + if(is_array($member_info->group_list)) { |
|
2244 | + $group_list = array_keys($member_info->group_list); |
|
2245 | + } else { |
|
2246 | + $group_list = array(); |
|
2247 | + } |
|
2248 | + } else |
|
2022 | 2249 | { |
2023 | 2250 | $group_list = array(); |
2024 | 2251 | } |
@@ -2032,8 +2259,7 @@ discard block |
||
2032 | 2259 | } |
2033 | 2260 | |
2034 | 2261 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
2035 | - } |
|
2036 | - else |
|
2262 | + } else |
|
2037 | 2263 | { |
2038 | 2264 | // If module_srl exists |
2039 | 2265 | // Get a type of granted permission |
@@ -2046,7 +2272,9 @@ discard block |
||
2046 | 2272 | $args->module_srl = $module_srl; |
2047 | 2273 | $args->member_srl = $member_info->member_srl; |
2048 | 2274 | $output = executeQuery('module.getModuleAdmin',$args); |
2049 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2275 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
2276 | + $grant->manager = true; |
|
2277 | + } |
|
2050 | 2278 | } |
2051 | 2279 | // If not an administrator, get information from the DB and grant manager privilege. |
2052 | 2280 | if(!$grant->manager) |
@@ -2056,8 +2284,7 @@ discard block |
||
2056 | 2284 | if($module_info->module == 'planet') |
2057 | 2285 | { |
2058 | 2286 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2059 | - } |
|
2060 | - else |
|
2287 | + } else |
|
2061 | 2288 | { |
2062 | 2289 | $args = new stdClass; |
2063 | 2290 | $args->module_srl = $module_srl; |
@@ -2072,42 +2299,48 @@ discard block |
||
2072 | 2299 | foreach($output->data as $val) |
2073 | 2300 | { |
2074 | 2301 | $grant_exists[$val->name] = true; |
2075 | - if($granted[$val->name]) continue; |
|
2302 | + if($granted[$val->name]) { |
|
2303 | + continue; |
|
2304 | + } |
|
2076 | 2305 | // Log-in member only |
2077 | 2306 | if($val->group_srl == -1) |
2078 | 2307 | { |
2079 | 2308 | $granted[$val->name] = true; |
2080 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2309 | + if($member_info->member_srl) { |
|
2310 | + $grant->{$val->name} = true; |
|
2311 | + } |
|
2081 | 2312 | // Site-joined member only |
2082 | - } |
|
2083 | - elseif($val->group_srl == -2) |
|
2313 | + } elseif($val->group_srl == -2) |
|
2084 | 2314 | { |
2085 | 2315 | $granted[$val->name] = true; |
2086 | 2316 | // Do not grant any permission for non-logged member |
2087 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2317 | + if(!$member_info->member_srl) { |
|
2318 | + $grant->{$val->name} = false; |
|
2319 | + } |
|
2088 | 2320 | // Log-in member |
2089 | 2321 | else |
2090 | 2322 | { |
2091 | 2323 | $site_module_info = Context::get('site_module_info'); |
2092 | 2324 | // Permission granted if no information of the currently connected site exists |
2093 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2325 | + if(!$site_module_info->site_srl) { |
|
2326 | + $grant->{$val->name} = true; |
|
2327 | + } |
|
2094 | 2328 | // Permission is not granted if information of the currently connected site exists |
2095 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2329 | + elseif(count($group_list)) { |
|
2330 | + $grant->{$val->name} = true; |
|
2331 | + } |
|
2096 | 2332 | } |
2097 | 2333 | // All of non-logged members |
2098 | - } |
|
2099 | - elseif($val->group_srl == -3) |
|
2334 | + } elseif($val->group_srl == -3) |
|
2100 | 2335 | { |
2101 | 2336 | $granted[$val->name] = true; |
2102 | 2337 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2103 | - } |
|
2104 | - elseif($val->group_srl == 0) |
|
2338 | + } elseif($val->group_srl == 0) |
|
2105 | 2339 | { |
2106 | 2340 | $granted[$val->name] = true; |
2107 | 2341 | $grant->{$val->name} = true; |
2108 | 2342 | // If a target is a group |
2109 | - } |
|
2110 | - else |
|
2343 | + } else |
|
2111 | 2344 | { |
2112 | 2345 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
2113 | 2346 | { |
@@ -2118,30 +2351,43 @@ discard block |
||
2118 | 2351 | } |
2119 | 2352 | } |
2120 | 2353 | // Separate processing for the virtual group access |
2121 | - if(!$grant_exists['access']) $grant->access = true; |
|
2354 | + if(!$grant_exists['access']) { |
|
2355 | + $grant->access = true; |
|
2356 | + } |
|
2122 | 2357 | if(count($grant_info)) |
2123 | 2358 | { |
2124 | 2359 | foreach($grant_info as $grant_name => $grant_item) |
2125 | 2360 | { |
2126 | - if($grant_exists[$grant_name]) continue; |
|
2361 | + if($grant_exists[$grant_name]) { |
|
2362 | + continue; |
|
2363 | + } |
|
2127 | 2364 | switch($grant_item->default) |
2128 | 2365 | { |
2129 | 2366 | case 'guest' : |
2130 | 2367 | $grant->{$grant_name} = true; |
2131 | 2368 | break; |
2132 | 2369 | case 'member' : |
2133 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2134 | - else $grant->{$grant_name} = false; |
|
2370 | + if($member_info->member_srl) { |
|
2371 | + $grant->{$grant_name} = true; |
|
2372 | + } else { |
|
2373 | + $grant->{$grant_name} = false; |
|
2374 | + } |
|
2135 | 2375 | break; |
2136 | 2376 | case 'site' : |
2137 | 2377 | $site_module_info = Context::get('site_module_info'); |
2138 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2139 | - else $grant->{$grant_name} = false; |
|
2378 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
2379 | + $grant->{$grant_name} = true; |
|
2380 | + } else { |
|
2381 | + $grant->{$grant_name} = false; |
|
2382 | + } |
|
2140 | 2383 | break; |
2141 | 2384 | case 'manager' : |
2142 | 2385 | case 'root' : |
2143 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2144 | - else $grant->{$grant_name} = false; |
|
2386 | + if($member_info->is_admin == 'Y') { |
|
2387 | + $grant->{$grant_name} = true; |
|
2388 | + } else { |
|
2389 | + $grant->{$grant_name} = false; |
|
2390 | + } |
|
2145 | 2391 | break; |
2146 | 2392 | } |
2147 | 2393 | } |
@@ -2217,16 +2463,22 @@ discard block |
||
2217 | 2463 | function getFileBoxListHtml() |
2218 | 2464 | { |
2219 | 2465 | $logged_info = Context::get('logged_info'); |
2220 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2466 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
2467 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
2468 | + } |
|
2221 | 2469 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2222 | 2470 | $link_params = explode('&',$link['query']); |
2223 | 2471 | foreach ($link_params as $param) |
2224 | 2472 | { |
2225 | 2473 | $param = explode("=",$param); |
2226 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2474 | + if($param[0] == 'selected_widget') { |
|
2475 | + $selected_widget = $param[1]; |
|
2476 | + } |
|
2227 | 2477 | } |
2228 | 2478 | $oWidgetModel = getModel('widget'); |
2229 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2479 | + if($selected_widget) { |
|
2480 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2481 | + } |
|
2230 | 2482 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2231 | 2483 | |
2232 | 2484 | $oModuleModel = getModel('module'); |
@@ -2234,7 +2486,9 @@ discard block |
||
2234 | 2486 | Context::set('filebox_list', $output->data); |
2235 | 2487 | |
2236 | 2488 | $page = Context::get('page'); |
2237 | - if (!$page) $page = 1; |
|
2489 | + if (!$page) { |
|
2490 | + $page = 1; |
|
2491 | + } |
|
2238 | 2492 | Context::set('page', $page); |
2239 | 2493 | Context::set('page_navigation', $output->page_navigation); |
2240 | 2494 | |
@@ -2264,25 +2518,28 @@ discard block |
||
2264 | 2518 | $rulsetFile = str_replace('@', '', $ruleset); |
2265 | 2519 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2266 | 2520 | return FileHandler::getRealPath($xml_file); |
2267 | - } |
|
2268 | - else if (strpos($ruleset, '#') !== false) |
|
2521 | + } else if (strpos($ruleset, '#') !== false) |
|
2269 | 2522 | { |
2270 | 2523 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2271 | 2524 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2272 | - if(is_readable($xml_file)) |
|
2273 | - return FileHandler::getRealPath($xml_file); |
|
2274 | - else{ |
|
2525 | + if(is_readable($xml_file)) { |
|
2526 | + return FileHandler::getRealPath($xml_file); |
|
2527 | + } else{ |
|
2275 | 2528 | $ruleset = str_replace('#', '', $ruleset); |
2276 | 2529 | } |
2277 | 2530 | |
2278 | 2531 | } |
2279 | 2532 | // Get a path of the requested module. Return if not exists. |
2280 | 2533 | $class_path = ModuleHandler::getModulePath($module); |
2281 | - if(!$class_path) return; |
|
2534 | + if(!$class_path) { |
|
2535 | + return; |
|
2536 | + } |
|
2282 | 2537 | |
2283 | 2538 | // Check if module.xml exists in the path. Return if not exist |
2284 | 2539 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2285 | - if(!file_exists($xml_file)) return; |
|
2540 | + if(!file_exists($xml_file)) { |
|
2541 | + return; |
|
2542 | + } |
|
2286 | 2543 | |
2287 | 2544 | return $xml_file; |
2288 | 2545 | } |
@@ -2332,7 +2589,9 @@ discard block |
||
2332 | 2589 | function getLangByLangcode() |
2333 | 2590 | { |
2334 | 2591 | $langCode = Context::get('langCode'); |
2335 | - if (!$langCode) return; |
|
2592 | + if (!$langCode) { |
|
2593 | + return; |
|
2594 | + } |
|
2336 | 2595 | |
2337 | 2596 | $oModuleController = getController('module'); |
2338 | 2597 | $oModuleController->replaceDefinedLangCode($langCode); |