GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 8ee354...c8ec2b )
by gyeong-won
11:10
created
modules/krzip/krzip.admin.controller.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
 
20 20
 		$oKrzipController = getController('krzip');
21 21
 		$output = $oKrzipController->updateConfig($module_config);
22
-		if(!$output->toBool())
22
+		if (!$output->toBool())
23 23
 		{
24 24
 			return $output;
25 25
 		}
26 26
 
27 27
 		$success_return_url = Context::get('success_return_url');
28
-		if($success_return_url)
28
+		if ($success_return_url)
29 29
 		{
30 30
 			$return_url = $success_return_url;
31 31
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
 		if($success_return_url)
29 29
 		{
30 30
 			$return_url = $success_return_url;
31
-		}
32
-		else
31
+		} else
33 32
 		{
34 33
 			$return_url = getNotEncodedUrl('', 'module', 'krzip', 'act', 'dispKrzipAdminConfig');
35 34
 		}
Please login to merge, or discard this patch.
modules/krzip/krzip.view.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 {
11 11
 	function init()
12 12
 	{
13
-		$this->setTemplatePath($this->module_path . 'tpl');
13
+		$this->setTemplatePath($this->module_path.'tpl');
14 14
 	}
15 15
 
16 16
 	/**
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 		$oKrzipModel = getModel('krzip');
24 24
 		$module_config = $oKrzipModel->getConfig();
25 25
 		$module_config->sequence_id = ++self::$sequence_id;
26
-		if(!isset($api_handler) || !isset(self::$api_list[$api_handler]))
26
+		if (!isset($api_handler) || !isset(self::$api_list[$api_handler]))
27 27
 		{
28 28
 			$api_handler = $module_config->api_handler;
29 29
 		}
30 30
 
31 31
 		Context::set('template_config', $module_config);
32
-		$this->setTemplateFile('searchForm.' . self::$api_list[$api_handler]);
32
+		$this->setTemplateFile('searchForm.'.self::$api_list[$api_handler]);
33 33
 		$this->setLayoutPath('./common/tpl/');
34 34
 		$this->setLayoutFile('popup_layout');
35 35
 	}
Please login to merge, or discard this patch.
classes/xml/xmlquery/tags/table/HintTableTag.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 		$result = sprintf('new %sTableWithHint(\'%s\'%s, array('
40 40
 				, !strncasecmp($dbType, 'Mysql', 5) ? 'Mysql' : $dbType
41 41
 				, $dbParser->escape($this->name)
42
-				, $this->alias ? ', \'' . $dbParser->escape($this->alias) . '\'' : ', null'
42
+				, $this->alias ? ', \''.$dbParser->escape($this->alias).'\'' : ', null'
43 43
 				//, ', \'' . $dbParser->escape($this->index->name) .'\', \'' . $this->index->type .'\''
44 44
 		);
45
-		foreach($this->index as $indx)
45
+		foreach ($this->index as $indx)
46 46
 		{
47 47
 			$result .= "new IndexHint(";
48
-			$result .= '\'' . $dbParser->escape($indx->name) . '\', \'' . $indx->type . '\'' . ') , ';
48
+			$result .= '\''.$dbParser->escape($indx->name).'\', \''.$indx->type.'\''.') , ';
49 49
 		}
50 50
 		$result = substr($result, 0, -2);
51 51
 		$result .= '))';
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	function getArguments()
56 56
 	{
57
-		if(!isset($this->conditionsTag))
57
+		if (!isset($this->conditionsTag))
58 58
 		{
59 59
 			return array();
60 60
 		}
Please login to merge, or discard this patch.
modules/point/point.admin.view.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 		//Security
22 22
 		$security = new Security();
23
-		$security->encodeHTML('config.point_name','config.level_icon');
23
+		$security->encodeHTML('config.point_name', 'config.level_icon');
24 24
 		$security->encodeHTML('module_info..');
25 25
 
26 26
 		// Set the template path
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 		$oMemberModel = getModel('member');
40 40
 		$group_list = $oMemberModel->getGroups();
41 41
 		$selected_group_list = array();
42
-		if(count($group_list))
42
+		if (count($group_list))
43 43
 		{
44
-			foreach($group_list as $key => $val)
44
+			foreach ($group_list as $key => $val)
45 45
 			{
46 46
 				$selected_group_list[$key] = $val;
47 47
 			}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		Context::set('group_list', $selected_group_list);
50 50
 		//Security
51 51
 		$security = new Security();
52
-		$security->encodeHTML('group_list..title','group_list..description');
52
+		$security->encodeHTML('group_list..title', 'group_list..description');
53 53
 
54 54
 		// Set the template
55 55
 		$this->setTemplateFile('config');
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 		$columnList = array('module_srl', 'mid', 'browser_title', 'module');
66 66
 		$mid_list = $oModuleModel->getMidList(null, $columnList);
67 67
 
68
-		foreach($mid_list as $mid => $item)
68
+		foreach ($mid_list as $mid => $item)
69 69
 		{
70
-			if($item->module === 'page')
70
+			if ($item->module === 'page')
71 71
 			{
72 72
 				unset($mid_list[$mid]);
73 73
 			}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		//Security
80 80
 		$security = new Security();
81
-		$security->encodeHTML('mid_list..browser_title','mid_list..mid');
81
+		$security->encodeHTML('mid_list..browser_title', 'mid_list..mid');
82 82
 
83 83
 		// Set the template
84 84
 		$this->setTemplateFile('module_config');
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		Context::set('group_list', $this->group_list);
125 125
 		//Security
126 126
 		$security = new Security();
127
-		$security->encodeHTML('group_list..title','group_list..description');
127
+		$security->encodeHTML('group_list..title', 'group_list..description');
128 128
 		$security->encodeHTML('member_list..');
129 129
 		$security->encodeHTML('search_target', 'search_keyword');
130 130
 
Please login to merge, or discard this patch.
classes/file/FileHandler.class.php 3 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $target_dir Path of target dir
35 35
 	 * @param string $filter Regex to filter files. If file matches this regex, the file is not copied.
36 36
 	 * @param string $type If set as 'force'. Even if the file exists in target, the file is copied.
37
-	 * @return void
37
+	 * @return false|null
38 38
 	 */
39 39
 	function copyDir($source_dir, $target_dir, $filter = null, $type = null)
40 40
 	{
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too.
278 278
 	 *
279 279
 	 * @param string $path_string Path of target directory
280
-	 * @return bool TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed.
280
+	 * @return boolean|null TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed.
281 281
 	 */
282 282
 	function makeDir($path_string)
283 283
 	{
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * @param string $url The address of the target file
668 668
 	 * @param string $target_filename The location to store
669 669
 	 * @param string $body HTTP request body
670
-	 * @param string $timeout Connection timeout
670
+	 * @param integer $timeout Connection timeout
671 671
 	 * @param string $method GET/POST
672 672
 	 * @param string $content_type Content type header of HTTP request
673 673
 	 * @param string[] $headers Headers key value array.
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
 	 * Convert size in string into numeric value
701 701
 	 *
702 702
 	 * @see self::filesize()
703
-	 * @param $val Size in string (ex., 10, 10K, 10M, 10G )
704
-	 * @return int converted size
703
+	 * @param string $val Size in string (ex., 10, 10K, 10M, 10G )
704
+	 * @return double converted size
705 705
 	 */
706 706
 	function returnBytes($val)
707 707
 	{
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	 * @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type
753 753
 	 * @param string $thumbnail_type Thumbnail type(crop, ratio)
754 754
 	 * @param bool $thumbnail_transparent If $target_type is png, set background set transparent color
755
-	 * @return bool TRUE: success, FALSE: failed
755
+	 * @return null|boolean TRUE: success, FALSE: failed
756 756
 	 */
757 757
 	function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop', $thumbnail_transparent = FALSE)
758 758
 	{
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 	 * Check file exists.
1083 1083
 	 *
1084 1084
 	 * @param string $filename Target file name
1085
-	 * @return bool Returns FALSE if the file does not exists, or Returns full path file(string).
1085
+	 * @return string|false Returns FALSE if the file does not exists, or Returns full path file(string).
1086 1086
 	 */
1087 1087
 	function exists($filename)
1088 1088
 	{
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	/**
1094 1094
 	 * Check it is dir
1095 1095
 	 *
1096
-	 * @param string $dir Target dir path
1097
-	 * @return bool Returns FALSE if the dir is not dir, or Returns full path of dir(string).
1096
+	 * @param string $path
1097
+	 * @return string|false Returns FALSE if the dir is not dir, or Returns full path of dir(string).
1098 1098
 	 */
1099 1099
 	function isDir($path)
1100 1100
 	{
Please login to merge, or discard this patch.
Braces   +32 added lines, -49 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
 			if(is_dir($source_dir . $file))
75 75
 			{
76 76
 				self::copyDir($source_dir . $file, $target_dir . $file, $type);
77
-			}
78
-			else
77
+			} else
79 78
 			{
80 79
 				if($type == 'force')
81 80
 				{
82 81
 					@unlink($target_dir . $file);
83
-				}
84
-				else
82
+				} else
85 83
 				{
86 84
 					if(!file_exists($target_dir . $file))
87 85
 					{
@@ -381,15 +379,13 @@  discard block
 block discarded – undo
381 379
 				if(is_dir($target))
382 380
 				{
383 381
 					self::removeDir($target);
384
-				}
385
-				else
382
+				} else
386 383
 				{
387 384
 					unlink($target);
388 385
 				}
389 386
 			}
390 387
 			rmdir($path);
391
-		}
392
-		else
388
+		} else
393 389
 		{
394 390
 			unlink($path);
395 391
 		}
@@ -456,16 +452,16 @@  discard block
 block discarded – undo
456 452
 				if(is_dir($target))
457 453
 				{
458 454
 					self::removeFilesInDir($target);
459
-				}
460
-				else
455
+				} else
461 456
 				{
462 457
 					unlink($target);
463 458
 				}
464 459
 			}
465
-		}
466
-		else
460
+		} else
467 461
 		{
468
-			if(self::exists($path)) unlink($path);
462
+			if(self::exists($path)) {
463
+				unlink($path);
464
+			}
469 465
 		}
470 466
 
471 467
 	}
@@ -535,8 +531,7 @@  discard block
 block discarded – undo
535 531
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
536 532
 				$oRequest->setMethod('POST');
537 533
 				$oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
538
-			}
539
-			else
534
+			} else
540 535
 			{
541 536
 				$oRequest = new HTTP_Request($url);
542 537
 
@@ -560,8 +555,7 @@  discard block
 block discarded – undo
560 555
 							{
561 556
 								$oRequest->attach($observer);
562 557
 							}
563
-						}
564
-						else
558
+						} else
565 559
 						{
566 560
 							$oRequest->setConfig($key, $val);
567 561
 						}
@@ -572,8 +566,7 @@  discard block
 block discarded – undo
572 566
 					if(extension_loaded('curl'))
573 567
 					{
574 568
 						$oRequest->setConfig('adapter', 'curl');
575
-					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
569
+					} elseif(version_compare(PHP_VERSION, '5.6', '<'))
577 570
 					{
578 571
 						$oRequest->setConfig('ssl_verify_host', false);
579 572
 					}
@@ -605,20 +598,21 @@  discard block
 block discarded – undo
605 598
 						$oRequest->addPostData($key, $val);
606 599
 					}
607 600
 				}
608
-				if(!$content_type)
609
-					$oRequest->addHeader('Content-Type', 'text/html');
610
-				else
611
-					$oRequest->addHeader('Content-Type', $content_type);
601
+				if(!$content_type) {
602
+									$oRequest->addHeader('Content-Type', 'text/html');
603
+				} else {
604
+									$oRequest->addHeader('Content-Type', $content_type);
605
+				}
612 606
 				$oRequest->setMethod($method);
