@@ -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,7 +250,7 @@ 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 | 255 | $arr_seq = $_SESSION['seq']; |
| 256 | 256 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function checkUserSequence($seq) |
| 268 | 268 | { |
| 269 | - if(!isset($_SESSION['seq'])) |
|
| 269 | + if (!isset($_SESSION['seq'])) |
|
| 270 | 270 | { |
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | - if(!in_array($seq, $_SESSION['seq'])) |
|
| 273 | + if (!in_array($seq, $_SESSION['seq'])) |
|
| 274 | 274 | { |
| 275 | 275 | return false; |
| 276 | 276 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $num_args = func_num_args(); |
| 297 | 297 | $args_list = func_get_args(); |
| 298 | 298 | |
| 299 | - if($num_args) |
|
| 299 | + if ($num_args) |
|
| 300 | 300 | $url = Context::getUrl($num_args, $args_list); |
| 301 | 301 | else |
| 302 | 302 | $url = Context::getRequestUri(); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $num_args = func_num_args(); |
| 316 | 316 | $args_list = func_get_args(); |
| 317 | 317 | |
| 318 | - if($num_args) |
|
| 318 | + if ($num_args) |
|
| 319 | 319 | { |
| 320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 321 | 321 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $num_args = func_num_args(); |
| 339 | 339 | $args_list = func_get_args(); |
| 340 | 340 | |
| 341 | - if($num_args) |
|
| 341 | + if ($num_args) |
|
| 342 | 342 | { |
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
| 344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | $num_args = func_num_args(); |
| 361 | 361 | $args_list = func_get_args(); |
| 362 | 362 | $request_uri = Context::getRequestUri(); |
| 363 | - if(!$num_args) |
|
| 363 | + if (!$num_args) |
|
| 364 | 364 | { |
| 365 | 365 | return $request_uri; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $url = Context::getUrl($num_args, $args_list); |
| 369 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 369 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 370 | 370 | { |
| 371 | 371 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 372 | - return substr($match[0], 0, -1) . $url; |
|
| 372 | + return substr($match[0], 0, -1).$url; |
|
| 373 | 373 | } |
| 374 | 374 | return $url; |
| 375 | 375 | } |
@@ -384,17 +384,17 @@ discard block |
||
| 384 | 384 | $num_args = func_num_args(); |
| 385 | 385 | $args_list = func_get_args(); |
| 386 | 386 | $request_uri = Context::getRequestUri(); |
| 387 | - if(!$num_args) |
|
| 387 | + if (!$num_args) |
|
| 388 | 388 | { |
| 389 | 389 | return $request_uri; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 393 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 393 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 394 | 394 | { |
| 395 | 395 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 397 | - return substr($match[0], 0, -1) . $url; |
|
| 397 | + return substr($match[0], 0, -1).$url; |
|
| 398 | 398 | } |
| 399 | 399 | return $url; |
| 400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $num_args = func_num_args(); |
| 411 | 411 | $args_list = func_get_args(); |
| 412 | 412 | |
| 413 | - if(!$num_args) |
|
| 413 | + if (!$num_args) |
|
| 414 | 414 | { |
| 415 | 415 | return Context::getRequestUri(); |
| 416 | 416 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $num_args = func_num_args(); |
| 433 | 433 | $args_list = func_get_args(); |
| 434 | 434 | |
| 435 | - if(!$num_args) |
|
| 435 | + if (!$num_args) |
|
| 436 | 436 | { |
| 437 | 437 | return Context::getRequestUri(); |
| 438 | 438 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $args_list = func_get_args(); |
| 455 | 455 | |
| 456 | 456 | $request_uri = Context::getRequestUri(); |
| 457 | - if(!$num_args) |
|
| 457 | + if (!$num_args) |
|
| 458 | 458 | { |
| 459 | 459 | return $request_uri; |
| 460 | 460 | } |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | $num_args = count($args_list); |
| 464 | 464 | |
| 465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain); |
| 466 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 466 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 467 | 467 | { |
| 468 | 468 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 469 | - return substr($match[0], 0, -1) . $url; |
|
| 469 | + return substr($match[0], 0, -1).$url; |
|
| 470 | 470 | } |
| 471 | 471 | return $url; |
| 472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | function getCurrentPageUrl() |
| 480 | 480 | { |
| 481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
| 482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 482 | + $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | function cut_str($string, $cut_size = 0, $tail = '...') |
| 506 | 506 | { |
| 507 | - if($cut_size < 1 || !$string) |
|
| 507 | + if ($cut_size < 1 || !$string) |
|
| 508 | 508 | { |
| 509 | 509 | return $string; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 512 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 513 | 513 | { |
| 514 | 514 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
| 515 | 515 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | $char_count = 0; |
| 524 | 524 | |
| 525 | 525 | $idx = 0; |
| 526 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 526 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 527 | 527 | { |
| 528 | 528 | $c = ord(substr($string, $idx, 1)); |
| 529 | 529 | $char_count++; |
| 530 | - if($c < 128) |
|
| 530 | + if ($c < 128) |
|
| 531 | 531 | { |
| 532 | 532 | $char_width += (int) $chars[$c - 32]; |
| 533 | 533 | $idx++; |
| 534 | 534 | } |
| 535 | - else if(191 < $c && $c < 224) |
|
| 535 | + else if (191 < $c && $c < 224) |
|
| 536 | 536 | { |
| 537 | 537 | $char_width += $chars[4]; |
| 538 | 538 | $idx += 2; |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | $output = substr($string, 0, $idx); |
| 548 | - if(strlen($output) < $string_length) |
|
| 548 | + if (strlen($output) < $string_length) |
|
| 549 | 549 | { |
| 550 | 550 | $output .= $tail; |
| 551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | function zgap() |
| 562 | 562 | { |
| 563 | 563 | $time_zone = $GLOBALS['_time_zone']; |
| 564 | - if($time_zone < 0) |
|
| 564 | + if ($time_zone < 0) |
|
| 565 | 565 | { |
| 566 | 566 | $to = -1; |
| 567 | 567 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $t_min = substr($time_zone, 3, 2) * $to; |
| 575 | 575 | |
| 576 | 576 | $server_time_zone = date("O"); |
| 577 | - if($server_time_zone < 0) |
|
| 577 | + if ($server_time_zone < 0) |
|
| 578 | 578 | { |
| 579 | 579 | $so = -1; |
| 580 | 580 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | function ztime($str) |
| 603 | 603 | { |
| 604 | - if(!$str) |
|
| 604 | + if (!$str) |
|
| 605 | 605 | { |
| 606 | 606 | return; |
| 607 | 607 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $year = (int) substr($str, 0, 4); |
| 613 | 613 | $month = (int) substr($str, 4, 2); |
| 614 | 614 | $day = (int) substr($str, 6, 2); |
| 615 | - if(strlen($str) <= 8) |
|
| 615 | + if (strlen($str) <= 8) |
|
| 616 | 616 | { |
| 617 | 617 | $gap = 0; |
| 618 | 618 | } |
@@ -636,19 +636,19 @@ discard block |
||
| 636 | 636 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
| 637 | 637 | |
| 638 | 638 | $lang_time_gap = Context::getLang('time_gap'); |
| 639 | - if($gap < 60) |
|
| 639 | + if ($gap < 60) |
|
| 640 | 640 | { |
| 641 | 641 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
| 642 | 642 | } |
| 643 | - elseif($gap < 60 * 60) |
|
| 643 | + elseif ($gap < 60 * 60) |
|
| 644 | 644 | { |
| 645 | 645 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
| 646 | 646 | } |
| 647 | - elseif($gap < 60 * 60 * 2) |
|
| 647 | + elseif ($gap < 60 * 60 * 2) |
|
| 648 | 648 | { |
| 649 | 649 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
| 650 | 650 | } |
| 651 | - elseif($gap < 60 * 60 * 24) |
|
| 651 | + elseif ($gap < 60 * 60 * 24) |
|
| 652 | 652 | { |
| 653 | 653 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
| 654 | 654 | } |
@@ -685,40 +685,40 @@ discard block |
||
| 685 | 685 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
| 686 | 686 | { |
| 687 | 687 | // return null if no target time is specified |
| 688 | - if(!$str) |
|
| 688 | + if (!$str) |
|
| 689 | 689 | { |
| 690 | 690 | return; |
| 691 | 691 | } |
| 692 | 692 | // convert the date format according to the language |
| 693 | - if($conversion == TRUE) |
|
| 693 | + if ($conversion == TRUE) |
|
| 694 | 694 | { |
| 695 | - switch(Context::getLangType()) |
|
| 695 | + switch (Context::getLangType()) |
|
| 696 | 696 | { |
| 697 | 697 | case 'en' : |
| 698 | 698 | case 'es' : |
| 699 | - if($format == 'Y-m-d') |
|
| 699 | + if ($format == 'Y-m-d') |
|
| 700 | 700 | { |
| 701 | 701 | $format = 'M d, Y'; |
| 702 | 702 | } |
| 703 | - elseif($format == 'Y-m-d H:i:s') |
|
| 703 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 704 | 704 | { |
| 705 | 705 | $format = 'M d, Y H:i:s'; |
| 706 | 706 | } |
| 707 | - elseif($format == 'Y-m-d H:i') |
|
| 707 | + elseif ($format == 'Y-m-d H:i') |
|
| 708 | 708 | { |
| 709 | 709 | $format = 'M d, Y H:i'; |
| 710 | 710 | } |
| 711 | 711 | break; |
| 712 | 712 | case 'vi' : |
| 713 | - if($format == 'Y-m-d') |
|
| 713 | + if ($format == 'Y-m-d') |
|
| 714 | 714 | { |
| 715 | 715 | $format = 'd-m-Y'; |
| 716 | 716 | } |
| 717 | - elseif($format == 'Y-m-d H:i:s') |
|
| 717 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 718 | 718 | { |
| 719 | 719 | $format = 'H:i:s d-m-Y'; |
| 720 | 720 | } |
| 721 | - elseif($format == 'Y-m-d H:i') |
|
| 721 | + elseif ($format == 'Y-m-d H:i') |
|
| 722 | 722 | { |
| 723 | 723 | $format = 'H:i d-m-Y'; |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // If year value is less than 1970, handle it separately. |
| 730 | - if((int) substr($str, 0, 4) < 1970) |
|
| 730 | + if ((int) substr($str, 0, 4) < 1970) |
|
| 731 | 731 | { |
| 732 | 732 | $hour = (int) substr($str, 8, 2); |
| 733 | 733 | $min = (int) substr($str, 10, 2); |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | function getEncodeEmailAddress($email) |
| 778 | 778 | { |
| 779 | 779 | $return = ''; |
| 780 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 780 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 781 | 781 | { |
| 782 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
| 782 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
| 783 | 783 | } |
| 784 | 784 | return $return; |
| 785 | 785 | } |
@@ -800,25 +800,25 @@ discard block |
||
| 800 | 800 | static $debug_file; |
| 801 | 801 | static $debug_file_exist; |
| 802 | 802 | |
| 803 | - if(!(__DEBUG__ & 1)) |
|
| 803 | + if (!(__DEBUG__ & 1)) |
|
| 804 | 804 | { |
| 805 | 805 | return; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | static $firephp; |
| 809 | 809 | $bt = debug_backtrace(); |
| 810 | - if(is_array($bt)) |
|
| 810 | + if (is_array($bt)) |
|
| 811 | 811 | { |
| 812 | 812 | $bt_debug_print = array_shift($bt); |
| 813 | 813 | $bt_called_function = array_shift($bt); |
| 814 | 814 | } |
| 815 | 815 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
| 816 | 816 | $line_num = $bt_debug_print['line']; |
| 817 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
| 817 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
| 818 | 818 | |
| 819 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 819 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 820 | 820 | { |
| 821 | - if(!isset($firephp)) |
|
| 821 | + if (!isset($firephp)) |
|
| 822 | 822 | { |
| 823 | 823 | $firephp = FirePHP::getInstance(TRUE); |
| 824 | 824 | } |
@@ -827,16 +827,16 @@ discard block |
||
| 827 | 827 | $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())); |
| 828 | 828 | |
| 829 | 829 | // Check a FirePHP option |
| 830 | - if($display_option === 'TABLE') |
|
| 830 | + if ($display_option === 'TABLE') |
|
| 831 | 831 | { |
| 832 | 832 | $label = $display_option; |
| 833 | 833 | } |
| 834 | - if($display_option === 'ERROR') |
|
| 834 | + if ($display_option === 'ERROR') |
|
| 835 | 835 | { |
| 836 | 836 | $type = $display_option; |
| 837 | 837 | } |
| 838 | 838 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
| 839 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 839 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 840 | 840 | { |
| 841 | 841 | $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'; |
| 842 | 842 | $label = NULL; |
@@ -846,18 +846,18 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | else |
| 848 | 848 | { |
| 849 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 849 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 850 | 850 | { |
| 851 | 851 | return; |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | $print = array(); |
| 855 | - if($debug_file_exist === NULL) $print[] = '<?php exit() ?>'; |
|
| 855 | + if ($debug_file_exist === NULL) $print[] = '<?php exit() ?>'; |
|
| 856 | 856 | |
| 857 | - if(!$debug_file) $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 858 | - if(!$debug_file_exist) $debug_file_exist = file_exists($debug_file); |
|
| 857 | + if (!$debug_file) $debug_file = _XE_PATH_.'files/'.$file; |
|
| 858 | + if (!$debug_file_exist) $debug_file_exist = file_exists($debug_file); |
|
| 859 | 859 | |
| 860 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
| 860 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
| 861 | 861 | { |
| 862 | 862 | $print[] = str_repeat('=', 80); |
| 863 | 863 | } |
@@ -865,10 +865,10 @@ discard block |
||
| 865 | 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 | |
| 867 | 867 | $type = gettype($debug_output); |
| 868 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
| 868 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
| 869 | 869 | { |
| 870 | - if($display_option === 'ERROR') $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
| 871 | - else $print[] = $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
| 870 | + if ($display_option === 'ERROR') $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
| 871 | + else $print[] = $type.'('.var_export($debug_output, TRUE).')'; |
|
| 872 | 872 | $print[] = PHP_EOL.PHP_EOL; |
| 873 | 873 | } |
| 874 | 874 | else |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $print[] = PHP_EOL; |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 880 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | */ |
| 889 | 889 | function writeSlowlog($type, $elapsed_time, $obj) |
| 890 | 890 | { |
| 891 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 891 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 892 | 892 | |
| 893 | 893 | static $log_filename = array( |
| 894 | 894 | 'query' => 'files/_slowlog_query.php', |
@@ -898,47 +898,47 @@ discard block |
||
| 898 | 898 | ); |
| 899 | 899 | $write_file = true; |
| 900 | 900 | |
| 901 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
| 901 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
| 902 | 902 | |
| 903 | 903 | $buff = array(); |
| 904 | 904 | $buff[] = '<?php exit(); ?>'; |
| 905 | 905 | $buff[] = date('c'); |
| 906 | 906 | |
| 907 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 907 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 908 | 908 | { |
| 909 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 910 | - $buff[] = "\tCalled : " . $obj->called; |
|
| 909 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 910 | + $buff[] = "\tCalled : ".$obj->called; |
|
| 911 | 911 | } |
| 912 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 912 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 913 | 913 | { |
| 914 | - $buff[] = "\tAddon : " . $obj->called; |
|
| 915 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
| 914 | + $buff[] = "\tAddon : ".$obj->called; |
|
| 915 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
| 916 | 916 | } |
| 917 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 917 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 918 | 918 | { |
| 919 | - $buff[] = "\tWidget : " . $obj->called; |
|
| 919 | + $buff[] = "\tWidget : ".$obj->called; |
|
| 920 | 920 | } |
| 921 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 921 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 922 | 922 | { |
| 923 | 923 | |
| 924 | 924 | $buff[] = $obj->query; |
| 925 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
| 926 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 927 | - $buff[] = "\tConnection : " . $obj->connection; |
|
| 925 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
| 926 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 927 | + $buff[] = "\tConnection : ".$obj->connection; |
|
| 928 | 928 | } |
| 929 | 929 | else |
| 930 | 930 | { |
| 931 | 931 | $write_file = false; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - if($write_file) |
|
| 934 | + if ($write_file) |
|
| 935 | 935 | { |
| 936 | 936 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
| 937 | - $buff[] = PHP_EOL . PHP_EOL; |
|
| 937 | + $buff[] = PHP_EOL.PHP_EOL; |
|
| 938 | 938 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | - if($type != 'query') |
|
| 941 | + if ($type != 'query') |
|
| 942 | 942 | { |
| 943 | 943 | $trigger_args = $obj; |
| 944 | 944 | $trigger_args->_log_type = $type; |
@@ -978,11 +978,11 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | function delObjectVars($target_obj, $del_obj) |
| 980 | 980 | { |
| 981 | - if(!is_object($target_obj)) |
|
| 981 | + if (!is_object($target_obj)) |
|
| 982 | 982 | { |
| 983 | 983 | return; |
| 984 | 984 | } |
| 985 | - if(!is_object($del_obj)) |
|
| 985 | + if (!is_object($del_obj)) |
|
| 986 | 986 | { |
| 987 | 987 | return; |
| 988 | 988 | } |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | $target = array_keys($target_vars); |
| 994 | 994 | $del = array_keys($del_vars); |
| 995 | - if(!count($target) || !count($del)) |
|
| 995 | + if (!count($target) || !count($del)) |
|
| 996 | 996 | { |
| 997 | 997 | return $target_obj; |
| 998 | 998 | } |
@@ -1000,10 +1000,10 @@ discard block |
||
| 1000 | 1000 | $return_obj = new stdClass(); |
| 1001 | 1001 | |
| 1002 | 1002 | $target_count = count($target); |
| 1003 | - for($i = 0; $i < $target_count; $i++) |
|
| 1003 | + for ($i = 0; $i < $target_count; $i++) |
|
| 1004 | 1004 | { |
| 1005 | 1005 | $target_key = $target[$i]; |
| 1006 | - if(!in_array($target_key, $del)) |
|
| 1006 | + if (!in_array($target_key, $del)) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
| 1009 | 1009 | } |
@@ -1016,10 +1016,10 @@ discard block |
||
| 1016 | 1016 | { |
| 1017 | 1017 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
| 1018 | 1018 | |
| 1019 | - foreach($del_vars as $var) |
|
| 1019 | + foreach ($del_vars as $var) |
|
| 1020 | 1020 | { |
| 1021 | - if(is_array($vars)) unset($vars[$var]); |
|
| 1022 | - else if(is_object($vars)) unset($vars->$var); |
|
| 1021 | + if (is_array($vars)) unset($vars[$var]); |
|
| 1022 | + else if (is_object($vars)) unset($vars->$var); |
|
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | return $vars; |
@@ -1036,12 +1036,12 @@ discard block |
||
| 1036 | 1036 | */ |
| 1037 | 1037 | function handleError($errno, $errstr, $file, $line) |
| 1038 | 1038 | { |
| 1039 | - if(!__DEBUG__) |
|
| 1039 | + if (!__DEBUG__) |
|
| 1040 | 1040 | { |
| 1041 | 1041 | return; |
| 1042 | 1042 | } |
| 1043 | 1043 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
| 1044 | - if(!in_array($errno, $errors)) |
|
| 1044 | + if (!in_array($errno, $errors)) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return; |
| 1047 | 1047 | } |
@@ -1061,8 +1061,8 @@ discard block |
||
| 1061 | 1061 | function getNumberingPath($no, $size = 3) |
| 1062 | 1062 | { |
| 1063 | 1063 | $mod = pow(10, $size); |
| 1064 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
| 1065 | - if($no >= $mod) |
|
| 1064 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
| 1065 | + if ($no >= $mod) |
|
| 1066 | 1066 | { |
| 1067 | 1067 | $output .= getNumberingPath((int) $no / $mod, $size); |
| 1068 | 1068 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | |
| 1083 | 1083 | function purifierHtml(&$content) |
| 1084 | 1084 | { |
| 1085 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
| 1085 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
| 1086 | 1086 | $oPurifier = Purifier::getInstance(); |
| 1087 | 1087 | $oPurifier->purify($content); |
| 1088 | 1088 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | */ |
| 1096 | 1096 | function removeHackTag($content) |
| 1097 | 1097 | { |
| 1098 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 1098 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 1099 | 1099 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 1100 | 1100 | $oEmbedFilter->check($content); |
| 1101 | 1101 | |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | */ |
| 1138 | 1138 | function checkUploadedFile($file) |
| 1139 | 1139 | { |
| 1140 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
| 1140 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
| 1141 | 1141 | return UploadFileFilter::check($file); |
| 1142 | 1142 | } |
| 1143 | 1143 | |
@@ -1151,13 +1151,13 @@ discard block |
||
| 1151 | 1151 | { |
| 1152 | 1152 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
| 1153 | 1153 | |
| 1154 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1154 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1155 | 1155 | { |
| 1156 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1156 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | $content .= '</xmp>'; |
| 1159 | 1159 | } |
| 1160 | - else if($close_xmp < $start_xmp) |
|
| 1160 | + else if ($close_xmp < $start_xmp) |
|
| 1161 | 1161 | { |
| 1162 | 1162 | $content .= '</xmp>'; |
| 1163 | 1163 | } |
@@ -1177,33 +1177,33 @@ discard block |
||
| 1177 | 1177 | $tag = strtolower($match[2]); |
| 1178 | 1178 | |
| 1179 | 1179 | // xmp tag ?뺣━ |
| 1180 | - if($tag == 'xmp') |
|
| 1180 | + if ($tag == 'xmp') |
|
| 1181 | 1181 | { |
| 1182 | 1182 | return "<{$match[1]}xmp>"; |
| 1183 | 1183 | } |
| 1184 | - if($match[1]) |
|
| 1184 | + if ($match[1]) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | return $match[0]; |
| 1187 | 1187 | } |
| 1188 | - if($match[4]) |
|
| 1188 | + if ($match[4]) |
|
| 1189 | 1189 | { |
| 1190 | - $match[4] = ' ' . $match[4]; |
|
| 1190 | + $match[4] = ' '.$match[4]; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | $attrs = array(); |
| 1194 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1194 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1195 | 1195 | { |
| 1196 | - foreach($m[1] as $idx => $name) |
|
| 1196 | + foreach ($m[1] as $idx => $name) |
|
| 1197 | 1197 | { |
| 1198 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1198 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | continue; |
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | - $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]); |
|
| 1203 | + $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]); |
|
| 1204 | 1204 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
| 1205 | 1205 | |
| 1206 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
| 1206 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
| 1207 | 1207 | { |
| 1208 | 1208 | continue; |
| 1209 | 1209 | } |
@@ -1214,60 +1214,60 @@ discard block |
||
| 1214 | 1214 | |
| 1215 | 1215 | $filter_arrts = array('style', 'src', 'href'); |
| 1216 | 1216 | |
| 1217 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1218 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1217 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1218 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1219 | 1219 | |
| 1220 | - foreach($filter_arrts as $attr) |
|
| 1220 | + foreach ($filter_arrts as $attr) |
|
| 1221 | 1221 | { |
| 1222 | - if(!isset($attrs[$attr])) continue; |
|
| 1222 | + if (!isset($attrs[$attr])) continue; |
|
| 1223 | 1223 | |
| 1224 | 1224 | $attr_value = rawurldecode($attrs[$attr]); |
| 1225 | 1225 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
| 1226 | 1226 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
| 1227 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1227 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1228 | 1228 | { |
| 1229 | 1229 | unset($attrs[$attr]); |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1233 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | unset($attrs['style']); |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | $attr = array(); |
| 1239 | - foreach($attrs as $name => $val) |
|
| 1239 | + foreach ($attrs as $name => $val) |
|
| 1240 | 1240 | { |
| 1241 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1241 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1242 | 1242 | { |
| 1243 | 1243 | $attribute = strtolower(trim($name)); |
| 1244 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1244 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1245 | 1245 | { |
| 1246 | - if(stripos($val, 'data:') === 0) |
|
| 1246 | + if (stripos($val, 'data:') === 0) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | continue; |
| 1249 | 1249 | } |
| 1250 | 1250 | } |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | - if($tag == 'img') |
|
| 1253 | + if ($tag == 'img') |
|
| 1254 | 1254 | { |
| 1255 | 1255 | $attribute = strtolower(trim($name)); |
| 1256 | - if(stripos($val, 'data:') === 0) |
|
| 1256 | + if (stripos($val, 'data:') === 0) |
|
| 1257 | 1257 | { |
| 1258 | 1258 | continue; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
| 1261 | 1261 | $val = str_replace('"', '"', $val); |
| 1262 | - $attr[] = $name . "=\"{$val}\""; |
|
| 1262 | + $attr[] = $name."=\"{$val}\""; |
|
| 1263 | 1263 | } |
| 1264 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
| 1264 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
| 1265 | 1265 | |
| 1266 | 1266 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | // convert hexa value to RGB |
| 1270 | -if(!function_exists('hexrgb')) |
|
| 1270 | +if (!function_exists('hexrgb')) |
|
| 1271 | 1271 | { |
| 1272 | 1272 | |
| 1273 | 1273 | /** |
@@ -1303,9 +1303,9 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | settype($password, "string"); |
| 1305 | 1305 | |
| 1306 | - for($i = 0; $i < strlen($password); $i++) |
|
| 1306 | + for ($i = 0; $i < strlen($password); $i++) |
|
| 1307 | 1307 | { |
| 1308 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1308 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1309 | 1309 | { |
| 1310 | 1310 | continue; |
| 1311 | 1311 | } |
@@ -1317,11 +1317,11 @@ discard block |
||
| 1317 | 1317 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
| 1318 | 1318 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
| 1319 | 1319 | |
| 1320 | - if($result1 == '80000000') |
|
| 1320 | + if ($result1 == '80000000') |
|
| 1321 | 1321 | { |
| 1322 | 1322 | $nr += 0x80000000; |
| 1323 | 1323 | } |
| 1324 | - if($result2 == '80000000') |
|
| 1324 | + if ($result2 == '80000000') |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $nr2 += 0x80000000; |
| 1327 | 1327 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | function getScriptPath() |
| 1338 | 1338 | { |
| 1339 | 1339 | static $url = NULL; |
| 1340 | - if($url == NULL) |
|
| 1340 | + if ($url == NULL) |
|
| 1341 | 1341 | { |
| 1342 | 1342 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php$/i', '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
| 1343 | 1343 | } |
@@ -1367,14 +1367,14 @@ discard block |
||
| 1367 | 1367 | $decodedStr = ''; |
| 1368 | 1368 | $pos = 0; |
| 1369 | 1369 | $len = strlen($source); |
| 1370 | - while($pos < $len) |
|
| 1370 | + while ($pos < $len) |
|
| 1371 | 1371 | { |
| 1372 | 1372 | $charAt = substr($source, $pos, 1); |
| 1373 | - if($charAt == '%') |
|
| 1373 | + if ($charAt == '%') |
|
| 1374 | 1374 | { |
| 1375 | 1375 | $pos++; |
| 1376 | 1376 | $charAt = substr($source, $pos, 1); |
| 1377 | - if($charAt == 'u') |
|
| 1377 | + if ($charAt == 'u') |
|
| 1378 | 1378 | { |
| 1379 | 1379 | // we got a unicode character |
| 1380 | 1380 | $pos++; |
@@ -1408,21 +1408,21 @@ discard block |
||
| 1408 | 1408 | */ |
| 1409 | 1409 | function _code2utf($num) |
| 1410 | 1410 | { |
| 1411 | - if($num < 128) |
|
| 1411 | + if ($num < 128) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | return chr($num); |
| 1414 | 1414 | } |
| 1415 | - if($num < 2048) |
|
| 1415 | + if ($num < 2048) |
|
| 1416 | 1416 | { |
| 1417 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 1417 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 1418 | 1418 | } |
| 1419 | - if($num < 65536) |
|
| 1419 | + if ($num < 65536) |
|
| 1420 | 1420 | { |
| 1421 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1421 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1422 | 1422 | } |
| 1423 | - if($num < 2097152) |
|
| 1423 | + if ($num < 2097152) |
|
| 1424 | 1424 | { |
| 1425 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1425 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1426 | 1426 | } |
| 1427 | 1427 | return ''; |
| 1428 | 1428 | } |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | */ |
| 1438 | 1438 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
| 1439 | 1439 | { |
| 1440 | - if($urldecode) |
|
| 1440 | + if ($urldecode) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | $string = urldecode($string); |
| 1443 | 1443 | } |
@@ -1445,12 +1445,12 @@ discard block |
||
| 1445 | 1445 | $sample = iconv('utf-8', 'utf-8', $string); |
| 1446 | 1446 | $is_utf8 = (md5($sample) === md5($string)); |
| 1447 | 1447 | |
| 1448 | - if(!$urldecode) |
|
| 1448 | + if (!$urldecode) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | $string = urldecode($string); |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | - if($return_convert) |
|
| 1453 | + if ($return_convert) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
| 1456 | 1456 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | */ |
| 1467 | 1467 | function json_encode2($data) |
| 1468 | 1468 | { |
| 1469 | - switch(gettype($data)) |
|
| 1469 | + switch (gettype($data)) |
|
| 1470 | 1470 | { |
| 1471 | 1471 | case 'boolean': |
| 1472 | 1472 | return $data ? 'true' : 'false'; |
@@ -1474,15 +1474,15 @@ discard block |
||
| 1474 | 1474 | case 'double': |
| 1475 | 1475 | return $data; |
| 1476 | 1476 | case 'string': |
| 1477 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
| 1477 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
| 1478 | 1478 | case 'object': |
| 1479 | 1479 | $data = get_object_vars($data); |
| 1480 | 1480 | case 'array': |
| 1481 | 1481 | $rel = FALSE; // relative array? |
| 1482 | 1482 | $key = array_keys($data); |
| 1483 | - foreach($key as $v) |
|
| 1483 | + foreach ($key as $v) |
|
| 1484 | 1484 | { |
| 1485 | - if(!is_int($v)) |
|
| 1485 | + if (!is_int($v)) |
|
| 1486 | 1486 | { |
| 1487 | 1487 | $rel = TRUE; |
| 1488 | 1488 | break; |
@@ -1490,12 +1490,12 @@ discard block |
||
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | $arr = array(); |
| 1493 | - foreach($data as $k => $v) |
|
| 1493 | + foreach ($data as $k => $v) |
|
| 1494 | 1494 | { |
| 1495 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
| 1495 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
| 1498 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
| 1499 | 1499 | default: |
| 1500 | 1500 | return '""'; |
| 1501 | 1501 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | */ |
| 1510 | 1510 | function isCrawler($agent = NULL) |
| 1511 | 1511 | { |
| 1512 | - if(!$agent) |
|
| 1512 | + if (!$agent) |
|
| 1513 | 1513 | { |
| 1514 | 1514 | $agent = $_SERVER['HTTP_USER_AGENT']; |
| 1515 | 1515 | } |
@@ -1519,9 +1519,9 @@ discard block |
||
| 1519 | 1519 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
| 1520 | 1520 | ); |
| 1521 | 1521 | |
| 1522 | - foreach($check_agent as $str) |
|
| 1522 | + foreach ($check_agent as $str) |
|
| 1523 | 1523 | { |
| 1524 | - if(stristr($agent, $str) != FALSE) |
|
| 1524 | + if (stristr($agent, $str) != FALSE) |
|
| 1525 | 1525 | { |
| 1526 | 1526 | return TRUE; |
| 1527 | 1527 | } |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | */ |
| 1540 | 1540 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
| 1541 | 1541 | { |
| 1542 | - if(!Context::get('is_logged')) |
|
| 1542 | + if (!Context::get('is_logged')) |
|
| 1543 | 1543 | { |
| 1544 | 1544 | return; |
| 1545 | 1545 | } |
@@ -1547,18 +1547,18 @@ discard block |
||
| 1547 | 1547 | $oModuleModel = getModel('module'); |
| 1548 | 1548 | $logged_info = Context::get('logged_info'); |
| 1549 | 1549 | |
| 1550 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1550 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1551 | 1551 | { |
| 1552 | - if($writer_member_srl) |
|
| 1552 | + if ($writer_member_srl) |
|
| 1553 | 1553 | { |
| 1554 | 1554 | $oMemberModel = getModel('member'); |
| 1555 | 1555 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
| 1556 | - if($member_info->is_admin == "Y") |
|
| 1556 | + if ($member_info->is_admin == "Y") |
|
| 1557 | 1557 | { |
| 1558 | 1558 | return; |
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | - $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>"; |
|
| 1561 | + $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>"; |
|
| 1562 | 1562 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
| 1563 | 1563 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
| 1564 | 1564 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1574,19 +1574,19 @@ discard block |
||
| 1574 | 1574 | */ |
| 1575 | 1575 | function requirePear() |
| 1576 | 1576 | { |
| 1577 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1577 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1578 | 1578 | { |
| 1579 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
| 1579 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
| 1580 | 1580 | } |
| 1581 | 1581 | else |
| 1582 | 1582 | { |
| 1583 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
| 1583 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | 1587 | function checkCSRF() |
| 1588 | 1588 | { |
| 1589 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1589 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1590 | 1590 | { |
| 1591 | 1591 | return FALSE; |
| 1592 | 1592 | } |
@@ -1594,9 +1594,9 @@ discard block |
||
| 1594 | 1594 | $default_url = Context::getDefaultUrl(); |
| 1595 | 1595 | $referer = $_SERVER["HTTP_REFERER"]; |
| 1596 | 1596 | |
| 1597 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1597 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1598 | 1598 | { |
| 1599 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1599 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1600 | 1600 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1601 | 1601 | $referer = $IDN->encode($referer); |
| 1602 | 1602 | } |
@@ -1607,9 +1607,9 @@ discard block |
||
| 1607 | 1607 | $oModuleModel = getModel('module'); |
| 1608 | 1608 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
| 1609 | 1609 | |
| 1610 | - if($siteModuleInfo->site_srl == 0) |
|
| 1610 | + if ($siteModuleInfo->site_srl == 0) |
|
| 1611 | 1611 | { |
| 1612 | - if($default_url['host'] !== $referer['host']) |
|
| 1612 | + if ($default_url['host'] !== $referer['host']) |
|
| 1613 | 1613 | { |
| 1614 | 1614 | return FALSE; |
| 1615 | 1615 | } |
@@ -1617,7 +1617,7 @@ discard block |
||
| 1617 | 1617 | else |
| 1618 | 1618 | { |
| 1619 | 1619 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
| 1620 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1620 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1621 | 1621 | { |
| 1622 | 1622 | return FALSE; |
| 1623 | 1623 | } |
@@ -1633,15 +1633,15 @@ discard block |
||
| 1633 | 1633 | */ |
| 1634 | 1634 | function recurciveExposureCheck(&$menu) |
| 1635 | 1635 | { |
| 1636 | - if(is_array($menu)) |
|
| 1636 | + if (is_array($menu)) |
|
| 1637 | 1637 | { |
| 1638 | - foreach($menu AS $key=>$value) |
|
| 1638 | + foreach ($menu AS $key=>$value) |
|
| 1639 | 1639 | { |
| 1640 | - if(!$value['isShow']) |
|
| 1640 | + if (!$value['isShow']) |
|
| 1641 | 1641 | { |
| 1642 | 1642 | unset($menu[$key]); |
| 1643 | 1643 | } |
| 1644 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
| 1644 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
| 1645 | 1645 | { |
| 1646 | 1646 | recurciveExposureCheck($menu[$key]['list']); |
| 1647 | 1647 | } |
@@ -1651,14 +1651,14 @@ discard block |
||
| 1651 | 1651 | |
| 1652 | 1652 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
| 1653 | 1653 | { |
| 1654 | - if($requestKey != $dbKey) |
|
| 1654 | + if ($requestKey != $dbKey) |
|
| 1655 | 1655 | { |
| 1656 | 1656 | $arrayUrl = parse_url(Context::get('success_return_url')); |
| 1657 | - if($arrayUrl['query']) |
|
| 1657 | + if ($arrayUrl['query']) |
|
| 1658 | 1658 | { |
| 1659 | 1659 | parse_str($arrayUrl['query'], $parsedStr); |
| 1660 | 1660 | |
| 1661 | - if(isset($parsedStr[$key])) |
|
| 1661 | + if (isset($parsedStr[$key])) |
|
| 1662 | 1662 | { |
| 1663 | 1663 | $parsedStr[$key] = $requestKey; |
| 1664 | 1664 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1701,14 +1701,14 @@ discard block |
||
| 1701 | 1701 | */ |
| 1702 | 1702 | function alertScript($msg) |
| 1703 | 1703 | { |
| 1704 | - if(!$msg) |
|
| 1704 | + if (!$msg) |
|
| 1705 | 1705 | { |
| 1706 | 1706 | return; |
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | echo '<script type="text/javascript"> |
| 1710 | 1710 | //<![CDATA[ |
| 1711 | -alert("' . $msg . '"); |
|
| 1711 | +alert("' . $msg.'"); |
|
| 1712 | 1712 | //]]> |
| 1713 | 1713 | </script>'; |
| 1714 | 1714 | } |
@@ -1739,7 +1739,7 @@ discard block |
||
| 1739 | 1739 | |
| 1740 | 1740 | echo '<script type="text/javascript"> |
| 1741 | 1741 | //<![CDATA[ |
| 1742 | -' . $reloadScript . ' |
|
| 1742 | +' . $reloadScript.' |
|
| 1743 | 1743 | //]]> |
| 1744 | 1744 | </script>'; |
| 1745 | 1745 | } |