GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( ca4e83...78be4d )
by gyeong-won
13:50
created
config/func.inc.php 2 patches
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,13 +360,13 @@  discard block
 block discarded – undo
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 372
 		return substr($match[0], 0, -1) . $url;
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
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);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,7 +463,7 @@  discard block
 block discarded – undo
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 469
 		return substr($match[0], 0, -1) . $url;
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,7 +777,7 @@  discard block
 block discarded – undo
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 782
 		$return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';
783 783
 	}
@@ -800,14 +800,14 @@  discard block
 block discarded – undo
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);
@@ -816,9 +816,9 @@  discard block
 block discarded – undo
816 816
 	$line_num = $bt_debug_print['line'];
817 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
 block discarded – undo
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
 block discarded – undo
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,11 +865,11 @@  discard block
 block discarded – undo
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);
870
+			if ($display_option === 'ERROR') $print[] = 'ERROR : ' . var_export($debug_output, TRUE);
871 871
 			else $print[] = $type . '(' . var_export($debug_output, TRUE) . ')';
872
-			$print[] = PHP_EOL.PHP_EOL;
872
+			$print[] = PHP_EOL . PHP_EOL;
873 873
 		}
874 874
 		else
875 875
 		{
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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',
@@ -904,21 +904,21 @@  discard block
 block discarded – undo
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 909
 		$buff[] = "\tCaller : " . $obj->caller;
910 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 914
 		$buff[] = "\tAddon : " . $obj->called;
915 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 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;
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
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 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 {
1063 1063
 	$mod = pow(10, $size);
1064 1064
 	$output = sprintf('%0' . $size . 'd/', $no % $mod);
1065
-	if($no >= $mod)
1065
+	if ($no >= $mod)
1066 1066
 	{
1067 1067
 		$output .= getNumberingPath((int) $no / $mod, $size);
1068 1068
 	}
@@ -1151,13 +1151,13 @@  discard block
 block discarded – undo
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,25 +1177,25 @@  discard block
 block discarded – undo
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 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
 			}
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 			$val = preg_replace('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/e', 'chr("\\1"?0x00\\1:\\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,46 +1214,46 @@  discard block
 block discarded – undo
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=)@i', $attr_value))
1227
+		if (preg_match('@(\?|&|;)(act=)@i', $attr_value))
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
 			}
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,19 +1408,19 @@  discard block
 block discarded – undo
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 1417
 		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1418 1418
 	}
1419
-	if($num < 65536)
1419
+	if ($num < 65536)
1420 1420
 	{
1421 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 1425
 		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1426 1426
 	}
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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';
@@ -1480,9 +1480,9 @@  discard block
 block discarded – undo
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,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 			}
1491 1491
 
1492 1492
 			$arr = array();
1493
-			foreach($data as $k => $v)
1493
+			foreach ($data as $k => $v)
1494 1494
 			{
1495 1495
 				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v);
1496 1496
 			}
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,13 +1547,13 @@  discard block
 block discarded – undo
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
 			}
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
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 1579
 		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1580 1580
 	}
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
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,7 +1594,7 @@  discard block
 block discarded – undo
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 1599
 		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1600 1600
 		$IDN = new idna_convert(array('idn_version' => 2008));
@@ -1607,9 +1607,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,17 +1651,17 @@  discard block
 block discarded – undo
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
-				$successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);
1664
+				$successReturnUrl .= $arrayUrl['path'] . '?' . http_build_query($parsedStr);
1665 1665
 				Context::set($urlName, $successReturnUrl);
1666 1666
 			}
1667 1667
 		}
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
  */
1702 1702
 function alertScript($msg)
1703 1703
 {
1704
-	if(!$msg)
1704
+	if (!$msg)
1705 1705
 	{
1706 1706
 		return;
1707 1707
 	}
Please login to merge, or discard this patch.
Braces   +63 added lines, -69 removed lines patch added patch discarded remove patch
@@ -296,10 +296,11 @@  discard block
 block discarded – undo
296 296
 	$num_args = func_num_args();
297 297
 	$args_list = func_get_args();
298 298
 
299
-	if($num_args)
300
-		$url = Context::getUrl($num_args, $args_list);
301
-	else
302
-		$url = Context::getRequestUri();
299
+	if($num_args) {
300
+			$url = Context::getUrl($num_args, $args_list);
301
+	} else {
302
+			$url = Context::getRequestUri();
303
+	}
303 304
 
304 305
 	return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url);
