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