@@ -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 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $year = (int) substr($str, 0, 4); |
616 | 616 | $month = (int) substr($str, 4, 2); |
617 | 617 | $day = (int) substr($str, 6, 2); |
618 | - if(strlen($str) <= 8) |
|
618 | + if (strlen($str) <= 8) |
|
619 | 619 | { |
620 | 620 | $gap = 0; |
621 | 621 | } |
@@ -639,19 +639,19 @@ discard block |
||
639 | 639 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
640 | 640 | |
641 | 641 | $lang_time_gap = Context::getLang('time_gap'); |
642 | - if($gap < 60) |
|
642 | + if ($gap < 60) |
|
643 | 643 | { |
644 | 644 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
645 | 645 | } |
646 | - elseif($gap < 60 * 60) |
|
646 | + elseif ($gap < 60 * 60) |
|
647 | 647 | { |
648 | 648 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
649 | 649 | } |
650 | - elseif($gap < 60 * 60 * 2) |
|
650 | + elseif ($gap < 60 * 60 * 2) |
|
651 | 651 | { |
652 | 652 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
653 | 653 | } |
654 | - elseif($gap < 60 * 60 * 24) |
|
654 | + elseif ($gap < 60 * 60 * 24) |
|
655 | 655 | { |
656 | 656 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
657 | 657 | } |
@@ -688,40 +688,40 @@ discard block |
||
688 | 688 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
689 | 689 | { |
690 | 690 | // return null if no target time is specified |
691 | - if(!$str) |
|
691 | + if (!$str) |
|
692 | 692 | { |
693 | 693 | return; |
694 | 694 | } |
695 | 695 | // convert the date format according to the language |
696 | - if($conversion == TRUE) |
|
696 | + if ($conversion == TRUE) |
|
697 | 697 | { |
698 | - switch(Context::getLangType()) |
|
698 | + switch (Context::getLangType()) |
|
699 | 699 | { |
700 | 700 | case 'en' : |
701 | 701 | case 'es' : |
702 | - if($format == 'Y-m-d') |
|
702 | + if ($format == 'Y-m-d') |
|
703 | 703 | { |
704 | 704 | $format = 'M d, Y'; |
705 | 705 | } |
706 | - elseif($format == 'Y-m-d H:i:s') |
|
706 | + elseif ($format == 'Y-m-d H:i:s') |
|
707 | 707 | { |
708 | 708 | $format = 'M d, Y H:i:s'; |
709 | 709 | } |
710 | - elseif($format == 'Y-m-d H:i') |
|
710 | + elseif ($format == 'Y-m-d H:i') |
|
711 | 711 | { |
712 | 712 | $format = 'M d, Y H:i'; |
713 | 713 | } |
714 | 714 | break; |
715 | 715 | case 'vi' : |
716 | - if($format == 'Y-m-d') |
|
716 | + if ($format == 'Y-m-d') |
|
717 | 717 | { |
718 | 718 | $format = 'd-m-Y'; |
719 | 719 | } |
720 | - elseif($format == 'Y-m-d H:i:s') |
|
720 | + elseif ($format == 'Y-m-d H:i:s') |
|
721 | 721 | { |
722 | 722 | $format = 'H:i:s d-m-Y'; |
723 | 723 | } |
724 | - elseif($format == 'Y-m-d H:i') |
|
724 | + elseif ($format == 'Y-m-d H:i') |
|
725 | 725 | { |
726 | 726 | $format = 'H:i d-m-Y'; |
727 | 727 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | } |
731 | 731 | |
732 | 732 | // If year value is less than 1970, handle it separately. |
733 | - if((int) substr($str, 0, 4) < 1970) |
|
733 | + if ((int) substr($str, 0, 4) < 1970) |
|
734 | 734 | { |
735 | 735 | $hour = (int) substr($str, 8, 2); |
736 | 736 | $min = (int) substr($str, 10, 2); |
@@ -780,9 +780,9 @@ discard block |
||
780 | 780 | function getEncodeEmailAddress($email) |
781 | 781 | { |
782 | 782 | $return = ''; |
783 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
783 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
784 | 784 | { |
785 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
785 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
786 | 786 | } |
787 | 787 | return $return; |
788 | 788 | } |
@@ -802,25 +802,25 @@ discard block |
||
802 | 802 | { |
803 | 803 | static $debug_file; |
804 | 804 | |
805 | - if(!(__DEBUG__ & 1)) |
|
805 | + if (!(__DEBUG__ & 1)) |
|
806 | 806 | { |
807 | 807 | return; |
808 | 808 | } |
809 | 809 | |
810 | 810 | static $firephp; |
811 | 811 | $bt = debug_backtrace(); |
812 | - if(is_array($bt)) |
|
812 | + if (is_array($bt)) |
|
813 | 813 | { |
814 | 814 | $bt_debug_print = array_shift($bt); |
815 | 815 | $bt_called_function = array_shift($bt); |
816 | 816 | } |
817 | 817 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
818 | 818 | $line_num = $bt_debug_print['line']; |
819 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
819 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
820 | 820 | |
821 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
821 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
822 | 822 | { |
823 | - if(!isset($firephp)) |
|
823 | + if (!isset($firephp)) |
|
824 | 824 | { |
825 | 825 | $firephp = FirePHP::getInstance(TRUE); |
826 | 826 | } |
@@ -829,16 +829,16 @@ discard block |
||
829 | 829 | $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())); |
830 | 830 | |
831 | 831 | // Check a FirePHP option |
832 | - if($display_option === 'TABLE') |
|
832 | + if ($display_option === 'TABLE') |
|
833 | 833 | { |
834 | 834 | $label = $display_option; |
835 | 835 | } |
836 | - if($display_option === 'ERROR') |
|
836 | + if ($display_option === 'ERROR') |
|
837 | 837 | { |
838 | 838 | $type = $display_option; |
839 | 839 | } |
840 | 840 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
841 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
841 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
842 | 842 | { |
843 | 843 | $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'; |
844 | 844 | $label = NULL; |
@@ -848,52 +848,52 @@ discard block |
||
848 | 848 | } |
849 | 849 | else |
850 | 850 | { |
851 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
851 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
852 | 852 | { |
853 | 853 | return; |
854 | 854 | } |
855 | 855 | |
856 | 856 | $print = array(); |
857 | - if(!$debug_file) |
|
857 | + if (!$debug_file) |
|
858 | 858 | { |
859 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
859 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
860 | 860 | } |
861 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
861 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
862 | 862 | |
863 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
863 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
864 | 864 | { |
865 | - $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()));; |
|
865 | + $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())); ; |
|
866 | 866 | $print[] = str_repeat('=', 80); |
867 | 867 | } |
868 | 868 | $type = gettype($debug_output); |
869 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
869 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
870 | 870 | { |
871 | - if($display_option === 'ERROR') |
|
871 | + if ($display_option === 'ERROR') |
|
872 | 872 | { |
873 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
873 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
874 | 874 | } |
875 | 875 | else |
876 | 876 | { |
877 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
877 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | else |
881 | 881 | { |
882 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
882 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
883 | 883 | } |
884 | 884 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
885 | 885 | $backtrace = debug_backtrace($backtrace_args); |
886 | 886 | |
887 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
887 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
888 | 888 | { |
889 | 889 | array_shift($backtrace); |
890 | 890 | } |
891 | - foreach($backtrace as $val) |
|
891 | + foreach ($backtrace as $val) |
|
892 | 892 | { |
893 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
893 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
894 | 894 | } |
895 | 895 | $print[] = PHP_EOL; |
896 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
896 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | */ |
905 | 905 | function writeSlowlog($type, $elapsed_time, $obj) |
906 | 906 | { |
907 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
907 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
908 | 908 | |
909 | 909 | static $log_filename = array( |
910 | 910 | 'query' => 'files/_slowlog_query.php', |
@@ -914,47 +914,47 @@ discard block |
||
914 | 914 | ); |
915 | 915 | $write_file = true; |
916 | 916 | |
917 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
917 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
918 | 918 | |
919 | 919 | $buff = array(); |
920 | 920 | $buff[] = '<?php exit(); ?>'; |
921 | 921 | $buff[] = date('c'); |
922 | 922 | |
923 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
923 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
924 | 924 | { |
925 | - $buff[] = "\tCaller : " . $obj->caller; |
|
926 | - $buff[] = "\tCalled : " . $obj->called; |
|
925 | + $buff[] = "\tCaller : ".$obj->caller; |
|
926 | + $buff[] = "\tCalled : ".$obj->called; |
|
927 | 927 | } |
928 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
928 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
929 | 929 | { |
930 | - $buff[] = "\tAddon : " . $obj->called; |
|
931 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
930 | + $buff[] = "\tAddon : ".$obj->called; |
|
931 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
932 | 932 | } |
933 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
933 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
934 | 934 | { |
935 | - $buff[] = "\tWidget : " . $obj->called; |
|
935 | + $buff[] = "\tWidget : ".$obj->called; |
|
936 | 936 | } |
937 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
937 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
938 | 938 | { |
939 | 939 | |
940 | 940 | $buff[] = $obj->query; |
941 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
942 | - $buff[] = "\tCaller : " . $obj->caller; |
|
943 | - $buff[] = "\tConnection : " . $obj->connection; |
|
941 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
942 | + $buff[] = "\tCaller : ".$obj->caller; |
|
943 | + $buff[] = "\tConnection : ".$obj->connection; |
|
944 | 944 | } |
945 | 945 | else |
946 | 946 | { |
947 | 947 | $write_file = false; |
948 | 948 | } |
949 | 949 | |
950 | - if($write_file) |
|
950 | + if ($write_file) |
|
951 | 951 | { |
952 | 952 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
953 | - $buff[] = PHP_EOL . PHP_EOL; |
|
953 | + $buff[] = PHP_EOL.PHP_EOL; |
|
954 | 954 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
955 | 955 | } |
956 | 956 | |
957 | - if($type != 'query') |
|
957 | + if ($type != 'query') |
|
958 | 958 | { |
959 | 959 | $trigger_args = $obj; |
960 | 960 | $trigger_args->_log_type = $type; |
@@ -994,11 +994,11 @@ discard block |
||
994 | 994 | */ |
995 | 995 | function delObjectVars($target_obj, $del_obj) |
996 | 996 | { |
997 | - if(!is_object($target_obj)) |
|
997 | + if (!is_object($target_obj)) |
|
998 | 998 | { |
999 | 999 | return; |
1000 | 1000 | } |
1001 | - if(!is_object($del_obj)) |
|
1001 | + if (!is_object($del_obj)) |
|
1002 | 1002 | { |
1003 | 1003 | return; |
1004 | 1004 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | |
1009 | 1009 | $target = array_keys($target_vars); |
1010 | 1010 | $del = array_keys($del_vars); |
1011 | - if(!count($target) || !count($del)) |
|
1011 | + if (!count($target) || !count($del)) |
|
1012 | 1012 | { |
1013 | 1013 | return $target_obj; |
1014 | 1014 | } |
@@ -1016,10 +1016,10 @@ discard block |
||
1016 | 1016 | $return_obj = new stdClass(); |
1017 | 1017 | |
1018 | 1018 | $target_count = count($target); |
1019 | - for($i = 0; $i < $target_count; $i++) |
|
1019 | + for ($i = 0; $i < $target_count; $i++) |
|
1020 | 1020 | { |
1021 | 1021 | $target_key = $target[$i]; |
1022 | - if(!in_array($target_key, $del)) |
|
1022 | + if (!in_array($target_key, $del)) |
|
1023 | 1023 | { |
1024 | 1024 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
1025 | 1025 | } |
@@ -1032,10 +1032,10 @@ discard block |
||
1032 | 1032 | { |
1033 | 1033 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
1034 | 1034 | |
1035 | - foreach($del_vars as $var) |
|
1035 | + foreach ($del_vars as $var) |
|
1036 | 1036 | { |
1037 | - if(is_array($vars)) unset($vars[$var]); |
|
1038 | - else if(is_object($vars)) unset($vars->$var); |
|
1037 | + if (is_array($vars)) unset($vars[$var]); |
|
1038 | + else if (is_object($vars)) unset($vars->$var); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | return $vars; |
@@ -1052,12 +1052,12 @@ discard block |
||
1052 | 1052 | */ |
1053 | 1053 | function handleError($errno, $errstr, $file, $line) |
1054 | 1054 | { |
1055 | - if(!__DEBUG__) |
|
1055 | + if (!__DEBUG__) |
|
1056 | 1056 | { |
1057 | 1057 | return; |
1058 | 1058 | } |
1059 | 1059 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
1060 | - if(!in_array($errno, $errors)) |
|
1060 | + if (!in_array($errno, $errors)) |
|
1061 | 1061 | { |
1062 | 1062 | return; |
1063 | 1063 | } |
@@ -1077,8 +1077,8 @@ discard block |
||
1077 | 1077 | function getNumberingPath($no, $size = 3) |
1078 | 1078 | { |
1079 | 1079 | $mod = pow(10, $size); |
1080 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
1081 | - if($no >= $mod) |
|
1080 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
1081 | + if ($no >= $mod) |
|
1082 | 1082 | { |
1083 | 1083 | $output .= getNumberingPath((int) $no / $mod, $size); |
1084 | 1084 | } |
@@ -1098,12 +1098,12 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | function purifierHtml(&$content) |
1100 | 1100 | { |
1101 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
1101 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
1102 | 1102 | $oPurifier = Purifier::getInstance(); |
1103 | 1103 | |
1104 | 1104 | // @see https://github.com/xpressengine/xe-core/issues/2278 |
1105 | 1105 | $logged_info = Context::get('logged_info'); |
1106 | - if($logged_info->is_admin !== 'Y') { |
|
1106 | + if ($logged_info->is_admin !== 'Y') { |
|
1107 | 1107 | $oPurifier->setConfig('HTML.Nofollow', true); |
1108 | 1108 | } |
1109 | 1109 | |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | */ |
1119 | 1119 | function removeHackTag($content) |
1120 | 1120 | { |
1121 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
1121 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
1122 | 1122 | $oEmbedFilter = EmbedFilter::getInstance(); |
1123 | 1123 | $oEmbedFilter->check($content); |
1124 | 1124 | |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | */ |
1161 | 1161 | function checkUploadedFile($file) |
1162 | 1162 | { |
1163 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
1163 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
1164 | 1164 | return UploadFileFilter::check($file); |
1165 | 1165 | } |
1166 | 1166 | |
@@ -1174,13 +1174,13 @@ discard block |
||
1174 | 1174 | { |
1175 | 1175 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
1176 | 1176 | |
1177 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1177 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1178 | 1178 | { |
1179 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1179 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1180 | 1180 | { |
1181 | 1181 | $content .= '</xmp>'; |
1182 | 1182 | } |
1183 | - else if($close_xmp < $start_xmp) |
|
1183 | + else if ($close_xmp < $start_xmp) |
|
1184 | 1184 | { |
1185 | 1185 | $content .= '</xmp>'; |
1186 | 1186 | } |
@@ -1200,33 +1200,33 @@ discard block |
||
1200 | 1200 | $tag = strtolower($match[2]); |
1201 | 1201 | |
1202 | 1202 | // xmp tag ?뺣━ |
1203 | - if($tag == 'xmp') |
|
1203 | + if ($tag == 'xmp') |
|
1204 | 1204 | { |
1205 | 1205 | return "<{$match[1]}xmp>"; |
1206 | 1206 | } |
1207 | - if($match[1]) |
|
1207 | + if ($match[1]) |
|
1208 | 1208 | { |
1209 | 1209 | return $match[0]; |
1210 | 1210 | } |
1211 | - if($match[4]) |
|
1211 | + if ($match[4]) |
|
1212 | 1212 | { |
1213 | - $match[4] = ' ' . $match[4]; |
|
1213 | + $match[4] = ' '.$match[4]; |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | $attrs = array(); |
1217 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1217 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1218 | 1218 | { |
1219 | - foreach($m[1] as $idx => $name) |
|
1219 | + foreach ($m[1] as $idx => $name) |
|
1220 | 1220 | { |
1221 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1221 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1222 | 1222 | { |
1223 | 1223 | continue; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - $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]); |
|
1226 | + $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]); |
|
1227 | 1227 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
1228 | 1228 | |
1229 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
1229 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
1230 | 1230 | { |
1231 | 1231 | continue; |
1232 | 1232 | } |
@@ -1237,60 +1237,60 @@ discard block |
||
1237 | 1237 | |
1238 | 1238 | $filter_arrts = array('style', 'src', 'href'); |
1239 | 1239 | |
1240 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1241 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1240 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
1241 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
1242 | 1242 | |
1243 | - foreach($filter_arrts as $attr) |
|
1243 | + foreach ($filter_arrts as $attr) |
|
1244 | 1244 | { |
1245 | - if(!isset($attrs[$attr])) continue; |
|
1245 | + if (!isset($attrs[$attr])) continue; |
|
1246 | 1246 | |
1247 | 1247 | $attr_value = rawurldecode($attrs[$attr]); |
1248 | 1248 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
1249 | 1249 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
1250 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1250 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1251 | 1251 | { |
1252 | 1252 | unset($attrs[$attr]); |
1253 | 1253 | } |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1256 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1257 | 1257 | { |
1258 | 1258 | unset($attrs['style']); |
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | $attr = array(); |
1262 | - foreach($attrs as $name => $val) |
|
1262 | + foreach ($attrs as $name => $val) |
|
1263 | 1263 | { |
1264 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1264 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1265 | 1265 | { |
1266 | 1266 | $attribute = strtolower(trim($name)); |
1267 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1267 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1268 | 1268 | { |
1269 | - if(stripos($val, 'data:') === 0) |
|
1269 | + if (stripos($val, 'data:') === 0) |
|
1270 | 1270 | { |
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | } |
1275 | 1275 | |
1276 | - if($tag == 'img') |
|
1276 | + if ($tag == 'img') |
|
1277 | 1277 | { |
1278 | 1278 | $attribute = strtolower(trim($name)); |
1279 | - if(stripos($val, 'data:') === 0) |
|
1279 | + if (stripos($val, 'data:') === 0) |
|
1280 | 1280 | { |
1281 | 1281 | continue; |
1282 | 1282 | } |
1283 | 1283 | } |
1284 | 1284 | $val = str_replace('"', '"', $val); |
1285 | - $attr[] = $name . "=\"{$val}\""; |
|
1285 | + $attr[] = $name."=\"{$val}\""; |
|
1286 | 1286 | } |
1287 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
1287 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
1288 | 1288 | |
1289 | 1289 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | // convert hexa value to RGB |
1293 | -if(!function_exists('hexrgb')) |
|
1293 | +if (!function_exists('hexrgb')) |
|
1294 | 1294 | { |
1295 | 1295 | |
1296 | 1296 | /** |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | |
1327 | 1327 | settype($password, "string"); |
1328 | 1328 | |
1329 | - for($i = 0; $i < strlen($password); $i++) |
|
1329 | + for ($i = 0; $i < strlen($password); $i++) |
|
1330 | 1330 | { |
1331 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
1331 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
1332 | 1332 | { |
1333 | 1333 | continue; |
1334 | 1334 | } |
@@ -1340,11 +1340,11 @@ discard block |
||
1340 | 1340 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
1341 | 1341 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
1342 | 1342 | |
1343 | - if($result1 == '80000000') |
|
1343 | + if ($result1 == '80000000') |
|
1344 | 1344 | { |
1345 | 1345 | $nr += 0x80000000; |
1346 | 1346 | } |
1347 | - if($result2 == '80000000') |
|
1347 | + if ($result2 == '80000000') |
|
1348 | 1348 | { |
1349 | 1349 | $nr2 += 0x80000000; |
1350 | 1350 | } |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | function getScriptPath() |
1361 | 1361 | { |
1362 | 1362 | static $url = NULL; |
1363 | - if($url == NULL) |
|
1363 | + if ($url == NULL) |
|
1364 | 1364 | { |
1365 | 1365 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
1366 | 1366 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1391,14 +1391,14 @@ discard block |
||
1391 | 1391 | $decodedStr = ''; |
1392 | 1392 | $pos = 0; |
1393 | 1393 | $len = strlen($source); |
1394 | - while($pos < $len) |
|
1394 | + while ($pos < $len) |
|
1395 | 1395 | { |
1396 | 1396 | $charAt = substr($source, $pos, 1); |
1397 | - if($charAt == '%') |
|
1397 | + if ($charAt == '%') |
|
1398 | 1398 | { |
1399 | 1399 | $pos++; |
1400 | 1400 | $charAt = substr($source, $pos, 1); |
1401 | - if($charAt == 'u') |
|
1401 | + if ($charAt == 'u') |
|
1402 | 1402 | { |
1403 | 1403 | // we got a unicode character |
1404 | 1404 | $pos++; |
@@ -1432,21 +1432,21 @@ discard block |
||
1432 | 1432 | */ |
1433 | 1433 | function _code2utf($num) |
1434 | 1434 | { |
1435 | - if($num < 128) |
|
1435 | + if ($num < 128) |
|
1436 | 1436 | { |
1437 | 1437 | return chr($num); |
1438 | 1438 | } |
1439 | - if($num < 2048) |
|
1439 | + if ($num < 2048) |
|
1440 | 1440 | { |
1441 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1441 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
1442 | 1442 | } |
1443 | - if($num < 65536) |
|
1443 | + if ($num < 65536) |
|
1444 | 1444 | { |
1445 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1445 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1446 | 1446 | } |
1447 | - if($num < 2097152) |
|
1447 | + if ($num < 2097152) |
|
1448 | 1448 | { |
1449 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1449 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1450 | 1450 | } |
1451 | 1451 | return ''; |
1452 | 1452 | } |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | */ |
1462 | 1462 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
1463 | 1463 | { |
1464 | - if($urldecode) |
|
1464 | + if ($urldecode) |
|
1465 | 1465 | { |
1466 | 1466 | $string = urldecode($string); |
1467 | 1467 | } |
@@ -1469,12 +1469,12 @@ discard block |
||
1469 | 1469 | $sample = iconv('utf-8', 'utf-8', $string); |
1470 | 1470 | $is_utf8 = (md5($sample) === md5($string)); |
1471 | 1471 | |
1472 | - if(!$urldecode) |
|
1472 | + if (!$urldecode) |
|
1473 | 1473 | { |
1474 | 1474 | $string = urldecode($string); |
1475 | 1475 | } |
1476 | 1476 | |
1477 | - if($return_convert) |
|
1477 | + if ($return_convert) |
|
1478 | 1478 | { |
1479 | 1479 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
1480 | 1480 | } |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | */ |
1491 | 1491 | function json_encode2($data) |
1492 | 1492 | { |
1493 | - switch(gettype($data)) |
|
1493 | + switch (gettype($data)) |
|
1494 | 1494 | { |
1495 | 1495 | case 'boolean': |
1496 | 1496 | return $data ? 'true' : 'false'; |
@@ -1498,15 +1498,15 @@ discard block |
||
1498 | 1498 | case 'double': |
1499 | 1499 | return $data; |
1500 | 1500 | case 'string': |
1501 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
1501 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
1502 | 1502 | case 'object': |
1503 | 1503 | $data = get_object_vars($data); |
1504 | 1504 | case 'array': |
1505 | 1505 | $rel = FALSE; // relative array? |
1506 | 1506 | $key = array_keys($data); |
1507 | - foreach($key as $v) |
|
1507 | + foreach ($key as $v) |
|
1508 | 1508 | { |
1509 | - if(!is_int($v)) |
|
1509 | + if (!is_int($v)) |
|
1510 | 1510 | { |
1511 | 1511 | $rel = TRUE; |
1512 | 1512 | break; |
@@ -1514,12 +1514,12 @@ discard block |
||
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | $arr = array(); |
1517 | - foreach($data as $k => $v) |
|
1517 | + foreach ($data as $k => $v) |
|
1518 | 1518 | { |
1519 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
1519 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
1522 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
1523 | 1523 | default: |
1524 | 1524 | return '""'; |
1525 | 1525 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | */ |
1534 | 1534 | function isCrawler($agent = NULL) |
1535 | 1535 | { |
1536 | - if(!$agent) |
|
1536 | + if (!$agent) |
|
1537 | 1537 | { |
1538 | 1538 | $agent = $_SERVER['HTTP_USER_AGENT']; |
1539 | 1539 | } |
@@ -1543,9 +1543,9 @@ discard block |
||
1543 | 1543 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
1544 | 1544 | ); |
1545 | 1545 | |
1546 | - foreach($check_agent as $str) |
|
1546 | + foreach ($check_agent as $str) |
|
1547 | 1547 | { |
1548 | - if(stristr($agent, $str) != FALSE) |
|
1548 | + if (stristr($agent, $str) != FALSE) |
|
1549 | 1549 | { |
1550 | 1550 | return TRUE; |
1551 | 1551 | } |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | */ |
1564 | 1564 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
1565 | 1565 | { |
1566 | - if(!Context::get('is_logged')) |
|
1566 | + if (!Context::get('is_logged')) |
|
1567 | 1567 | { |
1568 | 1568 | return; |
1569 | 1569 | } |
@@ -1571,18 +1571,18 @@ discard block |
||
1571 | 1571 | $oModuleModel = getModel('module'); |
1572 | 1572 | $logged_info = Context::get('logged_info'); |
1573 | 1573 | |
1574 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1574 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1575 | 1575 | { |
1576 | - if($writer_member_srl) |
|
1576 | + if ($writer_member_srl) |
|
1577 | 1577 | { |
1578 | 1578 | $oMemberModel = getModel('member'); |
1579 | 1579 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
1580 | - if($member_info->is_admin == "Y") |
|
1580 | + if ($member_info->is_admin == "Y") |
|
1581 | 1581 | { |
1582 | 1582 | return; |
1583 | 1583 | } |
1584 | 1584 | } |
1585 | - $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>"; |
|
1585 | + $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>"; |
|
1586 | 1586 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
1587 | 1587 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
1588 | 1588 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1599,18 +1599,18 @@ discard block |
||
1599 | 1599 | function requirePear() |
1600 | 1600 | { |
1601 | 1601 | static $required = false; |
1602 | - if($required) |
|
1602 | + if ($required) |
|
1603 | 1603 | { |
1604 | 1604 | return; |
1605 | 1605 | } |
1606 | 1606 | |
1607 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1607 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1608 | 1608 | { |
1609 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
1609 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
1610 | 1610 | } |
1611 | 1611 | else |
1612 | 1612 | { |
1613 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
1613 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | $required = true; |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | |
1619 | 1619 | function checkCSRF() |
1620 | 1620 | { |
1621 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1621 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1622 | 1622 | { |
1623 | 1623 | return FALSE; |
1624 | 1624 | } |
@@ -1626,9 +1626,9 @@ discard block |
||
1626 | 1626 | $default_url = Context::getDefaultUrl(); |
1627 | 1627 | $referer = $_SERVER["HTTP_REFERER"]; |
1628 | 1628 | |
1629 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1629 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1630 | 1630 | { |
1631 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1631 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1632 | 1632 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1633 | 1633 | $referer = $IDN->encode($referer); |
1634 | 1634 | } |
@@ -1639,9 +1639,9 @@ discard block |
||
1639 | 1639 | $oModuleModel = getModel('module'); |
1640 | 1640 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
1641 | 1641 | |
1642 | - if($siteModuleInfo->site_srl == 0) |
|
1642 | + if ($siteModuleInfo->site_srl == 0) |
|
1643 | 1643 | { |
1644 | - if($default_url['host'] !== $referer['host']) |
|
1644 | + if ($default_url['host'] !== $referer['host']) |
|
1645 | 1645 | { |
1646 | 1646 | return FALSE; |
1647 | 1647 | } |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | else |
1650 | 1650 | { |
1651 | 1651 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1652 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1652 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1653 | 1653 | { |
1654 | 1654 | return FALSE; |
1655 | 1655 | } |
@@ -1665,15 +1665,15 @@ discard block |
||
1665 | 1665 | */ |
1666 | 1666 | function recurciveExposureCheck(&$menu) |
1667 | 1667 | { |
1668 | - if(is_array($menu)) |
|
1668 | + if (is_array($menu)) |
|
1669 | 1669 | { |
1670 | - foreach($menu AS $key=>$value) |
|
1670 | + foreach ($menu AS $key=>$value) |
|
1671 | 1671 | { |
1672 | - if(!$value['isShow']) |
|
1672 | + if (!$value['isShow']) |
|
1673 | 1673 | { |
1674 | 1674 | unset($menu[$key]); |
1675 | 1675 | } |
1676 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
1676 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
1677 | 1677 | { |
1678 | 1678 | recurciveExposureCheck($menu[$key]['list']); |
1679 | 1679 | } |
@@ -1683,14 +1683,14 @@ discard block |
||
1683 | 1683 | |
1684 | 1684 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1685 | 1685 | { |
1686 | - if($requestKey != $dbKey) |
|
1686 | + if ($requestKey != $dbKey) |
|
1687 | 1687 | { |
1688 | 1688 | $arrayUrl = parse_url(Context::get('success_return_url')); |
1689 | - if($arrayUrl['query']) |
|
1689 | + if ($arrayUrl['query']) |
|
1690 | 1690 | { |
1691 | 1691 | parse_str($arrayUrl['query'], $parsedStr); |
1692 | 1692 | |
1693 | - if(isset($parsedStr[$key])) |
|
1693 | + if (isset($parsedStr[$key])) |
|
1694 | 1694 | { |
1695 | 1695 | $parsedStr[$key] = $requestKey; |
1696 | 1696 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1733,14 +1733,14 @@ discard block |
||
1733 | 1733 | */ |
1734 | 1734 | function alertScript($msg) |
1735 | 1735 | { |
1736 | - if(!$msg) |
|
1736 | + if (!$msg) |
|
1737 | 1737 | { |
1738 | 1738 | return; |
1739 | 1739 | } |
1740 | 1740 | |
1741 | 1741 | echo '<script type="text/javascript"> |
1742 | 1742 | //<![CDATA[ |
1743 | -alert("' . $msg . '"); |
|
1743 | +alert("' . $msg.'"); |
|
1744 | 1744 | //]]> |
1745 | 1745 | </script>'; |
1746 | 1746 | } |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | |
1772 | 1772 | echo '<script type="text/javascript"> |
1773 | 1773 | //<![CDATA[ |
1774 | -' . $reloadScript . ' |
|
1774 | +' . $reloadScript.' |
|
1775 | 1775 | //]]> |
1776 | 1776 | </script>'; |
1777 | 1777 | } |