305 306
 }
@@ -318,8 +319,7 @@  discard block
 block discarded – undo
318 319
 	if($num_args)
319 320
 	{
320 321
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
321
-	}
322
-	else
322
+	} else
323 323
 	{
324 324
 		$url = Context::getRequestUri();
325 325
 	}
@@ -341,8 +341,7 @@  discard block
 block discarded – undo
341 341
 	if($num_args)
342 342
 	{
343 343
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
344
-	}
345
-	else
344
+	} else
346 345
 	{
347 346
 		$url = Context::getRequestUri();
348 347
 	}
@@ -531,13 +530,11 @@  discard block
 block discarded – undo
531 530
 		{
532 531
 			$char_width += (int) $chars[$c - 32];
533 532
 			$idx++;
534
-		}
535
-		else if(191 < $c && $c < 224)
533
+		} else if(191 < $c && $c < 224)
536 534
 		{
537 535
 			$char_width += $chars[4];
538 536
 			$idx += 2;
539
-		}
540
-		else
537
+		} else
541 538
 		{
542 539
 			$char_width += $chars[0];
543 540
 			$idx += 3;
@@ -564,8 +561,7 @@  discard block
 block discarded – undo
564 561
 	if($time_zone < 0)
565 562
 	{
566 563
 		$to = -1;
567
-	}
568
-	else
564
+	} else
569 565
 	{
570 566
 		$to = 1;
571 567
 	}
@@ -577,8 +573,7 @@  discard block
 block discarded – undo
577 573
 	if($server_time_zone < 0)
578 574
 	{
579 575
 		$so = -1;
580
-	}
581
-	else
576
+	} else
582 577
 	{
583 578
 		$so = 1;
584 579
 	}
@@ -615,8 +610,7 @@  discard block
 block discarded – undo
615 610
 	if(strlen($str) <= 8)
616 611
 	{
617 612
 		$gap = 0;
618
-	}
619
-	else
613
+	} else
620 614
 	{
621 615
 		$gap = zgap();
622 616
 	}
@@ -639,20 +633,16 @@  discard block
 block discarded – undo
639 633
 	if($gap < 60)
640 634
 	{
641 635
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
642
-	}
643
-	elseif($gap < 60 * 60)
636
+	} elseif($gap < 60 * 60)
644 637
 	{
645 638
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
646
-	}
647
-	elseif($gap < 60 * 60 * 2)
639
+	} elseif($gap < 60 * 60 * 2)
648 640
 	{
649 641
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
650
-	}
651
-	elseif($gap < 60 * 60 * 24)
642
+	} elseif($gap < 60 * 60 * 24)
652 643
 	{
653 644
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
654
-	}
655
-	else
645
+	} else
656 646
 	{
657 647
 		$buff = zdate($date, $format);
658 648
 	}
@@ -699,12 +689,10 @@  discard block
 block discarded – undo
699 689
 				if($format == 'Y-m-d')
700 690
 				{
701 691
 					$format = 'M d, Y';
702
-				}
703
-				elseif($format == 'Y-m-d H:i:s')
692
+				} elseif($format == 'Y-m-d H:i:s')
704 693
 				{
705 694
 					$format = 'M d, Y H:i:s';
706
-				}
707
-				elseif($format == 'Y-m-d H:i')
695
+				} elseif($format == 'Y-m-d H:i')
708 696
 				{
709 697
 					$format = 'M d, Y H:i';
710 698
 				}
@@ -713,12 +701,10 @@  discard block
 block discarded – undo
713 701
 				if($format == 'Y-m-d')
714 702
 				{
715 703
 					$format = 'd-m-Y';
716
-				}
717
-				elseif($format == 'Y-m-d H:i:s')
704
+				} elseif($format == 'Y-m-d H:i:s')
718 705
 				{
719 706
 					$format = 'H:i:s d-m-Y';
720
-				}
721
-				elseif($format == 'Y-m-d H:i')
707
+				} elseif($format == 'Y-m-d H:i')
722 708
 				{
723 709
 					$format = 'H:i d-m-Y';
724 710
 				}
@@ -754,8 +740,7 @@  discard block
 block discarded – undo
754 740
 		);
755 741
 
756 742
 		$string = strtr($format, $trans);
757
-	}
758
-	else
743
+	} else
759 744
 	{
760 745
 		// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. 
761 746
 		$string = date($format, ztime($str));
@@ -843,8 +828,7 @@  discard block
 block discarded – undo
843 828
 		}
