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 ( bf80d8...01f3e2 )
by gyeong-won
09:01
created
classes/security/Purifier.class.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$this->_checkCacheDir();
15 15
 
16 16
 		// purifier setting
17
-		require_once _XE_PATH_ . 'classes/security/htmlpurifier/library/HTMLPurifier.auto.php';
17
+		require_once _XE_PATH_.'classes/security/htmlpurifier/library/HTMLPurifier.auto.php';
18 18
 		require_once 'HTMLPurifier.func.php';
19 19
 
20 20
 		$this->_setConfig();
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function getInstance()
24 24
 	{
25
-		if(!isset($GLOBALS['__PURIFIER_INSTANCE__']))
25
+		if (!isset($GLOBALS['__PURIFIER_INSTANCE__']))
26 26
 		{
27 27
 			$GLOBALS['__PURIFIER_INSTANCE__'] = new Purifier();
28 28
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public function setConfig($name, $value)
56 56
 	{
57
-		if($this->_config->isFinalized()) return;
57
+		if ($this->_config->isFinalized()) return;
58 58
 
59 59
 		$this->_config->set($name, $value);
60 60
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		// add attribute for edit component
65 65
 		$editComponentAttrs = $this->_searchEditComponent($content);
66
-		if(is_array($editComponentAttrs))
66
+		if (is_array($editComponentAttrs))
67 67
 		{
68
-			foreach($editComponentAttrs AS $k => $v)
68
+			foreach ($editComponentAttrs AS $k => $v)
69 69
 			{
70 70
 				$this->_def->addAttribute('img', $v, 'CDATA');
71 71
 				$this->_def->addAttribute('div', $v, 'CDATA');
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// add attribute for widget component
76 76
 		$widgetAttrs = $this->_searchWidget($content);
77
-		if(is_array($widgetAttrs))
77
+		if (is_array($widgetAttrs))
78 78
 		{
79
-			foreach($widgetAttrs AS $k => $v)
79
+			foreach ($widgetAttrs AS $k => $v)
80 80
 			{
81 81
 				$this->_def->addAttribute('img', $v, 'CDATA');
82 82
 			}
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 		preg_match_all('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
94 94
 
95 95
 		$attributeList = array();
96
-		if(is_array($m[2]))
96
+		if (is_array($m[2]))
97 97
 		{
98
-			foreach($m[2] as $key => $value)
98
+			foreach ($m[2] as $key => $value)
99 99
 			{
100 100
 				unset($script, $m2);
101 101
 				$script = " {$m[2][$key]} editor_component={$m[3][$key]}";
102 102
 
103
-				if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
103
+				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
104 104
 				{
105
-					foreach($m2[1] as $value2)
105
+					foreach ($m2[1] as $value2)
106 106
 					{
107 107
 						//SECISSUE check style attr
108
-						if($value2 == 'style')
108
+						if ($value2 == 'style')
109 109
 						{
110 110
 							continue;
111 111
 						}
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
 		preg_match_all('!<(?:(div)|img)([^>]*)class="zbxe_widget_output"([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
129 129
 
130 130
 		$attributeList = array();
131
-		if(is_array($m[3]))
131
+		if (is_array($m[3]))
132 132
 		{
133 133
 			$content = str_replace('<img class="zbxe_widget_output"', '<img src="" class="zbxe_widget_output"', $content);
134 134
 
135
-			foreach($m[3] as $key => $value)
135
+			foreach ($m[3] as $key => $value)
136 136
 			{
137 137
 				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2))
138 138
 				{
139
-					foreach($m2[1] as $value2)
139
+					foreach ($m2[1] as $value2)
140 140
 					{
141 141
 						//SECISSUE check style attr
142
-						if($value2 == 'style')
142
+						if ($value2 == 'style')
143 143
 						{
144 144
 							continue;
145 145
 						}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		$whiteIframeUrlList = $oEmbedFilter->getWhiteIframeUrlList();
158 158
 
159 159
 		$whiteDomain = array();
160
-		foreach($whiteIframeUrlList as $value)
160
+		foreach ($whiteIframeUrlList as $value)
161 161
 		{
162 162
 			$whiteDomain[] = preg_quote($value, '%');
163 163
 		}
164 164
 
165
-		$whiteDomainRegex = '%^(' . implode('|', $whiteDomain) . ')%';
165
+		$whiteDomainRegex = '%^('.implode('|', $whiteDomain).')%';
166 166
 
167 167
 		return $whiteDomainRegex;
168 168
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	private function _checkCacheDir()
171 171
 	{
172 172
 		// check htmlpurifier cache directory
173
-		$this->_cacheDir = _XE_PATH_ . 'files/cache/htmlpurifier';
173
+		$this->_cacheDir = _XE_PATH_.'files/cache/htmlpurifier';
174 174
 		FileHandler::makeDir($this->_cacheDir);
175 175
 	}
176 176
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@
 block discarded – undo
54 54
 
55 55
 	public function setConfig($name, $value)
56 56
 	{
57
-		if($this->_config->isFinalized()) return;
57
+		if($this->_config->isFinalized()) {
58
+			return;
59
+		}
58 60
 
59 61
 		$this->_config->set($name, $value);
60 62
 	}
Please login to merge, or discard this patch.
config/func.inc.php 1 patch
Spacing   +183 added lines, -183 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,16 +360,16 @@  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
-		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
 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);
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
 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,10 +463,10 @@  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
-		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
 block discarded – undo
479 479
 function getCurrentPageUrl()
480 480
 {
481 481
 	$protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
482
-	$url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
482
+	$url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
483 483
 	return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);
484 484
 }
485 485
 
@@ -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,9 +777,9 @@  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
-		$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
 }
@@ -799,25 +799,25 @@  discard block
 block discarded – undo
799 799
 {
800 800
 	static $debug_file;
801 801
 
802
-	if(!(__DEBUG__ & 1))
802
+	if (!(__DEBUG__ & 1))
803 803
 	{
804 804
 		return;
805 805
 	}
806 806
 
807 807
 	static $firephp;
808 808
 	$bt = debug_backtrace();
809
-	if(is_array($bt))
809
+	if (is_array($bt))
810 810
 	{
811 811
 		$bt_debug_print = array_shift($bt);
812 812
 		$bt_called_function = array_shift($bt);
813 813
 	}
814 814
 	$file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);
815 815
 	$line_num = $bt_debug_print['line'];
816
-	$function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];
816
+	$function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];
817 817
 
818
-	if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
818
+	if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
819 819
 	{
820
-		if(!isset($firephp))
820
+		if (!isset($firephp))
821 821
 		{
822 822
 			$firephp = FirePHP::getInstance(TRUE);
823 823
 		}
@@ -826,16 +826,16 @@  discard block
 block discarded – undo
826 826
 		$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()));
827 827
 
828 828
 		// Check a FirePHP option
829
-		if($display_option === 'TABLE')
829
+		if ($display_option === 'TABLE')
830 830
 		{
831 831
 			$label = $display_option;
832 832
 		}
833
-		if($display_option === 'ERROR')
833
+		if ($display_option === 'ERROR')
834 834
 		{
835 835
 			$type = $display_option;
836 836
 		}
837 837
 		// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
838
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
838
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
839 839
 		{
840 840
 			$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';
841 841
 			$label = NULL;
@@ -845,52 +845,52 @@  discard block
 block discarded – undo
845 845
 	}
846 846
 	else
847 847
 	{
848
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
848
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
849 849
 		{
850 850
 			return;
851 851
 		}
852 852
 
853 853
 		$print = array();
854
-		if(!$debug_file)
854
+		if (!$debug_file)
855 855
 		{
856
-			$debug_file = _XE_PATH_ . 'files/' . $file;
856
+			$debug_file = _XE_PATH_.'files/'.$file;
857 857
 		}
858
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
858
+		if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';
859 859
 
860
-		if($display_option === TRUE || $display_option === 'ERROR')
860
+		if ($display_option === TRUE || $display_option === 'ERROR')
861 861
 		{
862
-			$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()));;
862
+			$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())); ;
863 863
 			$print[] = str_repeat('=', 80);
864 864
 		}
865 865
 		$type = gettype($debug_output);
866
-		if(!in_array($type, array('array', 'object', 'resource')))
866
+		if (!in_array($type, array('array', 'object', 'resource')))
867 867
 		{
868
-			if($display_option === 'ERROR')
868
+			if ($display_option === 'ERROR')
869 869
 			{
870
-				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
870
+				$print[] = 'ERROR : '.var_export($debug_output, TRUE);
871 871
 			}
872 872
 			else
873 873
 			{
874
-				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
874
+				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')';
875 875
 			}
876 876
 		}
877 877
 		else
878 878
 		{
879
-			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
879
+			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true)));
880 880
 		}
881 881
 		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
882 882
 		$backtrace = debug_backtrace($backtrace_args);
883 883
 
884
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
884
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
885 885
 		{
886 886
 			array_shift($backtrace);
887 887
 		}
888
-		foreach($backtrace as $val)
888
+		foreach ($backtrace as $val)
889 889
 		{
890
-			$print[] = '        - ' . $val['file'] . ' : ' . $val['line'];
890
+			$print[] = '        - '.$val['file'].' : '.$val['line'];
891 891
 		}
892 892
 		$print[] = PHP_EOL;
893
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
893
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
894 894
 	}
895 895
 }