613
-				if($body)
614
-					$oRequest->setBody($body);
607
+				if($body) {
608
+									$oRequest->setBody($body);
609
+				}
615 610
 			}
616 611
 			
617 612
 			if(method_exists($oRequest, 'setConfig'))
618 613
 			{
619 614
 				$oRequest->setConfig('timeout', $timeout);
620
-			}
621
-			elseif(property_exists($oRequest, '_timeout'))
615
+			} elseif(property_exists($oRequest, '_timeout'))
622 616
 			{
623 617
 				$oRequest->_timeout = $timeout;
624 618
 			}
@@ -649,13 +643,11 @@  discard block
 block discarded – undo
649 643
 			if(isset($request_config['store_body']) && !$request_config['store_body'])
650 644
 			{
651 645
 				return TRUE;
652
-			}
653
-			else
646
+			} else
654 647
 			{
655 648
 				return $response;
656 649
 			}
657
-		}
658
-		catch(Exception $e)
650
+		} catch(Exception $e)
659 651
 		{
660 652
 			return NULL;
661 653
 		}
@@ -688,8 +680,7 @@  discard block
 block discarded – undo
688 680
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
689 681
 			self::clearStatCache($target_filename);
690 682
 			self::invalidateOpcache($target_filename);
691
-		}
692
-		catch(Exception $e)
683
+		} catch(Exception $e)
693 684
 		{
694 685
 			return FALSE;
695 686
 		}
@@ -820,8 +811,7 @@  discard block
 block discarded – undo
820 811
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
821 812
 			$resize_width = $width * $per;
822 813
 			$resize_height = $height * $per;
823
-		}
824
-		else
814
+		} else
825 815
 		{
826 816
 			$per = ($width_per < $height_per) ? $height_per : $width_per;
827 817
 		}
@@ -831,8 +821,7 @@  discard block
 block discarded – undo
831 821
 		if(function_exists('imagecreateTRUEcolor'))
832 822
 		{
833 823
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
834
-		}
835
-		else if(function_exists('imagecreate'))
824
+		} else if(function_exists('imagecreate'))
836 825
 		{
837 826
 			$thumb = imagecreate($resize_width, $resize_height);
838 827
 		}
@@ -855,8 +844,7 @@  discard block
 block discarded – undo
855 844
 			{
856 845
 				imagealphablending($thumb, TRUE);
857 846
 			}
858
-		}
859
-		else
847
+		} else
860 848
 		{
861 849
 			imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255));
862 850
 		}
@@ -914,8 +902,7 @@  discard block
 block discarded – undo
914 902
 		if(function_exists('imagecopyresampled'))
915 903
 		{
916 904
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
917
-		}
918
-		else
905
+		} else
919 906
 		{
920 907
 			imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
921 908
 		}
@@ -984,8 +971,7 @@  discard block
 block discarded – undo
984 971
 		if(is_array($arr) && count($arr) > 0)
985 972
 		{
986 973
 			return $arr;
987
-		}
988
-		else
974
+		} else
989 975
 		{
990 976
 			return array();
991 977
 		}
@@ -1035,12 +1021,10 @@  discard block
 block discarded – undo
1035 1021
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1036 1022
 				}
1037 1023
 				// value
1038
-			}
1039
-			else if(is_object($val))
1024
+			} else if(is_object($val))
1040 1025
 			{
1041 1026
 				continue;
1042
-			}
1043
-			else
1027
+			} else
1044 1028
 			{
1045 1029
 				$return[] = sprintf("%s=\"%s\"", $key, $val);
1046 1030
 			}
@@ -1182,8 +1166,7 @@  discard block
 block discarded – undo
1182 1166
 		if(substr($target, -4) === '.php')
1183 1167
 		{
1184 1168
 			opcache_invalidate(self::getRealPath($target), $force);
1185
-		}
1186
-		else if($path = self::isDir($target))
1169
+		} else if($path = self::isDir($target))
1187 1170
 		{
1188 1171
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1189 1172
 		}
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 		self::clearStatCache($filename);
160 160
 		self::invalidateOpcache($filename);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	function moveFile($source, $target)