844 829
 
845 830
 		$firephp->fb($debug_output, $label, $type);
846
-	}
847
-	else
831
+	} else
848 832
 	{
849 833
 		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
850 834
 		{
@@ -852,10 +836,16 @@  discard block
 block discarded – undo
852 836
 		}
853 837
 
854 838
 		$print = array();
855
-		if($debug_file_exist === NULL) $print[] = '<?php exit() ?>';
839
+		if($debug_file_exist === NULL) {
840
+			$print[] = '<?php exit() ?>';
841
+		}
856 842
 
857
-		if(!$debug_file) $debug_file =  _XE_PATH_ . 'files/' . $file;
858
-		if(!$debug_file_exist) $debug_file_exist = file_exists($debug_file);
843
+		if(!$debug_file) {
844
+			$debug_file =  _XE_PATH_ . 'files/' . $file;
845
+		}
846
+		if(!$debug_file_exist) {
847
+			$debug_file_exist = file_exists($debug_file);
848
+		}
859 849
 
860 850
 		if($display_option === TRUE || $display_option === 'ERROR')
861 851
 		{
@@ -867,11 +857,13 @@  discard block
 block discarded – undo
867 857
 		$type = gettype($debug_output);
868 858
 		if(!in_array($type, array('array', 'object', 'resource')))
869 859
 		{
870
-			if($display_option === 'ERROR') $print[] = 'ERROR : ' . var_export($debug_output, TRUE);
871
-			else $print[] = $type . '(' . var_export($debug_output, TRUE) . ')';
860
+			if($display_option === 'ERROR') {
861
+				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
862
+			} else {
863
+				$print[] = $type . '(' . var_export($debug_output, TRUE) . ')';
864
+			}
872 865
 			$print[] = PHP_EOL.PHP_EOL;
873
-		}
874
-		else
866
+		} else
875 867
 		{
876 868
 			$print[] = print_r($debug_output, TRUE);
877 869
 			$print[] = PHP_EOL;
@@ -888,7 +880,9 @@  discard block
 block discarded – undo
888 880
  */
889 881
 function writeSlowlog($type, $elapsed_time, $obj)
890 882
 {
891
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
883
+	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) {
884
+		return;
885
+	}
892 886
 
893 887
 	static $log_filename = array(
894 888
 		'query' => 'files/_slowlog_query.php',
@@ -908,25 +902,21 @@  discard block
 block discarded – undo
908 902
 	{
909 903
 		$buff[] = "\tCaller : " . $obj->caller;
910 904
 		$buff[] = "\tCalled : " . $obj->called;
911
-	}
912
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
905
+	} else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
913 906
 	{
914 907
 		$buff[] = "\tAddon : " . $obj->called;
915 908
 		$buff[] = "\tCalled position : " . $obj->caller;
916
-	}
917
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
909
+	} else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
918 910
 	{
919 911
 		$buff[] = "\tWidget : " . $obj->called;
920
-	}
921
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
912
+	} else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
922 913
 	{
923 914
 
924 915
 		$buff[] = $obj->query;
925 916
 		$buff[] = "\tQuery ID   : " . $obj->query_id;
926 917
 		$buff[] = "\tCaller     : " . $obj->caller;
927 918
 		$buff[] = "\tConnection : " . $obj->connection;
928
-	}
929
-	else
919
+	} else
930 920
 	{
931 921
 		$write_file = false;
932 922
 	}
@@ -1018,8 +1008,11 @@  discard block
 block discarded – undo
1018 1008
 
1019 1009
 	foreach($del_vars as $var)
1020 1010
 	{
1021
-		if(is_array($vars)) unset($vars[$var]);
1022
-		else if(is_object($vars)) unset($vars->$var);
1011
+		if(is_array($vars)) {
1012
+			unset($vars[$var]);
1013
+		} else if(is_object($vars)) {
1014
+			unset($vars->$var);
1015
+		}
1023 1016
 	}
1024 1017
 
1025 1018
 	return $vars;
@@ -1156,8 +1149,7 @@  discard block
 block discarded – undo
1156 1149
 		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1157 1150
 		{
1158 1151
 			$content .= '</xmp>';
1159
-		}
1160
-		else if($close_xmp < $start_xmp)
1152
+		} else if($close_xmp < $start_xmp)
1161 1153
 		{
1162 1154
 			$content .= '</xmp>';
1163 1155
 		}