896 896
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
  */
902 902
 function writeSlowlog($type, $elapsed_time, $obj)
903 903
 {
904
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
904
+	if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
905 905
 
906 906
 	static $log_filename = array(
907 907
 		'query' => 'files/_slowlog_query.php',
@@ -911,47 +911,47 @@  discard block
 block discarded – undo
911 911
 	);
912 912
 	$write_file = true;
913 913
 
914
-	$log_file = _XE_PATH_ . $log_filename[$type];
914
+	$log_file = _XE_PATH_.$log_filename[$type];
915 915
 
916 916
 	$buff = array();
917 917
 	$buff[] = '<?php exit(); ?>';
918 918
 	$buff[] = date('c');
919 919
 
920
-	if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
920
+	if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
921 921
 	{
922
-		$buff[] = "\tCaller : " . $obj->caller;
923
-		$buff[] = "\tCalled : " . $obj->called;
922
+		$buff[] = "\tCaller : ".$obj->caller;
923
+		$buff[] = "\tCalled : ".$obj->called;
924 924
 	}
925
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
925
+	else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
926 926
 	{
927
-		$buff[] = "\tAddon : " . $obj->called;
928
-		$buff[] = "\tCalled position : " . $obj->caller;
927
+		$buff[] = "\tAddon : ".$obj->called;
928
+		$buff[] = "\tCalled position : ".$obj->caller;
929 929
 	}
930
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
930
+	else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
931 931
 	{
932
-		$buff[] = "\tWidget : " . $obj->called;
932
+		$buff[] = "\tWidget : ".$obj->called;
933 933
 	}
934
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
934
+	else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
935 935
 	{
936 936
 
937 937
 		$buff[] = $obj->query;
938
-		$buff[] = "\tQuery ID   : " . $obj->query_id;
939
-		$buff[] = "\tCaller     : " . $obj->caller;
940
-		$buff[] = "\tConnection : " . $obj->connection;
938
+		$buff[] = "\tQuery ID   : ".$obj->query_id;
939
+		$buff[] = "\tCaller     : ".$obj->caller;
940
+		$buff[] = "\tConnection : ".$obj->connection;
941 941
 	}
942 942
 	else
943 943
 	{
944 944
 		$write_file = false;
945 945
 	}
946 946
 
947
-	if($write_file)
947
+	if ($write_file)
948 948
 	{
949 949
 		$buff[] = sprintf("\t%0.6f sec", $elapsed_time);
950
-		$buff[] = PHP_EOL . PHP_EOL;
950
+		$buff[] = PHP_EOL.PHP_EOL;
951 951
 		file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
952 952
 	}
953 953
 
954
-	if($type != 'query')
954
+	if ($type != 'query')
955 955
 	{
956 956
 		$trigger_args = $obj;
957 957
 		$trigger_args->_log_type = $type;
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
  */
992 992
 function delObjectVars($target_obj, $del_obj)
993 993
 {
994
-	if(!is_object($target_obj))
994
+	if (!is_object($target_obj))
995 995
 	{
996 996
 		return;
997 997
 	}
998
-	if(!is_object($del_obj))
998
+	if (!is_object($del_obj))
999 999
 	{
1000 1000
 		return;
1001 1001
 	}
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 	$target = array_keys($target_vars);
1007 1007
 	$del = array_keys($del_vars);
1008
-	if(!count($target) || !count($del))
1008
+	if (!count($target) || !count($del))
1009 1009
 	{
1010 1010
 		return $target_obj;
1011 1011
 	}
@@ -1013,10 +1013,10 @@  discard block
 block discarded – undo
1013 1013
 	$return_obj = new stdClass();
1014 1014
 
1015 1015
 	$target_count = count($target);
1016
-	for($i = 0; $i < $target_count; $i++)
1016
+	for ($i = 0; $i < $target_count; $i++)
1017 1017
 	{
1018 1018
 		$target_key = $target[$i];
1019
-		if(!in_array($target_key, $del))
1019
+		if (!in_array($target_key, $del))
1020 1020
 		{
1021 1021
 			$return_obj->{$target_key} = $target_obj->{$target_key};
1022 1022
 		}
@@ -1029,10 +1029,10 @@  discard block
 block discarded – undo
1029 1029
 {
1030 1030
 	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id');
1031 1031
 
1032
-	foreach($del_vars as $var)
1032
+	foreach ($del_vars as $var)
1033 1033
 	{
1034
-		if(is_array($vars)) unset($vars[$var]);
1035
-		else if(is_object($vars)) unset($vars->$var);
1034
+		if (is_array($vars)) unset($vars[$var]);
1035
+		else if (is_object($vars)) unset($vars->$var);
1036 1036
 	}
1037 1037
 
1038 1038
 	return $vars;
@@ -1049,12 +1049,12 @@  discard block
 block discarded – undo
1049 1049
  */
1050 1050
 function handleError($errno, $errstr, $file, $line)
1051 1051
 {
1052
-	if(!__DEBUG__)
1052
+	if (!__DEBUG__)
1053 1053
 	{
1054 1054
 		return;
1055 1055
 	}
1056 1056
 	$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
1057
-	if(!in_array($errno, $errors))
1057
+	if (!in_array($errno, $errors))
1058 1058
 	{
1059 1059
 		return;
1060 1060
 	}
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 function getNumberingPath($no, $size = 3)
1075 1075
 {
1076 1076
 	$mod = pow(10, $size);
1077
-	$output = sprintf('%0' . $size . 'd/', $no % $mod);
1078
-	if($no >= $mod)
1077
+	$output = sprintf('%0'.$size.'d/', $no % $mod);
1078
+	if ($no >= $mod)
1079 1079
 	{
1080 1080
 		$output .= getNumberingPath((int) $no / $mod, $size);
1081 1081
 	}
@@ -1095,12 +1095,12 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 function purifierHtml(&$content)
1097 1097
 {
1098
-	require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');
1098
+	require_once(_XE_PATH_.'classes/security/Purifier.class.php');
1099 1099
 	$oPurifier = Purifier::getInstance();
1100 1100
 
1101 1101
 	// @see https://github.com/xpressengine/xe-core/issues/2278
1102 1102
 	$logged_info = Context::get('logged_info');
1103
-	if($logged_info->is_admin !== 'Y') {
1103
+	if ($logged_info->is_admin !== 'Y') {
1104 1104
 		$oPurifier->setConfig('HTML.Nofollow', true);
1105 1105
 	}
1106 1106
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
  */
1116 1116
 function removeHackTag($content)
1117 1117
 {
1118
-	require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
1118
+	require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
1119 1119
 	$oEmbedFilter = EmbedFilter::getInstance();
1120 1120
 	$oEmbedFilter->check($content);
1121 1121
 
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
  */
1158 1158
 function checkUploadedFile($file)
1159 1159
 {
1160
-	require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');
1160
+	require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');
1161 1161
 	return UploadFileFilter::check($file);
1162 1162
 }
1163 1163
 
@@ -1171,13 +1171,13 @@  discard block
 block discarded – undo
1171 1171
 {
1172 1172
 	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content);
1173 1173
 
1174
-	if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1174
+	if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1175 1175
 	{
1176
-		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1176
+		if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1177 1177
 		{
1178 1178
 			$content .= '</xmp>';
1179 1179
 		}
1180
-		else if($close_xmp < $start_xmp)
1180
+		else if ($close_xmp < $start_xmp)
1181 1181
 		{
1182 1182
 			$content .= '</xmp>';
1183 1183
 		}
@@ -1197,33 +1197,33 @@  discard block
 block discarded – undo
1197 1197
 	$tag = strtolower($match[2]);
1198 1198
 
1199 1199
 	// xmp tag ?뺣━
1200
-	if($tag == 'xmp')
1200
+	if ($tag == 'xmp')
1201 1201
 	{
1202 1202
 		return "<{$match[1]}xmp>";
1203 1203
 	}
1204
-	if($match[1])
1204
+	if ($match[1])
1205 1205
 	{
1206 1206
 		return $match[0];
1207 1207
 	}
1208
-	if($match[4])
1208
+	if ($match[4])
1209 1209
 	{
1210
-		$match[4] = ' ' . $match[4];
1210
+		$match[4] = ' '.$match[4];
1211 1211
 	}
1212 1212
 
1213 1213
 	$attrs = array();
1214
-	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1214
+	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1215 1215
 	{
1216
-		foreach($m[1] as $idx => $name)
1216
+		foreach ($m[1] as $idx => $name)
1217 1217
 		{
1218
-			if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1218
+			if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1219 1219
 			{
1220 1220
 				continue;
1221 1221
 			}
1222 1222
 
1223
-			$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]);
1223
+			$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]);
1224 1224
 			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val);
1225 1225
 
1226
-			if(preg_match('/^[a-z]+script:/i', $val))
1226
+			if (preg_match('/^[a-z]+script:/i', $val))
1227 1227
 			{
1228 1228
 				continue;
1229 1229
 			}
@@ -1234,60 +1234,60 @@  discard block
 block discarded – undo
1234 1234
 
1235 1235
 	$filter_arrts = array('style', 'src', 'href');
1236 1236
 
1237
-	if($tag === 'object') array_push($filter_arrts, 'data');
1238
-	if($tag === 'param') array_push($filter_arrts, 'value');
1237
+	if ($tag === 'object') array_push($filter_arrts, 'data');
1238
+	if ($tag === 'param') array_push($filter_arrts, 'value');
1239 1239
 
1240
-	foreach($filter_arrts as $attr)
1240
+	foreach ($filter_arrts as $attr)
1241 1241
 	{
1242
-		if(!isset($attrs[$attr])) continue;
1242
+		if (!isset($attrs[$attr])) continue;
1243 1243
 
1244 1244
 		$attr_value = rawurldecode($attrs[$attr]);
1245 1245
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
1246 1246
 		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value);
1247
-		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1247
+		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1248 1248
 		{
1249 1249
 			unset($attrs[$attr]);
1250 1250
 		}
1251 1251
 	}
1252 1252
 
1253
-	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1253
+	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1254 1254
 	{
1255 1255
 		unset($attrs['style']);
1256 1256
 	}
1257 1257
 
1258 1258
 	$attr = array();
1259
-	foreach($attrs as $name => $val)
1259
+	foreach ($attrs as $name => $val)
1260 1260
 	{
1261
-		if($tag == 'object' || $tag == 'embed' || $tag == 'a')
1261
+		if ($tag == 'object' || $tag == 'embed' || $tag == 'a')
1262 1262
 		{
1263 1263
 			$attribute = strtolower(trim($name));
1264
-			if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1264
+			if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1265 1265
 			{
1266
-				if(stripos($val, 'data:') === 0)
1266
+				if (stripos($val, 'data:') === 0)
1267 1267
 				{
1268 1268
 					continue;
1269 1269
 				}
1270 1270
 			}
1271 1271
 		}
1272 1272
 
1273
-		if($tag == 'img')
1273
+		if ($tag == 'img')
1274 1274
 		{
1275 1275
 			$attribute = strtolower(trim($name));
1276
-			if(stripos($val, 'data:') === 0)
1276
+			if (stripos($val, 'data:') === 0)
1277 1277
 			{
1278 1278
 				continue;
1279 1279
 			}
1280 1280
 		}
1281 1281
 		$val = str_replace('"', '&quot;', $val);
1282
-		$attr[] = $name . "=\"{$val}\"";
1282
+		$attr[] = $name."=\"{$val}\"";
1283 1283
 	}
1284
-	$attr = count($attr) ? ' ' . implode(' ', $attr) : '';
1284
+	$attr = count($attr) ? ' '.implode(' ', $attr) : '';
1285 1285
 
1286 1286
 	return "<{$match[1]}{$tag}{$attr}{$match[4]}>";
1287 1287
 }
1288 1288
 
1289 1289
 // convert hexa value to RGB
1290
-if(!function_exists('hexrgb'))
1290
+if (!function_exists('hexrgb'))
1291 1291
 {
1292 1292
 
1293 1293
 	/**
@@ -1323,9 +1323,9 @@  discard block
 block discarded – undo
1323 1323
 
1324 1324
 	settype($password, "string");
1325 1325
 
1326
-	for($i = 0; $i < strlen($password); $i++)
1326
+	for ($i = 0; $i < strlen($password); $i++)
1327 1327
 	{
1328
-		if($password[$i] == ' ' || $password[$i] == '\t')
1328
+		if ($password[$i] == ' ' || $password[$i] == '\t')
1329 1329
 		{
1330 1330
 			continue;
1331 1331
 		}
@@ -1337,11 +1337,11 @@  discard block
 block discarded – undo
1337 1337
 	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1));
1338 1338
 	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1));
1339 1339
 
1340
-	if($result1 == '80000000')
1340
+	if ($result1 == '80000000')
1341 1341
 	{
1342 1342
 		$nr += 0x80000000;
1343 1343
 	}
1344
-	if($result2 == '80000000')
1344
+	if ($result2 == '80000000')
1345 1345
 	{
1346 1346
 		$nr2 += 0x80000000;
1347 1347
 	}
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 function getScriptPath()
1358 1358
 {
1359 1359
 	static $url = NULL;
1360
-	if($url == NULL)
1360
+	if ($url == NULL)
1361 1361
 	{
1362 1362
 		$script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);
1363 1363
 		$url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path)));
@@ -1388,14 +1388,14 @@  discard block
 block discarded – undo
1388 1388
 	$decodedStr = '';
1389 1389
 	$pos = 0;
1390 1390
 	$len = strlen($source);
1391
-	while($pos < $len)
1391
+	while ($pos < $len)
1392 1392
 	{
1393 1393
 		$charAt = substr($source, $pos, 1);
1394
-		if($charAt == '%')
1394
+		if ($charAt == '%')
1395 1395
 		{
1396 1396
 			$pos++;
1397 1397
 			$charAt = substr($source, $pos, 1);
1398
-			if($charAt == 'u')
1398
+			if ($charAt == 'u')
1399 1399
 			{
1400 1400
 				// we got a unicode character
1401 1401
 				$pos++;
@@ -1429,21 +1429,21 @@  discard block
 block discarded – undo
1429 1429
  */
1430 1430
 function _code2utf($num)
1431 1431
 {
1432
-	if($num < 128)
1432
+	if ($num < 128)
1433 1433
 	{
1434 1434
 		return chr($num);
1435 1435
 	}
1436
-	if($num < 2048)
1436
+	if ($num < 2048)
1437 1437
 	{
1438
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1438
+		return chr(($num >> 6) + 192).chr(($num & 63) + 128);
1439 1439
 	}
1440
-	if($num < 65536)
1440
+	if ($num < 65536)
1441 1441
 	{
1442
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1442
+		return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1443 1443
 	}
1444
-	if($num < 2097152)
1444
+	if ($num < 2097152)
1445 1445
 	{
1446
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1446
+		return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1447 1447
 	}
1448 1448
 	return '';
1449 1449
 }
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
  */
1459 1459
 function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)
1460 1460
 {
1461
-	if($urldecode)
1461
+	if ($urldecode)
1462 1462
 	{
1463 1463
 		$string = urldecode($string);
1464 1464
 	}
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 	$sample = iconv('utf-8', 'utf-8', $string);
1467 1467
 	$is_utf8 = (md5($sample) === md5($string));
1468 1468
 
1469
-	if(!$urldecode)
1469
+	if (!$urldecode)
1470 1470
 	{
1471 1471
 		$string = urldecode($string);
1472 1472
 	}
1473 1473
 
1474
-	if($return_convert)
1474
+	if ($return_convert)
1475 1475
 	{
1476 1476
 		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string);
1477 1477
 	}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
  */
1488 1488
 function json_encode2($data)
1489 1489
 {
1490
-	switch(gettype($data))
1490
+	switch (gettype($data))
1491 1491
 	{
1492 1492
 		case 'boolean':
1493 1493
 			return $data ? 'true' : 'false';
@@ -1495,15 +1495,15 @@  discard block
 block discarded – undo
1495 1495
 		case 'double':
1496 1496
 			return $data;
1497 1497
 		case 'string':
1498
-			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"';
1498
+			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"';
1499 1499
 		case 'object':
1500 1500
 			$data = get_object_vars($data);
1501 1501
 		case 'array':
1502 1502
 			$rel = FALSE; // relative array?
1503 1503
 			$key = array_keys($data);
1504
-			foreach($key as $v)
1504
+			foreach ($key as $v)
1505 1505
 			{
1506
-				if(!is_int($v))
1506
+				if (!is_int($v))
1507 1507
 				{
1508 1508
 					$rel = TRUE;
1509 1509
 					break;
@@ -1511,12 +1511,12 @@  discard block
 block discarded – undo
1511 1511
 			}
1512 1512
 
1513 1513
 			$arr = array();
1514
-			foreach($data as $k => $v)
1514
+			foreach ($data as $k => $v)
1515 1515
 			{
1516
-				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v);
1516
+				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v);
1517 1517
 			}
1518 1518
 
1519
-			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']';
1519
+			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']';
1520 1520
 		default:
1521 1521
 			return '""';
1522 1522
 	}
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
  */
1531 1531
 function isCrawler($agent = NULL)
1532 1532
 {
1533
-	if(!$agent)
1533
+	if (!$agent)
1534 1534
 	{
1535 1535
 		$agent = $_SERVER['HTTP_USER_AGENT'];
1536 1536
 	}
@@ -1540,9 +1540,9 @@  discard block
 block discarded – undo
1540 1540
 		/*'211.245.21.110-211.245.21.119' mixsh is closed */
1541 1541
 	);
1542 1542
 
1543
-	foreach($check_agent as $str)
1543
+	foreach ($check_agent as $str)
1544 1544
 	{
1545
-		if(stristr($agent, $str) != FALSE)
1545
+		if (stristr($agent, $str) != FALSE)
1546 1546
 		{
1547 1547
 			return TRUE;
1548 1548
 		}
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
  */
1561 1561
 function stripEmbedTagForAdmin(&$content, $writer_member_srl)
1562 1562
 {
1563
-	if(!Context::get('is_logged'))
1563
+	if (!Context::get('is_logged'))
1564 1564
 	{
1565 1565
 		return;
1566 1566
 	}
@@ -1568,18 +1568,18 @@  discard block
 block discarded – undo
1568 1568
 	$oModuleModel = getModel('module');
1569 1569
 	$logged_info = Context::get('logged_info');
1570 1570
 
1571
-	if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1571
+	if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1572 1572
 	{
1573
-		if($writer_member_srl)
1573
+		if ($writer_member_srl)
1574 1574
 		{
1575 1575
 			$oMemberModel = getModel('member');
1576 1576
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);
1577
-			if($member_info->is_admin == "Y")
1577
+			if ($member_info->is_admin == "Y")
1578 1578
 			{
1579 1579
 				return;
1580 1580
 			}
1581 1581
 		}
1582
-		$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>";
1582
+		$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>";
1583 1583
 		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content);
1584 1584
 		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content);
1585 1585
 		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content);
@@ -1596,18 +1596,18 @@  discard block
 block discarded – undo
1596 1596
 function requirePear()
1597 1597
 {
1598 1598
 	static $required = false;
1599
-	if($required)
1599
+	if ($required)
1600 1600
 	{
1601 1601
 		return;
1602 1602
 	}
1603 1603
 
1604
-	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1604
+	if (version_compare(PHP_VERSION, "5.3.0") < 0)
1605 1605
 	{
1606
-		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1606
+		set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());
1607 1607
 	}
1608 1608
 	else
1609 1609
 	{
1610
-		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1610
+		set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());
1611 1611
 	}
1612 1612
 
1613 1613
 	$required = true;
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 
1616 1616
 function checkCSRF()
1617 1617
 {
1618
-	if($_SERVER['REQUEST_METHOD'] != 'POST')
1618
+	if ($_SERVER['REQUEST_METHOD'] != 'POST')
1619 1619
 	{
1620 1620
 		return FALSE;
1621 1621
 	}
@@ -1623,9 +1623,9 @@  discard block
 block discarded – undo
1623 1623
 	$default_url = Context::getDefaultUrl();
1624 1624
 	$referer = $_SERVER["HTTP_REFERER"];
1625 1625
 
1626
-	if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1626
+	if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1627 1627
 	{
1628
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1628
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1629 1629
 		$IDN = new idna_convert(array('idn_version' => 2008));
1630 1630
 		$referer = $IDN->encode($referer);
1631 1631
 	}
@@ -1636,9 +1636,9 @@  discard block
 block discarded – undo
1636 1636
 	$oModuleModel = getModel('module');
1637 1637
 	$siteModuleInfo = $oModuleModel->getDefaultMid();
1638 1638
 
1639
-	if($siteModuleInfo->site_srl == 0)
1639
+	if ($siteModuleInfo->site_srl == 0)
1640 1640
 	{
1641
-		if($default_url['host'] !== $referer['host'])
1641
+		if ($default_url['host'] !== $referer['host'])
1642 1642
 		{
1643 1643
 			return FALSE;
1644 1644
 		}
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 	else
1647 1647
 	{
1648 1648
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1649
-		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1649
+		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1650 1650
 		{
1651 1651
 			return FALSE;
1652 1652
 		}
@@ -1662,15 +1662,15 @@  discard block
 block discarded – undo
1662 1662
  */
1663 1663
 function recurciveExposureCheck(&$menu)
1664 1664
 {
1665
-	if(is_array($menu))
1665
+	if (is_array($menu))
1666 1666
 	{
1667
-		foreach($menu AS $key=>$value)
1667
+		foreach ($menu AS $key=>$value)
1668 1668
 		{
1669
-			if(!$value['isShow'])
1669
+			if (!$value['isShow'])
1670 1670
 			{
1671 1671
 				unset($menu[$key]);
1672 1672
 			}
1673
-			if(is_array($value['list']) && count($value['list']) > 0)
1673
+			if (is_array($value['list']) && count($value['list']) > 0)
1674 1674
 			{
1675 1675
 				recurciveExposureCheck($menu[$key]['list']);
1676 1676
 			}
@@ -1680,14 +1680,14 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1682 1682
 {
1683
-	if($requestKey != $dbKey)
1683
+	if ($requestKey != $dbKey)
1684 1684
 	{
1685 1685
 		$arrayUrl = parse_url(Context::get('success_return_url'));
1686
-		if($arrayUrl['query'])
1686
+		if ($arrayUrl['query'])
1687 1687
 		{
1688 1688
 			parse_str($arrayUrl['query'], $parsedStr);
1689 1689
 
1690
-			if(isset($parsedStr[$key]))
1690
+			if (isset($parsedStr[$key]))
1691 1691
 			{
1692 1692
 				$parsedStr[$key] = $requestKey;
1693 1693
 				$successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);
@@ -1730,14 +1730,14 @@  discard block
 block discarded – undo
1730 1730
  */
1731 1731
 function alertScript($msg)
1732 1732
 {
1733
-	if(!$msg)
1733
+	if (!$msg)
1734 1734
 	{
1735 1735
 		return;
1736 1736
 	}
1737 1737
 
1738 1738
 	echo '<script type="text/javascript">
1739 1739
 //<![CDATA[
1740
-alert("' . $msg . '");
1740
+alert("' . $msg.'");
1741 1741
 //]]>
1742 1742
 </script>';
1743 1743
 }
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 
1769 1769
 	echo '<script type="text/javascript">
1770 1770
 //<![CDATA[
1771
-' . $reloadScript . '
1771
+' . $reloadScript.'
1772 1772
 //]]>
1773 1773
 </script>';
1774 1774
 }
Please login to merge, or discard this patch.