196 196
 	{
197
-		if(($source = self::exists($source)) !== FALSE)
197
+		if (($source = self::exists($source)) !== FALSE)
198 198
 		{
199 199
 			self::removeFile($target);
200 200
 			return self::rename($source, $target);
@@ -232,35 +232,35 @@  discard block
 block discarded – undo
232 232
 		$path = self::getRealPath($path);
233 233
 		$output = array();
234 234
 
235
-		if(substr($path, -1) != '/')
235
+		if (substr($path, -1) != '/')
236 236
 		{
237 237
 			$path .= '/';
238 238
 		}
239 239
 
240
-		if(!is_dir($path))
240
+		if (!is_dir($path))
241 241
 		{
242 242
 			return $output;
243 243
 		}
244 244
 
245 245
 		$files = scandir($path);
246
-		foreach($files as $file)
246
+		foreach ($files as $file)
247 247
 		{
248
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
248
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
249 249
 			{
250 250
 				continue;
251 251
 			}
252 252
 
253
-			if($to_lower)
253
+			if ($to_lower)
254 254
 			{
255 255
 				$file = strtolower($file);
256 256
 			}
257 257
 
258
-			if($filter)
258
+			if ($filter)
259 259
 			{
260 260
 				$file = preg_replace($filter, '$1', $file);
261 261
 			}
262 262
 
263
-			if($concat_prefix)
263
+			if ($concat_prefix)
264 264
 			{
265 265
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
266 266
 			}
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	function makeDir($path_string)
283 283
 	{
284
-		if(self::exists($path_string) !== FALSE)
284
+		if (self::exists($path_string) !== FALSE)
285 285
 		{
286 286
 			return TRUE;
287 287
 		}
288 288
 
289
-		if(!ini_get('safe_mode'))
289
+		if (!ini_get('safe_mode'))
290 290
 		{
291 291
 			@mkdir($path_string, 0755, TRUE);
292 292
 			@chmod($path_string, 0755);
@@ -297,35 +297,35 @@  discard block
 block discarded – undo
297 297
 			static $oFtp = NULL;
298 298
 
299 299
 			$ftp_info = Context::getFTPInfo();
300
-			if($oFtp == NULL)
300
+			if ($oFtp == NULL)
301 301
 			{
302
-				if(!Context::isFTPRegisted())
302
+				if (!Context::isFTPRegisted())
303 303
 				{
304 304
 					return;
305 305
 				}
306 306
 
307
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
307
+				require_once(_XE_PATH_.'libs/ftp.class.php');
308 308
 				$oFtp = new ftp();
309
-				if(!$ftp_info->ftp_host)
309
+				if (!$ftp_info->ftp_host)
310 310
 				{
311 311
 					$ftp_info->ftp_host = "127.0.0.1";
312 312
 				}
313
-				if(!$ftp_info->ftp_port)
313
+				if (!$ftp_info->ftp_port)
314 314
 				{
315 315
 					$ftp_info->ftp_port = 21;
316 316
 				}
317
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
317
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
318 318
 				{
319 319
 					return;
320 320
 				}
321
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
321
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
322 322
 				{
323 323
 					$oFtp->ftp_quit();
324 324
 					return;
325 325
 				}
326 326
 			}
327 327
 
328
-			if(!($ftp_path = $ftp_info->ftp_root_path))
328
+			if (!($ftp_path = $ftp_info->ftp_root_path))
329 329
 			{
330 330
 				$ftp_path = DIRECTORY_SEPARATOR;
331 331
 			}
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
335 335
 
336 336
 			$path = _XE_PATH_;
337
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
337
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
338 338
 			{
339
-				if(!$path_list[$i])
339
+				if (!$path_list[$i])
340 340
 				{
341 341
 					continue;
342 342
 				}
343 343
 
344
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
345
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
346
-				if(!is_dir($path))
344
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
345
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
346
+				if (!is_dir($path))
347 347
 				{
348 348
 					$oFtp->ftp_mkdir($ftp_path);
349
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
349
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
350 350
 				}
351 351
 			}
352 352
 		}
@@ -362,23 +362,23 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	function removeDir($path)
364 364
 	{
365
-		if(($path = self::isDir($path)) === FALSE)
365
+		if (($path = self::isDir($path)) === FALSE)
366 366
 		{
367 367
 			return;
368 368
 		}
369 369
 
370
-		if(self::isDir($path))
370
+		if (self::isDir($path))
371 371
 		{
372 372
 			$files = array_diff(scandir($path), array('..', '.'));
373 373
 
374
-			foreach($files as $file)
374
+			foreach ($files as $file)
375 375
 			{
376
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
376
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
377 377
 				{
378 378
 					continue;
379 379
 				}
380 380
 
381
-				if(is_dir($target))
381
+				if (is_dir($target))
382 382
 				{
383 383
 					self::removeDir($target);
384 384
 				}
@@ -403,22 +403,22 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function removeBlankDir($path)
405 405
 	{
406
-		if(($path = self::isDir($path)) === FALSE)
406
+		if (($path = self::isDir($path)) === FALSE)
407 407
 		{
408 408
 			return;
409 409
 		}
410 410
 
411 411
 		$files = array_diff(scandir($path), array('..', '.'));
412 412
 
413
-		if(count($files) < 1)
413
+		if (count($files) < 1)
414 414
 		{
415 415
 			rmdir($path);
416 416
 			return;
417 417
 		}
418 418
 
419
-		foreach($files as $file)
419
+		foreach ($files as $file)
420 420
 		{
421
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
421
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
422 422
 			{
423 423
 				continue;
424 424
 			}
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	function removeFilesInDir($path)
439 439
 	{
440
-		if(($path = self::getRealPath($path)) === FALSE)
440
+		if (($path = self::getRealPath($path)) === FALSE)
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 
445
-		if(is_dir($path))
445
+		if (is_dir($path))
446 446
 		{
447 447
 			$files = array_diff(scandir($path), array('..', '.'));
448 448
 
449
-			foreach($files as $file)
449
+			foreach ($files as $file)
450 450
 			{
451
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
451
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
452 452
 				{
453 453
 					continue;
454 454
 				}
455 455
 
456
-				if(is_dir($target))
456
+				if (is_dir($target))
457 457
 				{
458 458
 					self::removeFilesInDir($target);
459 459
 				}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		}
466 466
 		else
467 467
 		{
468
-			if(self::exists($path)) unlink($path);
468
+			if (self::exists($path)) unlink($path);
469 469
 		}
470 470
 
471 471
 	}
@@ -479,22 +479,22 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	function filesize($size)
481 481
 	{
482
-		if(!$size)
482
+		if (!$size)
483 483
 		{
484 484
 			return '0Byte';
485 485
 		}
486 486
 
487
-		if($size === 1)
487
+		if ($size === 1)
488 488
 		{
489 489
 			return '1Byte';
490 490
 		}
491 491
 
492
-		if($size < 1024)
492
+		if ($size < 1024)
493 493
 		{
494
-			return $size . 'Bytes';
494
+			return $size.'Bytes';
495 495
 		}
496 496
 
497
-		if($size >= 1024 && $size < 1024 * 1024)
497
+		if ($size >= 1024 && $size < 1024 * 1024)
498 498
 		{
499 499
 			return sprintf("%0.1fKB", $size / 1024);
500 500
 		}
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
521 521
 	{
522
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
522
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
523 523
 		$IDN = new idna_convert(array('idn_version' => 2008));
524 524
 		$url = $IDN->encode($url);
525 525
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			require_once('HTTP/Request.php');
530 530
 
531 531
 			$parsed_url = parse_url(__PROXY_SERVER__);
532
-			if($parsed_url["host"] && $parsed_url["path"])
532
+			if ($parsed_url["host"] && $parsed_url["path"])
533 533
 			{
534 534
 				// Old style proxy server support (POST payload to proxy script)
535 535
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 				$oRequest = new HTTP_Request($url);
542 542
 
543 543
 				// New style proxy server support (Use HTTP_Request2 native config format)
544
-				if($parsed_url['host'])
544
+				if ($parsed_url['host'])
545 545
 				{
546 546
 					$request_config['proxy_host'] = $parsed_url['host'];
547 547
 					$request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : '';
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 					$request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http';
551 551
 				}
552 552
 
553
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
553
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
554 554
 				{
555
-					foreach($request_config as $key=>$val)
555
+					foreach ($request_config as $key=>$val)
556 556
 					{
557
-						if($key === 'observers')
557
+						if ($key === 'observers')
558 558
 						{
559
-							foreach($val as $observer)
559
+							foreach ($val as $observer)
560 560
 							{
561 561
 								$oRequest->attach($observer);
562 562
 							}
@@ -567,58 +567,58 @@  discard block
 block discarded – undo
567 567
 						}
568 568
 					}
569 569
 				}
570
-				if(method_exists($oRequest, 'setConfig'))
570
+				if (method_exists($oRequest, 'setConfig'))
571 571
 				{
572
-					if(extension_loaded('curl'))
572
+					if (extension_loaded('curl'))
573 573
 					{
574 574
 						$oRequest->setConfig('adapter', 'curl');
575 575
 					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
576
+					elseif (version_compare(PHP_VERSION, '5.6', '<'))
577 577
 					{
578 578
 						$oRequest->setConfig('ssl_verify_host', false);
579 579
 					}
580
-					if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem'))
580
+					if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem'))
581 581
 					{
582
-						$oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem');
582
+						$oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem');
583 583
 					}
584 584
 				}
585 585
 
586
-				if(count($headers) > 0)
586
+				if (count($headers) > 0)
587 587
 				{
588
-					foreach($headers as $key => $val)
588
+					foreach ($headers as $key => $val)
589 589
 					{
590 590
 						$oRequest->addHeader($key, $val);
591 591
 					}
592 592
 				}
593 593
 				$host = parse_url($url, PHP_URL_HOST);
594
-				if($cookies[$host])
594
+				if ($cookies[$host])
595 595
 				{
596
-					foreach($cookies[$host] as $key => $val)
596
+					foreach ($cookies[$host] as $key => $val)
597 597
 					{
598 598
 						$oRequest->addCookie($key, $val);
599 599
 					}
600 600
 				}
601
-				if(count($post_data) > 0)
601
+				if (count($post_data) > 0)
602 602
 				{
603
-					foreach($post_data as $key => $val)
603
+					foreach ($post_data as $key => $val)
604 604
 					{
605 605
 						$oRequest->addPostData($key, $val);
606 606
 					}
607 607
 				}
608
-				if(!$content_type)
608
+				if (!$content_type)
609 609
 					$oRequest->addHeader('Content-Type', 'text/html');
610 610
 				else
611 611
 					$oRequest->addHeader('Content-Type', $content_type);
612 612
 				$oRequest->setMethod($method);
613
-				if($body)
613
+				if ($body)
614 614
 					$oRequest->setBody($body);
615 615
 			}
616 616
 			
617
-			if(method_exists($oRequest, 'setConfig'))
617
+			if (method_exists($oRequest, 'setConfig'))
618 618
 			{
619 619
 				$oRequest->setConfig('timeout', $timeout);
620 620
 			}
621
-			elseif(property_exists($oRequest, '_timeout'))
621
+			elseif (property_exists($oRequest, '_timeout'))
622 622
 			{
623 623
 				$oRequest->_timeout = $timeout;
624 624
 			}
@@ -628,25 +628,25 @@  discard block
 block discarded – undo
628 628
 			$code = $oRequest->getResponseCode();
629 629
 			$header = $oRequest->getResponseHeader();
630 630
 			$response = $oRequest->getResponseBody();
631
-			if($c = $oRequest->getResponseCookies())
631
+			if ($c = $oRequest->getResponseCookies())
632 632
 			{
633
-				foreach($c as $k => $v)
633
+				foreach ($c as $k => $v)
634 634
 				{
635 635
 					$cookies[$host][$v['name']] = $v['value'];
636 636
 				}
637 637
 			}
638 638
 
639
-			if($code > 300 && $code < 399 && $header['location'])
639
+			if ($code > 300 && $code < 399 && $header['location'])
640 640
 			{
641 641
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
642 642
 			}
643 643
 
644
-			if($code != 200)
644
+			if ($code != 200)
645 645
 			{
646 646
 				return;
647 647
 			}
648 648
 
649
-			if(isset($request_config['store_body']) && !$request_config['store_body'])
649
+			if (isset($request_config['store_body']) && !$request_config['store_body'])
650 650
 			{
651 651
 				return TRUE;
652 652
 			}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 				return $response;
656 656
 			}
657 657
 		}
658
-		catch(Exception $e)
658
+		catch (Exception $e)
659 659
 		{
660 660
 			return NULL;
661 661
 		}
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 			self::clearStatCache($target_filename);
690 690
 			self::invalidateOpcache($target_filename);
691 691
 		}
692
-		catch(Exception $e)
692
+		catch (Exception $e)
693 693
 		{
694 694
 			return FALSE;
695 695
 		}
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 	function returnBytes($val)
707 707
 	{
708 708
 		$unit = strtoupper(substr($val, -1));
709
-		$val = (float)$val;
709
+		$val = (float) $val;
710 710
 
711 711
 		switch ($unit)
712 712
 		{
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	function checkMemoryLoadImage(&$imageInfo)
728 728
 	{
729 729
 		$memoryLimit = self::returnBytes(ini_get('memory_limit'));
730
-		if($memoryLimit == -1)
730
+		if ($memoryLimit == -1)
731 731
 		{
732 732
 			return true;
733 733
 		}
@@ -735,14 +735,14 @@  discard block
 block discarded – undo
735 735
 		$K64 = 65536;
736 736
 		$TWEAKFACTOR = 2.0;
737 737
 		$channels = $imageInfo['channels'];
738
-		if(!$channels)
738
+		if (!$channels)
739 739
 		{
740 740
 			$channels = 6; //for png
741 741
 		}
742 742
 
743
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
743
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
744 744
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
745
-		if($availableMemory < $memoryNeeded)
745
+		if ($availableMemory < $memoryNeeded)
746 746
 		{
747 747
 			return FALSE;
748 748
 		}
@@ -771,30 +771,30 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
 		$target_file = self::getRealPath($target_file);
774
-		if(!$resize_width)
774
+		if (!$resize_width)
775 775
 		{
776 776
 			$resize_width = 100;
777 777
 		}
778 778
 
779
-		if(!$resize_height)
779
+		if (!$resize_height)
780 780
 		{
781 781
 			$resize_height = $resize_width;
782 782
 		}
783 783
 
784 784
 		// retrieve source image's information
785 785
 		$imageInfo = getimagesize($source_file);
786
-		if(!self::checkMemoryLoadImage($imageInfo))
786
+		if (!self::checkMemoryLoadImage($imageInfo))
787 787
 		{
788 788
 			return FALSE;
789 789
 		}
790 790
 
791 791
 		list($width, $height, $type, $attrs) = $imageInfo;
792
-		if($width < 1 || $height < 1)
792
+		if ($width < 1 || $height < 1)
793 793
 		{
794 794
 			return;
795 795
 		}
796 796
 
797
-		switch($type)
797
+		switch ($type)
798 798
 		{
799 799
 			case '1' :
800 800
 				$type = 'gif';
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 				return;
813 813
 		}
814 814
 
815
-		if(!$target_type)
815
+		if (!$target_type)
816 816
 		{
817 817
 			$target_type = $type;
818 818
 		}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
824 824
 
825 825
 		$per = NULL;
826
-		if($thumbnail_type == 'ratio')
826
+		if ($thumbnail_type == 'ratio')
827 827
 		{
828 828
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
829 829
 			$resize_width = $width * $per;
@@ -836,30 +836,30 @@  discard block
 block discarded – undo
836 836
 
837 837
 		// create temporary image with target size
838 838
 		$thumb = NULL;
839
-		if(function_exists('imagecreateTRUEcolor'))
839
+		if (function_exists('imagecreateTRUEcolor'))
840 840
 		{
841 841
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
842 842
 		}
843
-		else if(function_exists('imagecreate'))
843
+		else if (function_exists('imagecreate'))
844 844
 		{
845 845
 			$thumb = imagecreate($resize_width, $resize_height);
846 846
 		}
847 847
 
848
-		if(!$thumb)
848
+		if (!$thumb)
849 849
 		{
850 850
 			return FALSE;
851 851
 		}
852 852
 
853
-		if(function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent)
853
+		if (function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent)
854 854
 		{
855 855
 			imagefill($thumb, 0, 0, imagecolorallocatealpha($thumb, 0, 0, 0, 127));
856 856
 			
857
-			if(function_exists('imagesavealpha'))
857
+			if (function_exists('imagesavealpha'))
858 858
 			{
859 859
 				imagesavealpha($thumb, TRUE);
860 860
 			}
861 861
 
862
-			if(function_exists('imagealphablending'))
862
+			if (function_exists('imagealphablending'))
863 863
 			{
864 864
 				imagealphablending($thumb, TRUE);
865 865
 			}
@@ -871,37 +871,37 @@  discard block
 block discarded – undo
871 871
 
872 872
 		// create temporary image having original type
873 873
 		$source = NULL;
874
-		switch($type)
874
+		switch ($type)
875 875
 		{
876 876
 			case 'gif' :
877
-				if(function_exists('imagecreatefromgif'))
877
+				if (function_exists('imagecreatefromgif'))
878 878
 				{
879 879
 					$source = @imagecreatefromgif($source_file);
880 880
 				}
881 881
 				break;
882 882
 			case 'jpeg' :
883 883
 			case 'jpg' :
884
-				if(function_exists('imagecreatefromjpeg'))
884
+				if (function_exists('imagecreatefromjpeg'))
885 885
 				{
886 886
 					$source = @imagecreatefromjpeg($source_file);
887 887
 				}
888 888
 				break;
889 889
 			case 'png' :
890
-				if(function_exists('imagecreatefrompng'))
890
+				if (function_exists('imagecreatefrompng'))
891 891
 				{
892 892
 					$source = @imagecreatefrompng($source_file);
893 893
 				}
894 894
 				break;
895 895
 			case 'wbmp' :
896 896
 			case 'bmp' :
897
-				if(function_exists('imagecreatefromwbmp'))
897
+				if (function_exists('imagecreatefromwbmp'))
898 898
 				{
899 899
 					$source = @imagecreatefromwbmp($source_file);
900 900
 				}
901 901
 				break;
902 902
 		}
903 903
 
904
-		if(!$source)
904
+		if (!$source)
905 905
 		{
906 906
 			imagedestroy($thumb);
907 907
 			return FALSE;
@@ -913,13 +913,13 @@  discard block
 block discarded – undo
913 913
 
914 914
 		$x = 0;
915 915
 		$y = 0;
916
-		if($thumbnail_type == 'crop')
916
+		if ($thumbnail_type == 'crop')
917 917
 		{
918 918
 			$x = (int) ($resize_width / 2 - $new_width / 2);
919 919
 			$y = (int) ($resize_height / 2 - $new_height / 2);
920 920
 		}
921 921
 
922
-		if(function_exists('imagecopyresampled'))
922
+		if (function_exists('imagecopyresampled'))
923 923
 		{
924 924
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
925 925
 		}
@@ -933,30 +933,30 @@  discard block
 block discarded – undo
933 933
 
934 934
 		// write into the file
935 935
 		$output = NULL;
936
-		switch($target_type)
936
+		switch ($target_type)
937 937
 		{
938 938
 			case 'gif' :
939
-				if(function_exists('imagegif'))
939
+				if (function_exists('imagegif'))
940 940
 				{
941 941
 					$output = imagegif($thumb, $target_file);
942 942
 				}
943 943
 				break;
944 944
 			case 'jpeg' :
945 945
 			case 'jpg' :
946
-				if(function_exists('imagejpeg'))
946
+				if (function_exists('imagejpeg'))
947 947
 				{
948 948
 					$output = imagejpeg($thumb, $target_file, 100);
949 949
 				}
950 950
 				break;
951 951
 			case 'png' :
952
-				if(function_exists('imagepng'))
952
+				if (function_exists('imagepng'))
953 953
 				{
954 954
 					$output = imagepng($thumb, $target_file, 9);
955 955
 				}
956 956
 				break;
957 957
 			case 'wbmp' :
958 958
 			case 'bmp' :
959
-				if(function_exists('imagewbmp'))
959
+				if (function_exists('imagewbmp'))
960 960
 				{
961 961
 					$output = imagewbmp($thumb, $target_file, 100);
962 962
 				}
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		imagedestroy($thumb);
967 967
 		imagedestroy($source);
968 968
 
969
-		if(!$output)
969
+		if (!$output)
970 970
 		{
971 971
 			return FALSE;
972 972
 		}
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
 	 */
985 985
 	function readIniFile($filename)
986 986
 	{
987
-		if(($filename = self::exists($filename)) === FALSE)
987
+		if (($filename = self::exists($filename)) === FALSE)
988 988
 		{
989 989
 			return FALSE;
990 990
 		}
991 991
 		$arr = parse_ini_file($filename, TRUE);
992
-		if(is_array($arr) && count($arr) > 0)
992
+		if (is_array($arr) && count($arr) > 0)
993 993
 		{
994 994
 			return $arr;
995 995
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	function writeIniFile($filename, $arr)
1017 1017
 	{
1018
-		if(!is_array($arr) || count($arr) == 0)
1018
+		if (!is_array($arr) || count($arr) == 0)
1019 1019
 		{
1020 1020
 			return FALSE;
1021 1021
 		}
@@ -1032,19 +1032,19 @@  discard block
 block discarded – undo
1032 1032
 	function _makeIniBuff($arr)
1033 1033
 	{
1034 1034
 		$return = array();
1035
-		foreach($arr as $key => $val)
1035
+		foreach ($arr as $key => $val)
1036 1036
 		{
1037 1037
 			// section
1038
-			if(is_array($val))
1038
+			if (is_array($val))
1039 1039
 			{
1040 1040
 				$return[] = sprintf("[%s]", $key);
1041
-				foreach($val as $k => $v)
1041
+				foreach ($val as $k => $v)
1042 1042
 				{
1043 1043
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1044 1044
 				}
1045 1045
 				// value
1046 1046
 			}
1047
-			else if(is_object($val))
1047
+			else if (is_object($val))
1048 1048
 			{
1049 1049
 				continue;
1050 1050
 			}
@@ -1119,15 +1119,15 @@  discard block
 block discarded – undo
1119 1119
 	function isWritableDir($path)
1120 1120
 	{
1121 1121
 		$path = self::getRealPath($path);
1122
-		if(is_dir($path)==FALSE)
1122
+		if (is_dir($path) == FALSE)
1123 1123
 		{
1124 1124
 			return FALSE;
1125 1125
 		}
1126 1126
 
1127
-		$checkFile = $path . '/_CheckWritableDir';
1127
+		$checkFile = $path.'/_CheckWritableDir';
1128 1128
 
1129 1129
 		$fp = fopen($checkFile, 'w');
1130
-		if(!is_resource($fp))
1130
+		if (!is_resource($fp))
1131 1131
 		{
1132 1132
 			return FALSE;
1133 1133
 		}
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 	 **/
1146 1146
 	static public function clearStatCache($target, $include = false)
1147 1147
 	{
1148
-		if(is_array($target))
1148
+		if (is_array($target))
1149 1149
 		{
1150 1150
 			array_map('self::clearStatCache', $target);
1151 1151
 			return;
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 
1154 1154
 		$target = self::getRealPath($target);
1155 1155
 
1156
-		if($include && self::isDir($target))
1156
+		if ($include && self::isDir($target))
1157 1157
 		{
1158 1158
 			self::clearStatCache(self::readDir($target, '', false, true), $include);
1159 1159
 		}
@@ -1171,27 +1171,27 @@  discard block
 block discarded – undo
1171 1171
 	{
1172 1172
 		static $opcache = null;
1173 1173
 
1174
-		if($opcache === null)
1174
+		if ($opcache === null)
1175 1175
 		{
1176 1176
 			$opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate'));
1177 1177
 		}
1178 1178
 
1179
-		if($opcache === false)
1179
+		if ($opcache === false)
1180 1180
 		{
1181 1181
 			return;
1182 1182
 		}
1183 1183
 
1184
-		if(is_array($target))
1184
+		if (is_array($target))
1185 1185
 		{
1186 1186
 			array_map('self::invalidateOpcache', $target);
1187 1187
 			return;
1188 1188
 		}
1189 1189
 
1190
-		if(substr($target, -4) === '.php')
1190
+		if (substr($target, -4) === '.php')
1191 1191
 		{
1192 1192
 			opcache_invalidate(self::getRealPath($target), $force);
1193 1193
 		}
1194
-		else if($path = self::isDir($target))
1194
+		else if ($path = self::isDir($target))
1195 1195
 		{
1196 1196
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1197 1197
 		}
Please login to merge, or discard this patch.
modules/editor/editor.class.php 2 patches
Braces   +51 added lines, -23 removed lines patch added patch discarded remove patch
@@ -51,24 +51,44 @@  discard block
 block discarded – undo
51 51
 		if($oModuleModel->needUpdate($version_update_id))
52 52
 		{
53 53
 			// 2009. 06. 15 Save module_srl when auto-saving
54
-			if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
55
-			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
54
+			if(!$oDB->isColumnExists("editor_autosave","module_srl")) {
55
+				return true;
56
+			}
57
+			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) {
58
+				return true;
59
+			}
56 60
 
57 61
 			// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
58
-			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
59
-			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
62
+			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) {
63
+				return true;
64
+			}
65
+			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) {
66
+				return true;
67
+			}
60 68
 			// 2007. 10. 23 Add an editor trigger on the module addition setup
61
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
69
+			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) {
70
+				return true;
71
+			}
62 72
 			// 2009. 04. 14 Add a trigger from compiled codes of the editor component
63
-			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
73
+			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) {
74
+				return true;
75
+			}
64 76
 			// 2009. 06. 19 Remove unused trigger
65
-			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
77
+			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) {
78
+				return true;
79
+			}
66 80
 
67 81
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
68
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
82
+			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) {
83
+				return true;
84
+			}
69 85
 
70
-			if(!$oDB->isColumnExists("editor_autosave", "certify_key")) return true;
71
-			if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) return true;
86
+			if(!$oDB->isColumnExists("editor_autosave", "certify_key")) {
87
+				return true;
88
+			}
89
+			if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) {
90
+				return true;
91
+			}
72 92
 
73 93
 			$oModuleController->insertUpdatedLog($version_update_id);
74 94
 		}
@@ -88,26 +108,34 @@  discard block
 block discarded – undo
88 108
 		if($oModuleModel->needUpdate($version_update_id))
89 109
 		{
90 110
 			// Save module_srl when auto-saving 15/06/2009
91
-			if(!$oDB->isColumnExists("editor_autosave","module_srl")) 
92
-				$oDB->addColumn("editor_autosave","module_srl","number",11);
111
+			if(!$oDB->isColumnExists("editor_autosave","module_srl")) {
112
+							$oDB->addColumn("editor_autosave","module_srl","number",11);
113
+			}
93 114
 
94 115
 			// create an index on module_srl
95
-			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
116
+			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) {
117
+				$oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
118
+			}
96 119
 
97 120
 			// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
98
-			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
99
-				$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
100
-			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
101
-				$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
121
+			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) {
122
+							$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
123
+			}
124
+			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) {
125
+							$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
126
+			}
102 127
 			// 2007. 10. Add an editor trigger on the module addition setup
103
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) 
104
-				$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
128
+			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) {
129
+							$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
130
+			}
105 131
 			// 2009. 04. 14 Add a trigger from compiled codes of the editor component
106
-			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) 
107
-				$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
132
+			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) {
133
+							$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
134
+			}
108 135
 			// 2009. 06. 19 Remove unused trigger
109
-			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) 
110
-				$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
136
+			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) {
137
+							$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
138
+			}
111 139
 
112 140
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
113 141
 			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 		$oModuleController = getController('module');
17 17
 		// Add the default editor component
18 18
 		$oEditorController = getAdminController('editor');
19
-		$oEditorController->insertComponent('colorpicker_text',true);
20
-		$oEditorController->insertComponent('colorpicker_bg',true);
21
-		$oEditorController->insertComponent('emoticon',true);
22
-		$oEditorController->insertComponent('url_link',true);
23
-		$oEditorController->insertComponent('image_link',true);
24
-		$oEditorController->insertComponent('multimedia_link',true);
25
-		$oEditorController->insertComponent('quotation',true);
26
-		$oEditorController->insertComponent('table_maker',true);
27
-		$oEditorController->insertComponent('poll_maker',true);
28
-		$oEditorController->insertComponent('image_gallery',true);
19
+		$oEditorController->insertComponent('colorpicker_text', true);
20
+		$oEditorController->insertComponent('colorpicker_bg', true);
21
+		$oEditorController->insertComponent('emoticon', true);
22
+		$oEditorController->insertComponent('url_link', true);
23
+		$oEditorController->insertComponent('image_link', true);
24
+		$oEditorController->insertComponent('multimedia_link', true);
25
+		$oEditorController->insertComponent('quotation', true);
26
+		$oEditorController->insertComponent('table_maker', true);
27
+		$oEditorController->insertComponent('poll_maker', true);
28
+		$oEditorController->insertComponent('image_gallery', true);
29 29
 		// Create a directory to use in the editor module
30 30
 		FileHandler::makeDir('./files/cache/editor');
31 31
 		// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
@@ -48,27 +48,27 @@  discard block
 block discarded – undo
48 48
 		$oModuleModel = getModel('module');
49 49
 		$oModuleController = getController('module');
50 50
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
51
-		if($oModuleModel->needUpdate($version_update_id))
51
+		if ($oModuleModel->needUpdate($version_update_id))
52 52
 		{
53 53
 			// 2009. 06. 15 Save module_srl when auto-saving
54
-			if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
55
-			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
54
+			if (!$oDB->isColumnExists("editor_autosave", "module_srl")) return true;
55
+			if (!$oDB->isIndexExists("editor_autosave", "idx_module_srl")) return true;
56 56
 
57 57
 			// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
58
-			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
59
-			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
58
+			if (!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
59
+			if (!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
60 60
 			// 2007. 10. 23 Add an editor trigger on the module addition setup
61
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
61
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
62 62
 			// 2009. 04. 14 Add a trigger from compiled codes of the editor component
63
-			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
63
+			if (!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
64 64
 			// 2009. 06. 19 Remove unused trigger
65
-			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
65
+			if ($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
66 66
 
67 67
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
68
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
68
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
69 69
 
70
-			if(!$oDB->isColumnExists("editor_autosave", "certify_key")) return true;
71
-			if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) return true;
70
+			if (!$oDB->isColumnExists("editor_autosave", "certify_key")) return true;
71
+			if (!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) return true;
72 72
 
73 73
 			$oModuleController->insertUpdatedLog($version_update_id);
74 74
 		}
@@ -85,44 +85,44 @@  discard block
 block discarded – undo
85 85
 		$oModuleModel = getModel('module');
86 86
 		$oModuleController = getController('module');
87 87
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
88
-		if($oModuleModel->needUpdate($version_update_id))
88
+		if ($oModuleModel->needUpdate($version_update_id))
89 89
 		{
90 90
 			// Save module_srl when auto-saving 15/06/2009
91
-			if(!$oDB->isColumnExists("editor_autosave","module_srl")) 
92
-				$oDB->addColumn("editor_autosave","module_srl","number",11);
91
+			if (!$oDB->isColumnExists("editor_autosave", "module_srl")) 
92
+				$oDB->addColumn("editor_autosave", "module_srl", "number", 11);
93 93
 
94 94
 			// create an index on module_srl
95
-			if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
95
+			if (!$oDB->isIndexExists("editor_autosave", "idx_module_srl")) $oDB->addIndex("editor_autosave", "idx_module_srl", "module_srl");
96 96
 
97 97
 			// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
98
-			if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
98
+			if (!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
99 99
 				$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
100
-			if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
100
+			if (!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) 
101 101
 				$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
102 102
 			// 2007. 10. Add an editor trigger on the module addition setup
103
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) 
103
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) 
104 104
 				$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
105 105
 			// 2009. 04. 14 Add a trigger from compiled codes of the editor component
106
-			if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) 
106
+			if (!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) 
107 107
 				$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
108 108
 			// 2009. 06. 19 Remove unused trigger
109
-			if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) 
109
+			if ($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) 
110 110
 				$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
111 111
 
112 112
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
113
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
113
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
114 114
 			{
115 115
 				$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after');
116 116
 			}
117 117
 
118 118
 			// @see https://github.com/xpressengine/xe-core/issues/2229
119
-			if(!$oDB->isColumnExists('editor_autosave','certify_key'))
119
+			if (!$oDB->isColumnExists('editor_autosave', 'certify_key'))
120 120
 			{
121 121
 				$oDB->addColumn('editor_autosave', 'certify_key', 'varchar', 100);
122 122
 			}
123
-			if(!$oDB->isIndexExists("editor_autosave","idx_certify_key"))
123
+			if (!$oDB->isIndexExists("editor_autosave", "idx_certify_key"))
124 124
 			{
125
-				$oDB->addIndex("editor_autosave","idx_certify_key", "certify_key");
125
+				$oDB->addIndex("editor_autosave", "idx_certify_key", "certify_key");
126 126
 			}
127 127
 
128 128
 			$oModuleController->insertUpdatedLog($version_update_id);
Please login to merge, or discard this patch.
modules/module/module.class.php 2 patches
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$oModuleController = getController('module');
17 17
 
18 18
 		$oDB = &DB::getInstance();
19
-		$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true);
20
-		$oDB->addIndex('sites','unique_domain',array('domain'),true);
19
+		$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
20
+		$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
21 21
 		// Create a directory to use in the module module
22 22
 		FileHandler::makeDir('./files/cache/module_info');
23 23
 		FileHandler::makeDir('./files/cache/triggers');
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 		$args = new stdClass;
28 28
 		$args->site_srl = 0;
29 29
 		$output = $oDB->executeQuery('module.getSite', $args);
30
-		if(!$output->data || !$output->data->index_module_srl)
30
+		if (!$output->data || !$output->data->index_module_srl)
31 31
 		{
32 32
 			$db_info = Context::getDBInfo();
33 33
 			$domain = Context::getDefaultUrl();
34 34
 			$url_info = parse_url($domain);
35
-			$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
35
+			$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
36 36
 
37 37
 			$site_args = new stdClass;
38 38
 			$site_args->site_srl = 0;
39
-			$site_args->index_module_srl  = 0;
39
+			$site_args->index_module_srl = 0;
40 40
 			$site_args->domain = $domain;
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if (!$output->toBool()) return $output;
45 45
 		}
46 46
 
47 47
 		return new BaseObject();
@@ -56,68 +56,68 @@  discard block
 block discarded – undo
56 56
 		$oModuleModel = getModel('module');
57 57
 		$oModuleController = getController('module');
58 58
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
59
-		if($oModuleModel->needUpdate($version_update_id))
59
+		if ($oModuleModel->needUpdate($version_update_id))
60 60
 		{
61 61
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
62
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true;
63 63
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
64
+			if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true;
65 65
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
66
+			if ($oDB->isColumnExists('modules', 'grants')) return true;
67 67
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
68
+			if (!$oDB->isColumnExists('sites', 'default_language')) return true;
69 69
 			// Delete extra_vars* column
70
-			for($i=1;$i<=20;$i++)
70
+			for ($i = 1; $i <= 20; $i++)
71 71
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
72
+				if ($oDB->isColumnExists("documents", "extra_vars".$i)) return true;
73 73
 			}
74 74
 			// Insert site information to the table, sites
75 75
 			$args = new stdClass();
76 76
 			$args->site_srl = 0;
77 77
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
78
+			if (!$output->data) return true;
79 79
 
80 80
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
81
+			if ($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
+			if (!$oDB->isIndexExists('sites', 'unique_domain')) return true;
83 83
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
84
+			if (!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
+			if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
+			if (!$oDB->isColumnExists("modules", "mcontent")) return true;
87
+			if (!$oDB->isColumnExists("modules", "mskin")) return true;
88 88
 
89 89
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
90
+			if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
91 91
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
92
+			if (!$oDB->isColumnExists("module_config", "site_srl")) return true;
93 93
 
94 94
 			$args->skin = '.';
95 95
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
96
-			if($output->data && count($output->data) > 0)
96
+			if ($output->data && count($output->data) > 0)
97 97
 			{
98
-				foreach($output->data as $item)
98
+				foreach ($output->data as $item)
99 99
 				{
100 100
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
101
+					if (count($skin_path) != 2) continue;
102
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
103 103
 				}
104 104
 			}
105 105
 
106 106
 			// XE 1.7
107 107
 
108 108
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
109
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
110 110
 
111
-			if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true;
111
+			if (!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true;
112 112
 
113 113
 			$oModuleModel = getModel('module');
114 114
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
115
-			if(!$moduleConfig->isUpdateFixedValue) return true;
115
+			if (!$moduleConfig->isUpdateFixedValue) return true;
116 116
 
117 117
 			$oModuleController->insertUpdatedLog($version_update_id);
118 118
 		}
119 119
 
120
-		if(!is_dir('./files/ruleset')) return true;
120
+		if (!is_dir('./files/ruleset')) return true;
121 121
 
122 122
 		return false;
123 123
 	}
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
 		$oModuleModel = getModel('module');
132 132
 		$oModuleController = getController('module');
133 133
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
134
-		if($oModuleModel->needUpdate($version_update_id))
134
+		if ($oModuleModel->needUpdate($version_update_id))
135 135
 		{
136 136
 			// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
137
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config"))
137
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config"))
138 138
 			{
139 139
 				$oModuleModel = getModel('module');
140 140
 				$oModuleController = getController('module');
141 141
 				$modules = $oModuleModel->getModuleList();
142
-				foreach($modules as $key => $module_info)
142
+				foreach ($modules as $key => $module_info)
143 143
 				{
144 144
 					$module = $module_info->module;
145
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
145
+					if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue;
146 146
 					$config = $oModuleModel->getModuleConfig($module);
147 147
 
148 148
 					$module_config = null;
149
-					switch($module)
149
+					switch ($module)
150 150
 					{
151 151
 						case 'point' :
152 152
 							$module_config = $config->module_point;
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 						case 'editor' :
160 160
 							$module_config = $config->module_config;
161 161
 							unset($config->module_config);
162
-							if(is_array($module_config) && count($module_config))
162
+							if (is_array($module_config) && count($module_config))
163 163
 							{
164
-								foreach($module_config as $key => $val)
164
+								foreach ($module_config as $key => $val)
165 165
 								{
166
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
166
+									if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
167 167
 								}
168 168
 							}
169 169
 							break;
170 170
 						case 'layout' :
171 171
 							$tmp = $config->header_script;
172
-							if(is_array($tmp) && count($tmp))
172
+							if (is_array($tmp) && count($tmp))
173 173
 							{
174
-								foreach($tmp as $k => $v)
174
+								foreach ($tmp as $k => $v)
175 175
 								{
176
-									if(!$v && !trim($v)) continue;
176
+									if (!$v && !trim($v)) continue;
177 177
 									$module_config[$k]->header_script = $v;
178 178
 								}
179 179
 							}
@@ -183,29 +183,29 @@  discard block
 block discarded – undo
183 183
 
184 184
 					$oModuleController->insertModuleConfig($module, $config);
185 185
 
186
-					if(is_array($module_config) && count($module_config))
186
+					if (is_array($module_config) && count($module_config))
187 187
 					{
188
-						foreach($module_config as $module_srl => $module_part_config)
188
+						foreach ($module_config as $module_srl => $module_part_config)
189 189
 						{
190
-							$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
190
+							$oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config);
191 191
 						}
192 192
 					}
193 193
 				}
194
-				$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
194
+				$oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl"));
195 195
 			}
196 196
 			// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
197
-			if(!$oDB->isIndexExists('modules',"idx_site_mid"))
197
+			if (!$oDB->isIndexExists('modules', "idx_site_mid"))
198 198
 			{
199
-				$oDB->dropIndex("modules","unique_mid",true);
200
-				$oDB->addColumn('modules','site_srl','number',11,0,true);
201
-				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
199
+				$oDB->dropIndex("modules", "unique_mid", true);
200
+				$oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true);
201
+				$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
202 202
 			}
203 203
 			// document extra vars
204
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
204
+			if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
205 205
 
206
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
206
+			if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
207 207
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
208
-			if($oDB->isColumnExists('modules', 'grants'))
208
+			if ($oDB->isColumnExists('modules', 'grants'))
209 209
 			{
210 210
 				$oModuleController = getController('module');
211 211
 				$oDocumentController = getController('document');
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 				$lang_code = Context::getLangType();
214 214
 				// Get module_info of all modules
215 215
 				$output = executeQueryArray('module.getModuleInfos');
216
-				if(count($output->data))
216
+				if (count($output->data))
217 217
 				{
218
-					foreach($output->data as $module_info)
218
+					foreach ($output->data as $module_info)
219 219
 					{
220 220
 						// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
221 221
 						$module_srl = trim($module_info->module_srl);
222 222
 						// grant an authority
223 223
 						$grants = unserialize($module_info->grants);
224
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
224
+						if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
225 225
 						// Insert skin vars
226 226
 						$skin_vars = unserialize($module_info->skin_vars);
227
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
227
+						if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
228 228
 						// Insert super admin's ID
229 229
 						$admin_id = trim($module_info->admin_id);
230
-						if($admin_id && $admin_id != 'Array')
230
+						if ($admin_id && $admin_id != 'Array')
231 231
 						{
232
-							$admin_ids = explode(',',$admin_id);
233
-							if(count($admin_id))
232
+							$admin_ids = explode(',', $admin_id);
233
+							if (count($admin_id))
234 234
 							{
235
-								foreach($admin_ids as $admin_id)
235
+								foreach ($admin_ids as $admin_id)
236 236
 								{
237 237
 									$oModuleController->insertAdminId($module_srl, $admin_id);
238 238
 								}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 						// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
242 242
 						$extra_vars = unserialize($module_info->extra_vars);
243 243
 						$document_extra_keys = null;
244
-						if($extra_vars->extra_vars && count($extra_vars->extra_vars))
244
+						if ($extra_vars->extra_vars && count($extra_vars->extra_vars))
245 245
 						{
246 246
 							$document_extra_keys = $extra_vars->extra_vars;
247 247
 							unset($extra_vars->extra_vars);
248 248
 						}
249
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
249
+						if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
250 250
 
251 251
 						/**
252 252
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
253 253
 						 */
254 254
 						// Insert extra vars if planet module is
255
-						if($module_info->module == 'planet')
255
+						if ($module_info->module == 'planet')
256 256
 						{
257
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
257
+							if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
258 258
 							$planet_extra_keys->name = 'postscript';
259 259
 							$planet_extra_keys->type = 'text';
260 260
 							$planet_extra_keys->is_required = 'N';
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 							$document_extra_keys[20] = $planet_extra_keys;
265 265
 						}
266 266
 						// Register keys for document extra vars
267
-						if(count($document_extra_keys))
267
+						if (count($document_extra_keys))
268 268
 						{
269
-							foreach($document_extra_keys as $var_idx => $val)
269
+							foreach ($document_extra_keys as $var_idx => $val)
270 270
 							{
271 271
 								$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
272 272
 							}
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 							$oDocumentModel = getModel('document');
275 275
 							$total_count = $oDocumentModel->getDocumentCount($module_srl);
276 276
 
277
-							if($total_count > 0)
277
+							if ($total_count > 0)
278 278
 							{
279 279
 								$per_page = 100;
280 280
 								$total_pages = (int) (($total_count - 1) / $per_page) + 1;
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
 								$doc_args->sort_index = 'list_order';
286 286
 								$doc_args->order_type = 'asc';
287 287
 
288
-								for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
288
+								for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
289 289
 								{
290 290
 									$output = executeQueryArray('document.getDocumentList', $doc_args);
291 291
 
292
-									if($output->toBool() && $output->data && count($output->data))
292
+									if ($output->toBool() && $output->data && count($output->data))
293 293
 									{
294 294
 										foreach ($output->data as $document)
295 295
 										{
296
-											if(!$document) continue;
296
+											if (!$document) continue;
297 297
 											foreach ($document as $key => $var)
298 298
 											{
299 299
 												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
300
-												$var_idx = str_replace('extra_vars','',$key);
300
+												$var_idx = str_replace('extra_vars', '', $key);
301 301
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
302 302
 											}
303 303
 										}
@@ -313,96 +313,96 @@  discard block
 block discarded – undo
313 313
 						executeQuery('module.updateModule', $module_info);
314 314
 
315 315
 						$oCacheHandler = CacheHandler::getInstance('object', null, true);
316
-						if($oCacheHandler->isSupport())
316
+						if ($oCacheHandler->isSupport())
317 317
 						{
318 318
 							$oCacheHandler->invalidateGroupKey('site_and_module');
319 319
 						}
320 320
 					}
321 321
 				}
322 322
 				// Various column drop
323
-				$oDB->dropColumn('modules','grants');
324
-				$oDB->dropColumn('modules','admin_id');
325
-				$oDB->dropColumn('modules','skin_vars');
326
-				$oDB->dropColumn('modules','extra_vars');
323
+				$oDB->dropColumn('modules', 'grants');
324
+				$oDB->dropColumn('modules', 'admin_id');
325
+				$oDB->dropColumn('modules', 'skin_vars');
326
+				$oDB->dropColumn('modules', 'extra_vars');
327 327
 			}
328 328
 			// Rights of all modules/skins transferring the information into a table Update grants
329
-			if(!$oDB->isColumnExists('sites', 'default_language'))
329
+			if (!$oDB->isColumnExists('sites', 'default_language'))
330 330
 			{
331
-				$oDB->addColumn('sites','default_language','varchar',255,0,false);
331
+				$oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false);
332 332
 			}
333 333
 			// extra_vars * Remove Column
334
-			for($i=1;$i<=20;$i++)
334
+			for ($i = 1; $i <= 20; $i++)
335 335
 			{
336
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
337
-				$oDB->dropColumn('documents','extra_vars'.$i);
336
+				if (!$oDB->isColumnExists("documents", "extra_vars".$i)) continue;
337
+				$oDB->dropColumn('documents', 'extra_vars'.$i);
338 338
 			}
339 339
 
340 340
 			// Enter the main site information sites on the table
341 341
 			$args = new stdClass;
342 342
 			$args->site_srl = 0;
343 343
 			$output = $oDB->executeQuery('module.getSite', $args);
344
-			if(!$output->data)
344
+			if (!$output->data)
345 345
 			{
346 346
 				// Basic mid, language Wanted
347 347
 				$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
348 348
 				$db_info = Context::getDBInfo();
349 349
 				$domain = Context::getDefaultUrl();
350 350
 				$url_info = parse_url($domain);
351
-				$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
351
+				$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
352 352
 				$site_args->site_srl = 0;
353
-				$site_args->index_module_srl  = $mid_output->data->module_srl;
353
+				$site_args->index_module_srl = $mid_output->data->module_srl;
354 354
 				$site_args->domain = $domain;
355 355
 				$site_args->default_language = $db_info->lang_type;
356 356
 
357 357
 				$output = executeQuery('module.insertSite', $site_args);
358
-				if(!$output->toBool()) return $output;
358
+				if (!$output->toBool()) return $output;
359 359
 			}
360 360
 
361
-			if($oDB->isIndexExists('sites','idx_domain'))
361
+			if ($oDB->isIndexExists('sites', 'idx_domain'))
362 362
 			{
363
-				$oDB->dropIndex('sites','idx_domain');
363
+				$oDB->dropIndex('sites', 'idx_domain');
364 364
 			}
365
-			if(!$oDB->isIndexExists('sites','unique_domain'))
365
+			if (!$oDB->isIndexExists('sites', 'unique_domain'))
366 366
 			{
367 367
 				$this->updateForUniqueSiteDomain();
368
-				$oDB->addIndex('sites','unique_domain',array('domain'),true);
368
+				$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
369 369
 			}
370 370
 
371
-			if(!$oDB->isColumnExists("modules", "use_mobile"))
371
+			if (!$oDB->isColumnExists("modules", "use_mobile"))
372 372
 			{
373
-				$oDB->addColumn('modules','use_mobile','char',1,'N');
373
+				$oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N');
374 374
 			}
375
-			if(!$oDB->isColumnExists("modules", "mlayout_srl"))
375
+			if (!$oDB->isColumnExists("modules", "mlayout_srl"))
376 376
 			{
377
-				$oDB->addColumn('modules','mlayout_srl','number',11, 0);
377
+				$oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0);
378 378
 			}
379
-			if(!$oDB->isColumnExists("modules", "mcontent"))
379
+			if (!$oDB->isColumnExists("modules", "mcontent"))
380 380
 			{
381
-				$oDB->addColumn('modules','mcontent','bigtext');
381
+				$oDB->addColumn('modules', 'mcontent', 'bigtext');
382 382
 			}
383
-			if(!$oDB->isColumnExists("modules", "mskin"))
383
+			if (!$oDB->isColumnExists("modules", "mskin"))
384 384
 			{
385
-				$oDB->addColumn('modules','mskin','varchar',250);
385
+				$oDB->addColumn('modules', 'mskin', 'varchar', 250);
386 386
 			}
387
-			if(!$oDB->isColumnExists("modules", "is_skin_fix"))
387
+			if (!$oDB->isColumnExists("modules", "is_skin_fix"))
388 388
 			{
389 389
 				$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N');
390 390
 				$output = executeQuery('module.updateSkinFixModules');
391 391
 			}
392
-			if(!$oDB->isColumnExists("module_config", "site_srl"))
392
+			if (!$oDB->isColumnExists("module_config", "site_srl"))
393 393
 			{
394 394
 				$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
395 395
 			}
396 396
 
397 397
 			$args->skin = '.';
398 398
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
399
-			if($output->data && count($output->data) > 0)
399
+			if ($output->data && count($output->data) > 0)
400 400
 			{
401
-				foreach($output->data as $item)
401
+				foreach ($output->data as $item)
402 402
 				{
403 403
 					$skin_path = explode('.', $item->skin);
404
-					if(count($skin_path) != 2) continue;
405
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
404
+					if (count($skin_path) != 2) continue;
405
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
406 406
 					{
407 407
 						unset($args);
408 408
 						$args->skin = $item->skin;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			}
414 414
 
415 415
 			// XE 1.7
416
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix"))
416
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix"))
417 417
 			{
418 418
 				$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N');
419 419
 				$output = executeQuery('module.updateMobileSkinFixModules');
@@ -421,18 +421,18 @@  discard block
 block discarded – undo
421 421
 
422 422
 			$oModuleModel = getModel('module');
423 423
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
424
-			if(!$moduleConfig->isUpdateFixedValue)
424
+			if (!$moduleConfig->isUpdateFixedValue)
425 425
 			{
426 426
 				$output = executeQuery('module.updateSkinFixModules');
427 427
 				$output = executeQuery('module.updateMobileSkinFixModules');
428 428
 
429 429
 				$oModuleController = getController('module');
430
-				if(!$moduleConfig) $moduleConfig = new stdClass;
430
+				if (!$moduleConfig) $moduleConfig = new stdClass;
431 431
 				$moduleConfig->isUpdateFixedValue = TRUE;
432 432
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
433 433
 			}
434 434
 
435
-			if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config"))
435
+			if (!$oDB->isIndexExists("module_part_config", "unique_module_part_config"))
436 436
 			{
437 437
 				$oDB->addIndex("module_part_config", "unique_module_part_config", array("module", "module_srl"), TRUE);
438 438
 			}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 			$oModuleController->insertUpdatedLog($version_update_id);
441 441
 		}
442 442
 
443
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
443
+		if (!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
444 444
 
445 445
 		return new BaseObject(0, 'success_updated');
446 446
 	}
@@ -448,18 +448,18 @@  discard block
 block discarded – undo
448 448
 	function updateForUniqueSiteDomain()
449 449
 	{
450 450
 		$output = executeQueryArray("module.getNonuniqueDomains");
451
-		if(!$output->data) return;
452
-		foreach($output->data as $data)
451
+		if (!$output->data) return;
452
+		foreach ($output->data as $data)
453 453
 		{
454
-			if($data->count == 1) continue;
454
+			if ($data->count == 1) continue;
455 455
 			$domain = $data->domain;
456 456
 			$args = new stdClass;
457 457
 			$args->domain = $domain;
458 458
 			$output2 = executeQueryArray("module.getSiteByDomain", $args);
459 459
 			$bFirst = true;
460
-			foreach($output2->data as $site)
460
+			foreach ($output2->data as $site)
461 461
 			{
462
-				if($bFirst)
462
+				if ($bFirst)
463 463
 				{
464 464
 					$bFirst = false;
465 465
 					continue;
Please login to merge, or discard this patch.
Braces   +117 added lines, -39 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if(!$output->toBool()) {
45
+				return $output;
46
+			}
45 47
 		}
46 48
 
47 49
 		return new BaseObject();
@@ -59,37 +61,65 @@  discard block
 block discarded – undo
59 61
 		if($oModuleModel->needUpdate($version_update_id))
60 62
 		{
61 63
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
64
+			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
65
+				return true;
66
+			}
63 67
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
68
+			if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
69
+				return true;
70
+			}
65 71
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
72
+			if($oDB->isColumnExists('modules', 'grants')) {
73
+				return true;
74
+			}
67 75
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
76
+			if(!$oDB->isColumnExists('sites', 'default_language')) {
77
+				return true;
78
+			}
69 79
 			// Delete extra_vars* column
70 80
 			for($i=1;$i<=20;$i++)
71 81
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
82
+				if($oDB->isColumnExists("documents","extra_vars".$i)) {
83
+					return true;
84
+				}
73 85
 			}
74 86
 			// Insert site information to the table, sites
75 87
 			$args = new stdClass();
76 88
 			$args->site_srl = 0;
77 89
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
90
+			if(!$output->data) {
91
+				return true;
92
+			}
79 93
 
80 94
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
95
+			if($oDB->isIndexExists('sites', 'idx_domain')) {
96
+				return true;
97
+			}
98
+			if(!$oDB->isIndexExists('sites','unique_domain')) {
99
+				return true;
100
+			}
83 101
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
102
+			if(!$oDB->isColumnExists("modules", "use_mobile")) {
103
+				return true;
104
+			}
105
+			if(!$oDB->isColumnExists("modules", "mlayout_srl")) {
106
+				return true;
107
+			}
108
+			if(!$oDB->isColumnExists("modules", "mcontent")) {
109
+				return true;
110
+			}
111
+			if(!$oDB->isColumnExists("modules", "mskin")) {
112
+				return true;
113
+			}
88 114
 
89 115
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
116
+			if(!$oDB->isColumnExists("modules", "is_skin_fix")) {
117
+				return true;
118
+			}
91 119
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
120
+			if(!$oDB->isColumnExists("module_config", "site_srl")) {
121
+				return true;
122
+			}
93 123
 
94 124
 			$args->skin = '.';
95 125
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
@@ -98,26 +128,38 @@  discard block
 block discarded – undo
98 128
 				foreach($output->data as $item)
99 129
 				{
100 130
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
131
+					if(count($skin_path) != 2) {
132
+						continue;
133
+					}
134
+					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) {
135
+						return true;
136
+					}
103 137
 				}
104 138
 			}
105 139
 
106 140
 			// XE 1.7
107 141
 
108 142
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
143
+			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) {
144
+				return true;
145
+			}
110 146
 
111
-			if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true;
147
+			if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) {
148
+				return true;
149
+			}
112 150
 
113 151
 			$oModuleModel = getModel('module');
114 152
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
115
-			if(!$moduleConfig->isUpdateFixedValue) return true;
153
+			if(!$moduleConfig->isUpdateFixedValue) {
154
+				return true;
155
+			}
116 156
 
117 157
 			$oModuleController->insertUpdatedLog($version_update_id);
118 158
 		}
119 159
 
120
-		if(!is_dir('./files/ruleset')) return true;
160
+		if(!is_dir('./files/ruleset')) {
161
+			return true;
162
+		}
121 163
 
122 164
 		return false;
123 165
 	}
@@ -142,7 +184,9 @@  discard block
 block discarded – undo
142 184
 				foreach($modules as $key => $module_info)
143 185
 				{
144 186
 					$module = $module_info->module;
145
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
187
+					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) {
188
+						continue;
189
+					}
146 190
 					$config = $oModuleModel->getModuleConfig($module);
147 191
 
148 192
 					$module_config = null;
@@ -163,7 +207,9 @@  discard block
 block discarded – undo
163 207
 							{
164 208
 								foreach($module_config as $key => $val)
165 209
 								{
166
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
210
+									if(isset($module_config[$key]->module_srl)) {
211
+										unset($module_config[$key]->module_srl);
212
+									}
167 213
 								}
168 214
 							}
169 215
 							break;
@@ -173,7 +219,9 @@  discard block
 block discarded – undo
173 219
 							{
174 220
 								foreach($tmp as $k => $v)
175 221
 								{
176
-									if(!$v && !trim($v)) continue;
222
+									if(!$v && !trim($v)) {
223
+										continue;
224
+									}
177 225
 									$module_config[$k]->header_script = $v;
178 226
 								}
179 227
 							}
@@ -201,9 +249,13 @@  discard block
 block discarded – undo
201 249
 				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
202 250
 			}
203 251
 			// document extra vars
204
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
252
+			if(!$oDB->isTableExists('document_extra_vars')) {
253
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
254
+			}
205 255
 
206
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
256
+			if(!$oDB->isTableExists('document_extra_keys')) {
257
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
258
+			}
207 259
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
208 260
 			if($oDB->isColumnExists('modules', 'grants'))
209 261
 			{
@@ -221,10 +273,14 @@  discard block
 block discarded – undo
221 273
 						$module_srl = trim($module_info->module_srl);
222 274
 						// grant an authority
223 275
 						$grants = unserialize($module_info->grants);
224
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
276
+						if($grants) {
277
+							$oModuleController->insertModuleGrants($module_srl, $grants);
278
+						}
225 279
 						// Insert skin vars
226 280
 						$skin_vars = unserialize($module_info->skin_vars);
227
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
281
+						if($skin_vars) {
282
+							$oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
283
+						}
228 284
 						// Insert super admin's ID
229 285
 						$admin_id = trim($module_info->admin_id);
230 286
 						if($admin_id && $admin_id != 'Array')
@@ -246,7 +302,9 @@  discard block
 block discarded – undo
246 302
 							$document_extra_keys = $extra_vars->extra_vars;
247 303
 							unset($extra_vars->extra_vars);
248 304
 						}
249
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
305
+						if($extra_vars) {
306
+							$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
307
+						}
250 308
 
251 309
 						/**
252 310
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
@@ -254,7 +312,9 @@  discard block
 block discarded – undo
254 312
 						// Insert extra vars if planet module is
255 313
 						if($module_info->module == 'planet')
256 314
 						{
257
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
315
+							if(!$document_extra_keys || !is_array($document_extra_keys)) {
316
+								$document_extra_keys = array();
317
+							}
258 318
 							$planet_extra_keys->name = 'postscript';
259 319
 							$planet_extra_keys->type = 'text';
260 320
 							$planet_extra_keys->is_required = 'N';
@@ -293,10 +353,14 @@  discard block
 block discarded – undo
293 353
 									{
294 354
 										foreach ($output->data as $document)
295 355
 										{
296
-											if(!$document) continue;
356
+											if(!$document) {
357
+												continue;
358
+											}
297 359
 											foreach ($document as $key => $var)
298 360
 											{
299
-												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
361
+												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') {
362
+													continue;
363
+												}
300 364
 												$var_idx = str_replace('extra_vars','',$key);
301 365
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
302 366
 											}
@@ -333,7 +397,9 @@  discard block
 block discarded – undo
333 397
 			// extra_vars * Remove Column
334 398
 			for($i=1;$i<=20;$i++)
335 399
 			{
336
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
400
+				if(!$oDB->isColumnExists("documents","extra_vars".$i)) {
401
+					continue;
402
+				}
337 403
 				$oDB->dropColumn('documents','extra_vars'.$i);
338 404
 			}
339 405
 
@@ -355,7 +421,9 @@  discard block
 block discarded – undo
355 421
 				$site_args->default_language = $db_info->lang_type;
356 422
 
357 423
 				$output = executeQuery('module.insertSite', $site_args);
358
-				if(!$output->toBool()) return $output;
424
+				if(!$output->toBool()) {
425
+					return $output;
426
+				}
359 427
 			}
360 428
 
361 429
 			if($oDB->isIndexExists('sites','idx_domain'))
@@ -401,7 +469,9 @@  discard block
 block discarded – undo
401 469
 				foreach($output->data as $item)
402 470
 				{
403 471
 					$skin_path = explode('.', $item->skin);
404
-					if(count($skin_path) != 2) continue;
472
+					if(count($skin_path) != 2) {
473
+						continue;
474
+					}
405 475
 					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
406 476
 					{
407 477
 						unset($args);
@@ -427,7 +497,9 @@  discard block
 block discarded – undo
427 497
 				$output = executeQuery('module.updateMobileSkinFixModules');
428 498
 
429 499
 				$oModuleController = getController('module');
430
-				if(!$moduleConfig) $moduleConfig = new stdClass;
500
+				if(!$moduleConfig) {
501
+					$moduleConfig = new stdClass;
502
+				}
431 503
 				$moduleConfig->isUpdateFixedValue = TRUE;
432 504
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
433 505
 			}
@@ -440,7 +512,9 @@  discard block
 block discarded – undo
440 512
 			$oModuleController->insertUpdatedLog($version_update_id);
441 513
 		}
442 514
 
443
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
515
+		if(!is_dir('./files/ruleset')) {
516
+			FileHandler::makeDir('./files/ruleset');
517
+		}
444 518
 
445 519
 		return new BaseObject(0, 'success_updated');
446 520
 	}
@@ -448,10 +522,14 @@  discard block
 block discarded – undo
448 522
 	function updateForUniqueSiteDomain()
449 523
 	{
450 524
 		$output = executeQueryArray("module.getNonuniqueDomains");
451
-		if(!$output->data) return;
525
+		if(!$output->data) {
526
+			return;
527
+		}
452 528
 		foreach($output->data as $data)
453 529
 		{
454
-			if($data->count == 1) continue;
530
+			if($data->count == 1) {
531
+				continue;
532
+			}
455 533
 			$domain = $data->domain;
456 534
 			$args = new stdClass;
457 535
 			$args->domain = $domain;
Please login to merge, or discard this patch.
modules/syndication/syndication.controller.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -162,6 +162,9 @@
 block discarded – undo
162 162
 		$output = executeQuery('syndication.deleteLog', $args);
163 163
 	}
164 164
 
165
+	/**
166
+	 * @param string $type
167
+	 */
165 168
 	function ping($id, $type, $page=1) {
166 169
 		$this->ping_message = '';
167 170
 		$oSyndicationModel = getModel('syndication');
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@  discard block
 block discarded – undo
12 12
 	var $ping_message = '';
13 13
 
14 14
 	function triggerInsertDocument(&$obj) {
15
-		if($obj->module_srl < 1) return $this->makeObject();
16
-		if($obj->status !== 'PUBLIC') return $this->makeObject();
15
+		if ($obj->module_srl < 1) return $this->makeObject();
16
+		if ($obj->status !== 'PUBLIC') return $this->makeObject();
17 17
 
18 18
 		$oSyndicationModel = getModel('syndication');
19 19
 		$oModuleModel = getModel('module');
20 20
 
21
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
21
+		if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
22 22
 
23 23
 		$config = $oModuleModel->getModuleConfig('syndication');
24 24
 
25
-		if($config->syndication_use!='Y') return $this->makeObject();
25
+		if ($config->syndication_use != 'Y') return $this->makeObject();
26 26
 
27 27
 		$target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl);
28 28
 		$id = $oSyndicationModel->getID('article', $target_id);
@@ -32,22 +32,22 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	function triggerUpdateDocument(&$obj) {
35
-		if($obj->module_srl < 1) return $this->makeObject();
35
+		if ($obj->module_srl < 1) return $this->makeObject();
36 36
 
37 37
 		$oSyndicationModel = getModel('syndication');
38 38
 		$oModuleModel = getModel('module');
39 39
 
40
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
40
+		if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
41 41
 
42 42
 		$config = $oModuleModel->getModuleConfig('syndication');
43 43
 
44
-		if($config->syndication_use!='Y') return $this->makeObject();
44
+		if ($config->syndication_use != 'Y') return $this->makeObject();
45 45
 
46 46
 		$target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl);
47 47
 		$id = $oSyndicationModel->getID('article', $target_id);
48 48
 
49 49
 		// PUBLIC 외 삭제
50
-		if($obj->status === 'PUBLIC')
50
+		if ($obj->status === 'PUBLIC')
51 51
 		{
52 52
 			$this->ping($id, 'article');
53 53
 		}
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	function triggerDeleteDocument(&$obj) {
63
-		if($obj->module_srl < 1) return $this->makeObject();
63
+		if ($obj->module_srl < 1) return $this->makeObject();
64 64
 
65 65
 		$oModuleModel = getModel('module');
66 66
 		$oSyndicationModel = getModel('syndication');
67 67
 
68 68
 		$config = $oModuleModel->getModuleConfig('syndication');
69
-		if($config->syndication_use != 'Y') return $this->makeObject();
70
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
69
+		if ($config->syndication_use != 'Y') return $this->makeObject();
70
+		if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
71 71
 
72 72
 		$this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content);
73 73
 
@@ -85,25 +85,25 @@  discard block
 block discarded – undo
85 85
 
86 86
 	function triggerMoveDocumentModule(&$obj)
87 87
 	{
88
-		if($obj->module_srl < 1) return $this->makeObject();
88
+		if ($obj->module_srl < 1) return $this->makeObject();
89 89
 
90 90
 		$oSyndicationModel = getModel('syndication');
91 91
 		$oModuleModel = getModel('module');
92 92
 
93
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
93
+		if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
94 94
 
95 95
 		$config = $oModuleModel->getModuleConfig('syndication');
96 96
 
97
-		if($config->syndication_use!='Y') return $this->makeObject();
97
+		if ($config->syndication_use != 'Y') return $this->makeObject();
98 98
 
99 99
 		$arr_document_srl = explode(',', $obj->document_srls);
100
-		if(!$arr_document_srl) return $this->makeObject();
100
+		if (!$arr_document_srl) return $this->makeObject();
101 101
 
102
-		foreach($arr_document_srl as $document_srl)
102
+		foreach ($arr_document_srl as $document_srl)
103 103
 		{
104 104
 			// 기존 문서 삭제
105 105
 			$source_module_srl = $obj->source_module_srl[$document_srl];
106
-			if(!!$source_module_srl)
106
+			if (!!$source_module_srl)
107 107
 			{
108 108
 				$target_id = sprintf('%s-%s', $source_module_srl, $document_srl);
109 109
 				$id = $oSyndicationModel->getID('article', $target_id);
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 		$oSyndicationModel = getModel('syndication');
124 124
 		$oModuleModel = getModel('module');
125 125
 
126
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
126
+		if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
127 127
 
128 128
 		$config = $oModuleModel->getModuleConfig('syndication');
129 129
 
130
-		if($config->syndication_use!='Y') return $this->makeObject();
130
+		if ($config->syndication_use != 'Y') return $this->makeObject();
131 131
 
132 132
 		$this->insertLog($obj->module_srl, $obj->document_srl, '', '');
133 133
 
@@ -162,21 +162,21 @@  discard block
 block discarded – undo
162 162
 		$output = executeQuery('syndication.deleteLog', $args);
163 163
 	}
164 164
 
165
-	function ping($id, $type, $page=1) {
165
+	function ping($id, $type, $page = 1) {
166 166
 		$this->ping_message = '';
167 167
 		$oSyndicationModel = getModel('syndication');
168 168
 
169 169
 		$oModuleModel = getModel('module');
170 170
 		$config = $oModuleModel->getModuleConfig('syndication');
171 171
 
172
-		if(!$config->syndication_token)
172
+		if (!$config->syndication_token)
173 173
 		{
174 174
 			$this->ping_message = 'Syndication Token empty';
175 175
 			$oSyndicationModel->setResentPingLog($this->ping_message);
176 176
 			return false;
177 177
 		}
178 178
 
179
-		if(!$this->checkOpenSSLSupport())
179
+		if (!$this->checkOpenSSLSupport())
180 180
 		{
181 181
 			$lang = Context::get('lang');
182 182
 			$this->ping_message = $lang->msg_need_openssl_support;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			return false;
185 185
 		}
186 186
 
187
-		if(substr($config->site_url,-1)!='/')
187
+		if (substr($config->site_url, -1) != '/')
188 188
 		{
189 189
 			$config->site_url .= '/';
190 190
 		}
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 		$buff = FileHandler::getRemoteResource($ping_url, null, 10, 'POST', 'application/x-www-form-urlencoded', $ping_header, array(), array('ping_url'=>$ping_body), $request_config);
205 205
 
206 206
 		$xml = new XmlParser();
207
-		$xmlDoc= $xml->parse($buff);
207
+		$xmlDoc = $xml->parse($buff);
208 208
 
209
-		if($xmlDoc->result->error_code->body != '000')
209
+		if ($xmlDoc->result->error_code->body != '000')
210 210
 		{
211
-			if(!$buff)
211
+			if (!$buff)
212 212
 			{
213 213
 				$this->ping_message = 'Socket connection error. Check your Server Environment.';
214 214
 			}
Please login to merge, or discard this patch.
Braces   +50 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,17 +12,25 @@  discard block
 block discarded – undo
12 12
 	var $ping_message = '';
13 13
 
14 14
 	function triggerInsertDocument(&$obj) {
15
-		if($obj->module_srl < 1) return $this->makeObject();
16
-		if($obj->status !== 'PUBLIC') return $this->makeObject();
15
+		if($obj->module_srl < 1) {
16
+			return $this->makeObject();
17
+		}
18
+		if($obj->status !== 'PUBLIC') {
19
+			return $this->makeObject();
20
+		}
17 21
 
18 22
 		$oSyndicationModel = getModel('syndication');
19 23
 		$oModuleModel = getModel('module');
20 24
 
21
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
25
+		if($oSyndicationModel->isExceptedModules($obj->module_srl)) {
26
+			return $this->makeObject();
27
+		}
22 28
 
23 29
 		$config = $oModuleModel->getModuleConfig('syndication');
24 30
 
25
-		if($config->syndication_use!='Y') return $this->makeObject();
31
+		if($config->syndication_use!='Y') {
32
+			return $this->makeObject();
33
+		}
26 34
 
27 35
 		$target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl);
28 36
 		$id = $oSyndicationModel->getID('article', $target_id);
@@ -32,16 +40,22 @@  discard block
 block discarded – undo
32 40
 	}
33 41
 
34 42
 	function triggerUpdateDocument(&$obj) {
35
-		if($obj->module_srl < 1) return $this->makeObject();
43
+		if($obj->module_srl < 1) {
44
+			return $this->makeObject();
45
+		}
36 46
 
37 47
 		$oSyndicationModel = getModel('syndication');
38 48
 		$oModuleModel = getModel('module');
39 49
 
40
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
50
+		if($oSyndicationModel->isExceptedModules($obj->module_srl)) {
51
+			return $this->makeObject();
52
+		}
41 53
 
42 54
 		$config = $oModuleModel->getModuleConfig('syndication');
43 55
 
44
-		if($config->syndication_use!='Y') return $this->makeObject();
56
+		if($config->syndication_use!='Y') {
57
+			return $this->makeObject();
58
+		}
45 59
 
46 60
 		$target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl);
47 61
 		$id = $oSyndicationModel->getID('article', $target_id);
@@ -50,8 +64,7 @@  discard block
 block discarded – undo
50 64
 		if($obj->status === 'PUBLIC')
51 65
 		{
52 66
 			$this->ping($id, 'article');
53
-		}
54
-		else
67
+		} else
55 68
 		{
56 69
 			$this->ping($id, 'deleted');
57 70
 		}
@@ -60,14 +73,20 @@  discard block
 block discarded – undo
60 73
 	}
61 74
 
62 75
 	function triggerDeleteDocument(&$obj) {
63
-		if($obj->module_srl < 1) return $this->makeObject();
76
+		if($obj->module_srl < 1) {
77
+			return $this->makeObject();
78
+		}
64 79
 
65 80
 		$oModuleModel = getModel('module');
66 81
 		$oSyndicationModel = getModel('syndication');
67 82
 
68 83
 		$config = $oModuleModel->getModuleConfig('syndication');
69
-		if($config->syndication_use != 'Y') return $this->makeObject();
70
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
84
+		if($config->syndication_use != 'Y') {
85
+			return $this->makeObject();
86
+		}
87
+		if($oSyndicationModel->isExceptedModules($obj->module_srl)) {
88
+			return $this->makeObject();
89
+		}
71 90
 
72 91
 		$this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content);
73 92
 
@@ -85,19 +104,27 @@  discard block
 block discarded – undo
85 104
 
86 105
 	function triggerMoveDocumentModule(&$obj)
87 106
 	{
88
-		if($obj->module_srl < 1) return $this->makeObject();
107
+		if($obj->module_srl < 1) {
108
+			return $this->makeObject();
109
+		}
89 110
 
90 111
 		$oSyndicationModel = getModel('syndication');
91 112
 		$oModuleModel = getModel('module');
92 113
 
93
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
114
+		if($oSyndicationModel->isExceptedModules($obj->module_srl)) {
115
+			return $this->makeObject();
116
+		}
94 117
 
95 118
 		$config = $oModuleModel->getModuleConfig('syndication');
96 119
 
97
-		if($config->syndication_use!='Y') return $this->makeObject();
120
+		if($config->syndication_use!='Y') {
121
+			return $this->makeObject();
122
+		}
98 123
 
99 124
 		$arr_document_srl = explode(',', $obj->document_srls);
100
-		if(!$arr_document_srl) return $this->makeObject();
125
+		if(!$arr_document_srl) {
126
+			return $this->makeObject();
127
+		}
101 128
 
102 129
 		foreach($arr_document_srl as $document_srl)
103 130
 		{
@@ -123,11 +150,15 @@  discard block
 block discarded – undo
123 150
 		$oSyndicationModel = getModel('syndication');
124 151
 		$oModuleModel = getModel('module');
125 152
 
126
-		if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
153
+		if($oSyndicationModel->isExceptedModules($obj->module_srl)) {
154
+			return $this->makeObject();
155
+		}
127 156
 
128 157
 		$config = $oModuleModel->getModuleConfig('syndication');
129 158
 
130
-		if($config->syndication_use!='Y') return $this->makeObject();
159
+		if($config->syndication_use!='Y') {
160
+			return $this->makeObject();
161
+		}
131 162
 
132 163
 		$this->insertLog($obj->module_srl, $obj->document_srl, '', '');
133 164
 
@@ -211,8 +242,7 @@  discard block
 block discarded – undo
211 242
 			if(!$buff)
212 243
 			{
213 244
 				$this->ping_message = 'Socket connection error. Check your Server Environment.';
214
-			}
215
-			else
245
+			} else
216 246
 			{
217 247
 				$this->ping_message = $xmlDoc->result->message->body;
218 248
 			}
Please login to merge, or discard this patch.
modules/syndication/syndication.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after');
39 39
 
40 40
 		$oAddonAdminModel = getAdminModel('addon');
41
-		if($oAddonAdminModel->getAddonInfoXml('catpcha')){
41
+		if ($oAddonAdminModel->getAddonInfoXml('catpcha')) {
42 42
 			$oAddonAdminController = &addonAdminController::getInstance();
43 43
 			$oAddonAdminController->doActivate('catpcha');
44 44
 			$oAddonAdminController->makeCacheFile();
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 	function checkUpdate() {
49 49
 		$oModuleModel = getModel('module');
50
-		if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true;
50
+		if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true;
51 51
 		// if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true;
52
-		if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true;
52
+		if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true;
53 53
 
54 54
 		return false;
55 55
 	}
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
 		$oModuleModel = getModel('module');
59 59
 		$oModuleController = getController('module');
60 60
 
61
-		if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){
61
+		if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) {
62 62
 			$oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after');
63 63
 		}
64 64
 		// if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){
65 65
 		// 	$oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after');
66 66
 		// }
67
-		if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')){
67
+		if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) {
68 68
 			$oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after');
69 69
 		}
70 70
 
71 71
 		$oAddonAdminModel = getAdminModel('addon');
72
-		if($oAddonAdminModel->getAddonInfoXml('catpcha')){
72
+		if ($oAddonAdminModel->getAddonInfoXml('catpcha')) {
73 73
 			$oAddonAdminController = &addonAdminController::getInstance();
74 74
 			$oAddonAdminController->doActivate('catpcha');
75 75
 			$oAddonAdminController->makeCacheFile();
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 	function checkOpenSSLSupport()
83 83
 	{
84
-		if(!in_array('ssl', stream_get_transports())) {
84
+		if (!in_array('ssl', stream_get_transports())) {
85 85
 			return FALSE;
86 86
 		}
87 87
 		return TRUE;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,9 +47,13 @@
 block discarded – undo
47 47
 
48 48
 	function checkUpdate() {
49 49
 		$oModuleModel = getModel('module');
50
-		if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true;
50
+		if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) {
51
+			return true;
52
+		}
51 53
 		// if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true;
52
-		if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true;
54
+		if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) {
55
+			return true;
56
+		}
53 57
 
54 58
 		return false;
55 59
 	}
Please login to merge, or discard this patch.