@@ -1214,12 +1206,18 @@  discard block
 block discarded – undo
1214 1206
 
1215 1207
 	$filter_arrts = array('style', 'src', 'href');
1216 1208
 
1217
-	if($tag === 'object') array_push($filter_arrts, 'data');
1218
-	if($tag === 'param') array_push($filter_arrts, 'value');
1209
+	if($tag === 'object') {
1210
+		array_push($filter_arrts, 'data');
1211
+	}
1212
+	if($tag === 'param') {
1213
+		array_push($filter_arrts, 'value');
1214
+	}
1219 1215
 
1220 1216
 	foreach($filter_arrts as $attr)
1221 1217
 	{
1222
-		if(!isset($attrs[$attr])) continue;
1218
+		if(!isset($attrs[$attr])) {
1219
+			continue;
1220
+		}
1223 1221
 
1224 1222
 		$attr_value = rawurldecode($attrs[$attr]);
1225 1223
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
@@ -1382,16 +1380,14 @@  discard block
 block discarded – undo
1382 1380
 				$unicode = hexdec($unicodeHexVal);
1383 1381
 				$decodedStr .= _code2utf($unicode);
1384 1382
 				$pos += 4;
1385
-			}
1386
-			else
1383
+			} else
1387 1384
 			{
1388 1385
 				// we have an escaped ascii character
1389 1386
 				$hexVal = substr($source, $pos, 2);
1390 1387
 				$decodedStr .= chr(hexdec($hexVal));
1391 1388
 				$pos += 2;
1392 1389
 			}
1393
-		}
1394
-		else
1390
+		} else
1395 1391
 		{
1396 1392
 			$decodedStr .= $charAt;
1397 1393
 			$pos++;
@@ -1577,8 +1573,7 @@  discard block
 block discarded – undo
1577 1573
 	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1578 1574
 	{
1579 1575
 		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1580
-	}
1581
-	else
1576
+	} else
1582 1577
 	{
1583 1578
 		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1584 1579
 	}
@@ -1613,8 +1608,7 @@  discard block
 block discarded – undo
1613 1608
 		{
1614 1609
 			return FALSE;
1615 1610
 		}
1616
-	}
1617
-	else
1611
+	} else
1618 1612
 	{
1619 1613
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1620 1614
 		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
Please login to merge, or discard this patch.
modules/layout/layout.view.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	function init()
15 15
 	{
16
-		$this->setTemplatePath($this->module_path.'tpl');
16
+		$this->setTemplatePath($this->module_path . 'tpl');
17 17
 	}
18 18
 
19 19
 	/**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		// Get the layout information
26 26
 		$oLayoutModel = getModel('layout');
27 27
 		$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
28
-		if(!$layout_info) exit();
28
+		if (!$layout_info) exit();
29 29
 		Context::set('layout_info', $layout_info);
30 30
 		// Set the layout to be pop-up
31 31
 		$this->setLayoutFile('popup_layout');
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 			// admin check
54 54
 			// this act is admin view but in normal view because do not load admin css/js files
55 55
 			$logged_info = Context::get('logged_info');
56
-			if($logged_info->is_admin != 'Y')
56
+			if ($logged_info->is_admin != 'Y')
57 57
 			{
58 58
 				throw new Exception(Context::getLang('msg_invalid_request'));
59 59
 			}
60 60
 
61 61
 			// if module is 'ARTiCLE' and from site design setting, make content directly
62
-			if($module == 'ARTICLE' && !$mid)
62
+			if ($module == 'ARTICLE' && !$mid)
63 63
 			{
64 64
 				$oDocumentModel = getModel('document');
65 65
 				$oDocument = $oDocumentModel->getDocument(0, true);
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 				$t = Context::getLang('article_preview_title');
68 68
 
69 69
 				$c = '';
70
-				for($i = 0; $i < 4; $i++)
70
+				for ($i = 0; $i < 4; $i++)
71 71
 				{
72 72
 					$c .= '<p>';
73
-					for($j = 0; $j < 20; $j++)
73
+					for ($j = 0; $j < 20; $j++)
74 74
 					{
75 75
 						$c .= Context::getLang('article_preview_content') . ' ';
76 76
 					}
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 			Context::set('content', $content);
109 109
 
110 110
 			// find layout
111
-			if($layoutSrl)
111
+			if ($layoutSrl)
112 112
 			{
113
-				if($layoutSrl == -1)
113
+				if ($layoutSrl == -1)
114 114
 				{
115 115
 					$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
116 116
 					$designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl);
117 117
 					include($designInfoFile);
118 118
 
119
-					if($skinType == 'M')
119
+					if ($skinType == 'M')
120 120
 					{
121 121
 						$layoutSrl = $designInfo->mlayout_srl;
122 122
 					}
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 				$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
131 131
 
132 132
 				// If there is no layout, pass it.
133
-				if($layoutInfo)
133
+				if ($layoutInfo)
134 134
 				{
135 135
 					// Adhoc...
136 136
 
137 137
 					// Input extra_vars into $layout_info
138
-					if($layoutInfo->extra_var_count)
138
+					if ($layoutInfo->extra_var_count)
139 139
 					{
140 140
 
141
-						foreach($layoutInfo->extra_var as $var_id => $val)
141
+						foreach ($layoutInfo->extra_var as $var_id => $val)
142 142
 						{
143
-							if($val->type == 'image')
143
+							if ($val->type == 'image')
144 144
 							{
145
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
145
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
146 146
 								{
147 147
 									$val->value = Context::getRequestUri() . substr($val->value, 2);
148 148
 								}
@@ -152,22 +152,22 @@  discard block
 block discarded – undo
152 152
 					}
153 153
 
154 154
 					// Set menus into context
155
-					if($layoutInfo->menu_count)
155
+					if ($layoutInfo->menu_count)
156 156
 					{
157
-						foreach($layoutInfo->menu as $menu_id => $menu)
157
+						foreach ($layoutInfo->menu as $menu_id => $menu)
158 158
 						{
159 159
 							// set default menu set(included home menu)
160
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
160
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
161 161
 							{
162 162
 								$oMenuAdminController = getAdminController('menu');
163 163
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
164 164
 
165
-								if(file_exists($homeMenuCacheFile))
165
+								if (file_exists($homeMenuCacheFile))
166 166
 								{
167 167
 									include($homeMenuCacheFile);
168 168
 								}
169 169
 
170
-								if(!$menu->menu_srl)
170
+								if (!$menu->menu_srl)
171 171
 								{
172 172
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
173 173
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 							}
182 182
 
183 183
 							$menu->php_file = FileHandler::getRealPath($menu->php_file);
184
-							if(FileHandler::exists($menu->php_file))
184
+							if (FileHandler::exists($menu->php_file))
185 185
 							{
186 186
 								include($menu->php_file);
187 187
 							}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				}
194 194
 			}
195 195
 		}
196
-		catch(Exception $e)
196
+		catch (Exception $e)
197 197
 		{
198 198
 			$content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>';
199 199
 			Context::set('content', $content);
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 		$oTemplate = TemplateHandler::getInstance();
205 205
 		Context::clearHtmlHeader();
206 206
 
207
-		if($layoutInfo)
207
+		if ($layoutInfo)
208 208
 		{
209 209
 			$layout_path = $layoutInfo->path;
210 210
 			$editLayoutTPL = $this->getRealLayoutFile($layoutSrl);
211 211
 			$editLayoutCSS = $this->getRealLayoutCSS($layoutSrl);
212
-			if($editLayoutCSS != '')
212
+			if ($editLayoutCSS != '')
213 213
 			{
214 214
 				Context::addCSSFile($editLayoutCSS);
215 215
 			}
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 		}
226 226
 
227 227
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL);
228
-		Context::set('layout','none');
228
+		Context::set('layout', 'none');
229 229
 
230 230
 		// Convert widgets and others
231 231
 		$oContext = Context::getInstance();
232 232
 		Context::set('layout_tpl', $layout_tpl);
233
-		$this->setTemplatePath($this->module_path.'tpl');
233
+		$this->setTemplatePath($this->module_path . 'tpl');
234 234
 		$this->setTemplateFile('layout_preview');
235 235
 	}
236 236
 
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 	private function procRealModule($module, $mid, $skin, $skinType)
247 247
 	{
248 248
 		// if form site design and preview module, find target module
249
-		if($module && !$mid)
249
+		if ($module && !$mid)
250 250
 		{
251 251
 			$args = new stdClass();
252 252
 			$args->module = $module;
253 253
 			$output = executeQuery('layout.getOneModuleInstanceByModuleName', $args);
254
-			if(!$output->toBool())
254
+			if (!$output->toBool())
255 255
 			{
256 256
 				throw new Exception($output->getMessage());
257 257
 			}
258 258
 
259 259
 			// if there is no module instance, error...
260
-			if(!$output->data)
260
+			if (!$output->data)
261 261
 			{
262 262
 				throw new Exception(Context::getLang('msg_unabled_preview'));
263 263
 			}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		}
267 267
 
268 268
 		// if form site design and preview layout, find start module
269
-		elseif(!$module && !$mid)
269
+		elseif (!$module && !$mid)
270 270
 		{
271 271
 			$oModuleModel = getModel('module');
272 272
 			$columnList = array('modules.mid', 'sites.index_module_srl');
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$oModuleHandler->module_info->is_skin_fix = 'Y';
287 287
 		$oModuleHandler->module_info->is_mskin_fix = 'Y';
288 288
 
289
-		if($skinType == 'M')
289
+		if ($skinType == 'M')
290 290
 		{
291 291
 			Mobile::setMobile(TRUE);
292 292
 			$oModuleHandler->module_info->mskin = $skin;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 		// Proc module
301 301
 		$oModule = $oModuleHandler->procModule();
302
-		if(!$oModule->toBool())
302
+		if (!$oModule->toBool())
303 303
 		{
304 304
 			throw new Exception(Context::getLang('not_support_layout_preview'));
305 305
 		}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	function dispLayoutPreview()
318 318
 	{
319
-		if(!checkCSRF())
319
+		if (!checkCSRF())
320 320
 		{
321 321
 			$this->stop('msg_invalid_request');
322 322
 			return new Object(-1, 'msg_invalid_request');
@@ -325,36 +325,36 @@  discard block
 block discarded – undo
325 325
 		// admin check
326 326
 		// this act is admin view but in normal view because do not load admin css/js files
327 327
 		$logged_info = Context::get('logged_info');
328
-		if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
328
+		if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
329 329
 
330 330
 		$layout_srl = Context::get('layout_srl');
331 331
 		$code = Context::get('code');
332 332
 
333 333
 		$code_css = Context::get('code_css');
334
-		if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
334
+		if (!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
335 335
 		// Get the layout information
336 336
 		$oLayoutModel = getModel('layout');
337 337
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
338
-		if(!$layout_info) return new Object(-1, 'msg_invalid_request');
338
+		if (!$layout_info) return new Object(-1, 'msg_invalid_request');
339 339
 		// Separately handle the layout if its type is faceoff
340
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
340
+		if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
341 341
 		// Apply CSS directly
342
-		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
342
+		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">" . $code_css . "</style>");
343 343
 		// Set names and values of extra_vars to $layout_info
344
-		if($layout_info->extra_var_count)
344
+		if ($layout_info->extra_var_count)
345 345
 		{
346
-			foreach($layout_info->extra_var as $var_id => $val)
346
+			foreach ($layout_info->extra_var as $var_id => $val)
347 347
 			{
348 348
 				$layout_info->{$var_id} = $val->value;
349 349
 			}
350 350
 		}
351 351
 		// menu in layout information becomes an argument for Context:: set
352
-		if($layout_info->menu_count)
352
+		if ($layout_info->menu_count)
353 353
 		{
354
-			foreach($layout_info->menu as $menu_id => $menu)
354
+			foreach ($layout_info->menu as $menu_id => $menu)
355 355
 			{
356 356
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
357
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
357
+				if (FileHandler::exists($menu->php_file)) include($menu->php_file);
358 358
 
359 359
 				Context::set($menu_id, $menu);
360 360
 			}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		$layout_file = 'layout';
374 374
 
375 375
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
376
-		Context::set('layout','none');
376
+		Context::set('layout', 'none');
377 377
 		// Convert widgets and others
378 378
 		$oContext = &Context::getInstance();
379 379
 		Context::set('layout_tpl', $layout_tpl);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		$oLayoutModel = getModel('layout');
388 388
 		$layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl);
389 389
 
390
-		if(file_exists($layoutFile))
390
+		if (file_exists($layoutFile))
391 391
 		{
392 392
 			return $layoutFile;
393 393
 		}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$oLayoutModel = getModel('layout');
404 404
 		$cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl);
405 405
 
406
-		if(file_exists($cssFile))
406
+		if (file_exists($cssFile))
407 407
 		{
408 408
 			return $cssFile;
409 409
 		}
Please login to merge, or discard this patch.