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
Pull Request — develop (#2396)
by
unknown
07:48
created
modules/autoinstall/autoinstall.class.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 	function generate(&$params)
18 18
 	{
19 19
 		$xmlDoc = '<?xml version="1.0" encoding="utf-8" ?><methodCall><params>';
20
-		if(!is_array($params))
20
+		if (!is_array($params))
21 21
 		{
22 22
 			return NULL;
23 23
 		}
24 24
 
25 25
 		$params["module"] = "resourceapi";
26
-		foreach($params as $key => $val)
26
+		foreach ($params as $key => $val)
27 27
 		{
28 28
 			$xmlDoc .= sprintf("<%s><![CDATA[%s]]></%s>", $key, $val, $key);
29 29
 		}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		$body = XmlGenerater::generate($params);
43 43
 		$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
44
-		if(!$buff)
44
+		if (!$buff)
45 45
 		{
46 46
 			return;
47 47
 		}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	{
75 75
 		$oModuleModel = getModel('module');
76 76
 		$config = $oModuleModel->getModuleConfig('autoinstall');
77
-		if($config->downloadServer != _XE_DOWNLOAD_SERVER_)
77
+		if ($config->downloadServer != _XE_DOWNLOAD_SERVER_)
78 78
 		{
79 79
 			$this->stop('msg_not_match_server');
80 80
 		}
@@ -105,34 +105,34 @@  discard block
 block discarded – undo
105 105
 		$oModuleModel = getModel('module');
106 106
 		$oModuleController = getController('module');
107 107
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
108
-		if($oModuleModel->needUpdate($version_update_id))
108
+		if ($oModuleModel->needUpdate($version_update_id))
109 109
 		{
110
-			if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml')
110
+			if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml')
111 111
 				&& $oDB->isTableExists("autoinstall_installed_packages"))
112 112
 			{
113 113
 				return TRUE;
114 114
 			}
115
-			if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
115
+			if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
116 116
 				&& $oDB->isTableExists("autoinstall_remote_categories"))
117 117
 			{
118 118
 				return TRUE;
119 119
 			}
120 120
 
121 121
 			// 2011.08.08 add column 'list_order' in ai_remote_categories
122
-			if(!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
122
+			if (!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
123 123
 			{
124 124
 				return TRUE;
125 125
 			}
126 126
 
127 127
 			// 2011.08.08 set _XE_DOWNLOAD_SERVER_ at module config
128 128
 			$config = $oModuleModel->getModuleConfig('autoinstall');
129
-			if(!isset($config->downloadServer))
129
+			if (!isset($config->downloadServer))
130 130
 			{
131 131
 				return TRUE;
132 132
 			}
133 133
 
134 134
 			// 2012.11.12 add column 'have_instance' in autoinstall_packages
135
-			if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
135
+			if (!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
136 136
 			{
137 137
 				return TRUE;
138 138
 			}
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
 		$oModuleModel = getModel('module');
155 155
 		$oModuleController = getController('module');
156 156
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
157
-		if($oModuleModel->needUpdate($version_update_id))
157
+		if ($oModuleModel->needUpdate($version_update_id))
158 158
 		{
159
-			if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml')
159
+			if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml')
160 160
 				&& $oDB->isTableExists("autoinstall_installed_packages"))
161 161
 			{
162 162
 				$oDB->dropTable("autoinstall_installed_packages");
163 163
 			}
164
-			if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
164
+			if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
165 165
 				&& $oDB->isTableExists("autoinstall_remote_categories"))
166 166
 			{
167 167
 				$oDB->dropTable("autoinstall_remote_categories");
168 168
 			}
169 169
 
170 170
 			// 2011.08.08 add column 'list_order' in 'ai_remote_categories
171
-			if(!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
171
+			if (!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
172 172
 			{
173 173
 				$oDB->addColumn('ai_remote_categories', 'list_order', 'number', 11, NULL, TRUE);
174 174
 				$oDB->addIndex('ai_remote_categories', 'idx_list_order', array('list_order'));
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 
177 177
 			// 2011. 08. 08 set _XE_DOWNLOAD_SERVER_ at module config
178 178
 			$config = $oModuleModel->getModuleConfig('autoinstall');
179
-			if(!isset($config->downloadServer))
179
+			if (!isset($config->downloadServer))
180 180
 			{
181 181
 				$config->downloadServer = _XE_DOWNLOAD_SERVER_;
182 182
 				$oModuleController->insertModuleConfig('autoinstall', $config);
183 183
 			}
184 184
 
185 185
 			// 2012.11.12 add column 'have_instance' in autoinstall_packages
186
-			if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
186
+			if (!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
187 187
 			{
188 188
 				$oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE);
189 189
 			}
Please login to merge, or discard this patch.
modules/integration_search/integration_search.class.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
 		$oModuleModel = getModel('module');
32 32
 		$oModuleController = getController('module');
33 33
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
34
-		if($oModuleModel->needUpdate($version_update_id))
34
+		if ($oModuleModel->needUpdate($version_update_id))
35 35
 		{
36 36
 			$config = $oModuleModel->getModuleConfig('integration_search');
37 37
 
38
-			if($config->skin)
38
+			if ($config->skin)
39 39
 			{
40 40
 				$config_parse = explode('.', $config->skin);
41
-				if(count($config_parse) > 1)
41
+				if (count($config_parse) > 1)
42 42
 				{
43 43
 					$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
44
-					if(is_dir($template_path)) return true;
44
+					if (is_dir($template_path)) return true;
45 45
 				}
46 46
 			}
47 47
 
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 		$oModuleModel = getModel('module');
62 62
 		$oModuleController = getController('module');
63 63
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
64
-		if($oModuleModel->needUpdate($version_update_id))
64
+		if ($oModuleModel->needUpdate($version_update_id))
65 65
 		{
66 66
 			$config = $oModuleModel->getModuleConfig('message');
67 67
 
68
-			if($config->skin)
68
+			if ($config->skin)
69 69
 			{
70 70
 				$config_parse = explode('.', $config->skin);
71
-				if(count($config_parse) > 1)
71
+				if (count($config_parse) > 1)
72 72
 				{
73 73
 					$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
74
-					if(is_dir($template_path))
74
+					if (is_dir($template_path))
75 75
 					{
76 76
 						$config->skin = implode('|@|', $config_parse);
77 77
 						$oModuleController = getController('module');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
41 41
 				if(count($config_parse) > 1)
42 42
 				{
43 43
 					$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
44
-					if(is_dir($template_path)) return true;
44
+					if(is_dir($template_path)) {
45
+						return true;
46
+					}
45 47
 				}
46 48
 			}
47 49
 
Please login to merge, or discard this patch.
modules/editor/components/image_link/image_link.class.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 		$align = $xml_obj->attrs->align;
50 50
 		$alt = $xml_obj->attrs->alt;
51 51
 		$title = $xml_obj->attrs->title;
52
-		$border = (int)$xml_obj->attrs->border;
52
+		$border = (int) $xml_obj->attrs->border;
53 53
 		$link_url = $xml_obj->attrs->link_url;
54 54
 		$open_window = $xml_obj->attrs->open_window;
55 55
 		$style = $xml_obj->attrs->style;
56
-		$margin = (int)$xml_obj->attrs->margin;
56
+		$margin = (int) $xml_obj->attrs->margin;
57 57
 
58
-		$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
58
+		$src = str_replace(array('&', '"'), array('&amp;', '&qout;'), $src);
59 59
 		$src = str_replace('&amp;amp;', '&amp;', $src);
60 60
 
61 61
 		$sslPort = Context::get('_https_port');
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// Image containing the address to the address conversion request uri (rss output, etc. purposes)
65 65
 		$temp_src = explode('/', $src);
66
-		if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
67
-		else if(substr($src , 0, 1)=='/')
66
+		if (substr($src, 0, 2) == './') $src = Context::getRequestUri().substr($src, 2);
67
+		else if (substr($src, 0, 1) == '/')
68 68
 		{
69
-			if($_SERVER['HTTPS']=='on') {
69
+			if ($_SERVER['HTTPS'] == 'on') {
70 70
 				$http_src = 'https://';
71 71
 				$src = $http_src.$_SERVER['HTTP_HOST'].$sslPort.$src;
72 72
 			} else {
@@ -75,39 +75,39 @@  discard block
 block discarded – undo
75 75
 			}
76 76
 
77 77
 		}
78
-		else if(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
78
+		else if (!strpos($temp_src[0], ':') && $src) $src = Context::getRequestUri().$src;
79 79
 
80 80
 		$attr_output = array();
81 81
 		$attr_output = array("src=\"".$src."\"");
82 82
 		$attr_output[] = "alt=\"".$alt."\"";
83 83
 
84
-		if($title)
84
+		if ($title)
85 85
 		{
86 86
 			$attr_output[] = "title=\"".$title."\"";
87 87
 		}
88
-		if($margin)
88
+		if ($margin)
89 89
 		{
90
-			$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
91
-			$style = str_replace(';;',';',$style);
92
-			if($style == ';') $style = '';
90
+			$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i', '', $style)).';';
91
+			$style = str_replace(';;', ';', $style);
92
+			if ($style == ';') $style = '';
93 93
 			$style .= ' margin:'.$margin.'px;';
94 94
 		}
95
-		if($align) $attr_output[] = "align=\"".$align."\"";
96
-		if($width) $attr_output[] = 'width="'.$width.'"';
97
-		if($height) $attr_output[] = 'height="'.$height.'"';
98
-		if($border)
95
+		if ($align) $attr_output[] = "align=\"".$align."\"";
96
+		if ($width) $attr_output[] = 'width="'.$width.'"';
97
+		if ($height) $attr_output[] = 'height="'.$height.'"';
98
+		if ($border)
99 99
 		{
100
-			$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
101
-			$style = str_replace(';;',';',$style);
102
-			if($style == ';') $style = '';
100
+			$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i', '', $style)).';';
101
+			$style = str_replace(';;', ';', $style);
102
+			if ($style == ';') $style = '';
103 103
 			$style .= ' border-style: solid; border-width:'.$border.'px;';
104 104
 		}
105 105
 
106
-		$code = sprintf("<img %s style=\"%s\" />", implode(' ',$attr_output), $style);
106
+		$code = sprintf("<img %s style=\"%s\" />", implode(' ', $attr_output), $style);
107 107
 
108
-		if($link_url)
108
+		if ($link_url)
109 109
 		{
110
-			if($open_window =='Y') $code = sprintf('<a href="%s" target="_blank" rel="noopener">%s</a>', $link_url, $code);
110
+			if ($open_window == 'Y') $code = sprintf('<a href="%s" target="_blank" rel="noopener">%s</a>', $link_url, $code);
111 111
 			else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
112 112
 		}
113 113
 		return $code;
Please login to merge, or discard this patch.
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// Image containing the address to the address conversion request uri (rss output, etc. purposes)
65 65
 		$temp_src = explode('/', $src);
66
-		if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
67
-		else if(substr($src , 0, 1)=='/')
66
+		if(substr($src, 0,2)=='./') {
67
+			$src = Context::getRequestUri().substr($src, 2);
68
+		} else if(substr($src , 0, 1)=='/')
68 69
 		{
69 70
 			if($_SERVER['HTTPS']=='on') {
70 71
 				$http_src = 'https://';
@@ -74,8 +75,9 @@  discard block
 block discarded – undo
74 75
 				$src = $http_src.$_SERVER['HTTP_HOST'].$src;
75 76
 			}
76 77
 
78
+		} else if(!strpos($temp_src[0],':') && $src) {
79
+			$src = Context::getRequestUri().$src;
77 80
 		}
78
-		else if(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
79 81
 
80 82
 		$attr_output = array();
81 83
 		$attr_output = array("src=\"".$src."\"");
@@ -89,17 +91,27 @@  discard block
 block discarded – undo
89 91
 		{
90 92
 			$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
91 93
 			$style = str_replace(';;',';',$style);
92
-			if($style == ';') $style = '';
94
+			if($style == ';') {
95
+				$style = '';
96
+			}
93 97
 			$style .= ' margin:'.$margin.'px;';
94 98
 		}
95
-		if($align) $attr_output[] = "align=\"".$align."\"";
96
-		if($width) $attr_output[] = 'width="'.$width.'"';
97
-		if($height) $attr_output[] = 'height="'.$height.'"';
99
+		if($align) {
100
+			$attr_output[] = "align=\"".$align."\"";
101
+		}
102
+		if($width) {
103
+			$attr_output[] = 'width="'.$width.'"';
104
+		}
105
+		if($height) {
106
+			$attr_output[] = 'height="'.$height.'"';
107
+		}
98 108
 		if($border)
99 109
 		{
100 110
 			$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
101 111
 			$style = str_replace(';;',';',$style);
102
-			if($style == ';') $style = '';
112
+			if($style == ';') {
113
+				$style = '';
114
+			}
103 115
 			$style .= ' border-style: solid; border-width:'.$border.'px;';
104 116
 		}
105 117
 
@@ -107,8 +119,11 @@  discard block
 block discarded – undo
107 119
 
108 120
 		if($link_url)
109 121
 		{
110
-			if($open_window =='Y') $code = sprintf('<a href="%s" target="_blank" rel="noopener">%s</a>', $link_url, $code);
111
-			else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
122
+			if($open_window =='Y') {
123
+				$code = sprintf('<a href="%s" target="_blank" rel="noopener">%s</a>', $link_url, $code);
124
+			} else {
125
+				$code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
126
+			}
112 127
 		}
113 128
 		return $code;
114 129
 	}
Please login to merge, or discard this patch.
modules/editor/editor.model.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -113,6 +113,11 @@  discard block
 block discarded – undo
113 113
 		Context::set('drComponentList',$drComponentInfo);
114 114
 	}
115 115
 
116
+	/**
117
+	 * @param string $drComponentName
118
+	 *
119
+	 * @return string
120
+	 */
116 121
 	function getDrComponentXmlInfo($drComponentName)
117 122
 	{
118 123
 		$lang_type = Context::getLangType();
@@ -191,6 +196,7 @@  discard block
 block discarded – undo
191 196
 	 * @brief Return the editor template
192 197
 	 * You can call upload_target_srl when modifying content
193 198
 	 * The upload_target_srl is used for a routine to check if an attachment exists
199
+	 * @param stdClass $option
194 200
 	 */
195 201
 	function getEditor($upload_target_srl = 0, $option = null)
196 202
 	{
@@ -486,6 +492,7 @@  discard block
 block discarded – undo
486 492
 
487 493
 	/**
488 494
 	 * @brief Get information which has been auto-saved
495
+	 * @param integer $upload_target_srl
489 496
 	 */
490 497
 	function getSavedDoc($upload_target_srl)
491 498
 	{
Please login to merge, or discard this patch.
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getEditorConfig($module_srl = null)
25 25
 	{
26
-		if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
26
+		if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
27 27
 		{
28 28
 			// Get trackback settings of the selected module
29 29
 			$oModuleModel = getModel('module');
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
37
+		if (!is_object($editor_config)) $editor_config = new stdClass();
38 38
 
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
39
+		if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
+		if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
+		if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
+		if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
+		if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
+		if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
+		if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
+		if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
+		if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array();
48 48
 
49
-		if(!$editor_config->editor_height)
49
+		if (!$editor_config->editor_height)
50 50
 		{
51 51
 			$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
52 52
 		}
53
-		if(!$editor_config->comment_editor_height)
53
+		if (!$editor_config->comment_editor_height)
54 54
 		{
55 55
 			$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
56 56
 		}
57
-		if(!$editor_config->editor_skin)
57
+		if (!$editor_config->editor_skin)
58 58
 		{
59 59
 			$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
60 60
 		}
61
-		if(!$editor_config->comment_editor_skin)
61
+		if (!$editor_config->comment_editor_skin)
62 62
 		{
63 63
 			$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
64 64
 		}
65
-		if(!$editor_config->content_style)
65
+		if (!$editor_config->content_style)
66 66
 		{
67 67
 			$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
68 68
 		}
69
-		if(!$editor_config->content_font && $editor_default_config->content_font)
69
+		if (!$editor_config->content_font && $editor_default_config->content_font)
70 70
 		{
71 71
 			$editor_config->content_font = $editor_default_config->content_font;
72 72
 		}
73
-		if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
73
+		if (!$editor_config->content_font_size && $editor_default_config->content_font_size)
74 74
 		{
75 75
 			$editor_config->content_font_size = $editor_default_config->content_font_size;
76 76
 		}
77
-		if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
77
+		if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
78 78
 		{
79 79
 			$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
80 80
 		}
81
-		if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
81
+		if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
82 82
 		{
83 83
 			$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
84 84
 		}
85
-		if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
85
+		if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
86 86
 		{
87 87
 			$editor_config->comment_content_style = $editor_default_config->comment_content_style;
88 88
 		}
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 
93 93
 	function loadDrComponents()
94 94
 	{
95
-		$drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/';
95
+		$drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/';
96 96
 		$drComponentList = FileHandler::readDir($drComponentPath);
97 97
 
98 98
 		$oTemplate = &TemplateHandler::getInstance();
99 99
 
100 100
 		$drComponentInfo = array();
101
-		if($drComponentList)
101
+		if ($drComponentList)
102 102
 		{
103
-			foreach($drComponentList as $i => $drComponent)
103
+			foreach ($drComponentList as $i => $drComponent)
104 104
 			{
105 105
 				unset($obj);
106 106
 				$obj = $this->getDrComponentXmlInfo($drComponent);
107
-				Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
108
-				$path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent);
109
-				$obj->html = $oTemplate->compile($path,$drComponent);
107
+				Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent));
108
+				$path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent);
109
+				$obj->html = $oTemplate->compile($path, $drComponent);
110 110
 				$drComponentInfo[$drComponent] = $obj;
111 111
 			}
112 112
 		}
113
-		Context::set('drComponentList',$drComponentInfo);
113
+		Context::set('drComponentList', $drComponentInfo);
114 114
 	}
115 115
 
116 116
 	function getDrComponentXmlInfo($drComponentName)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$xml_file = sprintf('%sinfo.xml', $component_path);
123 123
 		$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
124 124
 		// Return information after including it after cached xml file exists
125
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
125
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
126 126
 		{
127 127
 			include($cache_file);
128 128
 			return $xml_info;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 152
 
153 153
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
154
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155 155
 		else $author_list = $xml_doc->component->author;
156 156
 
157
-		for($i=0; $i < count($author_list); $i++)
157
+		for ($i = 0; $i < count($author_list); $i++)
158 158
 		{
159 159
 			$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
160 160
 			$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// List extra variables (text type only in the editor component)
165 165
 		$extra_vars = $xml_doc->component->extra_vars->var;
166
-		if($extra_vars)
166
+		if ($extra_vars)
167 167
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
-			foreach($extra_vars as $key => $val)
168
+			if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
+			foreach ($extra_vars as $key => $val)
170 170
 			{
171 171
 				unset($obj);
172 172
 				$key = $val->attrs->name;
@@ -198,50 +198,50 @@  discard block
 block discarded – undo
198 198
 		 * Editor's default options
199 199
 		 */
200 200
 		// Option setting to allow file upload
201
-		if($upload_target_srl)
201
+		if ($upload_target_srl)
202 202
 		{
203 203
 			$option->editor_sequence = $upload_target_srl;
204 204
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
205
+		if (!$option->allow_fileupload) $allow_fileupload = false;
206 206
 		else $allow_fileupload = true;
207 207
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
208
+		if (!$option->content_style) $option->content_style = 'ckeditor_light';
209 209
 		Context::set('content_style', $option->content_style);
210
-		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
210
+		Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style);
211 211
 		// Default font setting
212 212
 		Context::set('content_font', addslashes($option->content_font));
213 213
 		Context::set('content_font_size', $option->content_font_size);
214 214
 
215 215
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
216
+		if (!$option->enable_autosave) $enable_autosave = false;
217
+		elseif (Context::get($option->primary_key_name)) $enable_autosave = false;
218 218
 		else $enable_autosave = true;
219 219
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
220
+		if (!$option->enable_default_component) $enable_default_component = false;
221 221
 		else $enable_default_component = true;
222 222
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
223
+		if (!$option->enable_component) $enable_component = false;
224 224
 		else $enable_component = true;
225 225
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
226
+		if ($option->disable_html) $html_mode = false;
227 227
 		else $html_mode = true;
228 228
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
229
+		if (!$option->height) $editor_height = 300;
230 230
 		else $editor_height = $option->height;
231
-		if(Mobile::isFromMobilePhone()) {
231
+		if (Mobile::isFromMobilePhone()) {
232 232
 			$editor_height = 150;
233 233
 		}
234 234
 		// Skin Setting
235 235
 		$skin = $option->skin;
236
-		if(!$skin) $skin = 'ckeditor';
236
+		if (!$skin) $skin = 'ckeditor';
237 237
 
238 238
 		$colorset = $option->colorset;
239
-		if(!$colorset) $colorset = 'moono';
239
+		if (!$colorset) $colorset = 'moono';
240 240
 		Context::set('colorset', $colorset);
241 241
 		Context::set('skin', $skin);
242 242
 		Context::set('module_type', $option->module_type);
243 243
 
244
-		if($skin=='dreditor')
244
+		if ($skin == 'dreditor')
245 245
 		{
246 246
 			$this->loadDrComponents();
247 247
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		/**
250 250
 		 * Check the automatic backup feature (do not use if the post is edited)
251 251
 		 */
252
-		if($enable_autosave)
252
+		if ($enable_autosave)
253 253
 		{
254 254
 			// Extract auto-saved data
255 255
 			$saved_doc = $this->getSavedDoc($upload_target_srl);
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 		/**
262 262
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
263 263
 		 */
264
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
264
+		if ($option->editor_sequence) $editor_sequence = $option->editor_sequence;
265 265
 		else
266 266
 		{
267
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
268
-			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
267
+			if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
268
+			$editor_sequence = $_SESSION['_editor_sequence_']++;
269 269
 		}
270 270
 
271 271
 		/**
272 272
 		 * Upload setting by using configuration of the file module internally
273 273
 		 */
274 274
 		$files_count = 0;
275
-		if($allow_fileupload)
275
+		if ($allow_fileupload)
276 276
 		{
277 277
 			$oFileModel = getModel('file');
278 278
 			// Get upload configuration to set on SWFUploader
279 279
 			$file_config = $oFileModel->getUploadConfig();
280
-			$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
281
-			$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
280
+			$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
281
+			$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
282 282
 
283
-			Context::set('file_config',$file_config);
283
+			Context::set('file_config', $file_config);
284 284
 			// Configure upload status such as file size
285 285
 			$upload_status = $oFileModel->getUploadStatus();
286 286
 			Context::set('upload_status', $upload_status);
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 			$oFileController = getController('file');
289 289
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
290 290
 			// Check if the file already exists
291
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
291
+			if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
292 292
 		}
293
-		Context::set('files_count', (int)$files_count);
293
+		Context::set('files_count', (int) $files_count);
294 294
 
295 295
 		Context::set('allow_fileupload', $allow_fileupload);
296 296
 		// Set editor_sequence value
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 		 * Check editor component
308 308
 		 */
309 309
 		$site_module_info = Context::get('site_module_info');
310
-		$site_srl = (int)$site_module_info->site_srl;
311
-		if($enable_component)
310
+		$site_srl = (int) $site_module_info->site_srl;
311
+		if ($enable_component)
312 312
 		{
313
-			if(!Context::get('component_list'))
313
+			if (!Context::get('component_list'))
314 314
 			{
315 315
 				$component_list = $this->getComponentList(true, $site_srl);
316 316
 				Context::set('component_list', $component_list);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
338 338
 		$tpl_file = 'editor.html';
339 339
 
340
-		if(!file_exists($tpl_path.$tpl_file))
340
+		if (!file_exists($tpl_path.$tpl_file))
341 341
 		{
342 342
 			$skin = 'ckeditor';
343 343
 			$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		$config->module_type = $type;
368 368
 
369 369
 		// Configurations listed according to a type
370
-		if($type == 'document')
370
+		if ($type == 'document')
371 371
 		{
372 372
 			$config->editor_skin = $editor_config->editor_skin;
373 373
 			$config->content_style = $editor_config->content_style;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			$config->enable_autosave = 'N';
397 397
 		}
398 398
 		// Check a group_list of the currently logged-in user for permission check
399
-		if(Context::get('is_logged'))
399
+		if (Context::get('is_logged'))
400 400
 		{
401 401
 			$logged_info = Context::get('logged_info');
402 402
 			$group_list = $logged_info->group_list;
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 		$option->colorset = $config->sel_editor_colorset;
416 416
 		// Permission check for file upload
417 417
 		$option->allow_fileupload = false;
418
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
419
-		elseif(count($config->upload_file_grant))
418
+		if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true;
419
+		elseif (count($config->upload_file_grant))
420 420
 		{
421
-			foreach($group_list as $group_srl => $group_info)
421
+			foreach ($group_list as $group_srl => $group_info)
422 422
 			{
423
-				if(in_array($group_srl, $config->upload_file_grant))
423
+				if (in_array($group_srl, $config->upload_file_grant))
424 424
 				{
425 425
 					$option->allow_fileupload = true;
426 426
 					break;
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
 		else $option->allow_fileupload = true;
431 431
 		// Permission check for using default components
432 432
 		$option->enable_default_component = false;
433
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
434
-		elseif(count($config->enable_default_component_grant))
433
+		if ($logged_info->is_admin == 'Y') $option->enable_default_component = true;
434
+		elseif (count($config->enable_default_component_grant))
435 435
 		{
436
-			foreach($group_list as $group_srl => $group_info)
436
+			foreach ($group_list as $group_srl => $group_info)
437 437
 			{
438
-				if(in_array($group_srl, $config->enable_default_component_grant))
438
+				if (in_array($group_srl, $config->enable_default_component_grant))
439 439
 				{
440 440
 					$option->enable_default_component = true;
441 441
 					break;
@@ -445,12 +445,12 @@  discard block
 block discarded – undo
445 445
 		else $option->enable_default_component = true;
446 446
 		// Permisshion check for using extended components
447 447
 		$option->enable_component = false;
448
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
449
-		elseif(count($config->enable_component_grant))
448
+		if ($logged_info->is_admin == 'Y') $option->enable_component = true;
449
+		elseif (count($config->enable_component_grant))
450 450
 		{
451
-			foreach($group_list as $group_srl => $group_info)
451
+			foreach ($group_list as $group_srl => $group_info)
452 452
 			{
453
-				if(in_array($group_srl, $config->enable_component_grant))
453
+				if (in_array($group_srl, $config->enable_component_grant))
454 454
 				{
455 455
 					$option->enable_component = true;
456 456
 					break;
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 		else $option->enable_component = true;
461 461
 		// HTML editing privileges
462 462
 		$enable_html = false;
463
-		if($logged_info->is_admin=='Y') $enable_html = true;
464
-		elseif(count($config->enable_html_grant))
463
+		if ($logged_info->is_admin == 'Y') $enable_html = true;
464
+		elseif (count($config->enable_html_grant))
465 465
 		{
466
-			foreach($group_list as $group_srl => $group_info)
466
+			foreach ($group_list as $group_srl => $group_info)
467 467
 			{
468
-				if(in_array($group_srl, $config->enable_html_grant))
468
+				if (in_array($group_srl, $config->enable_html_grant))
469 469
 				{
470 470
 					$enable_html = true;
471 471
 					break;
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 		}
475 475
 		else $enable_html = true;
476 476
 
477
-		if($enable_html) $option->disable_html = false;
477
+		if ($enable_html) $option->disable_html = false;
478 478
 		else $option->disable_html = true;
479 479
 		// Set Height
480 480
 		$option->height = $config->editor_height;
481 481
 		// Set an option for Auto-save
482
-		$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
482
+		$option->enable_autosave = $config->enable_autosave == 'Y' ?true:false;
483 483
 		// Other settings
484 484
 		$option->primary_key_name = $primary_key_name;
485 485
 		$option->content_key_name = $content_key_name;
@@ -495,31 +495,31 @@  discard block
 block discarded – undo
495 495
 		$auto_save_args = new stdClass();
496 496
 		$auto_save_args->module_srl = Context::get('module_srl');
497 497
 		// Get the current module if module_srl doesn't exist
498
-		if(!$auto_save_args->module_srl)
498
+		if (!$auto_save_args->module_srl)
499 499
 		{
500 500
 			$current_module_info = Context::get('current_module_info');
501 501
 			$auto_save_args->module_srl = $current_module_info->module_srl;
502 502
 		}
503 503
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
504
-		if(Context::get('is_logged'))
504
+		if (Context::get('is_logged'))
505 505
 		{
506 506
 			$logged_info = Context::get('logged_info');
507 507
 			$auto_save_args->member_srl = $logged_info->member_srl;
508 508
 		}
509 509
 		else
510 510
 		{
511
-			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
511
+			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_'.$auto_save_args->module_srl];
512 512
 			// @see https://github.com/xpressengine/xe-core/issues/2208
513 513
 			// 변경 이전에 작성된 게시물 호환성 유지
514
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
514
+			if (!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
515 515
 		}
516 516
 		// Extract auto-saved data from the DB
517 517
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
518 518
 		$saved_doc = $output->data;
519 519
 		// Return null if no result is auto-saved
520
-		if(!$saved_doc) return;
520
+		if (!$saved_doc) return;
521 521
 
522
-		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
522
+		if ($saved_doc->certify_key && !isset($auto_save_args->certify_key))
523 523
 		{
524 524
 			return;
525 525
 		}
@@ -527,16 +527,16 @@  discard block
 block discarded – undo
527 527
 		// Check if the auto-saved document already exists
528 528
 		$oDocumentModel = getModel('document');
529 529
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
530
-		if($oSaved->isExists()) return;
530
+		if ($oSaved->isExists()) return;
531 531
 		// Move all the files if the auto-saved data contains document_srl and file
532 532
 		// Then set document_srl to editor_sequence
533
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
533
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
534 534
 		{
535 535
 			$saved_doc->module_srl = $auto_save_args->module_srl;
536 536
 			$oFileController = getController('file');
537 537
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
538 538
 		}
539
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
539
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
540 540
 		// Change auto-saved data
541 541
 		$saved_doc->certify_key = $auto_save_args->certify_key;
542 542
 		$oEditorController = getController('editor');
@@ -553,18 +553,18 @@  discard block
 block discarded – undo
553 553
 	 */
554 554
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
555 555
 	{
556
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
556
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return;
557 557
 
558
-		if(!$this->loaded_component_list[$component][$editor_sequence])
558
+		if (!$this->loaded_component_list[$component][$editor_sequence])
559 559
 		{
560 560
 			// Create an object of the component and execute
561 561
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
562 562
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
563
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
563
+			if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
564 564
 			// Create an object after loading the class file
565 565
 			require_once($class_file);
566 566
 			$oComponent = new $component($editor_sequence, $class_path);
567
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
567
+			if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
568 568
 			// Add configuration information
569 569
 			$component_info = $this->getComponent($component, $site_srl);
570 570
 			$oComponent->setInfo($component_info);
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 	/**
586 586
 	 * @brief Return the cache file name of editor component list
587 587
 	 */
588
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
588
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
589 589
 	{
590 590
 		$lang = Context::getLangType();
591 591
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
592 592
 		FileHandler::makeDir($cache_path);
593
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
594
-		if($filter_enabled) $cache_file .= 'filter.';
595
-		if($site_srl) $cache_file .= $site_srl.'.';
593
+		$cache_file = $cache_path.'component_list.'.$lang.'.';
594
+		if ($filter_enabled) $cache_file .= 'filter.';
595
+		if ($site_srl) $cache_file .= $site_srl.'.';
596 596
 		$cache_file .= 'php';
597 597
 		return $cache_file;
598 598
 	}
@@ -604,33 +604,33 @@  discard block
 block discarded – undo
604 604
 		if ($filter_enabled) $cache_key[] = 'filter';
605 605
 		if ($site_srl) $cache_key[] = $site_srl;
606 606
 
607
-		return 'editor.component_list:' . implode('.', $cache_key);
607
+		return 'editor.component_list:'.implode('.', $cache_key);
608 608
 	}
609 609
 
610 610
 	/**
611 611
 	 * @brief Return a component list (DB Information included)
612 612
 	 */
613
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
613
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
614 614
 	{
615 615
 		$component_list = false;
616 616
 
617 617
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
618
-		if($oCacheHandler->isSupport()) {
618
+		if ($oCacheHandler->isSupport()) {
619 619
 			$cache_key = $this->getComponentListCacheKey(false, $site_srl);
620 620
 			$component_list = $oCacheHandler->get($cache_key);
621 621
 		}
622 622
 
623
-		if($from_db || $component_list === false)
623
+		if ($from_db || $component_list === false)
624 624
 		{
625 625
 			$oEditorController = getController('editor');
626 626
 			$component_list = $oEditorController->makeCache(false, $site_srl);
627 627
 
628 628
 		}
629 629
 
630
-		if(!$component_list) return array();
630
+		if (!$component_list) return array();
631 631
 
632 632
 		$logged_info = Context::get('logged_info');
633
-		if($logged_info && is_array($logged_info->group_list))
633
+		if ($logged_info && is_array($logged_info->group_list))
634 634
 		{
635 635
 			$group_list = array_keys($logged_info->group_list);
636 636
 		}
@@ -639,45 +639,45 @@  discard block
 block discarded – undo
639 639
 			$group_list = array();
640 640
 		}
641 641
 
642
-		if(count($component_list))
642
+		if (count($component_list))
643 643
 		{
644
-			foreach($component_list as $key => $val)
644
+			foreach ($component_list as $key => $val)
645 645
 			{
646
-				if(!trim($key)) continue;
647
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
646
+				if (!trim($key)) continue;
647
+				if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
648 648
 				{
649 649
 					FileHandler::removeFile($cache_file);
650 650
 					return $this->getComponentList($filter_enabled, $site_srl);
651 651
 				}
652
-				if(!$filter_enabled) continue;
653
-				if($val->enabled == "N")
652
+				if (!$filter_enabled) continue;
653
+				if ($val->enabled == "N")
654 654
 				{
655 655
 					unset($component_list->{$key});
656 656
 					continue;
657 657
 				}
658
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
659
-				if($val->target_group)
658
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
659
+				if ($val->target_group)
660 660
 				{
661
-					if(!$logged_info)
661
+					if (!$logged_info)
662 662
 					{
663 663
 						$val->enabled = "N";
664 664
 					}
665 665
 					else
666 666
 					{
667 667
 						$is_granted = false;
668
-						foreach($group_list as $group_srl)
668
+						foreach ($group_list as $group_srl)
669 669
 						{
670
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
670
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
671 671
 						}
672
-						if(!$is_granted) $val->enabled = "N";
672
+						if (!$is_granted) $val->enabled = "N";
673 673
 					}
674 674
 				}
675
-				if($val->enabled != "N" && $val->mid_list)
675
+				if ($val->enabled != "N" && $val->mid_list)
676 676
 				{
677 677
 					$mid = Context::get('mid');
678
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
678
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
679 679
 				}
680
-				if($val->enabled == "N")
680
+				if ($val->enabled == "N")
681 681
 				{
682 682
 					unset($component_list->{$key});
683 683
 					continue;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 		$args = new stdClass();
696 696
 		$args->component_name = $component_name;
697 697
 
698
-		if($site_srl)
698
+		if ($site_srl)
699 699
 		{
700 700
 			$args->site_srl = $site_srl;
701 701
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 		$component = $output->data;
708 708
 
709
-		if(!$output->data) return false;
709
+		if (!$output->data) return false;
710 710
 
711 711
 		$component_name = $component->component_name;
712 712
 
@@ -718,25 +718,25 @@  discard block
 block discarded – undo
718 718
 
719 719
 		$xml_info->mid_list = array();
720 720
 
721
-		if($component->extra_vars)
721
+		if ($component->extra_vars)
722 722
 		{
723 723
 			$extra_vars = unserialize($component->extra_vars);
724 724
 
725
-			if($extra_vars->target_group)
725
+			if ($extra_vars->target_group)
726 726
 			{
727 727
 				$xml_info->target_group = $extra_vars->target_group;
728 728
 				unset($extra_vars->target_group);
729 729
 			}
730 730
 
731
-			if($extra_vars->mid_list)
731
+			if ($extra_vars->mid_list)
732 732
 			{
733 733
 				$xml_info->mid_list = $extra_vars->mid_list;
734 734
 				unset($extra_vars->mid_list);
735 735
 			}
736 736
 
737
-			if($xml_info->extra_vars)
737
+			if ($xml_info->extra_vars)
738 738
 			{
739
-				foreach($xml_info->extra_vars as $key => $val)
739
+				foreach ($xml_info->extra_vars as $key => $val)
740 740
 				{
741 741
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
742 742
 				}
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
761 761
 
762 762
 		// Include and return xml file information if cached file exists
763
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
763
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
764 764
 		{
765 765
 			include($cache_file);
766 766
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		$component_info->component_name = $component;
778 778
 		$component_info->title = $xml_doc->component->title->body;
779 779
 
780
-		if($xml_doc->component->version)
780
+		if ($xml_doc->component->version)
781 781
 		{
782 782
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
783 783
 			$component_info->version = $xml_doc->component->version->body;
@@ -803,10 +803,10 @@  discard block
 block discarded – undo
803 803
 
804 804
 		// Author information
805 805
 		$author_list = array();
806
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
806
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
807 807
 		else $author_list = $xml_doc->component->author;
808 808
 
809
-		for($i = 0; $i < count($author_list); $i++)
809
+		for ($i = 0; $i < count($author_list); $i++)
810 810
 		{
811 811
 			$author = new stdClass;
812 812
 			$author->name = $author_list[$i]->name->body;
@@ -817,39 +817,39 @@  discard block
 block discarded – undo
817 817
 
818 818
 		// List extra variables (text type only for editor component)
819 819
 		$extra_vars = $xml_doc->component->extra_vars;
820
-		if($extra_vars)
820
+		if ($extra_vars)
821 821
 		{
822 822
 			$extra_var_groups = $extra_vars->group;
823
-			if(!$extra_var_groups)
823
+			if (!$extra_var_groups)
824 824
 			{
825 825
 				$extra_var_groups = $extra_vars;
826 826
 			}
827
-			if(!is_array($extra_var_groups))
827
+			if (!is_array($extra_var_groups))
828 828
 			{
829 829
 				$extra_var_groups = array($extra_var_groups);
830 830
 			}
831 831
 
832
-			foreach($extra_var_groups as $group)
832
+			foreach ($extra_var_groups as $group)
833 833
 			{
834 834
 				$extra_vars = $group->var;
835
-				if(!is_array($group->var))
835
+				if (!is_array($group->var))
836 836
 				{
837 837
 					$extra_vars = array($group->var);
838 838
 				}
839 839
 
840
-				foreach($extra_vars as $key => $val)
840
+				foreach ($extra_vars as $key => $val)
841 841
 				{
842
-					if(!$val)
842
+					if (!$val)
843 843
 					{
844 844
 						continue;
845 845
 					}
846 846
 
847 847
 					$obj = new stdClass();
848
-					if(!$val->attrs)
848
+					if (!$val->attrs)
849 849
 					{
850 850
 						$val->attrs = new stdClass();
851 851
 					}
852
-					if(!$val->attrs->type)
852
+					if (!$val->attrs->type)
853 853
 					{
854 854
 						$val->attrs->type = 'text';
855 855
 					}
@@ -859,26 +859,26 @@  discard block
 block discarded – undo
859 859
 					$obj->title = $val->title->body;
860 860
 					$obj->type = $val->attrs->type;
861 861
 					$obj->description = $val->description->body;
862
-					if($obj->name)
862
+					if ($obj->name)
863 863
 					{
864 864
 						$obj->value = $extra_vals->{$obj->name};
865 865
 					}
866
-					if(strpos($obj->value, '|@|') != FALSE)
866
+					if (strpos($obj->value, '|@|') != FALSE)
867 867
 					{
868 868
 						$obj->value = explode('|@|', $obj->value);
869 869
 					}
870
-					if($obj->type == 'mid_list' && !is_array($obj->value))
870
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
871 871
 					{
872 872
 						$obj->value = array($obj->value);
873 873
 					}
874 874
 
875 875
 					// 'Select'type obtained from the option list.
876
-					if($val->options && !is_array($val->options))
876
+					if ($val->options && !is_array($val->options))
877 877
 					{
878 878
 						$val->options = array($val->options);
879 879
 					}
880 880
 
881
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
881
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
882 882
 					{
883 883
 						$obj->options[$i] = new stdClass();
884 884
 						$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 
893 893
 		$buff = array();
894 894
 		$buff[] = '<?php if(!defined(\'__XE__\')) exit();';
895
-		$buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';';
895
+		$buff[] = '$xml_info = '.var_export($component_info, TRUE).';';
896 896
 		$buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff));
897 897
 
898 898
 		FileHandler::writeFile($cache_file, $buff, 'w');
Please login to merge, or discard this patch.
Braces   +182 added lines, -83 removed lines patch added patch discarded remove patch
@@ -34,17 +34,37 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
38
-
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
37
+		if(!is_object($editor_config)) {
38
+			$editor_config = new stdClass();
39
+		}
40
+
41
+		if($editor_config->enable_autosave != 'N') {
42
+			$editor_config->enable_autosave = 'Y';
43
+		}
44
+		if(!is_array($editor_config->enable_html_grant)) {
45
+			$editor_config->enable_html_grant = array();
46
+		}
47
+		if(!is_array($editor_config->enable_comment_html_grant)) {
48
+			$editor_config->enable_comment_html_grant = array();
49
+		}
50
+		if(!is_array($editor_config->upload_file_grant)) {
51
+			$editor_config->upload_file_grant = array();
52
+		}
53
+		if(!is_array($editor_config->comment_upload_file_grant)) {
54
+			$editor_config->comment_upload_file_grant = array();
55
+		}
56
+		if(!is_array($editor_config->enable_default_component_grant)) {
57
+			$editor_config->enable_default_component_grant = array();
58
+		}
59
+		if(!is_array($editor_config->enable_comment_default_component_grant)) {
60
+			$editor_config->enable_comment_default_component_grant = array();
61
+		}
62
+		if(!is_array($editor_config->enable_component_grant)) {
63
+			$editor_config->enable_component_grant = array();
64
+		}
65
+		if(!is_array($editor_config->enable_comment_component_grant)) {
66
+			$editor_config->enable_comment_component_grant= array();
67
+		}
48 68
 
49 69
 		if(!$editor_config->editor_height)
50 70
 		{
@@ -151,8 +171,11 @@  discard block
 block discarded – undo
151 171
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 172
 
153 173
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155
-		else $author_list = $xml_doc->component->author;
174
+		if(!is_array($xml_doc->component->author)) {
175
+			$author_list[] = $xml_doc->component->author;
176
+		} else {
177
+			$author_list = $xml_doc->component->author;
178
+		}
156 179
 
157 180
 		for($i=0; $i < count($author_list); $i++)
158 181
 		{
@@ -165,7 +188,9 @@  discard block
 block discarded – undo
165 188
 		$extra_vars = $xml_doc->component->extra_vars->var;
166 189
 		if($extra_vars)
167 190
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
191
+			if(!is_array($extra_vars)) {
192
+				$extra_vars = array($extra_vars);
193
+			}
169 194
 			foreach($extra_vars as $key => $val)
170 195
 			{
171 196
 				unset($obj);
@@ -202,10 +227,15 @@  discard block
 block discarded – undo
202 227
 		{
203 228
 			$option->editor_sequence = $upload_target_srl;
204 229
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
206
-		else $allow_fileupload = true;
230
+		if(!$option->allow_fileupload) {
231
+			$allow_fileupload = false;
232
+		} else {
233
+			$allow_fileupload = true;
234
+		}
207 235
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
236
+		if(!$option->content_style) {
237
+			$option->content_style = 'ckeditor_light';
238
+		}
209 239
 		Context::set('content_style', $option->content_style);
210 240
 		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
211 241
 		// Default font setting
@@ -213,30 +243,50 @@  discard block
 block discarded – undo
213 243
 		Context::set('content_font_size', $option->content_font_size);
214 244
 
215 245
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
218
-		else $enable_autosave = true;
246
+		if(!$option->enable_autosave) {
247
+			$enable_autosave = false;
248
+		} elseif(Context::get($option->primary_key_name)) {
249
+			$enable_autosave = false;
250
+		} else {
251
+			$enable_autosave = true;
252
+		}
219 253
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
221
-		else $enable_default_component = true;
254
+		if(!$option->enable_default_component) {
255
+			$enable_default_component = false;
256
+		} else {
257
+			$enable_default_component = true;
258
+		}
222 259
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
224
-		else $enable_component = true;
260
+		if(!$option->enable_component) {
261
+			$enable_component = false;
262
+		} else {
263
+			$enable_component = true;
264
+		}
225 265
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
227
-		else $html_mode = true;
266
+		if($option->disable_html) {
267
+			$html_mode = false;
268
+		} else {
269
+			$html_mode = true;
270
+		}
228 271
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
230
-		else $editor_height = $option->height;
272
+		if(!$option->height) {
273
+			$editor_height = 300;
274
+		} else {
275
+			$editor_height = $option->height;
276
+		}
231 277
 		if(Mobile::isFromMobilePhone()) {
232 278
 			$editor_height = 150;
233 279
 		}
234 280
 		// Skin Setting
235 281
 		$skin = $option->skin;
236
-		if(!$skin) $skin = 'ckeditor';
282
+		if(!$skin) {
283
+			$skin = 'ckeditor';
284
+		}
237 285
 
238 286
 		$colorset = $option->colorset;
239
-		if(!$colorset) $colorset = 'moono';
287
+		if(!$colorset) {
288
+			$colorset = 'moono';
289
+		}
240 290
 		Context::set('colorset', $colorset);
241 291
 		Context::set('skin', $skin);
242 292
 		Context::set('module_type', $option->module_type);
@@ -261,10 +311,13 @@  discard block
 block discarded – undo
261 311
 		/**
262 312
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
263 313
 		 */
264
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
265
-		else
314
+		if($option->editor_sequence) {
315
+			$editor_sequence = $option->editor_sequence;
316
+		} else
266 317
 		{
267
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
318
+			if(!$_SESSION['_editor_sequence_']) {
319
+				$_SESSION['_editor_sequence_'] = 1;
320
+			}
268 321
 			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
269 322
 		}
270 323
 
@@ -288,7 +341,9 @@  discard block
 block discarded – undo
288 341
 			$oFileController = getController('file');
289 342
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
290 343
 			// Check if the file already exists
291
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
344
+			if($upload_target_srl) {
345
+				$files_count = $oFileModel->getFilesCount($upload_target_srl);
346
+			}
292 347
 		}
293 348
 		Context::set('files_count', (int)$files_count);
294 349
 
@@ -380,8 +435,7 @@  discard block
 block discarded – undo
380 435
 			$config->enable_html_grant = $editor_config->enable_html_grant;
381 436
 			$config->editor_height = $editor_config->editor_height;
382 437
 			$config->enable_autosave = $editor_config->enable_autosave;
383
-		}
384
-		else
438
+		} else
385 439
 		{
386 440
 			$config->editor_skin = $editor_config->comment_editor_skin;
387 441
 			$config->content_style = $editor_config->comment_content_style;
@@ -400,8 +454,7 @@  discard block
 block discarded – undo
400 454
 		{
401 455
 			$logged_info = Context::get('logged_info');
402 456
 			$group_list = $logged_info->group_list;
403
-		}
404
-		else
457
+		} else
405 458
 		{
406 459
 			$group_list = array();
407 460
 		}
@@ -415,8 +468,9 @@  discard block
 block discarded – undo
415 468
 		$option->colorset = $config->sel_editor_colorset;
416 469
 		// Permission check for file upload
417 470
 		$option->allow_fileupload = false;
418
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
419
-		elseif(count($config->upload_file_grant))
471
+		if($logged_info->is_admin=='Y') {
472
+			$option->allow_fileupload = true;
473
+		} elseif(count($config->upload_file_grant))
420 474
 		{
421 475
 			foreach($group_list as $group_srl => $group_info)
422 476
 			{
@@ -426,12 +480,14 @@  discard block
 block discarded – undo
426 480
 					break;
427 481
 				}
428 482
 			}
483
+		} else {
484
+			$option->allow_fileupload = true;
429 485
 		}
430
-		else $option->allow_fileupload = true;
431 486
 		// Permission check for using default components
432 487
 		$option->enable_default_component = false;
433
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
434
-		elseif(count($config->enable_default_component_grant))
488
+		if($logged_info->is_admin=='Y') {
489
+			$option->enable_default_component = true;
490
+		} elseif(count($config->enable_default_component_grant))
435 491
 		{
436 492
 			foreach($group_list as $group_srl => $group_info)
437 493
 			{
@@ -441,12 +497,14 @@  discard block
 block discarded – undo
441 497
 					break;
442 498
 				}
443 499
 			}
500
+		} else {
501
+			$option->enable_default_component = true;
444 502
 		}
445
-		else $option->enable_default_component = true;
446 503
 		// Permisshion check for using extended components
447 504
 		$option->enable_component = false;
448
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
449
-		elseif(count($config->enable_component_grant))
505
+		if($logged_info->is_admin=='Y') {
506
+			$option->enable_component = true;
507
+		} elseif(count($config->enable_component_grant))
450 508
 		{
451 509
 			foreach($group_list as $group_srl => $group_info)
452 510
 			{
@@ -456,12 +514,14 @@  discard block
 block discarded – undo
456 514
 					break;
457 515
 				}
458 516
 			}
517
+		} else {
518
+			$option->enable_component = true;
459 519
 		}
460
-		else $option->enable_component = true;
461 520
 		// HTML editing privileges
462 521
 		$enable_html = false;
463
-		if($logged_info->is_admin=='Y') $enable_html = true;
464
-		elseif(count($config->enable_html_grant))
522
+		if($logged_info->is_admin=='Y') {
523
+			$enable_html = true;
524
+		} elseif(count($config->enable_html_grant))
465 525
 		{
466 526
 			foreach($group_list as $group_srl => $group_info)
467 527
 			{
@@ -471,11 +531,15 @@  discard block
 block discarded – undo
471 531
 					break;
472 532
 				}
473 533
 			}
534
+		} else {
535
+			$enable_html = true;
474 536
 		}
475
-		else $enable_html = true;
476 537
 
477
-		if($enable_html) $option->disable_html = false;
478
-		else $option->disable_html = true;
538
+		if($enable_html) {
539
+			$option->disable_html = false;
540
+		} else {
541
+			$option->disable_html = true;
542
+		}
479 543
 		// Set Height
480 544
 		$option->height = $config->editor_height;
481 545
 		// Set an option for Auto-save
@@ -505,19 +569,22 @@  discard block
 block discarded – undo
505 569
 		{
506 570
 			$logged_info = Context::get('logged_info');
507 571
 			$auto_save_args->member_srl = $logged_info->member_srl;
508
-		}
509
-		else
572
+		} else
510 573
 		{
511 574
 			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
512 575
 			// @see https://github.com/xpressengine/xe-core/issues/2208
513 576
 			// 변경 이전에 작성된 게시물 호환성 유지
514
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
577
+			if(!$auto_save_args->certify_key) {
578
+				$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
579
+			}
515 580
 		}
516 581
 		// Extract auto-saved data from the DB
517 582
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
518 583
 		$saved_doc = $output->data;
519 584
 		// Return null if no result is auto-saved
520
-		if(!$saved_doc) return;
585
+		if(!$saved_doc) {
586
+			return;
587
+		}
521 588
 
522 589
 		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
523 590
 		{
@@ -527,7 +594,9 @@  discard block
 block discarded – undo
527 594
 		// Check if the auto-saved document already exists
528 595
 		$oDocumentModel = getModel('document');
529 596
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
530
-		if($oSaved->isExists()) return;
597
+		if($oSaved->isExists()) {
598
+			return;
599
+		}
531 600
 		// Move all the files if the auto-saved data contains document_srl and file
532 601
 		// Then set document_srl to editor_sequence
533 602
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -535,8 +604,9 @@  discard block
 block discarded – undo
535 604
 			$saved_doc->module_srl = $auto_save_args->module_srl;
536 605
 			$oFileController = getController('file');
537 606
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
607
+		} else if($upload_target_srl) {
608
+			$saved_doc->document_srl = $upload_target_srl;
538 609
 		}
539
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
540 610
 		// Change auto-saved data
541 611
 		$saved_doc->certify_key = $auto_save_args->certify_key;
542 612
 		$oEditorController = getController('editor');
@@ -553,18 +623,24 @@  discard block
 block discarded – undo
553 623
 	 */
554 624
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
555 625
 	{
556
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
626
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
627
+			return;
628
+		}
557 629
 
558 630
 		if(!$this->loaded_component_list[$component][$editor_sequence])
559 631
 		{
560 632
 			// Create an object of the component and execute
561 633
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
562 634
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
563
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
635
+			if(!file_exists($class_file)) {
636
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
637
+			}
564 638
 			// Create an object after loading the class file
565 639
 			require_once($class_file);
566 640
 			$oComponent = new $component($editor_sequence, $class_path);
567
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
641
+			if(!$oComponent) {
642
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
643
+			}
568 644
 			// Add configuration information
569 645
 			$component_info = $this->getComponent($component, $site_srl);
570 646
 			$oComponent->setInfo($component_info);
@@ -591,8 +667,12 @@  discard block
 block discarded – undo
591 667
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
592 668
 		FileHandler::makeDir($cache_path);
593 669
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
594
-		if($filter_enabled) $cache_file .= 'filter.';
595
-		if($site_srl) $cache_file .= $site_srl.'.';
670
+		if($filter_enabled) {
671
+			$cache_file .= 'filter.';
672
+		}
673
+		if($site_srl) {
674
+			$cache_file .= $site_srl.'.';
675
+		}
596 676
 		$cache_file .= 'php';
597 677
 		return $cache_file;
598 678
 	}
@@ -601,8 +681,12 @@  discard block
 block discarded – undo
601 681
 	{
602 682
 		$cache_key = array();
603 683
 		$cache_key[] = Context::getLangType();
604
-		if ($filter_enabled) $cache_key[] = 'filter';
605
-		if ($site_srl) $cache_key[] = $site_srl;
684
+		if ($filter_enabled) {
685
+			$cache_key[] = 'filter';
686
+		}
687
+		if ($site_srl) {
688
+			$cache_key[] = $site_srl;
689
+		}
606 690
 
607 691
 		return 'editor.component_list:' . implode('.', $cache_key);
608 692
 	}
@@ -627,14 +711,15 @@  discard block
 block discarded – undo
627 711
 
628 712
 		}
629 713
 
630
-		if(!$component_list) return array();
714
+		if(!$component_list) {
715
+			return array();
716
+		}
631 717
 
632 718
 		$logged_info = Context::get('logged_info');
633 719
 		if($logged_info && is_array($logged_info->group_list))
634 720
 		{
635 721
 			$group_list = array_keys($logged_info->group_list);
636
-		}
637
-		else
722
+		} else
638 723
 		{
639 724
 			$group_list = array();
640 725
 		}
@@ -643,39 +728,50 @@  discard block
 block discarded – undo
643 728
 		{
644 729
 			foreach($component_list as $key => $val)
645 730
 			{
646
-				if(!trim($key)) continue;
731
+				if(!trim($key)) {
732
+					continue;
733
+				}
647 734
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
648 735
 				{
649 736
 					FileHandler::removeFile($cache_file);
650 737
 					return $this->getComponentList($filter_enabled, $site_srl);
651 738
 				}
652
-				if(!$filter_enabled) continue;
739
+				if(!$filter_enabled) {
740
+					continue;
741
+				}
653 742
 				if($val->enabled == "N")
654 743
 				{
655 744
 					unset($component_list->{$key});
656 745
 					continue;
657 746
 				}
658
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
747
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
748
+					continue;
749
+				}
659 750
 				if($val->target_group)
660 751
 				{
661 752
 					if(!$logged_info)
662 753
 					{
663 754
 						$val->enabled = "N";
664
-					}
665
-					else
755
+					} else
666 756
 					{
667 757
 						$is_granted = false;
668 758
 						foreach($group_list as $group_srl)
669 759
 						{
670
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
760
+							if(in_array($group_srl, $val->target_group)) {
761
+								$is_granted = true;
762
+							}
763
+						}
764
+						if(!$is_granted) {
765
+							$val->enabled = "N";
671 766
 						}
672
-						if(!$is_granted) $val->enabled = "N";
673 767
 					}
674 768
 				}
675 769
 				if($val->enabled != "N" && $val->mid_list)
676 770
 				{
677 771
 					$mid = Context::get('mid');
678
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
772
+					if(!in_array($mid, $val->mid_list)) {
773
+						$val->enabled = "N";
774
+					}
679 775
 				}
680 776
 				if($val->enabled == "N")
681 777
 				{
@@ -699,14 +795,15 @@  discard block
 block discarded – undo
699 795
 		{
700 796
 			$args->site_srl = $site_srl;
701 797
 			$output = executeQuery('editor.getSiteComponent', $args);
702
-		}
703
-		else
798
+		} else
704 799
 		{
705 800
 			$output = executeQuery('editor.getComponent', $args);
706 801
 		}
707 802
 		$component = $output->data;
708 803
 
709
-		if(!$output->data) return false;
804
+		if(!$output->data) {
805
+			return false;
806
+		}
710 807
 
711 808
 		$component_name = $component->component_name;
712 809
 
@@ -785,8 +882,7 @@  discard block
 block discarded – undo
785 882
 			$component_info->homepage = $xml_doc->component->link->body;
786 883
 			$component_info->license = $xml_doc->component->license->body;
787 884
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
788
-		}
789
-		else
885
+		} else
790 886
 		{
791 887
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
792 888
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -803,8 +899,11 @@  discard block
 block discarded – undo
803 899
 
804 900
 		// Author information
805 901
 		$author_list = array();
806
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
807
-		else $author_list = $xml_doc->component->author;
902
+		if(!is_array($xml_doc->component->author)) {
903
+			$author_list[] = $xml_doc->component->author;
904
+		} else {
905
+			$author_list = $xml_doc->component->author;
906
+		}
808 907
 
809 908
 		for($i = 0; $i < count($author_list); $i++)
810 909
 		{
Please login to merge, or discard this patch.
modules/module/module.model.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -1038,6 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 	/**
1039 1039
 	 * @brief Get a list of skins for the module
1040 1040
 	 * Return file analysis of skin and skin.xml
1041
+	 * @param string $path
1041 1042
 	 */
1042 1043
 	function getSkins($path, $dir = 'skins')
1043 1044
 	{
@@ -1362,6 +1363,7 @@  discard block
 block discarded – undo
1362 1363
 	/**
1363 1364
 	 * @brief Return module configurations
1364 1365
 	 * Global configuration is used to manage board, member and others
1366
+	 * @param string $module
1365 1367
 	 */
1366 1368
 	function getModuleConfig($module, $site_srl = 0)
1367 1369
 	{
Please login to merge, or discard this patch.
Spacing   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$hostname = $request_url_parse['host'];
101 101
 			$path = $request_url_parse['path'];
102 102
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
105
+			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124
-				$object_key = 'site_info:' . md5($domain);
124
+				$object_key = 'site_info:'.md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225 225
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230
-				$object_key = 'mid_info:' . $module_srl;
230
+				$object_key = 'mid_info:'.$module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
232 232
 				$module_info = $oCacheHandler->get($module_info_cache_key);
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
244
-				$object_key = 'mid_info:' . $module_info->module_srl;
244
+				$object_key = 'mid_info:'.$module_info->module_srl;
245 245
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
246 246
 				$oCacheHandler->put($module_info_cache_key, $module_info);
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326 326
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331
-				$object_key = 'mid_info:' . $module_srl;
331
+				$object_key = 'mid_info:'.$module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
340
-				$object_key = 'mid_info:' . $output->data->module_srl;
340
+				$object_key = 'mid_info:'.$output->data->module_srl;
341 341
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 342
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343 343
 			}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	private function applyDefaultSkin(&$moduleInfo)
417 417
 	{
418
-		if($moduleInfo->is_skin_fix == 'N')
418
+		if ($moduleInfo->is_skin_fix == 'N')
419 419
 		{
420 420
 			$moduleInfo->skin = '/USE_DEFAULT/';
421 421
 		}
422 422
 
423
-		if($moduleInfo->is_mskin_fix == 'N')
423
+		if ($moduleInfo->is_mskin_fix == 'N')
424 424
 		{
425 425
 			$moduleInfo->mskin = '/USE_DEFAULT/';
426 426
 		}
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		$count = count($output->data);
439 439
 
440 440
 		$modules = array();
441
-		for($i=0;$i<$count;$i++)
441
+		for ($i = 0; $i < $count; $i++)
442 442
 		{
443 443
 			$modules[] = $output->data[$i];
444 444
 		}
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 	 */
451 451
 	function getModulesInfo($module_srls, $columnList = array())
452 452
 	{
453
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
453
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
454 454
 		$args = new stdClass();
455 455
 		$args->module_srls = $module_srls;
456 456
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
457
-		if(!$output->toBool()) return;
457
+		if (!$output->toBool()) return;
458 458
 		return $this->addModuleExtraVars($output->data);
459 459
 	}
460 460
 
@@ -464,31 +464,31 @@  discard block
 block discarded – undo
464 464
 	function addModuleExtraVars($module_info)
465 465
 	{
466 466
 		// Process although one or more module informaion is requested
467
-		if(!is_array($module_info)) $target_module_info = array($module_info);
467
+		if (!is_array($module_info)) $target_module_info = array($module_info);
468 468
 		else $target_module_info = $module_info;
469 469
 		// Get module_srl
470 470
 		$module_srls = array();
471
-		foreach($target_module_info as $key => $val)
471
+		foreach ($target_module_info as $key => $val)
472 472
 		{
473 473
 			$module_srl = $val->module_srl;
474
-			if(!$module_srl) continue;
474
+			if (!$module_srl) continue;
475 475
 			$module_srls[] = $val->module_srl;
476 476
 		}
477 477
 		// Extract extra information of the module and skin
478 478
 		$extra_vars = $this->getModuleExtraVars($module_srls);
479
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
479
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
480 480
 
481
-		foreach($target_module_info as $key => $val)
481
+		foreach ($target_module_info as $key => $val)
482 482
 		{
483
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
484
-			foreach($extra_vars[$val->module_srl] as $k => $v)
483
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
484
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
485 485
 			{
486
-				if($target_module_info[$key]->{$k}) continue;
486
+				if ($target_module_info[$key]->{$k}) continue;
487 487
 				$target_module_info[$key]->{$k} = $v;
488 488
 			}
489 489
 		}
490 490
 
491
-		if(is_array($module_info)) return $target_module_info;
491
+		if (is_array($module_info)) return $target_module_info;
492 492
 		return $target_module_info[0];
493 493
 	}
494 494
 
@@ -499,37 +499,37 @@  discard block
 block discarded – undo
499 499
 	{
500 500
 		$list = false;
501 501
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
502
-		if($oCacheHandler->isSupport())
502
+		if ($oCacheHandler->isSupport())
503 503
 		{
504
-			if(count($args) === 1 && isset($args->site_srl))
504
+			if (count($args) === 1 && isset($args->site_srl))
505 505
 			{
506
-				$object_key = 'module:mid_list_' . $args->site_srl;
506
+				$object_key = 'module:mid_list_'.$args->site_srl;
507 507
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
508 508
 				$list = $oCacheHandler->get($cache_key);
509 509
 			}
510 510
 		}
511 511
 
512
-		if($list === false)
512
+		if ($list === false)
513 513
 		{
514
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
514
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515 515
 			{
516 516
 				$columnList = array();
517 517
 			}
518 518
 
519 519
 			$output = executeQuery('module.getMidList', $args, $columnList);
520
-			if(!$output->toBool()) return $output;
520
+			if (!$output->toBool()) return $output;
521 521
 			$list = $output->data;
522 522
 
523
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
523
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524 524
 			{
525 525
 				$oCacheHandler->put($cache_key, $list);
526 526
 			}
527 527
 		}
528
-		if(!$list) return;
528
+		if (!$list) return;
529 529
 
530
-		if(!is_array($list)) $list = array($list);
530
+		if (!is_array($list)) $list = array($list);
531 531
 
532
-		foreach($list as $val)
532
+		foreach ($list as $val)
533 533
 		{
534 534
 			$mid_list[$val->mid] = $val;
535 535
 		}
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	function getModuleSrlList($args = null, $columnList = array())
544 544
 	{
545 545
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
546
-		if(!$output->toBool()) return $output;
546
+		if (!$output->toBool()) return $output;
547 547
 
548 548
 		$list = $output->data;
549
-		if(!$list) return;
549
+		if (!$list) return;
550 550
 
551 551
 		return $list;
552 552
 	}
@@ -556,22 +556,22 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	function getModuleSrlByMid($mid)
558 558
 	{
559
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
560
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
559
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
560
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
561 561
 
562 562
 		$site_module_info = Context::get('site_module_info');
563 563
 
564 564
 		$args = new stdClass;
565 565
 		$args->mid = $mid;
566
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
566
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
567 567
 		$output = executeQuery('module.getModuleSrlByMid', $args);
568
-		if(!$output->toBool()) return $output;
568
+		if (!$output->toBool()) return $output;
569 569
 
570 570
 		$list = $output->data;
571
-		if(!$list) return;
572
-		if(!is_array($list)) $list = array($list);
571
+		if (!$list) return;
572
+		if (!is_array($list)) $list = array($list);
573 573
 
574
-		foreach($list as $key => $val)
574
+		foreach ($list as $key => $val)
575 575
 		{
576 576
 			$module_srl_list[] = $val->module_srl;
577 577
 		}
@@ -587,33 +587,33 @@  discard block
 block discarded – undo
587 587
 		$action_forward = false;
588 588
 		// cache controll
589 589
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
590
-		if($oCacheHandler->isSupport())
590
+		if ($oCacheHandler->isSupport())
591 591
 		{
592 592
 			$cache_key = 'action_forward';
593 593
 			$action_forward = $oCacheHandler->get($cache_key);
594 594
 		}
595 595
 
596 596
 		// retrieve and caching all registered action_forward
597
-		if($action_forward === false)
597
+		if ($action_forward === false)
598 598
 		{
599 599
 			$args = new stdClass();
600
-			$output = executeQueryArray('module.getActionForward',$args);
601
-			if(!$output->toBool()) return new stdClass;
602
-			if(!$output->data) $output->data = array();
600
+			$output = executeQueryArray('module.getActionForward', $args);
601
+			if (!$output->toBool()) return new stdClass;
602
+			if (!$output->data) $output->data = array();
603 603
 
604 604
 			$action_forward = array();
605
-			foreach($output->data as $item)
605
+			foreach ($output->data as $item)
606 606
 			{
607 607
 				$action_forward[$item->act] = $item;
608 608
 			}
609 609
 
610
-			if($oCacheHandler->isSupport())
610
+			if ($oCacheHandler->isSupport())
611 611
 			{
612 612
 				$oCacheHandler->put($cache_key, $action_forward);
613 613
 			}
614 614
 		}
615 615
 
616
-		if($action_forward[$act])
616
+		if ($action_forward[$act])
617 617
 		{
618 618
 			return $action_forward[$act];
619 619
 		}
@@ -628,25 +628,25 @@  discard block
 block discarded – undo
628 628
 	 */
629 629
 	function getTriggers($trigger_name, $called_position)
630 630
 	{
631
-		if(is_null($GLOBALS['__triggers__']))
631
+		if (is_null($GLOBALS['__triggers__']))
632 632
 		{
633 633
 			$triggers = FALSE;
634 634
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
635
-			if($oCacheHandler->isSupport())
635
+			if ($oCacheHandler->isSupport())
636 636
 			{
637 637
 				$cache_key = 'triggers';
638 638
 				$triggers = $oCacheHandler->get($cache_key);
639 639
 			}
640
-			if($triggers === FALSE)
640
+			if ($triggers === FALSE)
641 641
 			{
642 642
 				$output = executeQueryArray('module.getTriggers');
643 643
 				$triggers = $output->data;
644
-				if($output->toBool() && $oCacheHandler->isSupport())
644
+				if ($output->toBool() && $oCacheHandler->isSupport())
645 645
 				{
646 646
 					$oCacheHandler->put($cache_key, $triggers);
647 647
 				}
648 648
 			}
649
-			foreach($triggers as $item)
649
+			foreach ($triggers as $item)
650 650
 			{
651 651
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
652 652
 			}
@@ -662,11 +662,11 @@  discard block
 block discarded – undo
662 662
 	{
663 663
 		$triggers = $this->getTriggers($trigger_name, $called_position);
664 664
 
665
-		if($triggers && is_array($triggers))
665
+		if ($triggers && is_array($triggers))
666 666
 		{
667
-			foreach($triggers as $item)
667
+			foreach ($triggers as $item)
668 668
 			{
669
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
669
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670 670
 				{
671 671
 					return $item;
672 672
 				}
@@ -679,12 +679,12 @@  discard block
 block discarded – undo
679 679
 	/**
680 680
 	 * @brief Get module extend
681 681
 	 */
682
-	function getModuleExtend($parent_module, $type, $kind='')
682
+	function getModuleExtend($parent_module, $type, $kind = '')
683 683
 	{
684 684
 		$key = $parent_module.'.'.$kind.'.'.$type;
685 685
 
686 686
 		$module_extend_info = $this->loadModuleExtends();
687
-		if(array_key_exists($key, $module_extend_info))
687
+		if (array_key_exists($key, $module_extend_info))
688 688
 		{
689 689
 			return $module_extend_info[$key];
690 690
 		}
@@ -700,29 +700,29 @@  discard block
 block discarded – undo
700 700
 		$cache_file = './files/config/module_extend.php';
701 701
 		$cache_file = FileHandler::getRealPath($cache_file);
702 702
 
703
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
703
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
704 704
 		{
705 705
 			// check pre install
706
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
706
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707 707
 			{
708 708
 				$arr = array();
709 709
 				$output = executeQueryArray('module.getModuleExtend');
710
-				if($output->data)
710
+				if ($output->data)
711 711
 				{
712
-					foreach($output->data as $v)
712
+					foreach ($output->data as $v)
713 713
 					{
714 714
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
715 715
 					}
716 716
 				}
717 717
 
718 718
 				$str = '<?PHP return array(%s); ?>';
719
-				$str = sprintf($str, join(',',$arr));
719
+				$str = sprintf($str, join(',', $arr));
720 720
 
721 721
 				FileHandler::writeFile($cache_file, $str);
722 722
 			}
723 723
 
724 724
 
725
-			if(file_exists($cache_file))
725
+			if (file_exists($cache_file))
726 726
 			{
727 727
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
728 728
 			}
@@ -742,20 +742,20 @@  discard block
 block discarded – undo
742 742
 	{
743 743
 		// Get a path of the requested module. Return if not exists.
744 744
 		$module_path = ModuleHandler::getModulePath($module);
745
-		if(!$module_path) return;
745
+		if (!$module_path) return;
746 746
 		// Read the xml file for module skin information
747 747
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
748
-		if(!file_exists($xml_file)) return;
748
+		if (!file_exists($xml_file)) return;
749 749
 
750 750
 		$oXmlParser = new XmlParser();
751 751
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
752 752
 		$xml_obj = $tmp_xml_obj->module;
753 753
 
754
-		if(!$xml_obj) return;
754
+		if (!$xml_obj) return;
755 755
 
756 756
 		// Module Information
757 757
 		$module_info = new stdClass();
758
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
758
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
759 759
 		{
760 760
 			// module format 0.2
761 761
 			$module_info->title = $xml_obj->title->body;
@@ -763,16 +763,16 @@  discard block
 block discarded – undo
763 763
 			$module_info->version = $xml_obj->version->body;
764 764
 			$module_info->homepage = $xml_obj->link->body;
765 765
 			$module_info->category = $xml_obj->category->body;
766
-			if(!$module_info->category) $module_info->category = 'service';
766
+			if (!$module_info->category) $module_info->category = 'service';
767 767
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
768 768
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->license = $xml_obj->license->body;
770 770
 			$module_info->license_link = $xml_obj->license->attrs->link;
771 771
 
772
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
772
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773 773
 			else $author_list = $xml_obj->author;
774 774
 
775
-			foreach($author_list as $author)
775
+			foreach ($author_list as $author)
776 776
 			{
777 777
 				$author_obj = new stdClass();
778 778
 				$author_obj->name = $author->name->body;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 			$module_info->description = $xml_obj->author->description->body;
789 789
 			$module_info->version = $xml_obj->attrs->version;
790 790
 			$module_info->category = $xml_obj->attrs->category;
791
-			if(!$module_info->category) $module_info->category = 'service';
791
+			if (!$module_info->category) $module_info->category = 'service';
792 792
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
793 793
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$author_obj = new stdClass();
@@ -817,17 +817,17 @@  discard block
 block discarded – undo
817 817
 	{
818 818
 		// Get a path of the requested module. Return if not exists.
819 819
 		$class_path = ModuleHandler::getModulePath($module);
820
-		if(!$class_path) return;
820
+		if (!$class_path) return;
821 821
 
822 822
 		// Check if module.xml exists in the path. Return if not exist
823 823
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
824
-		if(!file_exists($xml_file)) return;
824
+		if (!file_exists($xml_file)) return;
825 825
 
826 826
 		// Check if cached file exists
827
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
827
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828 828
 
829 829
 		// Update if no cache file exists or it is older than xml file
830
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
830
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831 831
 		{
832 832
 			$info = new stdClass();
833 833
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
842 842
 
843
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
843
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844 844
 
845 845
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
846 846
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -850,17 +850,17 @@  discard block
 block discarded – undo
850 850
 			$default_index = $admin_index = '';
851 851
 
852 852
 			// Arrange permission information
853
-			if($grants)
853
+			if ($grants)
854 854
 			{
855
-				if(is_array($grants)) $grant_list = $grants;
855
+				if (is_array($grants)) $grant_list = $grants;
856 856
 				else $grant_list[] = $grants;
857 857
 
858 858
 				$info->grant = new stdClass();
859 859
 				$buff[] = '$info->grant = new stdClass;';
860
-				foreach($grant_list as $grant)
860
+				foreach ($grant_list as $grant)
861 861
 				{
862 862
 					$name = $grant->attrs->name;
863
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
863
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
864 864
 					$title = $grant->title->body;
865 865
 
866 866
 					$info->grant->{$name} = new stdClass();
@@ -873,15 +873,15 @@  discard block
 block discarded – undo
873 873
 				}
874 874
 			}
875 875
 			// Permissions to grant
876
-			if($permissions)
876
+			if ($permissions)
877 877
 			{
878
-				if(is_array($permissions)) $permission_list = $permissions;
878
+				if (is_array($permissions)) $permission_list = $permissions;
879 879
 				else $permission_list[] = $permissions;
880 880
 
881 881
 				$buff[] = '$info->permission = new stdClass;';
882 882
 
883 883
 				$info->permission = new stdClass();
884
-				foreach($permission_list as $permission)
884
+				foreach ($permission_list as $permission)
885 885
 				{
886 886
 					$action = $permission->attrs->action;
887 887
 					$target = $permission->attrs->target;
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
 				}
893 893
 			}
894 894
 			// for admin menus
895
-			if($menus)
895
+			if ($menus)
896 896
 			{
897
-				if(is_array($menus)) $menu_list = $menus;
897
+				if (is_array($menus)) $menu_list = $menus;
898 898
 				else $menu_list[] = $menus;
899 899
 
900 900
 				$buff[] = '$info->menu = new stdClass;';
901 901
 				$info->menu = new stdClass();
902
-				foreach($menu_list as $menu)
902
+				foreach ($menu_list as $menu)
903 903
 				{
904 904
 					$menu_name = $menu->attrs->name;
905 905
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -917,23 +917,23 @@  discard block
 block discarded – undo
917 917
 			}
918 918
 
919 919
 			// actions
920
-			if($actions)
920
+			if ($actions)
921 921
 			{
922
-				if(is_array($actions)) $action_list = $actions;
922
+				if (is_array($actions)) $action_list = $actions;
923 923
 				else $action_list[] = $actions;
924 924
 
925 925
 				$buff[] = '$info->action = new stdClass;';
926 926
 				$info->action = new stdClass();
927
-				foreach($action_list as $action)
927
+				foreach ($action_list as $action)
928 928
 				{
929 929
 					$name = $action->attrs->name;
930 930
 
931 931
 					$type = $action->attrs->type;
932
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
933
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
934
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
935
-					$method = $action->attrs->method?$action->attrs->method:'';
936
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
932
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
933
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
934
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
935
+					$method = $action->attrs->method ? $action->attrs->method : '';
936
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
937 937
 					$meta_noindex = $action->attrs->{'meta-noindex'} === 'true' ? 'true' : 'false';
938 938
 
939 939
 					$index = $action->attrs->index;
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
 					$info->action->{$name}->method = $method;
951 951
 					$info->action->{$name}->check_csrf = $check_csrf;
952 952
 					$info->action->{$name}->meta_noindex = $meta_noindex;
953
-					if($action->attrs->menu_name)
953
+					if ($action->attrs->menu_name)
954 954
 					{
955
-						if($menu_index == 'true')
955
+						if ($menu_index == 'true')
956 956
 						{
957 957
 							$info->menu->{$action->attrs->menu_name}->index = $name;
958 958
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
959 959
 						}
960
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
960
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
961 961
 						{
962 962
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
963 963
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -976,22 +976,22 @@  discard block
 block discarded – undo
976 976
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
977 977
 					$buff[] = sprintf('$info->action->%s->meta_noindex=\'%s\';', $name, $meta_noindex);
978 978
 
979
-					if($index=='true')
979
+					if ($index == 'true')
980 980
 					{
981 981
 						$default_index_act = $name;
982 982
 						$info->default_index_act = $name;
983 983
 					}
984
-					if($admin_index=='true')
984
+					if ($admin_index == 'true')
985 985
 					{
986 986
 						$admin_index_act = $name;
987 987
 						$info->admin_index_act = $name;
988 988
 					}
989
-					if($setup_index=='true')
989
+					if ($setup_index == 'true')
990 990
 					{
991 991
 						$setup_index_act = $name;
992 992
 						$info->setup_index_act = $name;
993 993
 					}
994
-					if($simple_setup_index=='true')
994
+					if ($simple_setup_index == 'true')
995 995
 					{
996 996
 						$simple_setup_index_act = $name;
997 997
 						$info->simple_setup_index_act = $name;
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 			return $info;
1013 1013
 		}
1014 1014
 
1015
-		if(file_exists($cache_file)) return include($cache_file);
1015
+		if (file_exists($cache_file)) return include($cache_file);
1016 1016
 	}
1017 1017
 
1018 1018
 	/**
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	{
1024 1024
 		$module = Context::get('module_type');
1025 1025
 
1026
-		if($module == 'ARTICLE')
1026
+		if ($module == 'ARTICLE')
1027 1027
 		{
1028 1028
 			$module = 'page';
1029 1029
 		}
@@ -1043,26 +1043,26 @@  discard block
 block discarded – undo
1043 1043
 	 */
1044 1044
 	function getSkins($path, $dir = 'skins')
1045 1045
 	{
1046
-		if(substr($path, -1) == '/')
1046
+		if (substr($path, -1) == '/')
1047 1047
 		{
1048 1048
 			$path = substr($path, 0, -1);
1049 1049
 		}
1050 1050
 
1051 1051
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1052 1052
 		$list = FileHandler::readDir($skin_path);
1053
-		if(!count($list)) return;
1053
+		if (!count($list)) return;
1054 1054
 
1055 1055
 		natcasesort($list);
1056 1056
 
1057
-		foreach($list as $skin_name)
1057
+		foreach ($list as $skin_name)
1058 1058
 		{
1059
-			if(!is_dir($skin_path . $skin_name))
1059
+			if (!is_dir($skin_path.$skin_name))
1060 1060
 			{
1061 1061
 				continue;
1062 1062
 			}
1063 1063
 			unset($skin_info);
1064 1064
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1065
-			if(!$skin_info)
1065
+			if (!$skin_info)
1066 1066
 			{
1067 1067
 				$skin_info = new stdClass();
1068 1068
 				$skin_info->title = $skin_name;
@@ -1075,15 +1075,15 @@  discard block
 block discarded – undo
1075 1075
 		$tmpPath = trim($tmpPath);
1076 1076
 		$module = array_pop(explode(' ', $tmpPath));
1077 1077
 
1078
-		if($dir == 'skins')
1078
+		if ($dir == 'skins')
1079 1079
 		{
1080 1080
 			$oAdminModel = getAdminModel('admin');
1081 1081
 			$themesInfo = $oAdminModel->getThemeList();
1082 1082
 
1083
-			foreach($themesInfo as $themeName => $info)
1083
+			foreach ($themesInfo as $themeName => $info)
1084 1084
 			{
1085 1085
 				$skinInfos = $info->skin_infos;
1086
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1086
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1087 1087
 				{
1088 1088
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1089 1089
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1095,13 +1095,13 @@  discard block
 block discarded – undo
1095 1095
 		$oMenuAdminModel = getAdminModel('menu');
1096 1096
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1097 1097
 		$moduleName = $module;
1098
-		if($moduleName === 'page')
1098
+		if ($moduleName === 'page')
1099 1099
 		{
1100 1100
 			$moduleName = 'ARTICLE';
1101 1101
 		}
1102
-		if(array_key_exists($moduleName, $installedMenuTypes))
1102
+		if (array_key_exists($moduleName, $installedMenuTypes))
1103 1103
 		{
1104
-			if($dir == 'skins')
1104
+			if ($dir == 'skins')
1105 1105
 			{
1106 1106
 				$type = 'P';
1107 1107
 			}
@@ -1111,12 +1111,12 @@  discard block
 block discarded – undo
1111 1111
 			}
1112 1112
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1113 1113
 
1114
-			if(isset($defaultSkinName))
1114
+			if (isset($defaultSkinName))
1115 1115
 			{
1116 1116
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1117 1117
 
1118 1118
 				$useDefault = new stdClass();
1119
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1119
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1120 1120
 
1121 1121
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1122 1122
 
@@ -1133,20 +1133,20 @@  discard block
 block discarded – undo
1133 1133
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1134 1134
 	{
1135 1135
 		// Read xml file having skin information
1136
-		if(substr($path,-1)!='/') $path .= '/';
1136
+		if (substr($path, -1) != '/') $path .= '/';
1137 1137
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1138
-		if(!file_exists($skin_xml_file)) return;
1138
+		if (!file_exists($skin_xml_file)) return;
1139 1139
 		// Create XmlParser object
1140 1140
 		$oXmlParser = new XmlParser();
1141 1141
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1142 1142
 		// Return if no skin information is
1143
-		if(!$_xml_obj->skin) return;
1143
+		if (!$_xml_obj->skin) return;
1144 1144
 		$xml_obj = $_xml_obj->skin;
1145 1145
 		// Skin Name
1146 1146
 		$skin_info = new stdClass();
1147 1147
 		$skin_info->title = $xml_obj->title->body;
1148 1148
 		// Author information
1149
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1149
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1150 1150
 		{
1151 1151
 			// skin format v0.2
1152 1152
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1158 1158
 			$skin_info->description = $xml_obj->description->body;
1159 1159
 
1160
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1160
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1161 1161
 			else $author_list = $xml_obj->author;
1162 1162
 
1163
-			foreach($author_list as $author)
1163
+			foreach ($author_list as $author)
1164 1164
 			{
1165 1165
 				$author_obj = new stdClass();
1166 1166
 				$author_obj->name = $author->name->body;
@@ -1169,25 +1169,25 @@  discard block
 block discarded – undo
1169 1169
 				$skin_info->author[] = $author_obj;
1170 1170
 			}
1171 1171
 			// List extra vars
1172
-			if($xml_obj->extra_vars)
1172
+			if ($xml_obj->extra_vars)
1173 1173
 			{
1174 1174
 				$extra_var_groups = $xml_obj->extra_vars->group;
1175
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1176
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1175
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1176
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1177 1177
 
1178
-				foreach($extra_var_groups as $group)
1178
+				foreach ($extra_var_groups as $group)
1179 1179
 				{
1180 1180
 					$extra_vars = $group->var;
1181
-					if(!$extra_vars)
1181
+					if (!$extra_vars)
1182 1182
 					{
1183 1183
 						continue;
1184 1184
 					}
1185
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1185
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1186 1186
 
1187
-					foreach($extra_vars as $key => $val)
1187
+					foreach ($extra_vars as $key => $val)
1188 1188
 					{
1189 1189
 						$obj = new stdClass();
1190
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1190
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1191 1191
 
1192 1192
 						$obj->group = $group->title->body;
1193 1193
 						$obj->name = $val->attrs->name;
@@ -1196,14 +1196,14 @@  discard block
 block discarded – undo
1196 1196
 						$obj->description = $val->description->body;
1197 1197
 						$obj->value = $extra_vals->{$obj->name};
1198 1198
 						$obj->default = $val->attrs->default;
1199
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1200
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1199
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1200
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1201 1201
 						// Get an option list from 'select'type
1202
-						if(is_array($val->options))
1202
+						if (is_array($val->options))
1203 1203
 						{
1204 1204
 							$option_count = count($val->options);
1205 1205
 
1206
-							for($i = 0; $i < $option_count; $i++)
1206
+							for ($i = 0; $i < $option_count; $i++)
1207 1207
 							{
1208 1208
 								$obj->options[$i] = new stdClass();
1209 1209
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1240,18 +1240,18 @@  discard block
 block discarded – undo
1240 1240
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1241 1241
 			// Variables used in the skin
1242 1242
 			$extra_var_groups = $xml_obj->extra_vars->group;
1243
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1244
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1243
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1244
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1245 1245
 
1246
-			foreach($extra_var_groups as $group)
1246
+			foreach ($extra_var_groups as $group)
1247 1247
 			{
1248 1248
 				$extra_vars = $group->var;
1249 1249
 
1250
-				if($extra_vars)
1250
+				if ($extra_vars)
1251 1251
 				{
1252
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1252
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1253 1253
 
1254
-					foreach($extra_vars as $var)
1254
+					foreach ($extra_vars as $var)
1255 1255
 					{
1256 1256
 						unset($obj);
1257 1257
 						unset($options);
@@ -1262,11 +1262,11 @@  discard block
 block discarded – undo
1262 1262
 						$title = $var->title->body;
1263 1263
 						$description = $var->description->body;
1264 1264
 						// Get an option list from 'select'type.
1265
-						if(is_array($var->default))
1265
+						if (is_array($var->default))
1266 1266
 						{
1267 1267
 							$option_count = count($var->default);
1268 1268
 
1269
-							for($i = 0; $i < $option_count; $i++)
1269
+							for ($i = 0; $i < $option_count; $i++)
1270 1270
 							{
1271 1271
 								$options[$i]->title = $var->default[$i]->body;
1272 1272
 								$options[$i]->value = $var->default[$i]->body;
@@ -1300,19 +1300,19 @@  discard block
 block discarded – undo
1300 1300
 
1301 1301
 		// colorset
1302 1302
 		$colorset = $xml_obj->colorset->color;
1303
-		if($colorset)
1303
+		if ($colorset)
1304 1304
 		{
1305
-			if(!is_array($colorset)) $colorset = array($colorset);
1305
+			if (!is_array($colorset)) $colorset = array($colorset);
1306 1306
 
1307
-			foreach($colorset as $color)
1307
+			foreach ($colorset as $color)
1308 1308
 			{
1309 1309
 				$name = $color->attrs->name;
1310 1310
 				$title = $color->title->body;
1311 1311
 				$screenshot = $color->attrs->src;
1312
-				if($screenshot)
1312
+				if ($screenshot)
1313 1313
 				{
1314 1314
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1315
-					if(!file_exists($screenshot)) $screenshot = "";
1315
+					if (!file_exists($screenshot)) $screenshot = "";
1316 1316
 				}
1317 1317
 				else $screenshot = "";
1318 1318
 
@@ -1324,19 +1324,19 @@  discard block
 block discarded – undo
1324 1324
 			}
1325 1325
 		}
1326 1326
 		// Menu type (settings for layout)
1327
-		if($xml_obj->menus->menu)
1327
+		if ($xml_obj->menus->menu)
1328 1328
 		{
1329 1329
 			$menus = $xml_obj->menus->menu;
1330
-			if(!is_array($menus)) $menus = array($menus);
1330
+			if (!is_array($menus)) $menus = array($menus);
1331 1331
 
1332 1332
 			$menu_count = count($menus);
1333 1333
 			$skin_info->menu_count = $menu_count;
1334
-			for($i=0;$i<$menu_count;$i++)
1334
+			for ($i = 0; $i < $menu_count; $i++)
1335 1335
 			{
1336 1336
 				unset($obj);
1337 1337
 
1338 1338
 				$obj->name = $menus[$i]->attrs->name;
1339
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1339
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1340 1340
 				$obj->title = $menus[$i]->title->body;
1341 1341
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1342 1342
 
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 		}
1346 1346
 
1347 1347
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1348
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1348
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1349 1349
 		return $skin_info;
1350 1350
 	}
1351 1351
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 	{
1357 1357
 		$args = new stdClass;
1358 1358
 		$args->site_srl = $site_srl;
1359
-		if(!is_null($module)) $args->module = $module;
1359
+		if (!is_null($module)) $args->module = $module;
1360 1360
 		$output = executeQuery('module.getModuleCount', $args);
1361 1361
 		return $output->data->count;
1362 1362
 	}
@@ -1370,26 +1370,26 @@  discard block
 block discarded – undo
1370 1370
 		$config = false;
1371 1371
 		// cache controll
1372 1372
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1373
-		if($oCacheHandler->isSupport())
1373
+		if ($oCacheHandler->isSupport())
1374 1374
 		{
1375
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1375
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1376 1376
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1377 1377
 			$config = $oCacheHandler->get($cache_key);
1378 1378
 		}
1379 1379
 
1380
-		if($config === false)
1380
+		if ($config === false)
1381 1381
 		{
1382
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1382
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1383 1383
 			{
1384 1384
 				$args = new stdClass();
1385 1385
 				$args->module = $module;
1386 1386
 				$args->site_srl = $site_srl;
1387 1387
 				$output = executeQuery('module.getModuleConfig', $args);
1388
-				if($output->data->config) $config = unserialize($output->data->config);
1388
+				if ($output->data->config) $config = unserialize($output->data->config);
1389 1389
 				else $config = null;
1390 1390
 
1391 1391
 				//insert in cache
1392
-				if($oCacheHandler->isSupport())
1392
+				if ($oCacheHandler->isSupport())
1393 1393
 				{
1394 1394
 					$oCacheHandler->put($cache_key, $config);
1395 1395
 				}
@@ -1410,26 +1410,26 @@  discard block
 block discarded – undo
1410 1410
 		$config = false;
1411 1411
 		// cache controll
1412 1412
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1413
-		if($oCacheHandler->isSupport())
1413
+		if ($oCacheHandler->isSupport())
1414 1414
 		{
1415 1415
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1416 1416
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1417 1417
 			$config = $oCacheHandler->get($cache_key);
1418 1418
 		}
1419 1419
 
1420
-		if($config === false)
1420
+		if ($config === false)
1421 1421
 		{
1422
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1422
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1423 1423
 			{
1424 1424
 				$args = new stdClass();
1425 1425
 				$args->module = $module;
1426 1426
 				$args->module_srl = $module_srl;
1427 1427
 				$output = executeQuery('module.getModulePartConfig', $args);
1428
-				if($output->data->config) $config = unserialize($output->data->config);
1428
+				if ($output->data->config) $config = unserialize($output->data->config);
1429 1429
 				else $config = null;
1430 1430
 
1431 1431
 				//insert in cache
1432
-				if($oCacheHandler->isSupport())
1432
+				if ($oCacheHandler->isSupport())
1433 1433
 				{
1434 1434
 					$oCacheHandler->put($cache_key, $config);
1435 1435
 				}
@@ -1448,11 +1448,11 @@  discard block
 block discarded – undo
1448 1448
 	{
1449 1449
 		$args = new stdClass();
1450 1450
 		$args->module = $module;
1451
-		if($site_srl) $args->site_srl = $site_srl;
1451
+		if ($site_srl) $args->site_srl = $site_srl;
1452 1452
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1453
-		if(!$output->toBool() || !$output->data) return array();
1453
+		if (!$output->toBool() || !$output->data) return array();
1454 1454
 
1455
-		foreach($output->data as $key => $val)
1455
+		foreach ($output->data as $key => $val)
1456 1456
 		{
1457 1457
 			$result[$val->module_srl] = unserialize($val->config);
1458 1458
 		}
@@ -1468,12 +1468,12 @@  discard block
 block discarded – undo
1468 1468
 		$args->moduleCategorySrl = $moduleCategorySrl;
1469 1469
 		// Get data from the DB
1470 1470
 		$output = executeQuery('module.getModuleCategories', $args);
1471
-		if(!$output->toBool()) return $output;
1471
+		if (!$output->toBool()) return $output;
1472 1472
 		$list = $output->data;
1473
-		if(!$list) return;
1474
-		if(!is_array($list)) $list = array($list);
1473
+		if (!$list) return;
1474
+		if (!is_array($list)) $list = array($list);
1475 1475
 
1476
-		foreach($list as $val)
1476
+		foreach ($list as $val)
1477 1477
 		{
1478 1478
 			$category_list[$val->module_category_srl] = $val;
1479 1479
 		}
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 		$args = new stdClass;
1490 1490
 		$args->module_category_srl = $module_category_srl;
1491 1491
 		$output = executeQuery('module.getModuleCategory', $args);
1492
-		if(!$output->toBool()) return $output;
1492
+		if (!$output->toBool()) return $output;
1493 1493
 		return $output->data;
1494 1494
 	}
1495 1495
 
@@ -1501,10 +1501,10 @@  discard block
 block discarded – undo
1501 1501
 		// Get a list of downloaded and installed modules
1502 1502
 		$searched_list = FileHandler::readDir('./modules');
1503 1503
 		$searched_count = count($searched_list);
1504
-		if(!$searched_count) return;
1504
+		if (!$searched_count) return;
1505 1505
 		sort($searched_list);
1506 1506
 
1507
-		for($i=0;$i<$searched_count;$i++)
1507
+		for ($i = 0; $i < $searched_count; $i++)
1508 1508
 		{
1509 1509
 			// Module name
1510 1510
 			$module_name = $searched_list[$i];
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 			$info = $this->getModuleInfoXml($module_name);
1515 1515
 			unset($obj);
1516 1516
 
1517
-			if(!isset($info)) continue;
1517
+			if (!isset($info)) continue;
1518 1518
 			$info->module = $module_name;
1519 1519
 			$info->created_table_count = $created_table_count;
1520 1520
 			$info->table_count = $table_count;
@@ -1531,19 +1531,19 @@  discard block
 block discarded – undo
1531 1531
 		$info = null;
1532 1532
 
1533 1533
 		$moduledir = ModuleHandler::getModulePath($module_name);
1534
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1534
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1535 1535
 		{
1536 1536
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1537 1537
 			$table_count = count($tmp_files);
1538 1538
 			// Check if the table is created
1539 1539
 			$created_table_count = 0;
1540
-			for($j=0;$j<count($tmp_files);$j++)
1540
+			for ($j = 0; $j < count($tmp_files); $j++)
1541 1541
 			{
1542
-				list($table_name) = explode(".",$tmp_files[$j]);
1543
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1542
+				list($table_name) = explode(".", $tmp_files[$j]);
1543
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1544 1544
 			}
1545 1545
 			// Check if DB is installed
1546
-			if($table_count > $created_table_count) return true;
1546
+			if ($table_count > $created_table_count) return true;
1547 1547
 			else return false;
1548 1548
 		}
1549 1549
 		return false;
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 	{
1554 1554
 		// Check if it is upgraded to module.class.php on each module
1555 1555
 		$oDummy = getModule($module_name, 'class');
1556
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1556
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1557 1557
 		{
1558 1558
 			return $oDummy->checkUpdate();
1559 1559
 		}
@@ -1567,15 +1567,15 @@  discard block
 block discarded – undo
1567 1567
 	 */
1568 1568
 	public function needUpdate($update_id)
1569 1569
 	{
1570
-		if(!is_array($update_id)) $update_id = array($update_id);
1570
+		if (!is_array($update_id)) $update_id = array($update_id);
1571 1571
 
1572 1572
 		$args = new stdClass();
1573 1573
 		$args->update_id = implode(',', $update_id);
1574 1574
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1575 1575
 
1576
-		if(!!$output->error) return false;
1577
-		if(!$output->data) $output->data = array();
1578
-		if(count($update_id) === count($output->data)) return false;
1576
+		if (!!$output->error) return false;
1577
+		if (!$output->data) $output->data = array();
1578
+		if (count($update_id) === count($output->data)) return false;
1579 1579
 
1580 1580
 		return true;
1581 1581
 	}
@@ -1592,31 +1592,31 @@  discard block
 block discarded – undo
1592 1592
 		sort($searched_list);
1593 1593
 
1594 1594
 		$searched_count = count($searched_list);
1595
-		if(!$searched_count) return;
1595
+		if (!$searched_count) return;
1596 1596
 
1597
-		for($i=0;$i<$searched_count;$i++)
1597
+		for ($i = 0; $i < $searched_count; $i++)
1598 1598
 		{
1599 1599
 			// module name
1600 1600
 			$module_name = $searched_list[$i];
1601 1601
 
1602 1602
 			$path = ModuleHandler::getModulePath($module_name);
1603
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1603
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1604 1604
 
1605 1605
 			// Get the number of xml files to create a table in schemas
1606 1606
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1607 1607
 			$table_count = count($tmp_files);
1608 1608
 			// Check if the table is created
1609 1609
 			$created_table_count = 0;
1610
-			for($j=0;$j<$table_count;$j++)
1610
+			for ($j = 0; $j < $table_count; $j++)
1611 1611
 			{
1612
-				list($table_name) = explode('.',$tmp_files[$j]);
1613
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1612
+				list($table_name) = explode('.', $tmp_files[$j]);
1613
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1614 1614
 			}
1615 1615
 			// Get information of the module
1616 1616
 			$info = NULL;
1617 1617
 			$info = $this->getModuleInfoXml($module_name);
1618 1618
 
1619
-			if(!$info) continue;
1619
+			if (!$info) continue;
1620 1620
 
1621 1621
 			$info->module = $module_name;
1622 1622
 			$info->category = $info->category;
@@ -1625,12 +1625,12 @@  discard block
 block discarded – undo
1625 1625
 			$info->path = $path;
1626 1626
 			$info->admin_index_act = $info->admin_index_act;
1627 1627
 			// Check if DB is installed
1628
-			if($table_count > $created_table_count) $info->need_install = true;
1628
+			if ($table_count > $created_table_count) $info->need_install = true;
1629 1629
 			else $info->need_install = false;
1630 1630
 			// Check if it is upgraded to module.class.php on each module
1631 1631
 			$oDummy = null;
1632 1632
 			$oDummy = getModule($module_name, 'class');
1633
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1633
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1634 1634
 			{
1635 1635
 				$info->need_update = $oDummy->checkUpdate();
1636 1636
 			}
@@ -1651,15 +1651,15 @@  discard block
 block discarded – undo
1651 1651
 	 */
1652 1652
 	function syncModuleToSite(&$data)
1653 1653
 	{
1654
-		if(!$data) return;
1654
+		if (!$data) return;
1655 1655
 
1656
-		if(is_array($data))
1656
+		if (is_array($data))
1657 1657
 		{
1658
-			foreach($data as $key => $val)
1658
+			foreach ($data as $key => $val)
1659 1659
 			{
1660 1660
 				$module_srls[] = $val->module_srl;
1661 1661
 			}
1662
-			if(!count($module_srls)) return;
1662
+			if (!count($module_srls)) return;
1663 1663
 		}
1664 1664
 		else
1665 1665
 		{
@@ -1667,17 +1667,17 @@  discard block
 block discarded – undo
1667 1667
 		}
1668 1668
 
1669 1669
 		$args = new stdClass();
1670
-		$args->module_srls = implode(',',$module_srls);
1670
+		$args->module_srls = implode(',', $module_srls);
1671 1671
 		$output = executeQueryArray('module.getModuleSites', $args);
1672
-		if(!$output->data) return array();
1673
-		foreach($output->data as $key => $val)
1672
+		if (!$output->data) return array();
1673
+		foreach ($output->data as $key => $val)
1674 1674
 		{
1675 1675
 			$modules[$val->module_srl] = $val;
1676 1676
 		}
1677 1677
 
1678
-		if(is_array($data))
1678
+		if (is_array($data))
1679 1679
 		{
1680
-			foreach($data as $key => $val)
1680
+			foreach ($data as $key => $val)
1681 1681
 			{
1682 1682
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1683 1683
 			}
@@ -1693,14 +1693,14 @@  discard block
 block discarded – undo
1693 1693
 	 */
1694 1694
 	function isSiteAdmin($member_info, $site_srl = null)
1695 1695
 	{
1696
-		if(!$member_info->member_srl) return false;
1697
-		if($member_info->is_admin == 'Y') return true;
1696
+		if (!$member_info->member_srl) return false;
1697
+		if ($member_info->is_admin == 'Y') return true;
1698 1698
 
1699 1699
 		$args = new stdClass();
1700
-		if(!isset($site_srl))
1700
+		if (!isset($site_srl))
1701 1701
 		{
1702 1702
 			$site_module_info = Context::get('site_module_info');
1703
-			if(!$site_module_info) return;
1703
+			if (!$site_module_info) return;
1704 1704
 			$args->site_srl = $site_module_info->site_srl;
1705 1705
 		}
1706 1706
 		else
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 
1711 1711
 		$args->member_srl = $member_info->member_srl;
1712 1712
 		$output = executeQuery('module.isSiteAdmin', $args);
1713
-		if($output->data->member_srl == $args->member_srl) return true;
1713
+		if ($output->data->member_srl == $args->member_srl) return true;
1714 1714
 		return false;
1715 1715
 	}
1716 1716
 
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 		$obj = new stdClass();
1734 1734
 		$obj->module_srl = $module_srl;
1735 1735
 		$output = executeQueryArray('module.getAdminID', $obj);
1736
-		if(!$output->toBool() || !$output->data) return;
1736
+		if (!$output->toBool() || !$output->data) return;
1737 1737
 
1738 1738
 		return $output->data;
1739 1739
 	}
@@ -1746,20 +1746,20 @@  discard block
 block discarded – undo
1746 1746
 	{
1747 1747
 		$extra_vars = array();
1748 1748
 		$get_module_srls = array();
1749
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1749
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1750 1750
 
1751 1751
 		$vars = false;
1752 1752
 		// cache controll
1753 1753
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1754
-		if($oCacheHandler->isSupport())
1754
+		if ($oCacheHandler->isSupport())
1755 1755
 		{
1756
-			foreach($list_module_srl as $module_srl)
1756
+			foreach ($list_module_srl as $module_srl)
1757 1757
 			{
1758 1758
 				$object_key = 'module_extra_vars:'.$module_srl;
1759 1759
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1760 1760
 				$vars = $oCacheHandler->get($cache_key);
1761 1761
 
1762
-				if($vars)
1762
+				if ($vars)
1763 1763
 				{
1764 1764
 					$extra_vars[$module_srl] = $vars;
1765 1765
 				}
@@ -1774,35 +1774,35 @@  discard block
 block discarded – undo
1774 1774
 			$get_module_srls = $list_module_srl;
1775 1775
 		}
1776 1776
 
1777
-		if(count($get_module_srls) > 0)
1777
+		if (count($get_module_srls) > 0)
1778 1778
 		{
1779 1779
 			$args = new stdClass();
1780 1780
 			$args->module_srl = implode(',', $get_module_srls);
1781 1781
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1782 1782
 
1783
-			if(!$output->toBool())
1783
+			if (!$output->toBool())
1784 1784
 			{
1785 1785
 				return;
1786 1786
 			}
1787 1787
 
1788
-			if(!$output->data)
1788
+			if (!$output->data)
1789 1789
 			{
1790
-				foreach($get_module_srls as $module_srl)
1790
+				foreach ($get_module_srls as $module_srl)
1791 1791
 				{
1792 1792
 					$extra_vars[$module_srl] = new stdClass;
1793 1793
 				}
1794 1794
 			}
1795
-			foreach($output->data as $key => $val)
1795
+			foreach ($output->data as $key => $val)
1796 1796
 			{
1797
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1797
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1798 1798
 
1799
-				if(!isset($extra_vars[$val->module_srl]))
1799
+				if (!isset($extra_vars[$val->module_srl]))
1800 1800
 				{
1801 1801
 					$extra_vars[$val->module_srl] = new stdClass();
1802 1802
 				}
1803 1803
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1804 1804
 
1805
-				if($oCacheHandler->isSupport())
1805
+				if ($oCacheHandler->isSupport())
1806 1806
 				{
1807 1807
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1808 1808
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1821,27 +1821,27 @@  discard block
 block discarded – undo
1821 1821
 	{
1822 1822
 		$skin_vars = false;
1823 1823
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1824
-		if($oCacheHandler->isSupport())
1824
+		if ($oCacheHandler->isSupport())
1825 1825
 		{
1826 1826
 			$object_key = 'module_skin_vars:'.$module_srl;
1827 1827
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1828 1828
 			$skin_vars = $oCacheHandler->get($cache_key);
1829 1829
 		}
1830 1830
 
1831
-		if($skin_vars === false)
1831
+		if ($skin_vars === false)
1832 1832
 		{
1833 1833
 			$args = new stdClass();
1834 1834
 			$args->module_srl = $module_srl;
1835
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1836
-			if(!$output->toBool()) return;
1835
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1836
+			if (!$output->toBool()) return;
1837 1837
 
1838 1838
 			$skin_vars = array();
1839
-			foreach($output->data as $vars)
1839
+			foreach ($output->data as $vars)
1840 1840
 			{
1841 1841
 				$skin_vars[$vars->name] = $vars;
1842 1842
 			}
1843 1843
 
1844
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1844
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1845 1845
 		}
1846 1846
 
1847 1847
 		return $skin_vars;
@@ -1853,32 +1853,32 @@  discard block
 block discarded – undo
1853 1853
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1854 1854
 	{
1855 1855
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1856
-		if(!$site_srl) $site_srl = 0;
1856
+		if (!$site_srl) $site_srl = 0;
1857 1857
 
1858 1858
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1859
-		if(is_readable($designInfoFile))
1859
+		if (is_readable($designInfoFile))
1860 1860
 		{
1861 1861
 			include($designInfoFile);
1862 1862
 
1863 1863
 			$skinName = $designInfo->module->{$module_name}->{$target};
1864 1864
 		}
1865
-		if(!$skinName)
1865
+		if (!$skinName)
1866 1866
 		{
1867 1867
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1868 1868
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1869 1869
 
1870
-			if(is_dir($moduleSkinPath.'default'))
1870
+			if (is_dir($moduleSkinPath.'default'))
1871 1871
 			{
1872 1872
 				$skinName = 'default';
1873 1873
 			}
1874
-			else if(is_dir($moduleSkinPath.'xe_default'))
1874
+			else if (is_dir($moduleSkinPath.'xe_default'))
1875 1875
 			{
1876 1876
 				$skinName = 'xe_default';
1877 1877
 			}
1878 1878
 			else
1879 1879
 			{
1880 1880
 				$skins = FileHandler::readDir($moduleSkinPath);
1881
-				if(count($skins) > 0)
1881
+				if (count($skins) > 0)
1882 1882
 				{
1883 1883
 					$skinName = $skins[0];
1884 1884
 				}
@@ -1888,9 +1888,9 @@  discard block
 block discarded – undo
1888 1888
 				}
1889 1889
 			}
1890 1890
 
1891
-			if($updateCache && $skinName)
1891
+			if ($updateCache && $skinName)
1892 1892
 			{
1893
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1893
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1894 1894
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1895 1895
 
1896 1896
 				$oAdminController = getAdminController('admin');
@@ -1906,10 +1906,10 @@  discard block
 block discarded – undo
1906 1906
 	 */
1907 1907
 	function syncSkinInfoToModuleInfo(&$module_info)
1908 1908
 	{
1909
-		if(!$module_info->module_srl) return;
1909
+		if (!$module_info->module_srl) return;
1910 1910
 
1911 1911
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1912
-		if(Mobile::isFromMobilePhone())
1912
+		if (Mobile::isFromMobilePhone())
1913 1913
 		{
1914 1914
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1915 1915
 		}
@@ -1918,11 +1918,11 @@  discard block
 block discarded – undo
1918 1918
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1919 1919
 		}
1920 1920
 
1921
-		if(!$skin_vars) return;
1921
+		if (!$skin_vars) return;
1922 1922
 
1923
-		foreach($skin_vars as $name => $val)
1923
+		foreach ($skin_vars as $name => $val)
1924 1924
 		{
1925
-			if(isset($module_info->{$name})) continue;
1925
+			if (isset($module_info->{$name})) continue;
1926 1926
 			$module_info->{$name} = $val->value;
1927 1927
 		}
1928 1928
 	}
@@ -1936,27 +1936,27 @@  discard block
 block discarded – undo
1936 1936
 	{
1937 1937
 		$skin_vars = false;
1938 1938
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1939
-		if($oCacheHandler->isSupport())
1939
+		if ($oCacheHandler->isSupport())
1940 1940
 		{
1941 1941
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1942 1942
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1943 1943
 			$skin_vars = $oCacheHandler->get($cache_key);
1944 1944
 		}
1945 1945
 
1946
-		if($skin_vars === false)
1946
+		if ($skin_vars === false)
1947 1947
 		{
1948 1948
 			$args = new stdClass();
1949 1949
 			$args->module_srl = $module_srl;
1950
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1951
-			if(!$output->toBool() || !$output->data) return;
1950
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1951
+			if (!$output->toBool() || !$output->data) return;
1952 1952
 
1953 1953
 			$skin_vars = array();
1954
-			foreach($output->data as $vars)
1954
+			foreach ($output->data as $vars)
1955 1955
 			{
1956 1956
 				$skin_vars[$vars->name] = $vars;
1957 1957
 			}
1958 1958
 
1959
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1959
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1960 1960
 		}
1961 1961
 
1962 1962
 		return $skin_vars;
@@ -1968,32 +1968,32 @@  discard block
 block discarded – undo
1968 1968
 	 */
1969 1969
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1970 1970
 	{
1971
-		if(!$module_info->module_srl) return;
1971
+		if (!$module_info->module_srl) return;
1972 1972
 		$skin_vars = false;
1973 1973
 		// cache controll
1974 1974
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1975
-		if($oCacheHandler->isSupport())
1975
+		if ($oCacheHandler->isSupport())
1976 1976
 		{
1977 1977
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1978 1978
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1979 1979
 			$skin_vars = $oCacheHandler->get($cache_key);
1980 1980
 		}
1981
-		if($skin_vars === false)
1981
+		if ($skin_vars === false)
1982 1982
 		{
1983 1983
 			$args = new stdClass;
1984 1984
 			$args->module_srl = $module_info->module_srl;
1985
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1986
-			if(!$output->toBool()) return;
1985
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1986
+			if (!$output->toBool()) return;
1987 1987
 			$skin_vars = $output->data;
1988 1988
 
1989 1989
 			//insert in cache
1990
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1990
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1991 1991
 		}
1992
-		if(!$skin_vars) return;
1992
+		if (!$skin_vars) return;
1993 1993
 
1994
-		foreach($output->data as $val)
1994
+		foreach ($output->data as $val)
1995 1995
 		{
1996
-			if(isset($module_info->{$val->name})) continue;
1996
+			if (isset($module_info->{$val->name})) continue;
1997 1997
 			$module_info->{$val->name} = $val->value;
1998 1998
 		}
1999 1999
 	}
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 	{
2006 2006
 		$grant = new stdClass();
2007 2007
 
2008
-		if(!$xml_info)
2008
+		if (!$xml_info)
2009 2009
 		{
2010 2010
 			$module = $module_info->module;
2011 2011
 			$xml_info = $this->getModuleActionXml($module);
@@ -2013,9 +2013,9 @@  discard block
 block discarded – undo
2013 2013
 		// Set variables to grant group permission
2014 2014
 		$module_srl = $module_info->module_srl;
2015 2015
 		$grant_info = $xml_info->grant;
2016
-		if($member_info->member_srl)
2016
+		if ($member_info->member_srl)
2017 2017
 		{
2018
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2018
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2019 2019
 			else $group_list = array();
2020 2020
 		}
2021 2021
 		else
@@ -2023,10 +2023,10 @@  discard block
 block discarded – undo
2023 2023
 			$group_list = array();
2024 2024
 		}
2025 2025
 		// If module_srl doesn't exist(if unable to set permissions)
2026
-		if(!$module_srl)
2026
+		if (!$module_srl)
2027 2027
 		{
2028 2028
 			$grant->access = true;
2029
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2029
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2030 2030
 			{
2031 2031
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2032 2032
 			}
@@ -2037,23 +2037,23 @@  discard block
 block discarded – undo
2037 2037
 		{
2038 2038
 			// If module_srl exists
2039 2039
 			// Get a type of granted permission
2040
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2040
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2041 2041
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2042 2042
 			// If a just logged-in member is, check if the member is a module administrator
2043
-			if(!$grant->manager && $member_info->member_srl)
2043
+			if (!$grant->manager && $member_info->member_srl)
2044 2044
 			{
2045 2045
 				$args = new stdClass();
2046 2046
 				$args->module_srl = $module_srl;
2047 2047
 				$args->member_srl = $member_info->member_srl;
2048
-				$output = executeQuery('module.getModuleAdmin',$args);
2049
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2048
+				$output = executeQuery('module.getModuleAdmin', $args);
2049
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2050 2050
 			}
2051 2051
 			// If not an administrator, get information from the DB and grant manager privilege.
2052
-			if(!$grant->manager)
2052
+			if (!$grant->manager)
2053 2053
 			{
2054 2054
 				$args = new stdClass();
2055 2055
 				// If planet, get permission settings from the planet home
2056
-				if($module_info->module == 'planet')
2056
+				if ($module_info->module == 'planet')
2057 2057
 				{
2058 2058
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2059 2059
 				}
@@ -2066,42 +2066,42 @@  discard block
 block discarded – undo
2066 2066
 
2067 2067
 				$grant_exists = $granted = array();
2068 2068
 
2069
-				if($output->data)
2069
+				if ($output->data)
2070 2070
 				{
2071 2071
 					// Arrange names and groups who has privileges
2072
-					foreach($output->data as $val)
2072
+					foreach ($output->data as $val)
2073 2073
 					{
2074 2074
 						$grant_exists[$val->name] = true;
2075
-						if($granted[$val->name]) continue;
2075
+						if ($granted[$val->name]) continue;
2076 2076
 						// Log-in member only
2077
-						if($val->group_srl == -1)
2077
+						if ($val->group_srl == -1)
2078 2078
 						{
2079 2079
 							$granted[$val->name] = true;
2080
-							if($member_info->member_srl) $grant->{$val->name} = true;
2080
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2081 2081
 							// Site-joined member only
2082 2082
 						}
2083
-						elseif($val->group_srl == -2)
2083
+						elseif ($val->group_srl == -2)
2084 2084
 						{
2085 2085
 							$granted[$val->name] = true;
2086 2086
 							// Do not grant any permission for non-logged member
2087
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2087
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2088 2088
 							// Log-in member
2089 2089
 							else
2090 2090
 							{
2091 2091
 								$site_module_info = Context::get('site_module_info');
2092 2092
 								// Permission granted if no information of the currently connected site exists
2093
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2093
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2094 2094
 								// Permission is not granted if information of the currently connected site exists
2095
-								elseif(count($group_list)) $grant->{$val->name} = true;
2095
+								elseif (count($group_list)) $grant->{$val->name} = true;
2096 2096
 							}
2097 2097
 							// All of non-logged members
2098 2098
 						}
2099
-						elseif($val->group_srl == -3)
2099
+						elseif ($val->group_srl == -3)
2100 2100
 						{
2101 2101
 							$granted[$val->name] = true;
2102 2102
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2103 2103
 						}
2104
-						elseif($val->group_srl == 0)
2104
+						elseif ($val->group_srl == 0)
2105 2105
 						{
2106 2106
 							$granted[$val->name] = true;
2107 2107
 							$grant->{$val->name} = true;
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 						}
2110 2110
 						else
2111 2111
 						{
2112
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2112
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2113 2113
 							{
2114 2114
 								$grant->{$val->name} = true;
2115 2115
 								$granted[$val->name] = true;
@@ -2118,29 +2118,29 @@  discard block
 block discarded – undo
2118 2118
 					}
2119 2119
 				}
2120 2120
 				// Separate processing for the virtual group access
2121
-				if(!$grant_exists['access']) $grant->access = true;
2122
-				if(count($grant_info))
2121
+				if (!$grant_exists['access']) $grant->access = true;
2122
+				if (count($grant_info))
2123 2123
 				{
2124
-					foreach($grant_info as  $grant_name => $grant_item)
2124
+					foreach ($grant_info as  $grant_name => $grant_item)
2125 2125
 					{
2126
-						if($grant_exists[$grant_name]) continue;
2127
-						switch($grant_item->default)
2126
+						if ($grant_exists[$grant_name]) continue;
2127
+						switch ($grant_item->default)
2128 2128
 						{
2129 2129
 							case 'guest' :
2130 2130
 								$grant->{$grant_name} = true;
2131 2131
 								break;
2132 2132
 							case 'member' :
2133
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2133
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2134 2134
 								else $grant->{$grant_name} = false;
2135 2135
 								break;
2136 2136
 							case 'site' :
2137 2137
 								$site_module_info = Context::get('site_module_info');
2138
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2138
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2139 2139
 								else $grant->{$grant_name} = false;
2140 2140
 								break;
2141 2141
 							case 'manager' :
2142 2142
 							case 'root' :
2143
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2143
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2144 2144
 								else $grant->{$grant_name} = false;
2145 2145
 								break;
2146 2146
 						}
@@ -2148,12 +2148,12 @@  discard block
 block discarded – undo
2148 2148
 				}
2149 2149
 			}
2150 2150
 			// Set true to grant all privileges if an administrator is
2151
-			if($grant->manager)
2151
+			if ($grant->manager)
2152 2152
 			{
2153 2153
 				$grant->access = true;
2154
-				if(count($grant_info))
2154
+				if (count($grant_info))
2155 2155
 				{
2156
-					foreach($grant_info as $key => $val)
2156
+					foreach ($grant_info as $key => $val)
2157 2157
 					{
2158 2158
 						$grant->{$key} = true;
2159 2159
 					}
@@ -2185,27 +2185,27 @@  discard block
 block discarded – undo
2185 2185
 
2186 2186
 	function unserializeAttributes($module_filebox_list)
2187 2187
 	{
2188
-		if(is_array($module_filebox_list->data))
2188
+		if (is_array($module_filebox_list->data))
2189 2189
 		{
2190
-			foreach($module_filebox_list->data as &$item)
2190
+			foreach ($module_filebox_list->data as &$item)
2191 2191
 			{
2192
-				if(empty($item->comment))
2192
+				if (empty($item->comment))
2193 2193
 				{
2194 2194
 					continue;
2195 2195
 				}
2196 2196
 
2197 2197
 				$attributes = explode(';', $item->comment);
2198
-				foreach($attributes as $attribute)
2198
+				foreach ($attributes as $attribute)
2199 2199
 				{
2200 2200
 					$values = explode(':', $attribute);
2201
-					if((count($values) % 2) ==1)
2201
+					if ((count($values) % 2) == 1)
2202 2202
 					{
2203
-						for($i=2;$i<count($values);$i++)
2203
+						for ($i = 2; $i < count($values); $i++)
2204 2204
 						{
2205
-							$values[1].=":".$values[$i];
2205
+							$values[1] .= ":".$values[$i];
2206 2206
 						}
2207 2207
 					}
2208
-					$atts[$values[0]]=$values[1];
2208
+					$atts[$values[0]] = $values[1];
2209 2209
 				}
2210 2210
 				$item->attributes = $atts;
2211 2211
 				unset($atts);
@@ -2217,16 +2217,16 @@  discard block
 block discarded – undo
2217 2217
 	function getFileBoxListHtml()
2218 2218
 	{
2219 2219
 		$logged_info = Context::get('logged_info');
2220
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2220
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2221 2221
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2222
-		$link_params = explode('&',$link['query']);
2222
+		$link_params = explode('&', $link['query']);
2223 2223
 		foreach ($link_params as $param)
2224 2224
 		{
2225
-			$param = explode("=",$param);
2226
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2225
+			$param = explode("=", $param);
2226
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2227 2227
 		}
2228 2228
 		$oWidgetModel = getModel('widget');
2229
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2229
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2230 2230
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2231 2231
 
2232 2232
 		$oModuleModel = getModel('module');
@@ -2242,24 +2242,24 @@  discard block
 block discarded – undo
2242 2242
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2243 2243
 
2244 2244
 		$oTemplate = &TemplateHandler::getInstance();
2245
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2245
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2246 2246
 
2247 2247
 		$this->add('html', $html);
2248 2248
 	}
2249 2249
 
2250 2250
 	function getModuleFileBoxPath($module_filebox_srl)
2251 2251
 	{
2252
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2252
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2253 2253
 	}
2254 2254
 
2255 2255
 	/**
2256 2256
 	 * @brief Return ruleset cache file path
2257 2257
 	 * @param module, act
2258 2258
 	 */
2259
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2259
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2260 2260
 	{
2261 2261
 		// load dynamic ruleset xml file
2262
-		if(strpos($ruleset, '@') !== false)
2262
+		if (strpos($ruleset, '@') !== false)
2263 2263
 		{
2264 2264
 			$rulsetFile = str_replace('@', '', $ruleset);
2265 2265
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2269,20 +2269,20 @@  discard block
 block discarded – undo
2269 2269
 		{
2270 2270
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2271 2271
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2272
-			if(is_readable($xml_file))
2272
+			if (is_readable($xml_file))
2273 2273
 				return FileHandler::getRealPath($xml_file);
2274
-			else{
2274
+			else {
2275 2275
 				$ruleset = str_replace('#', '', $ruleset);
2276 2276
 			}
2277 2277
 
2278 2278
 		}
2279 2279
 		// Get a path of the requested module. Return if not exists.
2280 2280
 		$class_path = ModuleHandler::getModulePath($module);
2281
-		if(!$class_path) return;
2281
+		if (!$class_path) return;
2282 2282
 
2283 2283
 		// Check if module.xml exists in the path. Return if not exist
2284 2284
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2285
-		if(!file_exists($xml_file)) return;
2285
+		if (!file_exists($xml_file)) return;
2286 2286
 
2287 2287
 		return $xml_file;
2288 2288
 	}
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 		$requestVars = Context::getRequestVars();
2295 2295
 
2296 2296
 		$args = new stdClass;
2297
-		$args->site_srl = (int)$requestVars->site_srl;
2297
+		$args->site_srl = (int) $requestVars->site_srl;
2298 2298
 		$args->page = 1; // /< Page
2299 2299
 		$args->list_count = 100; // /< the number of posts to display on a single page
2300 2300
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2306,9 +2306,9 @@  discard block
 block discarded – undo
2306 2306
 
2307 2307
 		$list = array();
2308 2308
 
2309
-		if($output->toBool())
2309
+		if ($output->toBool())
2310 2310
 		{
2311
-			foreach((array)$output->data as $code_info)
2311
+			foreach ((array) $output->data as $code_info)
2312 2312
 			{
2313 2313
 				unset($codeInfo);
2314 2314
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
Braces   +467 added lines, -208 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$hostname = $request_url_parse['host'];
101 113
 			$path = $request_url_parse['path'];
102 114
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,8 +435,9 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406 443
 
@@ -450,11 +487,15 @@  discard block
 block discarded – undo
450 487
 	 */
451 488
 	function getModulesInfo($module_srls, $columnList = array())
452 489
 	{
453
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
490
+		if(is_array($module_srls)) {
491
+			$module_srls = implode(',',$module_srls);
492
+		}
454 493
 		$args = new stdClass();
455 494
 		$args->module_srls = $module_srls;
456 495
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
457
-		if(!$output->toBool()) return;
496
+		if(!$output->toBool()) {
497
+			return;
498
+		}
458 499
 		return $this->addModuleExtraVars($output->data);
459 500
 	}
460 501
 
@@ -464,31 +505,44 @@  discard block
 block discarded – undo
464 505
 	function addModuleExtraVars($module_info)
465 506
 	{
466 507
 		// Process although one or more module informaion is requested
467
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
-		else $target_module_info = $module_info;
508
+		if(!is_array($module_info)) {
509
+			$target_module_info = array($module_info);
510
+		} else {
511
+			$target_module_info = $module_info;
512
+		}
469 513
 		// Get module_srl
470 514
 		$module_srls = array();
471 515
 		foreach($target_module_info as $key => $val)
472 516
 		{
473 517
 			$module_srl = $val->module_srl;
474
-			if(!$module_srl) continue;
518
+			if(!$module_srl) {
519
+				continue;
520
+			}
475 521
 			$module_srls[] = $val->module_srl;
476 522
 		}
477 523
 		// Extract extra information of the module and skin
478 524
 		$extra_vars = $this->getModuleExtraVars($module_srls);
479
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
525
+		if(!count($module_srls) || !count($extra_vars)) {
526
+			return $module_info;
527
+		}
480 528
 
481 529
 		foreach($target_module_info as $key => $val)
482 530
 		{
483
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
531
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
532
+				continue;
533
+			}
484 534
 			foreach($extra_vars[$val->module_srl] as $k => $v)
485 535
 			{
486
-				if($target_module_info[$key]->{$k}) continue;
536
+				if($target_module_info[$key]->{$k}) {
537
+					continue;
538
+				}
487 539
 				$target_module_info[$key]->{$k} = $v;
488 540
 			}
489 541
 		}
490 542
 
491
-		if(is_array($module_info)) return $target_module_info;
543
+		if(is_array($module_info)) {
544
+			return $target_module_info;
545
+		}
492 546
 		return $target_module_info[0];
493 547
 	}
494 548
 
@@ -517,7 +571,9 @@  discard block
 block discarded – undo
517 571
 			}
518 572
 
519 573
 			$output = executeQuery('module.getMidList', $args, $columnList);
520
-			if(!$output->toBool()) return $output;
574
+			if(!$output->toBool()) {
575
+				return $output;
576
+			}
521 577
 			$list = $output->data;
522 578
 
523 579
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -525,9 +581,13 @@  discard block
 block discarded – undo
525 581
 				$oCacheHandler->put($cache_key, $list);
526 582
 			}
527 583
 		}
528
-		if(!$list) return;
584
+		if(!$list) {
585
+			return;
586
+		}
529 587
 
530
-		if(!is_array($list)) $list = array($list);
588
+		if(!is_array($list)) {
589
+			$list = array($list);
590
+		}
531 591
 
532 592
 		foreach($list as $val)
533 593
 		{
@@ -543,10 +603,14 @@  discard block
 block discarded – undo
543 603
 	function getModuleSrlList($args = null, $columnList = array())
544 604
 	{
545 605
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
546
-		if(!$output->toBool()) return $output;
606
+		if(!$output->toBool()) {
607
+			return $output;
608
+		}
547 609
 
548 610
 		$list = $output->data;
549
-		if(!$list) return;
611
+		if(!$list) {
612
+			return;
613
+		}
550 614
 
551 615
 		return $list;
552 616
 	}
@@ -556,20 +620,32 @@  discard block
 block discarded – undo
556 620
 	 */
557 621
 	function getModuleSrlByMid($mid)
558 622
 	{
559
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
560
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
623
+		if($mid && !is_array($mid)) {
624
+			$mid = explode(',',$mid);
625
+		}
626
+		if(is_array($mid)) {
627
+			$mid = "'".implode("','",$mid)."'";
628
+		}
561 629
 
562 630
 		$site_module_info = Context::get('site_module_info');
563 631
 
564 632
 		$args = new stdClass;
565 633
 		$args->mid = $mid;
566
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
634
+		if($site_module_info) {
635
+			$args->site_srl = $site_module_info->site_srl;
636
+		}
567 637
 		$output = executeQuery('module.getModuleSrlByMid', $args);
568
-		if(!$output->toBool()) return $output;
638
+		if(!$output->toBool()) {
639
+			return $output;
640
+		}
569 641
 
570 642
 		$list = $output->data;
571
-		if(!$list) return;
572
-		if(!is_array($list)) $list = array($list);
643
+		if(!$list) {
644
+			return;
645
+		}
646
+		if(!is_array($list)) {
647
+			$list = array($list);
648
+		}
573 649
 
574 650
 		foreach($list as $key => $val)
575 651
 		{
@@ -598,8 +674,12 @@  discard block
 block discarded – undo
598 674
 		{
599 675
 			$args = new stdClass();
600 676
 			$output = executeQueryArray('module.getActionForward',$args);
601
-			if(!$output->toBool()) return new stdClass;
602
-			if(!$output->data) $output->data = array();
677
+			if(!$output->toBool()) {
678
+				return new stdClass;
679
+			}
680
+			if(!$output->data) {
681
+				$output->data = array();
682
+			}
603 683
 
604 684
 			$action_forward = array();
605 685
 			foreach($output->data as $item)
@@ -616,8 +696,7 @@  discard block
 block discarded – undo
616 696
 		if($action_forward[$act])
617 697
 		{
618 698
 			return $action_forward[$act];
619
-		}
620
-		else
699
+		} else
621 700
 		{
622 701
 			return new stdClass();
623 702
 		}
@@ -725,8 +804,7 @@  discard block
 block discarded – undo
725 804
 			if(file_exists($cache_file))
726 805
 			{
727 806
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
728
-			}
729
-			else
807
+			} else
730 808
 			{
731 809
 				$GLOBALS['__MODULE_EXTEND__'] = array();
732 810
 			}
@@ -742,16 +820,22 @@  discard block
 block discarded – undo
742 820
 	{
743 821
 		// Get a path of the requested module. Return if not exists.
744 822
 		$module_path = ModuleHandler::getModulePath($module);
745
-		if(!$module_path) return;
823
+		if(!$module_path) {
824
+			return;
825
+		}
746 826
 		// Read the xml file for module skin information
747 827
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
748
-		if(!file_exists($xml_file)) return;
828
+		if(!file_exists($xml_file)) {
829
+			return;
830
+		}
749 831
 
750 832
 		$oXmlParser = new XmlParser();
751 833
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
752 834
 		$xml_obj = $tmp_xml_obj->module;
753 835
 
754
-		if(!$xml_obj) return;
836
+		if(!$xml_obj) {
837
+			return;
838
+		}
755 839
 
756 840
 		// Module Information
757 841
 		$module_info = new stdClass();
@@ -763,14 +847,19 @@  discard block
 block discarded – undo
763 847
 			$module_info->version = $xml_obj->version->body;
764 848
 			$module_info->homepage = $xml_obj->link->body;
765 849
 			$module_info->category = $xml_obj->category->body;
766
-			if(!$module_info->category) $module_info->category = 'service';
850
+			if(!$module_info->category) {
851
+				$module_info->category = 'service';
852
+			}
767 853
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
768 854
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
769 855
 			$module_info->license = $xml_obj->license->body;
770 856
 			$module_info->license_link = $xml_obj->license->attrs->link;
771 857
 
772
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
-			else $author_list = $xml_obj->author;
858
+			if(!is_array($xml_obj->author)) {
859
+				$author_list[] = $xml_obj->author;
860
+			} else {
861
+				$author_list = $xml_obj->author;
862
+			}
774 863
 
775 864
 			foreach($author_list as $author)
776 865
 			{
@@ -780,15 +869,16 @@  discard block
 block discarded – undo
780 869
 				$author_obj->homepage = $author->attrs->link;
781 870
 				$module_info->author[] = $author_obj;
782 871
 			}
783
-		}
784
-		else
872
+		} else
785 873
 		{
786 874
 			// module format 0.1
787 875
 			$module_info->title = $xml_obj->title->body;
788 876
 			$module_info->description = $xml_obj->author->description->body;
789 877
 			$module_info->version = $xml_obj->attrs->version;
790 878
 			$module_info->category = $xml_obj->attrs->category;
791
-			if(!$module_info->category) $module_info->category = 'service';
879
+			if(!$module_info->category) {
880
+				$module_info->category = 'service';
881
+			}
792 882
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
793 883
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
794 884
 			$author_obj = new stdClass();
@@ -817,11 +907,15 @@  discard block
 block discarded – undo
817 907
 	{
818 908
 		// Get a path of the requested module. Return if not exists.
819 909
 		$class_path = ModuleHandler::getModulePath($module);
820
-		if(!$class_path) return;
910
+		if(!$class_path) {
911
+			return;
912
+		}
821 913
 
822 914
 		// Check if module.xml exists in the path. Return if not exist
823 915
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
824
-		if(!file_exists($xml_file)) return;
916
+		if(!file_exists($xml_file)) {
917
+			return;
918
+		}
825 919
 
826 920
 		// Check if cached file exists
827 921
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -840,7 +934,10 @@  discard block
 block discarded – undo
840 934
 
841 935
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
842 936
 
843
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
937
+			if(!count($xml_obj->module)) {
938
+				return;
939
+			}
940
+			// /< Error occurs if module tag doesn't included in the xml
844 941
 
845 942
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
846 943
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -852,8 +949,11 @@  discard block
 block discarded – undo
852 949
 			// Arrange permission information
853 950
 			if($grants)
854 951
 			{
855
-				if(is_array($grants)) $grant_list = $grants;
856
-				else $grant_list[] = $grants;
952
+				if(is_array($grants)) {
953
+					$grant_list = $grants;
954
+				} else {
955
+					$grant_list[] = $grants;
956
+				}
857 957
 
858 958
 				$info->grant = new stdClass();
859 959
 				$buff[] = '$info->grant = new stdClass;';
@@ -875,8 +975,11 @@  discard block
 block discarded – undo
875 975
 			// Permissions to grant
876 976
 			if($permissions)
877 977
 			{
878
-				if(is_array($permissions)) $permission_list = $permissions;
879
-				else $permission_list[] = $permissions;
978
+				if(is_array($permissions)) {
979
+					$permission_list = $permissions;
980
+				} else {
981
+					$permission_list[] = $permissions;
982
+				}
880 983
 
881 984
 				$buff[] = '$info->permission = new stdClass;';
882 985
 
@@ -894,8 +997,11 @@  discard block
 block discarded – undo
894 997
 			// for admin menus
895 998
 			if($menus)
896 999
 			{
897
-				if(is_array($menus)) $menu_list = $menus;
898
-				else $menu_list[] = $menus;
1000
+				if(is_array($menus)) {
1001
+					$menu_list = $menus;
1002
+				} else {
1003
+					$menu_list[] = $menus;
1004
+				}
899 1005
 
900 1006
 				$buff[] = '$info->menu = new stdClass;';
901 1007
 				$info->menu = new stdClass();
@@ -919,8 +1025,11 @@  discard block
 block discarded – undo
919 1025
 			// actions
920 1026
 			if($actions)
921 1027
 			{
922
-				if(is_array($actions)) $action_list = $actions;
923
-				else $action_list[] = $actions;
1028
+				if(is_array($actions)) {
1029
+					$action_list = $actions;
1030
+				} else {
1031
+					$action_list[] = $actions;
1032
+				}
924 1033
 
925 1034
 				$buff[] = '$info->action = new stdClass;';
926 1035
 				$info->action = new stdClass();
@@ -1012,7 +1121,9 @@  discard block
 block discarded – undo
1012 1121
 			return $info;
1013 1122
 		}
1014 1123
 
1015
-		if(file_exists($cache_file)) return include($cache_file);
1124
+		if(file_exists($cache_file)) {
1125
+			return include($cache_file);
1126
+		}
1016 1127
 	}
1017 1128
 
1018 1129
 	/**
@@ -1050,7 +1161,9 @@  discard block
 block discarded – undo
1050 1161
 
1051 1162
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1052 1163
 		$list = FileHandler::readDir($skin_path);
1053
-		if(!count($list)) return;
1164
+		if(!count($list)) {
1165
+			return;
1166
+		}
1054 1167
 
1055 1168
 		natcasesort($list);
1056 1169
 
@@ -1104,8 +1217,7 @@  discard block
 block discarded – undo
1104 1217
 			if($dir == 'skins')
1105 1218
 			{
1106 1219
 				$type = 'P';
1107
-			}
1108
-			else
1220
+			} else
1109 1221
 			{
1110 1222
 				$type = 'M';
1111 1223
 			}
@@ -1133,14 +1245,20 @@  discard block
 block discarded – undo
1133 1245
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1134 1246
 	{
1135 1247
 		// Read xml file having skin information
1136
-		if(substr($path,-1)!='/') $path .= '/';
1248
+		if(substr($path,-1)!='/') {
1249
+			$path .= '/';
1250
+		}
1137 1251
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1138
-		if(!file_exists($skin_xml_file)) return;
1252
+		if(!file_exists($skin_xml_file)) {
1253
+			return;
1254
+		}
1139 1255
 		// Create XmlParser object
1140 1256
 		$oXmlParser = new XmlParser();
1141 1257
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1142 1258
 		// Return if no skin information is
1143
-		if(!$_xml_obj->skin) return;
1259
+		if(!$_xml_obj->skin) {
1260
+			return;
1261
+		}
1144 1262
 		$xml_obj = $_xml_obj->skin;
1145 1263
 		// Skin Name
1146 1264
 		$skin_info = new stdClass();
@@ -1157,8 +1275,11 @@  discard block
 block discarded – undo
1157 1275
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1158 1276
 			$skin_info->description = $xml_obj->description->body;
1159 1277
 
1160
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1161
-			else $author_list = $xml_obj->author;
1278
+			if(!is_array($xml_obj->author)) {
1279
+				$author_list[] = $xml_obj->author;
1280
+			} else {
1281
+				$author_list = $xml_obj->author;
1282
+			}
1162 1283
 
1163 1284
 			foreach($author_list as $author)
1164 1285
 			{
@@ -1172,8 +1293,12 @@  discard block
 block discarded – undo
1172 1293
 			if($xml_obj->extra_vars)
1173 1294
 			{
1174 1295
 				$extra_var_groups = $xml_obj->extra_vars->group;
1175
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1176
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1296
+				if(!$extra_var_groups) {
1297
+					$extra_var_groups = $xml_obj->extra_vars;
1298
+				}
1299
+				if(!is_array($extra_var_groups)) {
1300
+					$extra_var_groups = array($extra_var_groups);
1301
+				}
1177 1302
 
1178 1303
 				foreach($extra_var_groups as $group)
1179 1304
 				{
@@ -1182,7 +1307,9 @@  discard block
 block discarded – undo
1182 1307
 					{
1183 1308
 						continue;
1184 1309
 					}
1185
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1310
+					if(!is_array($group->var)) {
1311
+						$extra_vars = array($group->var);
1312
+					}
1186 1313
 
1187 1314
 					foreach($extra_vars as $key => $val)
1188 1315
 					{
@@ -1209,8 +1336,7 @@  discard block
 block discarded – undo
1209 1336
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1210 1337
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1211 1338
 							}
1212
-						}
1213
-						else
1339
+						} else
1214 1340
 						{
1215 1341
 							$obj->options[0] = new stdClass();
1216 1342
 							$obj->options[0]->title = $val->options->title->body;
@@ -1221,8 +1347,7 @@  discard block
 block discarded – undo
1221 1347
 					}
1222 1348
 				}
1223 1349
 			}
1224
-		}
1225
-		else
1350
+		} else
1226 1351
 		{
1227 1352
 			// skin format v0.1
1228 1353
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1240,8 +1365,12 @@  discard block
 block discarded – undo
1240 1365
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1241 1366
 			// Variables used in the skin
1242 1367
 			$extra_var_groups = $xml_obj->extra_vars->group;
1243
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1244
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1368
+			if(!$extra_var_groups) {
1369
+				$extra_var_groups = $xml_obj->extra_vars;
1370
+			}
1371
+			if(!is_array($extra_var_groups)) {
1372
+				$extra_var_groups = array($extra_var_groups);
1373
+			}
1245 1374
 
1246 1375
 			foreach($extra_var_groups as $group)
1247 1376
 			{
@@ -1249,7 +1378,9 @@  discard block
 block discarded – undo
1249 1378
 
1250 1379
 				if($extra_vars)
1251 1380
 				{
1252
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1381
+					if(!is_array($extra_vars)) {
1382
+						$extra_vars = array($extra_vars);
1383
+					}
1253 1384
 
1254 1385
 					foreach($extra_vars as $var)
1255 1386
 					{
@@ -1271,8 +1402,7 @@  discard block
 block discarded – undo
1271 1402
 								$options[$i]->title = $var->default[$i]->body;
1272 1403
 								$options[$i]->value = $var->default[$i]->body;
1273 1404
 							}
1274
-						}
1275
-						else
1405
+						} else
1276 1406
 						{
1277 1407
 							$options[0]->title = $var->default->body;
1278 1408
 							$options[0]->value = $var->default->body;
@@ -1302,7 +1432,9 @@  discard block
 block discarded – undo
1302 1432
 		$colorset = $xml_obj->colorset->color;
1303 1433
 		if($colorset)
1304 1434
 		{
1305
-			if(!is_array($colorset)) $colorset = array($colorset);
1435
+			if(!is_array($colorset)) {
1436
+				$colorset = array($colorset);
1437
+			}
1306 1438
 
1307 1439
 			foreach($colorset as $color)
1308 1440
 			{
@@ -1312,9 +1444,12 @@  discard block
 block discarded – undo
1312 1444
 				if($screenshot)
1313 1445
 				{
1314 1446
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1315
-					if(!file_exists($screenshot)) $screenshot = "";
1447
+					if(!file_exists($screenshot)) {
1448
+						$screenshot = "";
1449
+					}
1450
+				} else {
1451
+					$screenshot = "";
1316 1452
 				}
1317
-				else $screenshot = "";
1318 1453
 
1319 1454
 				$obj = new stdClass();
1320 1455
 				$obj->name = $name;
@@ -1327,7 +1462,9 @@  discard block
 block discarded – undo
1327 1462
 		if($xml_obj->menus->menu)
1328 1463
 		{
1329 1464
 			$menus = $xml_obj->menus->menu;
1330
-			if(!is_array($menus)) $menus = array($menus);
1465
+			if(!is_array($menus)) {
1466
+				$menus = array($menus);
1467
+			}
1331 1468
 
1332 1469
 			$menu_count = count($menus);
1333 1470
 			$skin_info->menu_count = $menu_count;
@@ -1336,7 +1473,9 @@  discard block
 block discarded – undo
1336 1473
 				unset($obj);
1337 1474
 
1338 1475
 				$obj->name = $menus[$i]->attrs->name;
1339
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1476
+				if($menus[$i]->attrs->default == "true") {
1477
+					$obj->default = true;
1478
+				}
1340 1479
 				$obj->title = $menus[$i]->title->body;
1341 1480
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1342 1481
 
@@ -1356,7 +1495,9 @@  discard block
 block discarded – undo
1356 1495
 	{
1357 1496
 		$args = new stdClass;
1358 1497
 		$args->site_srl = $site_srl;
1359
-		if(!is_null($module)) $args->module = $module;
1498
+		if(!is_null($module)) {
1499
+			$args->module = $module;
1500
+		}
1360 1501
 		$output = executeQuery('module.getModuleCount', $args);
1361 1502
 		return $output->data->count;
1362 1503
 	}
@@ -1385,8 +1526,11 @@  discard block
 block discarded – undo
1385 1526
 				$args->module = $module;
1386 1527
 				$args->site_srl = $site_srl;
1387 1528
 				$output = executeQuery('module.getModuleConfig', $args);
1388
-				if($output->data->config) $config = unserialize($output->data->config);
1389
-				else $config = null;
1529
+				if($output->data->config) {
1530
+					$config = unserialize($output->data->config);
1531
+				} else {
1532
+					$config = null;
1533
+				}
1390 1534
 
1391 1535
 				//insert in cache
1392 1536
 				if($oCacheHandler->isSupport())
@@ -1425,8 +1569,11 @@  discard block
 block discarded – undo
1425 1569
 				$args->module = $module;
1426 1570
 				$args->module_srl = $module_srl;
1427 1571
 				$output = executeQuery('module.getModulePartConfig', $args);
1428
-				if($output->data->config) $config = unserialize($output->data->config);
1429
-				else $config = null;
1572
+				if($output->data->config) {
1573
+					$config = unserialize($output->data->config);
1574
+				} else {
1575
+					$config = null;
1576
+				}
1430 1577
 
1431 1578
 				//insert in cache
1432 1579
 				if($oCacheHandler->isSupport())
@@ -1448,9 +1595,13 @@  discard block
 block discarded – undo
1448 1595
 	{
1449 1596
 		$args = new stdClass();
1450 1597
 		$args->module = $module;
1451
-		if($site_srl) $args->site_srl = $site_srl;
1598
+		if($site_srl) {
1599
+			$args->site_srl = $site_srl;
1600
+		}
1452 1601
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1453
-		if(!$output->toBool() || !$output->data) return array();
1602
+		if(!$output->toBool() || !$output->data) {
1603
+			return array();
1604
+		}
1454 1605
 
1455 1606
 		foreach($output->data as $key => $val)
1456 1607
 		{
@@ -1468,10 +1619,16 @@  discard block
 block discarded – undo
1468 1619
 		$args->moduleCategorySrl = $moduleCategorySrl;
1469 1620
 		// Get data from the DB
1470 1621
 		$output = executeQuery('module.getModuleCategories', $args);
1471
-		if(!$output->toBool()) return $output;
1622
+		if(!$output->toBool()) {
1623
+			return $output;
1624
+		}
1472 1625
 		$list = $output->data;
1473
-		if(!$list) return;
1474
-		if(!is_array($list)) $list = array($list);
1626
+		if(!$list) {
1627
+			return;
1628
+		}
1629
+		if(!is_array($list)) {
1630
+			$list = array($list);
1631
+		}
1475 1632
 
1476 1633
 		foreach($list as $val)
1477 1634
 		{
@@ -1489,7 +1646,9 @@  discard block
 block discarded – undo
1489 1646
 		$args = new stdClass;
1490 1647
 		$args->module_category_srl = $module_category_srl;
1491 1648
 		$output = executeQuery('module.getModuleCategory', $args);
1492
-		if(!$output->toBool()) return $output;
1649
+		if(!$output->toBool()) {
1650
+			return $output;
1651
+		}
1493 1652
 		return $output->data;
1494 1653
 	}
1495 1654
 
@@ -1501,7 +1660,9 @@  discard block
 block discarded – undo
1501 1660
 		// Get a list of downloaded and installed modules
1502 1661
 		$searched_list = FileHandler::readDir('./modules');
1503 1662
 		$searched_count = count($searched_list);
1504
-		if(!$searched_count) return;
1663
+		if(!$searched_count) {
1664
+			return;
1665
+		}
1505 1666
 		sort($searched_list);
1506 1667
 
1507 1668
 		for($i=0;$i<$searched_count;$i++)
@@ -1514,7 +1675,9 @@  discard block
 block discarded – undo
1514 1675
 			$info = $this->getModuleInfoXml($module_name);
1515 1676
 			unset($obj);
1516 1677
 
1517
-			if(!isset($info)) continue;
1678
+			if(!isset($info)) {
1679
+				continue;
1680
+			}
1518 1681
 			$info->module = $module_name;
1519 1682
 			$info->created_table_count = $created_table_count;
1520 1683
 			$info->table_count = $table_count;
@@ -1540,11 +1703,16 @@  discard block
 block discarded – undo
1540 1703
 			for($j=0;$j<count($tmp_files);$j++)
1541 1704
 			{
1542 1705
 				list($table_name) = explode(".",$tmp_files[$j]);
1543
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1706
+				if($oDB->isTableExists($table_name)) {
1707
+					$created_table_count ++;
1708
+				}
1544 1709
 			}
1545 1710
 			// Check if DB is installed
1546
-			if($table_count > $created_table_count) return true;
1547
-			else return false;
1711
+			if($table_count > $created_table_count) {
1712
+				return true;
1713
+			} else {
1714
+				return false;
1715
+			}
1548 1716
 		}
1549 1717
 		return false;
1550 1718
 	}
@@ -1567,15 +1735,23 @@  discard block
 block discarded – undo
1567 1735
 	 */
1568 1736
 	public function needUpdate($update_id)
1569 1737
 	{
1570
-		if(!is_array($update_id)) $update_id = array($update_id);
1738
+		if(!is_array($update_id)) {
1739
+			$update_id = array($update_id);
1740
+		}
1571 1741
 
1572 1742
 		$args = new stdClass();
1573 1743
 		$args->update_id = implode(',', $update_id);
1574 1744
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1575 1745
 
1576
-		if(!!$output->error) return false;
1577
-		if(!$output->data) $output->data = array();
1578
-		if(count($update_id) === count($output->data)) return false;
1746
+		if(!!$output->error) {
1747
+			return false;
1748
+		}
1749
+		if(!$output->data) {
1750
+			$output->data = array();
1751
+		}
1752
+		if(count($update_id) === count($output->data)) {
1753
+			return false;
1754
+		}
1579 1755
 
1580 1756
 		return true;
1581 1757
 	}
@@ -1592,7 +1768,9 @@  discard block
 block discarded – undo
1592 1768
 		sort($searched_list);
1593 1769
 
1594 1770
 		$searched_count = count($searched_list);
1595
-		if(!$searched_count) return;
1771
+		if(!$searched_count) {
1772
+			return;
1773
+		}
1596 1774
 
1597 1775
 		for($i=0;$i<$searched_count;$i++)
1598 1776
 		{
@@ -1600,7 +1778,9 @@  discard block
 block discarded – undo
1600 1778
 			$module_name = $searched_list[$i];
1601 1779
 
1602 1780
 			$path = ModuleHandler::getModulePath($module_name);
1603
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1781
+			if(!is_dir(FileHandler::getRealPath($path))) {
1782
+				continue;
1783
+			}
1604 1784
 
1605 1785
 			// Get the number of xml files to create a table in schemas
1606 1786
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1610,13 +1790,17 @@  discard block
 block discarded – undo
1610 1790
 			for($j=0;$j<$table_count;$j++)
1611 1791
 			{
1612 1792
 				list($table_name) = explode('.',$tmp_files[$j]);
1613
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1793
+				if($oDB->isTableExists($table_name)) {
1794
+					$created_table_count ++;
1795
+				}
1614 1796
 			}
1615 1797
 			// Get information of the module
1616 1798
 			$info = NULL;
1617 1799
 			$info = $this->getModuleInfoXml($module_name);
1618 1800
 
1619
-			if(!$info) continue;
1801
+			if(!$info) {
1802
+				continue;
1803
+			}
1620 1804
 
1621 1805
 			$info->module = $module_name;
1622 1806
 			$info->category = $info->category;
@@ -1625,16 +1809,18 @@  discard block
 block discarded – undo
1625 1809
 			$info->path = $path;
1626 1810
 			$info->admin_index_act = $info->admin_index_act;
1627 1811
 			// Check if DB is installed
1628
-			if($table_count > $created_table_count) $info->need_install = true;
1629
-			else $info->need_install = false;
1812
+			if($table_count > $created_table_count) {
1813
+				$info->need_install = true;
1814
+			} else {
1815
+				$info->need_install = false;
1816
+			}
1630 1817
 			// Check if it is upgraded to module.class.php on each module
1631 1818
 			$oDummy = null;
1632 1819
 			$oDummy = getModule($module_name, 'class');
1633 1820
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1634 1821
 			{
1635 1822
 				$info->need_update = $oDummy->checkUpdate();
1636
-			}
1637
-			else
1823
+			} else
1638 1824
 			{
1639 1825
 				continue;
1640 1826
 			}
@@ -1651,7 +1837,9 @@  discard block
 block discarded – undo
1651 1837
 	 */
1652 1838
 	function syncModuleToSite(&$data)
1653 1839
 	{
1654
-		if(!$data) return;
1840
+		if(!$data) {
1841
+			return;
1842
+		}
1655 1843
 
1656 1844
 		if(is_array($data))
1657 1845
 		{
@@ -1659,9 +1847,10 @@  discard block
 block discarded – undo
1659 1847
 			{
1660 1848
 				$module_srls[] = $val->module_srl;
1661 1849
 			}
1662
-			if(!count($module_srls)) return;
1663
-		}
1664
-		else
1850
+			if(!count($module_srls)) {
1851
+				return;
1852
+			}
1853
+		} else
1665 1854
 		{
1666 1855
 			$module_srls[] = $data->module_srl;
1667 1856
 		}
@@ -1669,7 +1858,9 @@  discard block
 block discarded – undo
1669 1858
 		$args = new stdClass();
1670 1859
 		$args->module_srls = implode(',',$module_srls);
1671 1860
 		$output = executeQueryArray('module.getModuleSites', $args);
1672
-		if(!$output->data) return array();
1861
+		if(!$output->data) {
1862
+			return array();
1863
+		}
1673 1864
 		foreach($output->data as $key => $val)
1674 1865
 		{
1675 1866
 			$modules[$val->module_srl] = $val;
@@ -1681,8 +1872,7 @@  discard block
 block discarded – undo
1681 1872
 			{
1682 1873
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1683 1874
 			}
1684
-		}
1685
-		else
1875
+		} else
1686 1876
 		{
1687 1877
 			$data->domain = $modules[$data->module_srl]->domain;
1688 1878
 		}
@@ -1693,24 +1883,31 @@  discard block
 block discarded – undo
1693 1883
 	 */
1694 1884
 	function isSiteAdmin($member_info, $site_srl = null)
1695 1885
 	{
1696
-		if(!$member_info->member_srl) return false;
1697
-		if($member_info->is_admin == 'Y') return true;
1886
+		if(!$member_info->member_srl) {
1887
+			return false;
1888
+		}
1889
+		if($member_info->is_admin == 'Y') {
1890
+			return true;
1891
+		}
1698 1892
 
1699 1893
 		$args = new stdClass();
1700 1894
 		if(!isset($site_srl))
1701 1895
 		{
1702 1896
 			$site_module_info = Context::get('site_module_info');
1703
-			if(!$site_module_info) return;
1897
+			if(!$site_module_info) {
1898
+				return;
1899
+			}
1704 1900
 			$args->site_srl = $site_module_info->site_srl;
1705
-		}
1706
-		else
1901
+		} else
1707 1902
 		{
1708 1903
 			$args->site_srl = $site_srl;
1709 1904
 		}
1710 1905
 
1711 1906
 		$args->member_srl = $member_info->member_srl;
1712 1907
 		$output = executeQuery('module.isSiteAdmin', $args);
1713
-		if($output->data->member_srl == $args->member_srl) return true;
1908
+		if($output->data->member_srl == $args->member_srl) {
1909
+			return true;
1910
+		}
1714 1911
 		return false;
1715 1912
 	}
1716 1913
 
@@ -1733,7 +1930,9 @@  discard block
 block discarded – undo
1733 1930
 		$obj = new stdClass();
1734 1931
 		$obj->module_srl = $module_srl;
1735 1932
 		$output = executeQueryArray('module.getAdminID', $obj);
1736
-		if(!$output->toBool() || !$output->data) return;
1933
+		if(!$output->toBool() || !$output->data) {
1934
+			return;
1935
+		}
1737 1936
 
1738 1937
 		return $output->data;
1739 1938
 	}
@@ -1746,7 +1945,9 @@  discard block
 block discarded – undo
1746 1945
 	{
1747 1946
 		$extra_vars = array();
1748 1947
 		$get_module_srls = array();
1749
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1948
+		if(!is_array($list_module_srl)) {
1949
+			$list_module_srl = array($list_module_srl);
1950
+		}
1750 1951
 
1751 1952
 		$vars = false;
1752 1953
 		// cache controll
@@ -1762,14 +1963,12 @@  discard block
 block discarded – undo
1762 1963
 				if($vars)
1763 1964
 				{
1764 1965
 					$extra_vars[$module_srl] = $vars;
1765
-				}
1766
-				else
1966
+				} else
1767 1967
 				{
1768 1968
 					$get_module_srls[] = $module_srl;
1769 1969
 				}
1770 1970
 			}
1771
-		}
1772
-		else
1971
+		} else
1773 1972
 		{
1774 1973
 			$get_module_srls = $list_module_srl;
1775 1974
 		}
@@ -1794,7 +1993,9 @@  discard block
 block discarded – undo
1794 1993
 			}
1795 1994
 			foreach($output->data as $key => $val)
1796 1995
 			{
1797
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1996
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1997
+					continue;
1998
+				}
1798 1999
 
1799 2000
 				if(!isset($extra_vars[$val->module_srl]))
1800 2001
 				{
@@ -1833,7 +2034,9 @@  discard block
 block discarded – undo
1833 2034
 			$args = new stdClass();
1834 2035
 			$args->module_srl = $module_srl;
1835 2036
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1836
-			if(!$output->toBool()) return;
2037
+			if(!$output->toBool()) {
2038
+				return;
2039
+			}
1837 2040
 
1838 2041
 			$skin_vars = array();
1839 2042
 			foreach($output->data as $vars)
@@ -1841,7 +2044,9 @@  discard block
 block discarded – undo
1841 2044
 				$skin_vars[$vars->name] = $vars;
1842 2045
 			}
1843 2046
 
1844
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2047
+			if($oCacheHandler->isSupport()) {
2048
+				$oCacheHandler->put($cache_key, $skin_vars);
2049
+			}
1845 2050
 		}
1846 2051
 
1847 2052
 		return $skin_vars;
@@ -1853,7 +2058,9 @@  discard block
 block discarded – undo
1853 2058
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1854 2059
 	{
1855 2060
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1856
-		if(!$site_srl) $site_srl = 0;
2061
+		if(!$site_srl) {
2062
+			$site_srl = 0;
2063
+		}
1857 2064
 
1858 2065
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1859 2066
 		if(is_readable($designInfoFile))
@@ -1870,19 +2077,16 @@  discard block
 block discarded – undo
1870 2077
 			if(is_dir($moduleSkinPath.'default'))
1871 2078
 			{
1872 2079
 				$skinName = 'default';
1873
-			}
1874
-			else if(is_dir($moduleSkinPath.'xe_default'))
2080
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1875 2081
 			{
1876 2082
 				$skinName = 'xe_default';
1877
-			}
1878
-			else
2083
+			} else
1879 2084
 			{
1880 2085
 				$skins = FileHandler::readDir($moduleSkinPath);
1881 2086
 				if(count($skins) > 0)
1882 2087
 				{
1883 2088
 					$skinName = $skins[0];
1884
-				}
1885
-				else
2089
+				} else
1886 2090
 				{
1887 2091
 					$skinName = NULL;
1888 2092
 				}
@@ -1890,7 +2094,9 @@  discard block
 block discarded – undo
1890 2094
 
1891 2095
 			if($updateCache && $skinName)
1892 2096
 			{
1893
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2097
+				if(!isset($designInfo->module->{$module_name})) {
2098
+					$designInfo->module->{$module_name} = new stdClass();
2099
+				}
1894 2100
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1895 2101
 
1896 2102
 				$oAdminController = getAdminController('admin');
@@ -1906,23 +2112,28 @@  discard block
 block discarded – undo
1906 2112
 	 */
1907 2113
 	function syncSkinInfoToModuleInfo(&$module_info)
1908 2114
 	{
1909
-		if(!$module_info->module_srl) return;
2115
+		if(!$module_info->module_srl) {
2116
+			return;
2117
+		}
1910 2118
 
1911 2119
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1912 2120
 		if(Mobile::isFromMobilePhone())
1913 2121
 		{
1914 2122
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1915
-		}
1916
-		else
2123
+		} else
1917 2124
 		{
1918 2125
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1919 2126
 		}
1920 2127
 
1921
-		if(!$skin_vars) return;
2128
+		if(!$skin_vars) {
2129
+			return;
2130
+		}
1922 2131
 
1923 2132
 		foreach($skin_vars as $name => $val)
1924 2133
 		{
1925
-			if(isset($module_info->{$name})) continue;
2134
+			if(isset($module_info->{$name})) {
2135
+				continue;
2136
+			}
1926 2137
 			$module_info->{$name} = $val->value;
1927 2138
 		}
1928 2139
 	}
@@ -1948,7 +2159,9 @@  discard block
 block discarded – undo
1948 2159
 			$args = new stdClass();
1949 2160
 			$args->module_srl = $module_srl;
1950 2161
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1951
-			if(!$output->toBool() || !$output->data) return;
2162
+			if(!$output->toBool() || !$output->data) {
2163
+				return;
2164
+			}
1952 2165
 
1953 2166
 			$skin_vars = array();
1954 2167
 			foreach($output->data as $vars)
@@ -1956,7 +2169,9 @@  discard block
 block discarded – undo
1956 2169
 				$skin_vars[$vars->name] = $vars;
1957 2170
 			}
1958 2171
 
1959
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2172
+			if($oCacheHandler->isSupport()) {
2173
+				$oCacheHandler->put($cache_key, $skin_vars);
2174
+			}
1960 2175
 		}
1961 2176
 
1962 2177
 		return $skin_vars;
@@ -1968,7 +2183,9 @@  discard block
 block discarded – undo
1968 2183
 	 */
1969 2184
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1970 2185
 	{
1971
-		if(!$module_info->module_srl) return;
2186
+		if(!$module_info->module_srl) {
2187
+			return;
2188
+		}
1972 2189
 		$skin_vars = false;
1973 2190
 		// cache controll
1974 2191
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1983,17 +2200,25 @@  discard block
 block discarded – undo
1983 2200
 			$args = new stdClass;
1984 2201
 			$args->module_srl = $module_info->module_srl;
1985 2202
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1986
-			if(!$output->toBool()) return;
2203
+			if(!$output->toBool()) {
2204
+				return;
2205
+			}
1987 2206
 			$skin_vars = $output->data;
1988 2207
 
1989 2208
 			//insert in cache
1990
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2209
+			if($oCacheHandler->isSupport()) {
2210
+				$oCacheHandler->put($cache_key, $skin_vars);
2211
+			}
2212
+		}
2213
+		if(!$skin_vars) {
2214
+			return;
1991 2215
 		}
1992
-		if(!$skin_vars) return;
1993 2216
 
1994 2217
 		foreach($output->data as $val)
1995 2218
 		{
1996
-			if(isset($module_info->{$val->name})) continue;
2219
+			if(isset($module_info->{$val->name})) {
2220
+				continue;
2221
+			}
1997 2222
 			$module_info->{$val->name} = $val->value;
1998 2223
 		}
1999 2224
 	}
@@ -2015,10 +2240,12 @@  discard block
 block discarded – undo
2015 2240
 		$grant_info = $xml_info->grant;
2016 2241
 		if($member_info->member_srl)
2017 2242
 		{
2018
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2019
-			else $group_list = array();
2020
-		}
2021
-		else
2243
+			if(is_array($member_info->group_list)) {
2244
+				$group_list = array_keys($member_info->group_list);
2245
+			} else {
2246
+				$group_list = array();
2247
+			}
2248
+		} else
2022 2249
 		{
2023 2250
 			$group_list = array();
2024 2251
 		}
@@ -2032,8 +2259,7 @@  discard block
 block discarded – undo
2032 2259
 			}
2033 2260
 
2034 2261
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2035
-		}
2036
-		else
2262
+		} else
2037 2263
 		{
2038 2264
 			// If module_srl exists
2039 2265
 			// Get a type of granted permission
@@ -2046,7 +2272,9 @@  discard block
 block discarded – undo
2046 2272
 				$args->module_srl = $module_srl;
2047 2273
 				$args->member_srl = $member_info->member_srl;
2048 2274
 				$output = executeQuery('module.getModuleAdmin',$args);
2049
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2275
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2276
+					$grant->manager = true;
2277
+				}
2050 2278
 			}
2051 2279
 			// If not an administrator, get information from the DB and grant manager privilege.
2052 2280
 			if(!$grant->manager)
@@ -2056,8 +2284,7 @@  discard block
 block discarded – undo
2056 2284
 				if($module_info->module == 'planet')
2057 2285
 				{
2058 2286
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2059
-				}
2060
-				else
2287
+				} else
2061 2288
 				{
2062 2289
 					$args = new stdClass;
2063 2290
 					$args->module_srl = $module_srl;
@@ -2072,42 +2299,48 @@  discard block
 block discarded – undo
2072 2299
 					foreach($output->data as $val)
2073 2300
 					{
2074 2301
 						$grant_exists[$val->name] = true;
2075
-						if($granted[$val->name]) continue;
2302
+						if($granted[$val->name]) {
2303
+							continue;
2304
+						}
2076 2305
 						// Log-in member only
2077 2306
 						if($val->group_srl == -1)
2078 2307
 						{
2079 2308
 							$granted[$val->name] = true;
2080
-							if($member_info->member_srl) $grant->{$val->name} = true;
2309
+							if($member_info->member_srl) {
2310
+								$grant->{$val->name} = true;
2311
+							}
2081 2312
 							// Site-joined member only
2082
-						}
2083
-						elseif($val->group_srl == -2)
2313
+						} elseif($val->group_srl == -2)
2084 2314
 						{
2085 2315
 							$granted[$val->name] = true;
2086 2316
 							// Do not grant any permission for non-logged member
2087
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2317
+							if(!$member_info->member_srl) {
2318
+								$grant->{$val->name} = false;
2319
+							}
2088 2320
 							// Log-in member
2089 2321
 							else
2090 2322
 							{
2091 2323
 								$site_module_info = Context::get('site_module_info');
2092 2324
 								// Permission granted if no information of the currently connected site exists
2093
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2325
+								if(!$site_module_info->site_srl) {
2326
+									$grant->{$val->name} = true;
2327
+								}
2094 2328
 								// Permission is not granted if information of the currently connected site exists
2095
-								elseif(count($group_list)) $grant->{$val->name} = true;
2329
+								elseif(count($group_list)) {
2330
+									$grant->{$val->name} = true;
2331
+								}
2096 2332
 							}
2097 2333
 							// All of non-logged members
2098
-						}
2099
-						elseif($val->group_srl == -3)
2334
+						} elseif($val->group_srl == -3)
2100 2335
 						{
2101 2336
 							$granted[$val->name] = true;
2102 2337
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2103
-						}
2104
-						elseif($val->group_srl == 0)
2338
+						} elseif($val->group_srl == 0)
2105 2339
 						{
2106 2340
 							$granted[$val->name] = true;
2107 2341
 							$grant->{$val->name} = true;
2108 2342
 							// If a target is a group
2109
-						}
2110
-						else
2343
+						} else
2111 2344
 						{
2112 2345
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2113 2346
 							{
@@ -2118,30 +2351,43 @@  discard block
 block discarded – undo
2118 2351
 					}
2119 2352
 				}
2120 2353
 				// Separate processing for the virtual group access
2121
-				if(!$grant_exists['access']) $grant->access = true;
2354
+				if(!$grant_exists['access']) {
2355
+					$grant->access = true;
2356
+				}
2122 2357
 				if(count($grant_info))
2123 2358
 				{
2124 2359
 					foreach($grant_info as  $grant_name => $grant_item)
2125 2360
 					{
2126
-						if($grant_exists[$grant_name]) continue;
2361
+						if($grant_exists[$grant_name]) {
2362
+							continue;
2363
+						}
2127 2364
 						switch($grant_item->default)
2128 2365
 						{
2129 2366
 							case 'guest' :
2130 2367
 								$grant->{$grant_name} = true;
2131 2368
 								break;
2132 2369
 							case 'member' :
2133
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2134
-								else $grant->{$grant_name} = false;
2370
+								if($member_info->member_srl) {
2371
+									$grant->{$grant_name} = true;
2372
+								} else {
2373
+									$grant->{$grant_name} = false;
2374
+								}
2135 2375
 								break;
2136 2376
 							case 'site' :
2137 2377
 								$site_module_info = Context::get('site_module_info');
2138
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2139
-								else $grant->{$grant_name} = false;
2378
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2379
+									$grant->{$grant_name} = true;
2380
+								} else {
2381
+									$grant->{$grant_name} = false;
2382
+								}
2140 2383
 								break;
2141 2384
 							case 'manager' :
2142 2385
 							case 'root' :
2143
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2144
-								else $grant->{$grant_name} = false;
2386
+								if($member_info->is_admin == 'Y') {
2387
+									$grant->{$grant_name} = true;
2388
+								} else {
2389
+									$grant->{$grant_name} = false;
2390
+								}
2145 2391
 								break;
2146 2392
 						}
2147 2393
 					}
@@ -2217,16 +2463,22 @@  discard block
 block discarded – undo
2217 2463
 	function getFileBoxListHtml()
2218 2464
 	{
2219 2465
 		$logged_info = Context::get('logged_info');
2220
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2466
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2467
+			return new BaseObject(-1, 'msg_not_permitted');
2468
+		}
2221 2469
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2222 2470
 		$link_params = explode('&',$link['query']);
2223 2471
 		foreach ($link_params as $param)
2224 2472
 		{
2225 2473
 			$param = explode("=",$param);
2226
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2474
+			if($param[0] == 'selected_widget') {
2475
+				$selected_widget = $param[1];
2476
+			}
2227 2477
 		}
2228 2478
 		$oWidgetModel = getModel('widget');
2229
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2479
+		if($selected_widget) {
2480
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2481
+		}
2230 2482
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2231 2483
 
2232 2484
 		$oModuleModel = getModel('module');
@@ -2234,7 +2486,9 @@  discard block
 block discarded – undo
2234 2486
 		Context::set('filebox_list', $output->data);
2235 2487
 
2236 2488
 		$page = Context::get('page');
2237
-		if (!$page) $page = 1;
2489
+		if (!$page) {
2490
+			$page = 1;
2491
+		}
2238 2492
 		Context::set('page', $page);
2239 2493
 		Context::set('page_navigation', $output->page_navigation);
2240 2494
 
@@ -2264,25 +2518,28 @@  discard block
 block discarded – undo
2264 2518
 			$rulsetFile = str_replace('@', '', $ruleset);
2265 2519
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2266 2520
 			return FileHandler::getRealPath($xml_file);
2267
-		}
2268
-		else if (strpos($ruleset, '#') !== false)
2521
+		} else if (strpos($ruleset, '#') !== false)
2269 2522
 		{
2270 2523
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2271 2524
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2272
-			if(is_readable($xml_file))
2273
-				return FileHandler::getRealPath($xml_file);
2274
-			else{
2525
+			if(is_readable($xml_file)) {
2526
+							return FileHandler::getRealPath($xml_file);
2527
+			} else{
2275 2528
 				$ruleset = str_replace('#', '', $ruleset);
2276 2529
 			}
2277 2530
 
2278 2531
 		}
2279 2532
 		// Get a path of the requested module. Return if not exists.
2280 2533
 		$class_path = ModuleHandler::getModulePath($module);
2281
-		if(!$class_path) return;
2534
+		if(!$class_path) {
2535
+			return;
2536
+		}
2282 2537
 
2283 2538
 		// Check if module.xml exists in the path. Return if not exist
2284 2539
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2285
-		if(!file_exists($xml_file)) return;
2540
+		if(!file_exists($xml_file)) {
2541
+			return;
2542
+		}
2286 2543
 
2287 2544
 		return $xml_file;
2288 2545
 	}
@@ -2332,7 +2589,9 @@  discard block
 block discarded – undo
2332 2589
 	function getLangByLangcode()
2333 2590
 	{
2334 2591
 		$langCode = Context::get('langCode');
2335
-		if (!$langCode) return;
2592
+		if (!$langCode) {
2593
+			return;
2594
+		}
2336 2595
 
2337 2596
 		$oModuleController = getController('module');
2338 2597
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/install/install.admin.controller.php 3 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,6 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
 	/**
296 296
 	 * @brief Supported languages (was procInstallAdminSaveLangSelected)
297
+	 * @param string $selected_lang
297 298
 	 */
298 299
 	function saveLangSelected($selected_lang)
299 300
 	{
@@ -312,7 +313,7 @@  discard block
 block discarded – undo
312 313
 
313 314
 	/**
314 315
 	 * Change the way the thumbnails are show.
315
-	 * @param $config
316
+	 * @param stdClass $config
316 317
 	 * @return void
317 318
 	 */
318 319
 	function setModulesConfig($config)
@@ -337,6 +338,10 @@  discard block
 block discarded – undo
337 338
 		$oModuleController->updateModuleConfig('module',$args);
338 339
 	}
339 340
 
341
+	/**
342
+	 * @param string $icon
343
+	 * @param string $iconname
344
+	 */
340 345
 	private function saveIconTmp($icon, $iconname)
341 346
 	{
342 347
 
@@ -383,6 +388,9 @@  discard block
 block discarded – undo
383 388
 		return $relative_filename;
384 389
 	}
385 390
 
391
+	/**
392
+	 * @param string $iconname
393
+	 */
386 394
 	private function updateIcon($iconname, $deleteIcon = false) {
387 395
 
388 396
 		$site_info = Context::get('site_module_info');
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
24 24
 
25 25
 		$oInstallController = getController('install');
26 26
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		@set_time_limit(0);
37 37
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
38
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
39 39
 
40 40
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
41
+		if ($oModule) $output = $oModule->moduleUpdate();
42 42
 		else $output = new BaseObject(-1, 'invalid_request');
43 43
 
44 44
 		return $output;
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$admin_ip_list = Context::get('admin_ip_list');
55 55
 
56
-		if($admin_ip_list)
56
+		if ($admin_ip_list)
57 57
 		{
58
-			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
59
-			$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
60
-			if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
58
+			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list);
59
+			$admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list);
60
+			if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
61 61
 			{
62 62
 				$admin_ip_list = '';
63 63
 			}
64
-			$admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
65
-			$admin_ip_list = explode(',',trim($admin_ip_list, ','));
64
+			$admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
65
+			$admin_ip_list = explode(',', trim($admin_ip_list, ','));
66 66
 			$admin_ip_list = array_unique($admin_ip_list);
67
-			if(!IpFilter::validate($admin_ip_list)) {
67
+			if (!IpFilter::validate($admin_ip_list)) {
68 68
 				return new BaseObject(-1, 'msg_invalid_ip');
69 69
 			}
70 70
 		}
71 71
 		
72 72
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
73
+		if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
+		if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
75 75
 
76 76
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
77
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
78 78
 		$IDN = new idna_convert(array('idn_version' => 2008));
79 79
 		$default_url = $IDN->encode($default_url);
80 80
 
81 81
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
82
+		if (!$use_ssl) $use_ssl = 'none';
83 83
 
84 84
 		$http_port = Context::get('http_port');
85 85
 		$https_port = Context::get('https_port');
86 86
 
87 87
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
88
+		if ($use_rewrite != 'Y') $use_rewrite = 'N';
89 89
 
90 90
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
91
+		if ($use_sso != 'Y') $use_sso = 'N';
92 92
 
93 93
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
94
+		if ($use_db_session != 'Y') $use_db_session = 'N';
95 95
 
96 96
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
97
+		if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N';
98 98
 
99 99
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
100
+		if (!$use_html5) $use_html5 = 'N';
101 101
 
102 102
 		$db_info->default_url = $default_url;
103 103
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 		$db_info->use_html5 = $use_html5;
109 109
 		$db_info->admin_ip_list = $admin_ip_list;
110 110
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
111
+		if ($http_port) $db_info->http_port = (int) $http_port;
112
+		else if ($db_info->http_port) unset($db_info->http_port);
113 113
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
114
+		if ($https_port) $db_info->https_port = (int) $https_port;
115
+		else if ($db_info->https_port) unset($db_info->https_port);
116 116
 
117 117
 		unset($db_info->lang_type);
118 118
 
119 119
 		$oInstallController = getController('install');
120
-		if(!$oInstallController->makeConfigFile())
120
+		if (!$oInstallController->makeConfigFile())
121 121
 		{
122 122
 			return new BaseObject(-1, 'msg_invalid_request');
123 123
 		}
124 124
 		else
125 125
 		{
126 126
 			Context::setDBInfo($db_info);
127
-			if($default_url)
127
+			if ($default_url)
128 128
 			{
129 129
 				$site_args = new stdClass;
130 130
 				$site_args->site_srl = 0;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 	function procInstallAdminUpdateIndexModule()
140 140
 	{
141
-		if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
141
+		if (!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
142 142
 		{
143 143
 			return new BaseObject(-1, 'msg_invalid_request');
144 144
 		}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		// update homeSitemap.php cache file
158 158
 		$oMenuAdminController = getAdminController('menu');
159 159
 		$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
160
-		if(file_exists($homeMenuCacheFile))
160
+		if (file_exists($homeMenuCacheFile))
161 161
 		{
162 162
 			include($homeMenuCacheFile);
163 163
 		}
164 164
 
165
-		if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
165
+		if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
166 166
 		{
167 167
 			$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
168 168
 		}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	function procInstallAdminRemoveFTPInfo()
174 174
 	{
175 175
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
176
+		if (file_exists($ftp_config_file)) unlink($ftp_config_file);
177
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
178 178
 		$this->setMessage('success_deleted');
179 179
 	}
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 186
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 187
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
188
+		if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
189 189
 		$ftp_info->sftp = Context::get('sftp');
190 190
 
191 191
 		$ftp_root_path = Context::get('ftp_root_path');
192
-		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
192
+		if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/")
193 193
 		{
194 194
 			$ftp_info->ftp_root_path = $ftp_root_path;
195 195
 		}
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 199
 		}
200 200
 
201
-		if(ini_get('safe_mode'))
201
+		if (ini_get('safe_mode'))
202 202
 		{
203 203
 			$ftp_info->ftp_password = Context::get('ftp_password');
204 204
 		}
205 205
 
206 206
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207
-		foreach($ftp_info as $key => $val)
207
+		foreach ($ftp_info as $key => $val)
208 208
 		{
209
-			if(!$val) continue;
210
-			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
209
+			if (!$val) continue;
210
+			if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 211
 			{
212 212
 				continue;
213 213
 			}
214
-			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
214
+			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
215 215
 		}
216 216
 		$buff .= "?>";
217 217
 		$config_file = Context::getFTPConfigFile();
218 218
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
219
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
220 220
 
221 221
 		$this->setMessage('success_updated');
222 222
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function procInstallAdminConfig()
227 227
 	{
228 228
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
229
+		if ($use_mobile_view != 'Y') $use_mobile_view = 'N';
230 230
 
231 231
 		$time_zone = Context::get('time_zone');
232 232
 
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		unset($db_info->lang_type);
238 238
 		Context::setDBInfo($db_info);
239 239
 		$oInstallController = getController('install');
240
-		if(!$oInstallController->makeConfigFile())
240
+		if (!$oInstallController->makeConfigFile())
241 241
 		{
242 242
 			return new BaseObject(-1, 'msg_invalid_request');
243 243
 		}
244 244
 
245 245
 		$site_args = new stdClass();
246 246
 		$site_args->site_srl = 0;
247
-		$site_args->index_module_srl = Context::get('index_module_srl');//
248
-		$site_args->default_language = Context::get('change_lang_type');//
247
+		$site_args->index_module_srl = Context::get('index_module_srl'); //
248
+		$site_args->default_language = Context::get('change_lang_type'); //
249 249
 		$oModuleController = getController('module');
250 250
 		$oModuleController->updateSite($site_args);
251 251
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		$deleteFavicon = Context::get('is_delete_favicon');
258 258
 		$deleteMobicon = Context::get('is_delete_mobicon');
259 259
 
260
-		$this->updateIcon('favicon.ico',$deleteFavicon);
261
-		$this->updateIcon('mobicon.png',$deleteMobicon);
260
+		$this->updateIcon('favicon.ico', $deleteFavicon);
261
+		$this->updateIcon('mobicon.png', $deleteMobicon);
262 262
 
263 263
 		//모듈 설정 저장(썸네일, 풋터스크립트)
264 264
 		$config = new stdClass();
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 
277 277
 		$favicon = Context::get('favicon');
278 278
 		$mobicon = Context::get('mobicon');
279
-		if(!$favicon && !$mobicon) {
279
+		if (!$favicon && !$mobicon) {
280 280
 			Context::set('msg', Context::getLang("msg_invalid_format"));
281 281
 			return;
282 282
 		}
283
-		if($favicon) {
283
+		if ($favicon) {
284 284
 			$name = 'favicon';
285
-			$tmpFileName = $this->saveIconTmp($favicon,'favicon.ico');
285
+			$tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico');
286 286
 		} else {
287 287
 			$name = 'mobicon';
288
-			$tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png');
288
+			$tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png');
289 289
 		}
290 290
 
291 291
 		Context::set('name', $name);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 		$lang_supported = Context::loadLangSupported();
303 303
 		$buff = null;
304
-		for($i=0;$i<count($langs);$i++)
304
+		for ($i = 0; $i < count($langs); $i++)
305 305
 		{
306 306
 			$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
307 307
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 
331 331
 		$oModuleController = getController('module');
332
-		$oModuleController->insertModuleConfig('document',$documentConfig);
332
+		$oModuleController->insertModuleConfig('document', $documentConfig);
333 333
 
334 334
 		$args = new stdClass;
335 335
 		$args->htmlFooter = $config->htmlFooter;
336 336
 		$args->siteTitle = $config->siteTitle;
337
-		$oModuleController->updateModuleConfig('module',$args);
337
+		$oModuleController->updateModuleConfig('module', $args);
338 338
 	}
339 339
 
340 340
 	private function saveIconTmp($icon, $iconname)
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 
343 343
 		$site_info = Context::get('site_module_info');
344 344
 		$virtual_site = '';
345
-		if($site_info->site_srl) 
345
+		if ($site_info->site_srl) 
346 346
 		{
347
-			$virtual_site = $site_info->site_srl . '/';
347
+			$virtual_site = $site_info->site_srl.'/';
348 348
 		}
349 349
 
350 350
 		$target_file = $icon['tmp_name'];
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
 		$target_filename = _XE_PATH_.$relative_filename;
354 354
 
355 355
 		list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
356
-		if($iconname == 'favicon.ico')
356
+		if ($iconname == 'favicon.ico')
357 357
 		{
358
-			if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) {
358
+			if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) {
359 359
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 360
 				return;
361 361
 			}
362 362
 		}
363
-		else if($iconname == 'mobicon.png')
363
+		else if ($iconname == 'mobicon.png')
364 364
 		{
365
-			if(!preg_match('/^.*(png).*$/',$type)) {
365
+			if (!preg_match('/^.*(png).*$/', $type)) {
366 366
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
367 367
 				return;
368 368
 			}
369
-			if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
369
+			if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
370 370
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 371
 				return;
372 372
 			}
@@ -387,21 +387,21 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$site_info = Context::get('site_module_info');
389 389
 		$virtual_site = '';
390
-		if($site_info->site_srl) 
390
+		if ($site_info->site_srl) 
391 391
 		{
392
-			$virtual_site = $site_info->site_srl . '/';
392
+			$virtual_site = $site_info->site_srl.'/';
393 393
 		}
394 394
 
395
-		$image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site;
395
+		$image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site;
396 396
 
397
-		if($deleteIcon) {
397
+		if ($deleteIcon) {
398 398
 			FileHandler::removeFile($image_filepath.$iconname);
399 399
 			return;
400 400
 		}
401 401
 
402 402
 		$tmpicon_filepath = $image_filepath.'tmp/'.$iconname;
403 403
 		$icon_filepath = $image_filepath.$iconname;
404
-		if(file_exists($tmpicon_filepath))
404
+		if (file_exists($tmpicon_filepath))
405 405
 		{
406 406
 			FileHandler::moveFile($tmpicon_filepath, $icon_filepath);
407 407
 		}
Please login to merge, or discard this patch.
Braces   +68 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if(!$module_name) {
24
+			return new BaseObject(-1, 'invalid_request');
25
+		}
24 26
 
25 27
 		$oInstallController = getController('install');
26 28
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,11 +37,16 @@  discard block
 block discarded – undo
35 37
 	{
36 38
 		@set_time_limit(0);
37 39
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
40
+		if(!$module_name) {
41
+			return new BaseObject(-1, 'invalid_request');
42
+		}
39 43
 
40 44
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
42
-		else $output = new BaseObject(-1, 'invalid_request');
45
+		if($oModule) {
46
+			$output = $oModule->moduleUpdate();
47
+		} else {
48
+			$output = new BaseObject(-1, 'invalid_request');
49
+		}
43 50
 
44 51
 		return $output;
45 52
 	}
@@ -70,8 +77,12 @@  discard block
 block discarded – undo
70 77
 		}
71 78
 		
72 79
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
80
+		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) {
81
+			$default_url = 'http://'.$default_url;
82
+		}
83
+		if($default_url && substr($default_url, -1) !== '/') {
84
+			$default_url = $default_url.'/';
85
+		}
75 86
 
76 87
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77 88
 		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
@@ -79,25 +90,37 @@  discard block
 block discarded – undo
79 90
 		$default_url = $IDN->encode($default_url);
80 91
 
81 92
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
93
+		if(!$use_ssl) {
94
+			$use_ssl = 'none';
95
+		}
83 96
 
84 97
 		$http_port = Context::get('http_port');
85 98
 		$https_port = Context::get('https_port');
86 99
 
87 100
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
101
+		if($use_rewrite!='Y') {
102
+			$use_rewrite = 'N';
103
+		}
89 104
 
90 105
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
106
+		if($use_sso !='Y') {
107
+			$use_sso = 'N';
108
+		}
92 109
 
93 110
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
111
+		if($use_db_session!='Y') {
112
+			$use_db_session = 'N';
113
+		}
95 114
 
96 115
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
116
+		if($qmail_compatibility!='Y') {
117
+			$qmail_compatibility = 'N';
118
+		}
98 119
 
99 120
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
121
+		if(!$use_html5) {
122
+			$use_html5 = 'N';
123
+		}
101 124
 
102 125
 		$db_info->default_url = $default_url;
103 126
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,11 +131,17 @@  discard block
 block discarded – undo
108 131
 		$db_info->use_html5 = $use_html5;
109 132
 		$db_info->admin_ip_list = $admin_ip_list;
110 133
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
134
+		if($http_port) {
135
+			$db_info->http_port = (int) $http_port;
136
+		} else if($db_info->http_port) {
137
+			unset($db_info->http_port);
138
+		}
113 139
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
140
+		if($https_port) {
141
+			$db_info->https_port = (int) $https_port;
142
+		} else if($db_info->https_port) {
143
+			unset($db_info->https_port);
144
+		}
116 145
 
117 146
 		unset($db_info->lang_type);
118 147
 
@@ -120,8 +149,7 @@  discard block
 block discarded – undo
120 149
 		if(!$oInstallController->makeConfigFile())
121 150
 		{
122 151
 			return new BaseObject(-1, 'msg_invalid_request');
123
-		}
124
-		else
152
+		} else
125 153
 		{
126 154
 			Context::setDBInfo($db_info);
127 155
 			if($default_url)
@@ -173,8 +201,12 @@  discard block
 block discarded – undo
173 201
 	function procInstallAdminRemoveFTPInfo()
174 202
 	{
175 203
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
204
+		if(file_exists($ftp_config_file)) {
205
+			unlink($ftp_config_file);
206
+		}
207
+		if($_SESSION['ftp_password']) {
208
+			unset($_SESSION['ftp_password']);
209
+		}
178 210
 		$this->setMessage('success_deleted');
179 211
 	}
180 212
 
@@ -185,15 +217,16 @@  discard block
 block discarded – undo
185 217
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 218
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 219
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
220
+		if(!$ftp_info->ftp_pasv) {
221
+			$ftp_info->ftp_pasv = "N";
222
+		}
189 223
 		$ftp_info->sftp = Context::get('sftp');
190 224
 
191 225
 		$ftp_root_path = Context::get('ftp_root_path');
192 226
 		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
193 227
 		{
194 228
 			$ftp_info->ftp_root_path = $ftp_root_path;
195
-		}
196
-		else
229
+		} else
197 230
 		{
198 231
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 232
 		}
@@ -206,7 +239,9 @@  discard block
 block discarded – undo
206 239
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207 240
 		foreach($ftp_info as $key => $val)
208 241
 		{
209
-			if(!$val) continue;
242
+			if(!$val) {
243
+				continue;
244
+			}
210 245
 			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 246
 			{
212 247
 				continue;
@@ -216,7 +251,9 @@  discard block
 block discarded – undo
216 251
 		$buff .= "?>";
217 252
 		$config_file = Context::getFTPConfigFile();
218 253
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
254
+		if($_SESSION['ftp_password']) {
255
+			unset($_SESSION['ftp_password']);
256
+		}
220 257
 
221 258
 		$this->setMessage('success_updated');
222 259
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +263,9 @@  discard block
 block discarded – undo
226 263
 	function procInstallAdminConfig()
227 264
 	{
228 265
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
266
+		if($use_mobile_view!='Y') {
267
+			$use_mobile_view = 'N';
268
+		}
230 269
 
231 270
 		$time_zone = Context::get('time_zone');
232 271
 
@@ -322,8 +361,7 @@  discard block
 block discarded – undo
322 361
 		if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio')
323 362
 		{
324 363
 			$documentConfig->thumbnail_type = 'crop';
325
-		}
326
-		else
364
+		} else
327 365
 		{
328 366
 			$documentConfig->thumbnail_type = 'ratio';
329 367
 		}
@@ -359,8 +397,7 @@  discard block
 block discarded – undo
359 397
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 398
 				return;
361 399
 			}
362
-		}
363
-		else if($iconname == 'mobicon.png')
400
+		} else if($iconname == 'mobicon.png')
364 401
 		{
365 402
 			if(!preg_match('/^.*(png).*$/',$type)) {
366 403
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
@@ -370,8 +407,7 @@  discard block
 block discarded – undo
370 407
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 408
 				return;
372 409
 			}
373
-		}
374
-		else
410
+		} else
375 411
 		{
376 412
 			Context::set('msg', Context::getLang('msg_invalid_format'));
377 413
 			return;
Please login to merge, or discard this patch.
widgets/mcontent/mcontent.class.php 2 patches
Braces   +137 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,20 +18,32 @@  discard block
 block discarded – undo
18 18
 	function proc($args)
19 19
 	{
20 20
 		// Targets to sort
21
-		if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order';
21
+		if(!in_array($args->order_target, array('list_order','update_order'))) {
22
+			$args->order_target = 'list_order';
23
+		}
22 24
 		// Sort order
23
-		if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc';
25
+		if(!in_array($args->order_type, array('asc','desc'))) {
26
+			$args->order_type = 'asc';
27
+		}
24 28
 		// The number of displayed lists
25 29
 		$args->list_count = (int)$args->list_count;
26
-		if(!$args->list_count) $args->list_count = 5;
30
+		if(!$args->list_count) {
31
+			$args->list_count = 5;
32
+		}
27 33
 		// Cut the length of the title
28
-		if(!$args->subject_cut_size) $args->subject_cut_size = 0;
34
+		if(!$args->subject_cut_size) {
35
+			$args->subject_cut_size = 0;
36
+		}
29 37
 		// Cut the length of contents
30
-		if(!$args->content_cut_size) $args->content_cut_size = 100;
38
+		if(!$args->content_cut_size) {
39
+			$args->content_cut_size = 100;
40
+		}
31 41
 		// Viewing options
32 42
 		$args->option_view_arr = explode(',',$args->option_view);
33 43
 		// markup options
34
-		if(!$args->markup_type) $args->markup_type = 'list';
44
+		if(!$args->markup_type) {
45
+			$args->markup_type = 'list';
46
+		}
35 47
 		// Set variables for internal use
36 48
 		$oModuleModel = getModel('module');
37 49
 		$module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array();
@@ -43,11 +55,12 @@  discard block
 block discarded – undo
43 55
 			$rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4));
44 56
 			for($i=0,$c=count($rss_urls);$i<$c;$i++)
45 57
 			{
46
-				if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
58
+				if($rss_urls[$i]) {
59
+					$args->rss_urls[] = $rss_urls[$i];
60
+				}
47 61
 			}
48 62
 			// Get module information after listing module_srls if the module is not RSS
49
-		}
50
-		else
63
+		} else
51 64
 		{
52 65
 			$obj = new stdClass();
53 66
 			// Apply to all modules in the site if a target module is not specified
@@ -68,8 +81,7 @@  discard block
 block discarded – undo
68 81
 
69 82
 				$args->modules_info = $oModuleModel->getMidList($obj);
70 83
 				// Apply to the module only if a target module is specified
71
-			}
72
-			else
84
+			} else
73 85
 			{
74 86
 				$obj->module_srls = $args->module_srls;
75 87
 				$output = executeQueryArray('widgets.content.getMids', $obj);
@@ -85,13 +97,17 @@  discard block
 block discarded – undo
85 97
 					for($i=0,$c=count($idx);$i<$c;$i++)
86 98
 					{
87 99
 						$srl = $idx[$i];
88
-						if(!$args->module_srls_info[$srl]) continue;
100
+						if(!$args->module_srls_info[$srl]) {
101
+							continue;
102
+						}
89 103
 						$args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid;
90 104
 					}
91 105
 				}
92 106
 			}
93 107
 			// Exit if no module is found
94
-			if(!count($args->modules_info)) return Context::get('msg_not_founded');
108
+			if(!count($args->modules_info)) {
109
+				return Context::get('msg_not_founded');
110
+			}
95 111
 			$args->module_srl = implode(',',$module_srls);
96 112
 		}
97 113
 
@@ -120,8 +136,7 @@  discard block
 block discarded – undo
120 136
 					break;
121 137
 			}
122 138
 			// If not a tab type
123
-		}
124
-		else
139
+		} else
125 140
 		{
126 141
 			$content_items = array();
127 142
 
@@ -180,7 +195,9 @@  discard block
 block discarded – undo
180 195
 
181 196
 		$content_items = array();
182 197
 
183
-		if(!count($output)) return;
198
+		if(!count($output)) {
199
+			return;
200
+		}
184 201
 
185 202
 		foreach($output as $key => $oComment)
186 203
 		{
@@ -227,7 +244,9 @@  discard block
 block discarded – undo
227 244
 		$obj->list_count = $args->list_count;
228 245
 		$obj->statusList = array('PUBLIC');
229 246
 		$output = executeQueryArray('widgets.content.getNewestDocuments', $obj);
230
-		if(!$output->toBool() || !$output->data) return;
247
+		if(!$output->toBool() || !$output->data) {
248
+			return;
249
+		}
231 250
 		// If the result exists, make each document as an object
232 251
 		$content_items = array();
233 252
 		$first_thumbnail_idx = -1;
@@ -258,7 +277,9 @@  discard block
 block discarded – undo
258 277
 				$content_item->setLink( getSiteUrl($domain,'', 'mid',$args->mid_lists[$module_srl], 'document_srl',$document_srl) );
259 278
 				$content_item->setThumbnail($thumbnail);
260 279
 				$content_item->add('mid', $args->mid_lists[$module_srl]);
261
-				if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
280
+				if($first_thumbnail_idx==-1 && $thumbnail) {
281
+					$first_thumbnail_idx = $i;
282
+				}
262 283
 				$content_items[] = $content_item;
263 284
 			}
264 285
 
@@ -288,15 +309,21 @@  discard block
 block discarded – undo
288 309
 		$obj->list_count = $args->list_count;
289 310
 		$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
290 311
 		$files_count = count($files_output->data);
291
-		if(!$files_count) return;
312
+		if(!$files_count) {
313
+			return;
314
+		}
292 315
 
293 316
 		$content_items = array();
294 317
 
295
-		for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
318
+		for($i=0;$i<$files_count;$i++) {
319
+			$document_srl_list[] = $files_output->data[$i]->document_srl;
320
+		}
296 321
 
297 322
 		$tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
298 323
 
299
-		if(!count($tmp_document_list)) return;
324
+		if(!count($tmp_document_list)) {
325
+			return;
326
+		}
300 327
 
301 328
 		foreach($tmp_document_list as $oDocument)
302 329
 		{
@@ -348,22 +375,33 @@  discard block
 block discarded – undo
348 375
 				{
349 376
 					$date = $v->get('regdate');
350 377
 					$i=0;
351
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
378
+					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) {
379
+						$i++;
380
+					}
352 381
 					$items[sprintf('%s%02d',$date,$i)] = $v;
353 382
 				}
354 383
 			}
355
-			if($args->order_type =='asc') ksort($items);
356
-			else krsort($items);
384
+			if($args->order_type =='asc') {
385
+				ksort($items);
386
+			} else {
387
+				krsort($items);
388
+			}
357 389
 			$content_items = array_slice(array_values($items),0,$args->list_count);
358 390
 		} return $content_items;
359 391
 	}
360 392
 
361 393
 	function _getRssBody($value)
362 394
 	{
363
-		if(!$value || is_string($value)) return $value;
364
-		if(is_object($value)) $value = get_object_vars($value);
395
+		if(!$value || is_string($value)) {
396
+			return $value;
397
+		}
398
+		if(is_object($value)) {
399
+			$value = get_object_vars($value);
400
+		}
365 401
 		$body = null;
366
-		if(!count($value)) return;
402
+		if(!count($value)) {
403
+			return;
404
+		}
367 405
 		foreach($value as $key => $val)
368 406
 		{
369 407
 			if($key == 'body')
@@ -371,8 +409,12 @@  discard block
 block discarded – undo
371 409
 				$body = $val;
372 410
 				continue;
373 411
 			}
374
-			if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val);
375
-			if($body !== null) return $body;
412
+			if(is_object($val)||is_array($val)) {
413
+				$body = $this->_getRssBody($val);
414
+			}
415
+			if($body !== null) {
416
+				return $body;
417
+			}
376 418
 		}
377 419
 		return $body;
378 420
 	}
@@ -416,7 +458,9 @@  discard block
 block discarded – undo
416 458
 		$buff = $this->requestFeedContents($args->rss_url);
417 459
 
418 460
 		$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
419
-		if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
461
+		if($encoding && stripos($matches[1], "UTF-8") === FALSE) {
462
+			$buff = Context::convertEncodingStr($buff);
463
+		}
420 464
 
421 465
 		$buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
422 466
 
@@ -430,20 +474,28 @@  discard block
 block discarded – undo
430 474
 
431 475
 			$items = $xml_doc->rss->channel->item;
432 476
 
433
-			if(!$items) return;
434
-			if($items && !is_array($items)) $items = array($items);
477
+			if(!$items) {
478
+				return;
479
+			}
480
+			if($items && !is_array($items)) {
481
+				$items = array($items);
482
+			}
435 483
 
436 484
 			$content_items = array();
437 485
 
438 486
 			foreach ($items as $key => $value)
439 487
 			{
440
-				if($key >= $args->list_count) break;
488
+				if($key >= $args->list_count) {
489
+					break;
490
+				}
441 491
 				unset($item);
442 492
 				$item = new stdClass();
443 493
 
444 494
 				foreach($value as $key2 => $value2)
445 495
 				{
446
-					if(is_array($value2)) $value2 = array_shift($value2);
496
+					if(is_array($value2)) {
497
+						$value2 = array_shift($value2);
498
+					}
447 499
 					$item->{$key2} = $this->_getRssBody($value2);
448 500
 				}
449 501
 
@@ -460,8 +512,7 @@  discard block
 block discarded – undo
460 512
 
461 513
 				$content_items[] = $content_item;
462 514
 			}
463
-		}
464
-		else if($xml_doc->{'rdf:rdf'})
515
+		} else if($xml_doc->{'rdf:rdf'})
465 516
 		{
466 517
 			// rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol
467 518
 			$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
@@ -469,20 +520,28 @@  discard block
 block discarded – undo
469 520
 
470 521
 			$items = $xml_doc->{'rdf:rdf'}->item;
471 522
 
472
-			if(!$items) return;
473
-			if($items && !is_array($items)) $items = array($items);
523
+			if(!$items) {
524
+				return;
525
+			}
526
+			if($items && !is_array($items)) {
527
+				$items = array($items);
528
+			}
474 529
 
475 530
 			$content_items = array();
476 531
 
477 532
 			foreach ($items as $key => $value)
478 533
 			{
479
-				if($key >= $args->list_count) break;
534
+				if($key >= $args->list_count) {
535
+					break;
536
+				}
480 537
 				unset($item);
481 538
 				$item = new stdClass();
482 539
 
483 540
 				foreach($value as $key2 => $value2)
484 541
 				{
485
-					if(is_array($value2)) $value2 = array_shift($value2);
542
+					if(is_array($value2)) {
543
+						$value2 = array_shift($value2);
544
+					}
486 545
 					$item->{$key2} = $this->_getRssBody($value2);
487 546
 				}
488 547
 
@@ -499,8 +558,7 @@  discard block
 block discarded – undo
499 558
 
500 559
 				$content_items[] = $content_item;
501 560
 			}
502
-		}
503
-		else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
561
+		} else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
504 562
 			{
505 563
 			// Atom 1.0 spec supported by misol
506 564
 			$rss->title = $xml_doc->feed->title->body;
@@ -515,24 +573,33 @@  discard block
 block discarded – undo
515 573
 						break;
516 574
 					}
517 575
 				}
576
+			} else if($links->attrs->rel == 'alternate') {
577
+				$rss->link = $links->attrs->href;
518 578
 			}
519
-			else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
520 579
 	
521 580
 			$items = $xml_doc->feed->entry;
522 581
 	
523
-			if(!$items) return;
524
-			if($items && !is_array($items)) $items = array($items);
582
+			if(!$items) {
583
+				return;
584
+			}
585
+			if($items && !is_array($items)) {
586
+				$items = array($items);
587
+			}
525 588
 	
526 589
 			$content_items = array();
527 590
 	
528 591
 			foreach ($items as $key => $value)
529 592
 			{
530
-				if($key >= $args->list_count) break;
593
+				if($key >= $args->list_count) {
594
+					break;
595
+				}
531 596
 				unset($item);
532 597
 	
533 598
 				foreach($value as $key2 => $value2)
534 599
 				{
535
-					if(is_array($value2)) $value2 = array_shift($value2);
600
+					if(is_array($value2)) {
601
+						$value2 = array_shift($value2);
602
+					}
536 603
 					$item->{$key2} = $this->_getRssBody($value2);
537 604
 				}
538 605
 	
@@ -548,13 +615,16 @@  discard block
 block discarded – undo
548 615
 							break;
549 616
 						}
550 617
 					}
618
+				} else if($links->attrs->rel == 'alternate') {
619
+					$item->link = $links->attrs->href;
551 620
 				}
552
-				else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
553 621
 	
554 622
 				$content_item->setContentsLink($rss->link);
555 623
 				if($item->title)
556 624
 				{
557
-					if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
625
+					if(stripos($value->title->attrs->type, "html") === FALSE) {
626
+						$item->title = $value->title->body;
627
+					}
558 628
 				}
559 629
 				$content_item->setTitle($item->title);
560 630
 				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
@@ -598,7 +668,9 @@  discard block
 block discarded – undo
598 668
 		$oTrackbackModel = getModel('trackback');
599 669
 		$output = $oTrackbackModel->getNewestTrackbackList($obj);
600 670
 		// If an error occurs, just ignore it.
601
-		if(!$output->toBool() || !$output->data) return;
671
+		if(!$output->toBool() || !$output->data) {
672
+			return;
673
+		}
602 674
 		// If the result exists, make each document as an object
603 675
 		$content_items = array();
604 676
 		foreach($output->data as $key => $item)
@@ -695,7 +767,9 @@  discard block
 block discarded – undo
695 767
 		static $default_domain = null;
696 768
 		if(!$domain)
697 769
 		{
698
-			if(is_null($default_domain)) $default_domain = Context::getDefaultUrl();
770
+			if(is_null($default_domain)) {
771
+				$default_domain = Context::getDefaultUrl();
772
+			}
699 773
 			$domain = $default_domain;
700 774
 		}
701 775
 		$this->domain = $domain;
@@ -764,13 +838,21 @@  discard block
 block discarded – undo
764 838
 	{
765 839
 		$title = strip_tags($this->get('title'));
766 840
 
767
-		if($cut_size) $title = cut_str($title, $cut_size, $tail);
841
+		if($cut_size) {
842
+			$title = cut_str($title, $cut_size, $tail);
843
+		}
768 844
 
769 845
 		$attrs = array();
770
-		if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
846
+		if($this->get('title_bold') == 'Y') {
847
+			$attrs[] = 'font-weight:bold';
848
+		}
849
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
850
+			$attrs[] = 'color:#'.$this->get('title_color');
851
+		}
772 852
 
773
-		if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
853
+		if(count($attrs)) {
854
+			$title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
855
+		}
774 856
 
775 857
 		return $title;
776 858
 	}
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -18,32 +18,32 @@  discard block
 block discarded – undo
18 18
 	function proc($args)
19 19
 	{
20 20
 		// Targets to sort
21
-		if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order';
21
+		if (!in_array($args->order_target, array('list_order', 'update_order'))) $args->order_target = 'list_order';
22 22
 		// Sort order
23
-		if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc';
23
+		if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
24 24
 		// The number of displayed lists
25
-		$args->list_count = (int)$args->list_count;
26
-		if(!$args->list_count) $args->list_count = 5;
25
+		$args->list_count = (int) $args->list_count;
26
+		if (!$args->list_count) $args->list_count = 5;
27 27
 		// Cut the length of the title
28
-		if(!$args->subject_cut_size) $args->subject_cut_size = 0;
28
+		if (!$args->subject_cut_size) $args->subject_cut_size = 0;
29 29
 		// Cut the length of contents
30
-		if(!$args->content_cut_size) $args->content_cut_size = 100;
30
+		if (!$args->content_cut_size) $args->content_cut_size = 100;
31 31
 		// Viewing options
32
-		$args->option_view_arr = explode(',',$args->option_view);
32
+		$args->option_view_arr = explode(',', $args->option_view);
33 33
 		// markup options
34
-		if(!$args->markup_type) $args->markup_type = 'list';
34
+		if (!$args->markup_type) $args->markup_type = 'list';
35 35
 		// Set variables for internal use
36 36
 		$oModuleModel = getModel('module');
37 37
 		$module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array();
38 38
 		$site_module_info = Context::get('site_module_info');
39 39
 		// List URLs if a type is RSS
40
-		if($args->content_type == 'rss')
40
+		if ($args->content_type == 'rss')
41 41
 		{
42 42
 			$args->rss_urls = array();
43
-			$rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4));
44
-			for($i=0,$c=count($rss_urls);$i<$c;$i++)
43
+			$rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4));
44
+			for ($i = 0, $c = count($rss_urls); $i < $c; $i++)
45 45
 			{
46
-				if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
46
+				if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
47 47
 			}
48 48
 			// Get module information after listing module_srls if the module is not RSS
49 49
 		}
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 		{
52 52
 			$obj = new stdClass();
53 53
 			// Apply to all modules in the site if a target module is not specified
54
-			if(!$args->module_srls)
54
+			if (!$args->module_srls)
55 55
 			{
56
-				$obj->site_srl = (int)$site_module_info->site_srl;
56
+				$obj->site_srl = (int) $site_module_info->site_srl;
57 57
 				$output = executeQueryArray('widgets.content.getMids', $obj);
58
-				if($output->data)
58
+				if ($output->data)
59 59
 				{
60
-					foreach($output->data as $key => $val)
60
+					foreach ($output->data as $key => $val)
61 61
 					{
62 62
 						$args->modules_info[$val->mid] = $val;
63 63
 						$args->module_srls_info[$val->module_srl] = $val;
@@ -73,35 +73,35 @@  discard block
 block discarded – undo
73 73
 			{
74 74
 				$obj->module_srls = $args->module_srls;
75 75
 				$output = executeQueryArray('widgets.content.getMids', $obj);
76
-				if($output->data)
76
+				if ($output->data)
77 77
 				{
78
-					foreach($output->data as $key => $val)
78
+					foreach ($output->data as $key => $val)
79 79
 					{
80 80
 						$args->modules_info[$val->mid] = $val;
81 81
 						$args->module_srls_info[$val->module_srl] = $val;
82 82
 						$module_srls[] = $val->module_srl;
83 83
 					}
84
-					$idx = explode(',',$args->module_srls);
85
-					for($i=0,$c=count($idx);$i<$c;$i++)
84
+					$idx = explode(',', $args->module_srls);
85
+					for ($i = 0, $c = count($idx); $i < $c; $i++)
86 86
 					{
87 87
 						$srl = $idx[$i];
88
-						if(!$args->module_srls_info[$srl]) continue;
88
+						if (!$args->module_srls_info[$srl]) continue;
89 89
 						$args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid;
90 90
 					}
91 91
 				}
92 92
 			}
93 93
 			// Exit if no module is found
94
-			if(!count($args->modules_info)) return Context::get('msg_not_founded');
95
-			$args->module_srl = implode(',',$module_srls);
94
+			if (!count($args->modules_info)) return Context::get('msg_not_founded');
95
+			$args->module_srl = implode(',', $module_srls);
96 96
 		}
97 97
 
98 98
 		/**
99 99
 		 * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist
100 100
 		 */
101 101
 		// tab mode
102
-		if($args->tab_type == 'none' || $args->tab_type == '')
102
+		if ($args->tab_type == 'none' || $args->tab_type == '')
103 103
 		{
104
-			switch($args->content_type)
104
+			switch ($args->content_type)
105 105
 			{
106 106
 				case 'comment':
107 107
 					$content_items = $this->_getCommentItems($args);
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 		{
126 126
 			$content_items = array();
127 127
 
128
-			switch($args->content_type)
128
+			switch ($args->content_type)
129 129
 			{
130 130
 				case 'comment':
131
-					foreach($args->mid_lists as $module_srl => $mid)
131
+					foreach ($args->mid_lists as $module_srl => $mid)
132 132
 					{
133 133
 						$args->module_srl = $module_srl;
134 134
 						$content_items[$module_srl] = $this->_getCommentItems($args);
135 135
 					}
136 136
 					break;
137 137
 				case 'image':
138
-					foreach($args->mid_lists as $module_srl => $mid)
138
+					foreach ($args->mid_lists as $module_srl => $mid)
139 139
 					{
140 140
 						$args->module_srl = $module_srl;
141 141
 						$content_items[$module_srl] = $this->_getImageItems($args);
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 					$content_items = $this->getRssItems($args);
146 146
 					break;
147 147
 				case 'trackback':
148
-					foreach($args->mid_lists as $module_srl => $mid){
148
+					foreach ($args->mid_lists as $module_srl => $mid) {
149 149
 						$args->module_srl = $module_srl;
150 150
 						$content_items[$module_srl] = $this->_getTrackbackItems($args);
151 151
 					}
152 152
 					break;
153 153
 				default:
154
-					foreach($args->mid_lists as $module_srl => $mid)
154
+					foreach ($args->mid_lists as $module_srl => $mid)
155 155
 					{
156 156
 						$args->module_srl = $module_srl;
157 157
 						$content_items[$module_srl] = $this->_getDocumentItems($args);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			}
161 161
 		}
162 162
 
163
-		$output = $this->_compile($args,$content_items);
163
+		$output = $this->_compile($args, $content_items);
164 164
 		return $output;
165 165
 	}
166 166
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$content_items = array();
182 182
 
183
-		if(!count($output)) return;
183
+		if (!count($output)) return;
184 184
 
185
-		foreach($output as $key => $oComment)
185
+		foreach ($output as $key => $oComment)
186 186
 		{
187 187
 			$attribute = $oComment->getObjectVars();
188 188
 			$title = $oComment->getSummary($args->content_cut_size);
189 189
 			$thumbnail = $oComment->getThumbnail();
190
-			$url = sprintf("%s#comment_%s",getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl'));
190
+			$url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl'));
191 191
 
192 192
 			$attribute->mid = $args->mid_lists[$attribute->module_srl];
193 193
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 		// Get categories
213 213
 		$obj = new stdClass();
214 214
 		$obj->module_srl = $args->module_srl;
215
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
216
-		if($output->toBool() && $output->data)
215
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
216
+		if ($output->toBool() && $output->data)
217 217
 		{
218
-			foreach($output->data as $key => $val)
218
+			foreach ($output->data as $key => $val)
219 219
 			{
220 220
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
221 221
 			}
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 		// Get a list of documents
224 224
 		$obj->module_srl = $args->module_srl;
225 225
 		$obj->sort_index = $args->order_target;
226
-		$obj->order_type = $args->order_type=="desc"?"asc":"desc";
226
+		$obj->order_type = $args->order_type == "desc" ? "asc" : "desc";
227 227
 		$obj->list_count = $args->list_count;
228 228
 		$obj->statusList = array('PUBLIC');
229 229
 		$output = executeQueryArray('widgets.content.getNewestDocuments', $obj);
230
-		if(!$output->toBool() || !$output->data) return;
230
+		if (!$output->toBool() || !$output->data) return;
231 231
 		// If the result exists, make each document as an object
232 232
 		$content_items = array();
233 233
 		$first_thumbnail_idx = -1;
234
-		if(count($output->data))
234
+		if (count($output->data))
235 235
 		{
236
-			foreach($output->data as $key => $attribute)
236
+			foreach ($output->data as $key => $attribute)
237 237
 			{
238 238
 				$oDocument = new documentItem();
239 239
 				$oDocument->setAttribute($attribute, false);
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
 			}
243 243
 			$oDocumentModel->setToAllDocumentExtraVars();
244 244
 
245
-			for($i=0,$c=count($document_srls);$i<$c;$i++)
245
+			for ($i = 0, $c = count($document_srls); $i < $c; $i++)
246 246
 			{
247 247
 				$oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]];
248 248
 				$document_srl = $oDocument->document_srl;
249 249
 				$module_srl = $oDocument->get('module_srl');
250 250
 				$category_srl = $oDocument->get('category_srl');
251 251
 				$thumbnail = $oDocument->getThumbnail();
252
-				$content_item = new mcontentItem( $args->module_srls_info[$module_srl]->browser_title );
252
+				$content_item = new mcontentItem($args->module_srls_info[$module_srl]->browser_title);
253 253
 				$content_item->adds($oDocument->getObjectVars());
254 254
 				$content_item->setTitle($oDocument->getTitleText());
255
-				$content_item->setCategory( $category_lists[$module_srl][$category_srl]->title );
256
-				$content_item->setDomain( $args->module_srls_info[$module_srl]->domain );
255
+				$content_item->setCategory($category_lists[$module_srl][$category_srl]->title);
256
+				$content_item->setDomain($args->module_srls_info[$module_srl]->domain);
257 257
 				$content_item->setContent($oDocument->getSummary($args->content_cut_size));
258
-				$content_item->setLink( getSiteUrl($domain,'', 'mid',$args->mid_lists[$module_srl], 'document_srl',$document_srl) );
258
+				$content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl));
259 259
 				$content_item->setThumbnail($thumbnail);
260 260
 				$content_item->add('mid', $args->mid_lists[$module_srl]);
261
-				if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
261
+				if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i;
262 262
 				$content_items[] = $content_item;
263 263
 			}
264 264
 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 		$obj->direct_download = 'Y';
277 277
 		$obj->isvalid = 'Y';
278 278
 		// Get categories
279
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
280
-		if($output->toBool() && $output->data)
279
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
280
+		if ($output->toBool() && $output->data)
281 281
 		{
282
-			foreach($output->data as $key => $val)
282
+			foreach ($output->data as $key => $val)
283 283
 			{
284 284
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
285 285
 			}
@@ -288,24 +288,24 @@  discard block
 block discarded – undo
288 288
 		$obj->list_count = $args->list_count;
289 289
 		$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
290 290
 		$files_count = count($files_output->data);
291
-		if(!$files_count) return;
291
+		if (!$files_count) return;
292 292
 
293 293
 		$content_items = array();
294 294
 
295
-		for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
295
+		for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
296 296
 
297 297
 		$tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
298 298
 
299
-		if(!count($tmp_document_list)) return;
299
+		if (!count($tmp_document_list)) return;
300 300
 
301
-		foreach($tmp_document_list as $oDocument)
301
+		foreach ($tmp_document_list as $oDocument)
302 302
 		{
303 303
 			$attribute = $oDocument->getObjectVars();
304 304
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
305 305
 			$domain = $args->module_srls_info[$attribute->module_srl]->domain;
306 306
 			$category = $category_lists[$attribute->module_srl]->text;
307 307
 			$content = $oDocument->getSummary($args->content_cut_size);
308
-			$url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount());
308
+			$url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount());
309 309
 			$thumbnail = $oDocument->getThumbnail();
310 310
 			$content_item = new mcontentItem($browser_title);
311 311
 			$content_item->adds($attribute);
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 		$content_items = array();
328 328
 		$args->mid_lists = array();
329 329
 
330
-		foreach($args->rss_urls as $key => $rss)
330
+		foreach ($args->rss_urls as $key => $rss)
331 331
 		{
332 332
 			$args->rss_url = $rss;
333 333
 			$content_item = $this->_getRssItems($args);
334
-			if(count($content_item) > 0)
334
+			if (count($content_item) > 0)
335 335
 			{
336 336
 				$browser_title = $content_item[0]->getBrowserTitle();
337 337
 				$args->mid_lists[] = $browser_title;
@@ -339,40 +339,40 @@  discard block
 block discarded – undo
339 339
 			}
340 340
 		}
341 341
 
342
-		if($args->tab_type == 'none' || $args->tab_type == '')
342
+		if ($args->tab_type == 'none' || $args->tab_type == '')
343 343
 		{
344 344
 			$items = array();
345
-			foreach($content_items as $key => $val)
345
+			foreach ($content_items as $key => $val)
346 346
 			{
347
-				foreach($val as $k => $v)
347
+				foreach ($val as $k => $v)
348 348
 				{
349 349
 					$date = $v->get('regdate');
350
-					$i=0;
351
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
352
-					$items[sprintf('%s%02d',$date,$i)] = $v;
350
+					$i = 0;
351
+					while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++;
352
+					$items[sprintf('%s%02d', $date, $i)] = $v;
353 353
 				}
354 354
 			}
355
-			if($args->order_type =='asc') ksort($items);
355
+			if ($args->order_type == 'asc') ksort($items);
356 356
 			else krsort($items);
357
-			$content_items = array_slice(array_values($items),0,$args->list_count);
357
+			$content_items = array_slice(array_values($items), 0, $args->list_count);
358 358
 		} return $content_items;
359 359
 	}
360 360
 
361 361
 	function _getRssBody($value)
362 362
 	{
363
-		if(!$value || is_string($value)) return $value;
364
-		if(is_object($value)) $value = get_object_vars($value);
363
+		if (!$value || is_string($value)) return $value;
364
+		if (is_object($value)) $value = get_object_vars($value);
365 365
 		$body = null;
366
-		if(!count($value)) return;
367
-		foreach($value as $key => $val)
366
+		if (!count($value)) return;
367
+		foreach ($value as $key => $val)
368 368
 		{
369
-			if($key == 'body')
369
+			if ($key == 'body')
370 370
 			{
371 371
 				$body = $val;
372 372
 				continue;
373 373
 			}
374
-			if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val);
375
-			if($body !== null) return $body;
374
+			if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val);
375
+			if ($body !== null) return $body;
376 376
 		}
377 377
 		return $body;
378 378
 	}
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
 		// Replace tags such as </p> , </div> , </li> and others to a whitespace
384 384
 		$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
385 385
 		// Remove Tag
386
-		$content = preg_replace('!<([^>]*?)>!is','', $content);
386
+		$content = preg_replace('!<([^>]*?)>!is', '', $content);
387 387
 		// Replace tags to < , > , " 
388
-		$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
388
+		$content = str_replace(array('&lt;', '&gt;', '&quot;', '&nbsp;'), array('<', '>', '"', ' '), $content);
389 389
 		// Delete a series of whitespaces
390 390
 		$content = preg_replace('/ ( +)/is', ' ', $content);
391 391
 		// Truncate string
392 392
 		$content = trim(cut_str($content, $str_size, $tail));
393 393
 		// Replace back < , > , "  to theoriginal tags
394
-		$content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
394
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
395 395
 		// Fixed a newline bug on a set of consecutive English letters 
396
-		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
396
+		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content);
397 397
 		return $content; 
398 398
 	}
399 399
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	function requestFeedContents($rss_url)
406 406
 	{
407
-		$rss_url = str_replace('&amp;','&',Context::convertEncodingStr($rss_url));
407
+		$rss_url = str_replace('&amp;', '&', Context::convertEncodingStr($rss_url));
408 408
 		return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml');
409 409
 	}
410 410
 
@@ -416,52 +416,52 @@  discard block
 block discarded – undo
416 416
 		$buff = $this->requestFeedContents($args->rss_url);
417 417
 
418 418
 		$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
419
-		if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
419
+		if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
420 420
 
421 421
 		$buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
422 422
 
423 423
 		$oXmlParser = new XmlParser();
424 424
 		$xml_doc = $oXmlParser->parse($buff);
425 425
 		$rss = new stdClass();
426
-		if($xml_doc->rss)
426
+		if ($xml_doc->rss)
427 427
 		{
428 428
 			$rss->title = $xml_doc->rss->channel->title->body;
429 429
 			$rss->link = $xml_doc->rss->channel->link->body;
430 430
 
431 431
 			$items = $xml_doc->rss->channel->item;
432 432
 
433
-			if(!$items) return;
434
-			if($items && !is_array($items)) $items = array($items);
433
+			if (!$items) return;
434
+			if ($items && !is_array($items)) $items = array($items);
435 435
 
436 436
 			$content_items = array();
437 437
 
438 438
 			foreach ($items as $key => $value)
439 439
 			{
440
-				if($key >= $args->list_count) break;
440
+				if ($key >= $args->list_count) break;
441 441
 				unset($item);
442 442
 				$item = new stdClass();
443 443
 
444
-				foreach($value as $key2 => $value2)
444
+				foreach ($value as $key2 => $value2)
445 445
 				{
446
-					if(is_array($value2)) $value2 = array_shift($value2);
446
+					if (is_array($value2)) $value2 = array_shift($value2);
447 447
 					$item->{$key2} = $this->_getRssBody($value2);
448 448
 				}
449 449
 
450 450
 				$content_item = new mcontentItem($rss->title);
451 451
 				$content_item->setContentsLink($rss->link);
452 452
 				$content_item->setTitle($item->title);
453
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
453
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
454 454
 				//$content_item->setCategory($item->category);
455
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
455
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
456 456
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
457 457
 				$content_item->setLink($item->link);
458
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
458
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
459 459
 				$content_item->setRegdate($date);
460 460
 
461 461
 				$content_items[] = $content_item;
462 462
 			}
463 463
 		}
464
-		else if($xml_doc->{'rdf:rdf'})
464
+		else if ($xml_doc->{'rdf:rdf'})
465 465
 		{
466 466
 			// rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol
467 467
 			$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
@@ -469,102 +469,102 @@  discard block
 block discarded – undo
469 469
 
470 470
 			$items = $xml_doc->{'rdf:rdf'}->item;
471 471
 
472
-			if(!$items) return;
473
-			if($items && !is_array($items)) $items = array($items);
472
+			if (!$items) return;
473
+			if ($items && !is_array($items)) $items = array($items);
474 474
 
475 475
 			$content_items = array();
476 476
 
477 477
 			foreach ($items as $key => $value)
478 478
 			{
479
-				if($key >= $args->list_count) break;
479
+				if ($key >= $args->list_count) break;
480 480
 				unset($item);
481 481
 				$item = new stdClass();
482 482
 
483
-				foreach($value as $key2 => $value2)
483
+				foreach ($value as $key2 => $value2)
484 484
 				{
485
-					if(is_array($value2)) $value2 = array_shift($value2);
485
+					if (is_array($value2)) $value2 = array_shift($value2);
486 486
 					$item->{$key2} = $this->_getRssBody($value2);
487 487
 				}
488 488
 
489 489
 				$content_item = new mcontentItem($rss->title);
490 490
 				$content_item->setContentsLink($rss->link);
491 491
 				$content_item->setTitle($item->title);
492
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
492
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
493 493
 				//$content_item->setCategory($item->category);
494
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
494
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
495 495
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
496 496
 				$content_item->setLink($item->link);
497
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
497
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
498 498
 				$content_item->setRegdate($date);
499 499
 
500 500
 				$content_items[] = $content_item;
501 501
 			}
502 502
 		}
503
-		else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
503
+		else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
504 504
 			{
505 505
 			// Atom 1.0 spec supported by misol
506 506
 			$rss->title = $xml_doc->feed->title->body;
507 507
 			$links = $xml_doc->feed->link;
508
-			if(is_array($links))
508
+			if (is_array($links))
509 509
 			{
510 510
 				foreach ($links as $value)
511 511
 				{
512
-					if($value->attrs->rel == 'alternate')
512
+					if ($value->attrs->rel == 'alternate')
513 513
 					{
514 514
 						$rss->link = $value->attrs->href;
515 515
 						break;
516 516
 					}
517 517
 				}
518 518
 			}
519
-			else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
519
+			else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
520 520
 	
521 521
 			$items = $xml_doc->feed->entry;
522 522
 	
523
-			if(!$items) return;
524
-			if($items && !is_array($items)) $items = array($items);
523
+			if (!$items) return;
524
+			if ($items && !is_array($items)) $items = array($items);
525 525
 	
526 526
 			$content_items = array();
527 527
 	
528 528
 			foreach ($items as $key => $value)
529 529
 			{
530
-				if($key >= $args->list_count) break;
530
+				if ($key >= $args->list_count) break;
531 531
 				unset($item);
532 532
 	
533
-				foreach($value as $key2 => $value2)
533
+				foreach ($value as $key2 => $value2)
534 534
 				{
535
-					if(is_array($value2)) $value2 = array_shift($value2);
535
+					if (is_array($value2)) $value2 = array_shift($value2);
536 536
 					$item->{$key2} = $this->_getRssBody($value2);
537 537
 				}
538 538
 	
539 539
 				$content_item = new mcontentItem($rss->title);
540 540
 				$links = $value->link;
541
-				if(is_array($links))
541
+				if (is_array($links))
542 542
 				{
543 543
 					foreach ($links as $val)
544 544
 					{
545
-						if($val->attrs->rel == 'alternate')
545
+						if ($val->attrs->rel == 'alternate')
546 546
 						{
547 547
 							$item->link = $val->attrs->href;
548 548
 							break;
549 549
 						}
550 550
 					}
551 551
 				}
552
-				else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
552
+				else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
553 553
 	
554 554
 				$content_item->setContentsLink($rss->link);
555
-				if($item->title)
555
+				if ($item->title)
556 556
 				{
557
-					if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
557
+					if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
558 558
 				}
559 559
 				$content_item->setTitle($item->title);
560
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
560
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
561 561
 				$content_item->setAuthorSite($value->author->uri->body);
562 562
 	
563 563
 				//$content_item->setCategory($item->category);
564 564
 				$item->description = ($item->content) ? $item->content : $item->description = $item->summary;
565
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
565
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
566 566
 	
567
-				if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
567
+				if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
568 568
 				{
569 569
 					$item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
570 570
 	
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	
573 573
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
574 574
 				$content_item->setLink($item->link);
575
-				$date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'})));
575
+				$date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'})));
576 576
 				$content_item->setRegdate($date);
577 577
 	
578 578
 				$content_items[] = $content_item;
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 		return $content_items;
582 582
 	}
583 583
 
584
-	function _getTrackbackItems($args){
584
+	function _getTrackbackItems($args) {
585 585
 		// Get categories
586
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
587
-		if($output->toBool() && $output->data)
586
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
587
+		if ($output->toBool() && $output->data)
588 588
 		{
589
-			foreach($output->data as $key => $val) {
589
+			foreach ($output->data as $key => $val) {
590 590
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
591 591
 			}
592 592
 		}
@@ -598,14 +598,14 @@  discard block
 block discarded – undo
598 598
 		$oTrackbackModel = getModel('trackback');
599 599
 		$output = $oTrackbackModel->getNewestTrackbackList($obj);
600 600
 		// If an error occurs, just ignore it.
601
-		if(!$output->toBool() || !$output->data) return;
601
+		if (!$output->toBool() || !$output->data) return;
602 602
 		// If the result exists, make each document as an object
603 603
 		$content_items = array();
604
-		foreach($output->data as $key => $item)
604
+		foreach ($output->data as $key => $item)
605 605
 		{
606 606
 			$domain = $args->module_srls_info[$item->module_srl]->domain;
607 607
 			$category = $category_lists[$item->module_srl]->text;
608
-			$url = getSiteUrl($domain,'','mid', $args->mid_lists[$item->module_srl],'document_srl',$item->document_srl);
608
+			$url = getSiteUrl($domain, '', 'mid', $args->mid_lists[$item->module_srl], 'document_srl', $item->document_srl);
609 609
 			$browser_title = $args->module_srls_info[$item->module_srl]->browser_title;
610 610
 
611 611
 			$content_item = new mcontentItem($browser_title);
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 			$content_item->setTitle($item->title);
614 614
 			$content_item->setCategory($category);
615 615
 			$content_item->setNickName($item->blog_name);
616
-			$content_item->setContent($item->excerpt);  ///<<
617
-			$content_item->setDomain($domain);  ///<<
616
+			$content_item->setContent($item->excerpt); ///<<
617
+			$content_item->setDomain($domain); ///<<
618 618
 			$content_item->setLink($url);
619 619
 			$content_item->add('mid', $args->mid_lists[$item->module_srl]);
620 620
 			$content_item->setRegdate($item->regdate);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		return $content_items;
624 624
 	}
625 625
 
626
-	function _compile($args,$content_items)
626
+	function _compile($args, $content_items)
627 627
 	{
628 628
 		$oTemplate = &TemplateHandler::getInstance();
629 629
 		// Set variables for widget
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	var $contents_link = null;
672 672
 	var $domain = null;
673 673
 
674
-	function __construct($browser_title='')
674
+	function __construct($browser_title = '')
675 675
 	{
676 676
 		$this->browser_title = $browser_title;
677 677
 	}
@@ -681,58 +681,58 @@  discard block
 block discarded – undo
681 681
 	}
682 682
 	function setFirstThumbnailIdx($first_thumbnail_idx)
683 683
 	{
684
-		if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) {
684
+		if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) {
685 685
 			$this->has_first_thumbnail_idx = true;
686
-			$this->first_thumbnail_idx= $first_thumbnail_idx;
686
+			$this->first_thumbnail_idx = $first_thumbnail_idx;
687 687
 		}
688 688
 	}
689 689
 	function setExtraImages($extra_images)
690 690
 	{
691
-		$this->add('extra_images',$extra_images);
691
+		$this->add('extra_images', $extra_images);
692 692
 	}
693 693
 	function setDomain($domain)
694 694
 	{
695 695
 		static $default_domain = null;
696
-		if(!$domain)
696
+		if (!$domain)
697 697
 		{
698
-			if(is_null($default_domain)) $default_domain = Context::getDefaultUrl();
698
+			if (is_null($default_domain)) $default_domain = Context::getDefaultUrl();
699 699
 			$domain = $default_domain;
700 700
 		}
701 701
 		$this->domain = $domain;
702 702
 	}
703 703
 	function setLink($url)
704 704
 	{
705
-		$this->add('url',$url);
705
+		$this->add('url', $url);
706 706
 	}
707 707
 	function setTitle($title)
708 708
 	{
709
-		$this->add('title',$title);
709
+		$this->add('title', $title);
710 710
 	}
711 711
 
712 712
 	function setThumbnail($thumbnail)
713 713
 	{
714
-		$this->add('thumbnail',$thumbnail);
714
+		$this->add('thumbnail', $thumbnail);
715 715
 	}
716 716
 	function setContent($content)
717 717
 	{
718
-		$this->add('content',$content);
718
+		$this->add('content', $content);
719 719
 	}
720 720
 	function setRegdate($regdate)
721 721
 	{
722
-		$this->add('regdate',$regdate);
722
+		$this->add('regdate', $regdate);
723 723
 	}
724 724
 	function setNickName($nick_name)
725 725
 	{
726
-		$this->add('nick_name',$nick_name);
726
+		$this->add('nick_name', $nick_name);
727 727
 	}
728 728
 	// Save author's homepage url by misol
729 729
 	function setAuthorSite($site_url)
730 730
 	{
731
-		$this->add('author_site',$site_url);
731
+		$this->add('author_site', $site_url);
732 732
 	}
733 733
 	function setCategory($category)
734 734
 	{
735
-		$this->add('category',$category);
735
+		$this->add('category', $category);
736 736
 	}
737 737
 	function getBrowserTitle()
738 738
 	{
@@ -760,17 +760,17 @@  discard block
 block discarded – undo
760 760
 	{
761 761
 		return $this->get('module_srl');
762 762
 	}
763
-	function getTitle($cut_size = 0, $tail='...')
763
+	function getTitle($cut_size = 0, $tail = '...')
764 764
 	{
765 765
 		$title = strip_tags($this->get('title'));
766 766
 
767
-		if($cut_size) $title = cut_str($title, $cut_size, $tail);
767
+		if ($cut_size) $title = cut_str($title, $cut_size, $tail);
768 768
 
769 769
 		$attrs = array();
770
-		if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
770
+		if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
772 772
 
773
-		if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
773
+		if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
774 774
 
775 775
 		return $title;
776 776
 	}
@@ -793,12 +793,12 @@  discard block
 block discarded – undo
793 793
 	function getCommentCount()
794 794
 	{
795 795
 		$comment_count = $this->get('comment_count');
796
-		return $comment_count>0 ? $comment_count : '';
796
+		return $comment_count > 0 ? $comment_count : '';
797 797
 	}
798 798
 	function getTrackbackCount()
799 799
 	{
800 800
 		$trackback_count = $this->get('trackback_count');
801
-		return $trackback_count>0 ? $trackback_count : '';
801
+		return $trackback_count > 0 ? $trackback_count : '';
802 802
 	}
803 803
 	function getRegdate($format = 'Y.m.d H:i:s')
804 804
 	{
Please login to merge, or discard this patch.
classes/db/DBCubrid.class.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param int $size column size
478 478
 	 * @param string|int $default default value
479 479
 	 * @param boolean $notnull not null status, default value is false
480
-	 * @return void
480
+	 * @return resource|null
481 481
 	 */
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	/**
694 694
 	 * Creates a table by using xml contents
695 695
 	 * @param string $xml_doc xml schema contents
696
-	 * @return void|object
696
+	 * @return null|resource
697 697
 	 */
698 698
 	function createTableByXml($xml_doc)
699 699
 	{
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	/**
704 704
 	 * Creates a table by using xml file path
705 705
 	 * @param string $file_name xml schema file path
706
-	 * @return void|object
706
+	 * @return null|resource
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	 * opt : notnull, default, size\n
724 724
 	 * index : primary key, index, unique\n
725 725
 	 * @param string $xml_doc xml schema contents
726
-	 * @return void|object
726
+	 * @return null|resource
727 727
 	 */
728 728
 	function _createTable($xml_doc)
729 729
 	{
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 	/**
1127 1127
 	 * If select query execute, return paging sql
1128
-	 * @param object $query
1128
+	 * @param BaseObject $query
1129 1129
 	 * @param boolean $with_values
1130 1130
 	 * @param int $start_count
1131 1131
 	 * @param int $list_count
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	function __construct($auto_connect = TRUE)
53 53
 	{
54 54
 		$this->_setDBInfo();
55
-		if($auto_connect) $this->_connect();
55
+		if ($auto_connect) $this->_connect();
56 56
 	}
57 57
 
58 58
 	/**
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
 		$result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]);
77 77
 
78 78
 		// check connections
79
-		if(!$result)
79
+		if (!$result)
80 80
 		{
81 81
 			$this->setError(-1, 'database connect fail');
82 82
 			return;
83 83
 		}
84 84
 
85
-		if(!defined('__CUBRID_VERSION__'))
85
+		if (!defined('__CUBRID_VERSION__'))
86 86
 		{
87 87
 			$cubrid_version = cubrid_get_server_info($result);
88 88
 			$cubrid_version_elem = explode('.', $cubrid_version);
89
-			$cubrid_version = $cubrid_version_elem[0] . '.' . $cubrid_version_elem[1] . '.' . $cubrid_version_elem[2];
89
+			$cubrid_version = $cubrid_version_elem[0].'.'.$cubrid_version_elem[1].'.'.$cubrid_version_elem[2];
90 90
 			define('__CUBRID_VERSION__', $cubrid_version);
91 91
 		}
92 92
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
93
+		if (__CUBRID_VERSION__ >= '8.4.0')
94 94
 			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95 95
 
96 96
 		return $result;
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function addQuotes($string)
118 118
 	{
119
-		if(version_compare(PHP_VERSION, "5.4.0", "<") &&
119
+		if (version_compare(PHP_VERSION, "5.4.0", "<") &&
120 120
 				get_magic_quotes_gpc())
121 121
 		{
122 122
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
123 123
 		}
124 124
 
125
-		if(!is_numeric($string))
125
+		if (!is_numeric($string))
126 126
 		{
127 127
 			/*
128 128
 			  if ($this->isConnected()) {
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	function _begin($transactionLevel = 0)
148 148
 	{
149
-		if(__CUBRID_VERSION__ >= '8.4.0')
149
+		if (__CUBRID_VERSION__ >= '8.4.0')
150 150
 		{
151 151
 			$connection = $this->_getConnection('master');
152 152
 
153
-			if(!$transactionLevel)
153
+			if (!$transactionLevel)
154 154
 			{
155 155
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156 156
 			}
157 157
 			else
158 158
 			{
159
-				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
159
+				$this->_query("SAVEPOINT SP".$transactionLevel, $connection);
160 160
 			}
161 161
 		}
162 162
 		return TRUE;
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$point = $transactionLevel - 1;
175 175
 
176
-		if($point)
176
+		if ($point)
177 177
 		{
178
-			$this->_query("ROLLBACK TO SP" . $point, $connection);
178
+			$this->_query("ROLLBACK TO SP".$point, $connection);
179 179
 		}
180 180
 		else
181 181
 		{
@@ -206,29 +206,29 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function __query($query, $connection)
208 208
 	{
209
-		if($this->use_prepared_statements == 'Y')
209
+		if ($this->use_prepared_statements == 'Y')
210 210
 		{
211 211
 			$req = @cubrid_prepare($connection, $query);
212
-			if(!$req)
212
+			if (!$req)
213 213
 			{
214 214
 				$this->_setError();
215 215
 				return false;
216 216
 			}
217 217
 
218 218
 			$position = 0;
219
-			if($this->param)
219
+			if ($this->param)
220 220
 			{
221
-				foreach($this->param as $param)
221
+				foreach ($this->param as $param)
222 222
 				{
223 223
 					$value = $param->getUnescapedValue();
224 224
 					$type = $param->getType();
225 225
 
226
-					if($param->isColumnName())
226
+					if ($param->isColumnName())
227 227
 					{
228 228
 						continue;
229 229
 					}
230 230
 
231
-					switch($type)
231
+					switch ($type)
232 232
 					{
233 233
 						case 'number' :
234 234
 							$bind_type = 'numeric';
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 							$bind_type = 'string';
241 241
 					}
242 242
 
243
-					if(is_array($value))
243
+					if (is_array($value))
244 244
 					{
245
-						foreach($value as $v)
245
+						foreach ($value as $v)
246 246
 						{
247 247
 							$bound = @cubrid_bind($req, ++$position, $v, $bind_type);
248
-							if(!$bound)
248
+							if (!$bound)
249 249
 							{
250 250
 								$this->_setError();
251 251
 								return false;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 					else
256 256
 					{
257 257
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258
-						if(!$bound)
258
+						if (!$bound)
259 259
 						{
260 260
 							$this->_setError();
261 261
 							return false;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 
267 267
 			$result = @cubrid_execute($req);
268
-			if(!$result)
268
+			if (!$result)
269 269
 			{
270 270
 				$this->_setError();
271 271
 				return false;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		// Execute the query
276 276
 		$result = @cubrid_execute($connection, $query);
277 277
 		// error check
278
-		if(!$result)
278
+		if (!$result)
279 279
 		{
280 280
 			$this->_setError();
281 281
 			return false;
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 	function _fetch($result, $arrayIndexEndValue = NULL)
307 307
 	{
308 308
 		$output = array();
309
-		if(!$this->isConnected() || $this->isError() || !$result)
309
+		if (!$this->isConnected() || $this->isError() || !$result)
310 310
 		{
311 311
 			return array();
312 312
 		}
313 313
 
314
-		if($this->use_prepared_statements == 'Y')
314
+		if ($this->use_prepared_statements == 'Y')
315 315
 		{
316 316
 
317 317
 		}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 		$col_names = cubrid_column_names($result);
323 323
 		$max = count($col_types);
324 324
 
325
-		for($count = 0; $count < $max; $count++)
325
+		for ($count = 0; $count < $max; $count++)
326 326
 		{
327
-			if(preg_match("/^char/", $col_types[$count]) > 0)
327
+			if (preg_match("/^char/", $col_types[$count]) > 0)
328 328
 			{
329 329
 				$char_type_fields[] = $col_names[$count];
330 330
 			}
331 331
 		}
332 332
 
333
-		while($tmp = cubrid_fetch($result, CUBRID_OBJECT))
333
+		while ($tmp = cubrid_fetch($result, CUBRID_OBJECT))
334 334
 		{
335
-			if(is_array($char_type_fields))
335
+			if (is_array($char_type_fields))
336 336
 			{
337
-				foreach($char_type_fields as $val)
337
+				foreach ($char_type_fields as $val)
338 338
 				{
339 339
 					$tmp->{$val} = rtrim($tmp->{$val});
340 340
 				}
341 341
 			}
342 342
 
343
-			if($arrayIndexEndValue)
343
+			if ($arrayIndexEndValue)
344 344
 			{
345 345
 				$output[$arrayIndexEndValue--] = $tmp;
346 346
 			}
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
 
353 353
 		unset($char_type_fields);
354 354
 
355
-		if($result)
355
+		if ($result)
356 356
 		{
357 357
 			cubrid_close_request($result);
358 358
 		}
359 359
 
360
-		if(count($output) == 1)
360
+		if (count($output) == 1)
361 361
 		{
362 362
 			// If call is made for pagination, always return array
363
-			if(isset($arrayIndexEndValue))
363
+			if (isset($arrayIndexEndValue))
364 364
 			{
365 365
 				return $output;
366 366
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	function _makeSequence()
397 397
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
398
+		if ($_GLOBALS['XE_EXISTS_SEQUENCE'])
399 399
 			return;
400 400
 
401 401
 		// check cubrid serial
@@ -404,21 +404,21 @@  discard block
 block discarded – undo
404 404
 		$output = $this->_fetch($result);
405 405
 
406 406
 		// if do not create serial
407
-		if($output->count == 0)
408
-		{
409
-			$query = sprintf('select max("a"."srl") as "srl" from ' .
410
-					'( select max("document_srl") as "srl" from ' .
411
-					'"%sdocuments" UNION ' .
412
-					'select max("comment_srl") as "srl" from ' .
413
-					'"%scomments" UNION ' .
414
-					'select max("member_srl") as "srl" from ' .
415
-					'"%smember"' .
407
+		if ($output->count == 0)
408
+		{
409
+			$query = sprintf('select max("a"."srl") as "srl" from '.
410
+					'( select max("document_srl") as "srl" from '.
411
+					'"%sdocuments" UNION '.
412
+					'select max("comment_srl") as "srl" from '.
413
+					'"%scomments" UNION '.
414
+					'select max("member_srl") as "srl" from '.
415
+					'"%smember"'.
416 416
 					') as "a"', $this->prefix, $this->prefix, $this->prefix);
417 417
 
418 418
 			$result = $this->_query($query);
419 419
 			$output = $this->_fetch($result);
420 420
 			$srl = $output->srl;
421
-			if($srl < 1)
421
+			if ($srl < 1)
422 422
 			{
423 423
 				$start = 1;
424 424
 			}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 */
443 443
 	function isTableExists($target_name)
444 444
 	{
445
-		if($target_name == 'sequence')
445
+		if ($target_name == 'sequence')
446 446
 		{
447 447
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448 448
 		}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 
454 454
 		$result = $this->_query($query);
455
-		if(cubrid_num_rows($result) > 0)
455
+		if (cubrid_num_rows($result) > 0)
456 456
 		{
457 457
 			$output = TRUE;
458 458
 		}
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			$output = FALSE;
462 462
 		}
463 463
 
464
-		if($result)
464
+		if ($result)
465 465
 		{
466 466
 			cubrid_close_request($result);
467 467
 		}
@@ -482,22 +482,22 @@  discard block
 block discarded – undo
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
484 484
 		$type = strtoupper($this->column_type[$type]);
485
-		if($type == 'INTEGER')
485
+		if ($type == 'INTEGER')
486 486
 		{
487 487
 			$size = '';
488 488
 		}
489 489
 
490 490
 		$query = sprintf("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name);
491 491
 
492
-		if($type == 'char' || $type == 'varchar')
492
+		if ($type == 'char' || $type == 'varchar')
493 493
 		{
494
-			if($size)
494
+			if ($size)
495 495
 			{
496 496
 				$size = $size * 3;
497 497
 			}
498 498
 		}
499 499
 
500
-		if($size)
500
+		if ($size)
501 501
 		{
502 502
 			$query .= sprintf("%s(%s) ", $type, $size);
503 503
 		}
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 			$query .= sprintf("%s ", $type);
507 507
 		}
508 508
 
509
-		if(isset($default))
509
+		if (isset($default))
510 510
 		{
511
-			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
511
+			if ($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 512
 			{
513 513
 				$query .= sprintf("default %d ", $default);
514 514
 			}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			}
519 519
 		}
520 520
 
521
-		if($notnull)
521
+		if ($notnull)
522 522
 		{
523 523
 			$query .= "not null ";
524 524
 		}
@@ -547,10 +547,10 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	function isColumnExists($table_name, $column_name)
549 549
 	{
550
-		$query = sprintf("select \"attr_name\" from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
550
+		$query = sprintf("select \"attr_name\" from \"db_attribute\" where "."\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
551 551
 		$result = $this->_query($query);
552 552
 
553
-		if(cubrid_num_rows($result) > 0)
553
+		if (cubrid_num_rows($result) > 0)
554 554
 		{
555 555
 			$output = TRUE;
556 556
 		}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			$output = FALSE;
560 560
 		}
561 561
 
562
-		if($result)
562
+		if ($result)
563 563
 		{
564 564
 			cubrid_close_request($result);
565 565
 		}
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = FALSE)
581 581
 	{
582
-		if(!is_array($target_columns))
582
+		if (!is_array($target_columns))
583 583
 		{
584 584
 			$target_columns = array($target_columns);
585 585
 		}
586 586
 
587
-		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"' . implode('","', $target_columns) . '"');
587
+		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"'.implode('","', $target_columns).'"');
588 588
 
589 589
 		$this->_query($query);
590 590
 	}
@@ -611,17 +611,17 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	function isIndexExists($table_name, $index_name)
613 613
 	{
614
-		$query = sprintf("select \"index_name\" from \"db_index\" where " . "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix . $index_name, $index_name);
614
+		$query = sprintf("select \"index_name\" from \"db_index\" where "."\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix.$index_name, $index_name);
615 615
 		$result = $this->_query($query);
616 616
 
617
-		if($this->isError())
617
+		if ($this->isError())
618 618
 		{
619 619
 			return FALSE;
620 620
 		}
621 621
 
622 622
 		$output = $this->_fetch($result);
623 623
 
624
-		if(!$output)
624
+		if (!$output)
625 625
 		{
626 626
 			return FALSE;
627 627
 		}
@@ -653,25 +653,25 @@  discard block
 block discarded – undo
653 653
 				", strlen($this->prefix)
654 654
 				, $this->prefix
655 655
 				, strlen($this->prefix) + 1
656
-				, "'" . $this->prefix . '%' . "'"
656
+				, "'".$this->prefix.'%'."'"
657 657
 				, strlen($this->prefix)
658 658
 				, $this->prefix
659 659
 				, strlen($this->prefix) + 1
660 660
 		);
661 661
 		$result = $this->_query($query);
662 662
 
663
-		if($this->isError())
663
+		if ($this->isError())
664 664
 		{
665 665
 			return FALSE;
666 666
 		}
667 667
 
668 668
 		$output = $this->_fetch($result);
669
-		if(!$output)
669
+		if (!$output)
670 670
 		{
671 671
 			return FALSE;
672 672
 		}
673 673
 
674
-		if(!is_array($output))
674
+		if (!is_array($output))
675 675
 		{
676 676
 			$indexes_to_be_deleted = array($output);
677 677
 		}
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
 			$indexes_to_be_deleted = $output;
681 681
 		}
682 682
 
683
-		foreach($indexes_to_be_deleted as $index)
683
+		foreach ($indexes_to_be_deleted as $index)
684 684
 		{
685 685
 			$this->dropIndex(substr($index->class_name, strlen($this->prefix))
686
-					, $this->prefix . $index->unprefixed_index_name
686
+					, $this->prefix.$index->unprefixed_index_name
687 687
 					, $index->is_unique == 'YES' ? TRUE : FALSE);
688 688
 		}
689 689
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
710
-		if(!file_exists($file_name))
710
+		if (!file_exists($file_name))
711 711
 		{
712 712
 			return;
713 713
 		}
@@ -734,28 +734,28 @@  discard block
 block discarded – undo
734 734
 		$table_name = $xml_obj->table->attrs->name;
735 735
 
736 736
 		// if the table already exists exit function
737
-		if($this->isTableExists($table_name))
737
+		if ($this->isTableExists($table_name))
738 738
 		{
739 739
 			return;
740 740
 		}
741 741
 
742 742
 		// If the table name is sequence, it creates a serial
743
-		if($table_name == 'sequence')
743
+		if ($table_name == 'sequence')
744 744
 		{
745
-			$query = sprintf('create serial "%s" start with 1 increment by 1' .
746
-					' minvalue 1 ' .
747
-					'maxvalue 10000000000000000000000000000000000000' . ' nocycle;', $this->prefix . $table_name);
745
+			$query = sprintf('create serial "%s" start with 1 increment by 1'.
746
+					' minvalue 1 '.
747
+					'maxvalue 10000000000000000000000000000000000000'.' nocycle;', $this->prefix.$table_name);
748 748
 
749 749
 			return $this->_query($query);
750 750
 		}
751 751
 
752 752
 
753
-		$table_name = $this->prefix . $table_name;
753
+		$table_name = $this->prefix.$table_name;
754 754
 
755 755
 		$query = sprintf('create class "%s";', $table_name);
756 756
 		$this->_query($query);
757 757
 
758
-		if(!is_array($xml_obj->table->column))
758
+		if (!is_array($xml_obj->table->column))
759 759
 		{
760 760
 			$columns[] = $xml_obj->table->column;
761 761
 		}
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		$unique_list = array();
771 771
 		$index_list = array();
772 772
 
773
-		foreach($columns as $column)
773
+		foreach ($columns as $column)
774 774
 		{
775 775
 			$name = $column->attrs->name;
776 776
 			$type = $column->attrs->type;
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 			$unique = $column->attrs->unique;
782 782
 			$default = $column->attrs->default;
783 783
 
784
-			switch($this->column_type[$type])
784
+			switch ($this->column_type[$type])
785 785
 			{
786 786
 				case 'integer' :
787 787
 					$size = NULL;
@@ -791,58 +791,58 @@  discard block
 block discarded – undo
791 791
 					break;
792 792
 			}
793 793
 
794
-			if(isset($default) && ($type == 'varchar' || $type == 'char' ||
794
+			if (isset($default) && ($type == 'varchar' || $type == 'char' ||
795 795
 					$type == 'text' || $type == 'tinytext' || $type == 'bigtext'))
796 796
 			{
797 797
 				$default = sprintf("'%s'", $default);
798 798
 			}
799 799
 
800
-			if($type == 'varchar' || $type == 'char')
800
+			if ($type == 'varchar' || $type == 'char')
801 801
 			{
802
-				if($size)
802
+				if ($size)
803 803
 					$size = $size * 3;
804 804
 			}
805 805
 
806 806
 
807
-			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default " . $default : '', $notnull ? 'not null' : '');
807
+			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default ".$default : '', $notnull ? 'not null' : '');
808 808
 
809
-			if($primary_key)
809
+			if ($primary_key)
810 810
 			{
811 811
 				$primary_list[] = $name;
812 812
 			}
813
-			else if($unique)
813
+			else if ($unique)
814 814
 			{
815 815
 				$unique_list[$unique][] = $name;
816 816
 			}
817
-			else if($index)
817
+			else if ($index)
818 818
 			{
819 819
 				$index_list[$index][] = $name;
820 820
 			}
821 821
 		}
822 822
 
823
-		$query .= implode(',', $column_schema) . ';';
823
+		$query .= implode(',', $column_schema).';';
824 824
 		$this->_query($query);
825 825
 
826
-		if(count($primary_list))
826
+		if (count($primary_list))
827 827
 		{
828
-			$query = sprintf("alter class \"%s\" add attribute constraint " . "\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"' . implode('","', $primary_list) . '"');
828
+			$query = sprintf("alter class \"%s\" add attribute constraint "."\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"'.implode('","', $primary_list).'"');
829 829
 			$this->_query($query);
830 830
 		}
831 831
 
832
-		if(count($unique_list))
832
+		if (count($unique_list))
833 833
 		{
834
-			foreach($unique_list as $key => $val)
834
+			foreach ($unique_list as $key => $val)
835 835
 			{
836
-				$query = sprintf("create unique index \"%s\" on \"%s\" " . "(%s);", $key, $table_name, '"' . implode('","', $val) . '"');
836
+				$query = sprintf("create unique index \"%s\" on \"%s\" "."(%s);", $key, $table_name, '"'.implode('","', $val).'"');
837 837
 				$this->_query($query);
838 838
 			}
839 839
 		}
840 840
 
841
-		if(count($index_list))
841
+		if (count($index_list))
842 842
 		{
843
-			foreach($index_list as $key => $val)
843
+			foreach ($index_list as $key => $val)
844 844
 			{
845
-				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"');
845
+				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"'.implode('","', $val).'"');
846 846
 				$this->_query($query);
847 847
 			}
848 848
 		}
@@ -856,22 +856,22 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	function _executeInsertAct($queryObject, $with_values = TRUE)
858 858
 	{
859
-		if($this->use_prepared_statements == 'Y')
859
+		if ($this->use_prepared_statements == 'Y')
860 860
 		{
861 861
 			$this->param = $queryObject->getArguments();
862 862
 			$with_values = FALSE;
863 863
 		}
864 864
 		$query = $this->getInsertSql($queryObject, $with_values);
865
-		if(is_a($query, 'BaseObject'))
865
+		if (is_a($query, 'BaseObject'))
866 866
 		{
867 867
 			unset($this->param);
868 868
 			return;
869 869
 		}
870 870
 
871
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
871
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
872 872
 
873 873
 		$result = $this->_query($query);
874
-		if($result && !$this->transaction_started)
874
+		if ($result && !$this->transaction_started)
875 875
 		{
876 876
 			$this->_commit();
877 877
 		}
@@ -887,23 +887,23 @@  discard block
 block discarded – undo
887 887
 	 */
888 888
 	function _executeUpdateAct($queryObject, $with_values = TRUE)
889 889
 	{
890
-		if($this->use_prepared_statements == 'Y')
890
+		if ($this->use_prepared_statements == 'Y')
891 891
 		{
892 892
 			$this->param = $queryObject->getArguments();
893 893
 			$with_values = FALSE;
894 894
 		}
895 895
 		$query = $this->getUpdateSql($queryObject, $with_values);
896
-		if(is_a($query, 'BaseObject'))
896
+		if (is_a($query, 'BaseObject'))
897 897
 		{
898 898
 			unset($this->param);
899 899
 			return;
900 900
 		}
901 901
 
902
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
902
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
903 903
 
904 904
 		$result = $this->_query($query);
905 905
 
906
-		if($result && !$this->transaction_started)
906
+		if ($result && !$this->transaction_started)
907 907
 		{
908 908
 			$this->_commit();
909 909
 		}
@@ -919,23 +919,23 @@  discard block
 block discarded – undo
919 919
 	 */
920 920
 	function _executeDeleteAct($queryObject, $with_values = TRUE)
921 921
 	{
922
-		if($this->use_prepared_statements == 'Y')
922
+		if ($this->use_prepared_statements == 'Y')
923 923
 		{
924 924
 			$this->param = $queryObject->getArguments();
925 925
 			$with_values = FALSE;
926 926
 		}
927 927
 		$query = $this->getDeleteSql($queryObject, $with_values);
928
-		if(is_a($query, 'BaseObject'))
928
+		if (is_a($query, 'BaseObject'))
929 929
 		{
930 930
 			unset($this->param);
931 931
 			return;
932 932
 		}
933 933
 
934
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
934
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
935 935
 
936 936
 		$result = $this->_query($query);
937 937
 
938
-		if($result && !$this->transaction_started)
938
+		if ($result && !$this->transaction_started)
939 939
 		{
940 940
 			$this->_commit();
941 941
 		}
@@ -955,29 +955,29 @@  discard block
 block discarded – undo
955 955
 	 */
956 956
 	function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE)
957 957
 	{
958
-		if($this->use_prepared_statements == 'Y')
958
+		if ($this->use_prepared_statements == 'Y')
959 959
 		{
960 960
 			$this->param = $queryObject->getArguments();
961 961
 			$with_values = FALSE;
962 962
 		}
963 963
 		$limit = $queryObject->getLimit();
964
-		if($limit && $limit->isPageHandler())
964
+		if ($limit && $limit->isPageHandler())
965 965
 		{
966 966
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967 967
 		}
968 968
 		else
969 969
 		{
970 970
 			$query = $this->getSelectSql($queryObject, $with_values);
971
-			if(is_a($query, 'BaseObject'))
971
+			if (is_a($query, 'BaseObject'))
972 972
 			{
973 973
 				unset($this->param);
974 974
 				return;
975 975
 			}
976 976
 
977
-			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
977
+			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
978 978
 			$result = $this->_query($query, $connection);
979 979
 
980
-			if($this->isError())
980
+			if ($this->isError())
981 981
 			{
982 982
 				unset($this->param);
983 983
 				return $this->queryError($queryObject);
@@ -1000,16 +1000,16 @@  discard block
 block discarded – undo
1000 1000
 	function queryError($queryObject)
1001 1001
 	{
1002 1002
 		$limit = $queryObject->getLimit();
1003
-		if($limit && $limit->isPageHandler())
1003
+		if ($limit && $limit->isPageHandler())
1004 1004
 		{
1005
-			$buff = new BaseObject ();
1005
+			$buff = new BaseObject();
1006 1006
 			$buff->total_count = 0;
1007 1007
 			$buff->total_page = 0;
1008 1008
 			$buff->page = 1;
1009 1009
 			$buff->data = array();
1010 1010
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 1011
 			return $buff;
1012
-		}else
1012
+		} else
1013 1013
 			return;
1014 1014
 	}
1015 1015
 
@@ -1025,48 +1025,48 @@  discard block
 block discarded – undo
1025 1025
 		$limit = $queryObject->getLimit();
1026 1026
 		// Total count
1027 1027
 		$temp_where = $queryObject->getWhereString($with_values, FALSE);
1028
-		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
1028
+		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where));
1029 1029
 
1030 1030
 		// Check for distinct query and if found update count query structure
1031 1031
 		$temp_select = $queryObject->getSelectString($with_values);
1032 1032
 		$uses_distinct = stripos($temp_select, "distinct") !== FALSE;
1033 1033
 		$uses_groupby = $queryObject->getGroupByString() != '';
1034
-		if($uses_distinct || $uses_groupby)
1034
+		if ($uses_distinct || $uses_groupby)
1035 1035
 		{
1036 1036
 			$count_query = sprintf('select %s %s %s %s'
1037 1037
 					, $temp_select
1038
-					, 'FROM ' . $queryObject->getFromString($with_values)
1039
-					, ($temp_where === '' ? '' : ' WHERE ' . $temp_where)
1040
-					, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
1038
+					, 'FROM '.$queryObject->getFromString($with_values)
1039
+					, ($temp_where === '' ? '' : ' WHERE '.$temp_where)
1040
+					, ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '')
1041 1041
 			);
1042 1042
 
1043 1043
 			// If query uses grouping or distinct, count from original select
1044 1044
 			$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
1045 1045
 		}
1046 1046
 
1047
-		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
1047
+		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : '';
1048 1048
 		$result = $this->_query($count_query, $connection);
1049 1049
 		$count_output = $this->_fetch($result);
1050 1050
 		$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
1051 1051
 
1052 1052
 		$list_count = $limit->list_count->getValue();
1053
-		if(!$list_count)
1053
+		if (!$list_count)
1054 1054
 		{
1055 1055
 			$list_count = 20;
1056 1056
 		}
1057 1057
 		$page_count = $limit->page_count->getValue();
1058
-		if(!$page_count)
1058
+		if (!$page_count)
1059 1059
 		{
1060 1060
 			$page_count = 10;
1061 1061
 		}
1062 1062
 		$page = $limit->page->getValue();
1063
-		if(!$page || $page < 1)
1063
+		if (!$page || $page < 1)
1064 1064
 		{
1065 1065
 			$page = 1;
1066 1066
 		}
1067 1067
 
1068 1068
 		// total pages
1069
-		if($total_count)
1069
+		if ($total_count)
1070 1070
 		{
1071 1071
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072 1072
 		}
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 		}
1077 1077
 
1078 1078
 		// check the page variables
1079
-		if($page > $total_page)
1079
+		if ($page > $total_page)
1080 1080
 		{
1081 1081
 			// If requested page is bigger than total number of pages, return empty list
1082 1082
 
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 		$start_count = ($page - 1) * $list_count;
1093 1093
 
1094 1094
 		$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
1095
-		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
1095
+		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
1096 1096
 		$result = $this->_query($query, $connection);
1097
-		if($this->isError())
1097
+		if ($this->isError())
1098 1098
 		{
1099 1099
 			unset($this->param);
1100 1100
 			return $this->queryError($queryObject);
@@ -1135,44 +1135,44 @@  discard block
 block discarded – undo
1135 1135
 	{
1136 1136
 
1137 1137
 		$select = $query->getSelectString($with_values);
1138
-		if($select == '')
1138
+		if ($select == '')
1139 1139
 		{
1140 1140
 			return new BaseObject(-1, "Invalid query");
1141 1141
 		}
1142
-		$select = 'SELECT ' . $select;
1142
+		$select = 'SELECT '.$select;
1143 1143
 
1144 1144
 		$from = $query->getFromString($with_values);
1145
-		if($from == '')
1145
+		if ($from == '')
1146 1146
 		{
1147 1147
 			return new BaseObject(-1, "Invalid query");
1148 1148
 		}
1149
-		$from = ' FROM ' . $from;
1149
+		$from = ' FROM '.$from;
1150 1150
 
1151 1151
 		$where = $query->getWhereString($with_values);
1152
-		if($where != '')
1152
+		if ($where != '')
1153 1153
 		{
1154
-			$where = ' WHERE ' . $where;
1154
+			$where = ' WHERE '.$where;
1155 1155
 		}
1156 1156
 
1157 1157
 		$groupBy = $query->getGroupByString();
1158
-		if($groupBy != '')
1158
+		if ($groupBy != '')
1159 1159
 		{
1160
-			$groupBy = ' GROUP BY ' . $groupBy;
1160
+			$groupBy = ' GROUP BY '.$groupBy;
1161 1161
 		}
1162 1162
 
1163 1163
 		$orderBy = $query->getOrderByString();
1164
-		if($orderBy != '')
1164
+		if ($orderBy != '')
1165 1165
 		{
1166
-			$orderBy = ' ORDER BY ' . $orderBy;
1166
+			$orderBy = ' ORDER BY '.$orderBy;
1167 1167
 		}
1168 1168
 
1169 1169
 		$limit = $query->getLimitString();
1170
-		if($limit != '')
1170
+		if ($limit != '')
1171 1171
 		{
1172 1172
 			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count);
1173 1173
 		}
1174 1174
 
1175
-		return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
1175
+		return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit;
1176 1176
 	}
1177 1177
 
1178 1178
 }
Please login to merge, or discard this patch.
Braces   +31 added lines, -41 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 	function __construct($auto_connect = TRUE)
53 53
 	{
54 54
 		$this->_setDBInfo();
55
-		if($auto_connect) $this->_connect();
55
+		if($auto_connect) {
56
+			$this->_connect();
57
+		}
56 58
 	}
57 59
 
58 60
 	/**
@@ -90,8 +92,9 @@  discard block
 block discarded – undo
90 92
 			define('__CUBRID_VERSION__', $cubrid_version);
91 93
 		}
92 94
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
94
-			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95
+		if(__CUBRID_VERSION__ >= '8.4.0') {
96
+					cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
97
+		}
95 98
 
96 99
 		return $result;
97 100
 	}
@@ -153,8 +156,7 @@  discard block
 block discarded – undo
153 156
 			if(!$transactionLevel)
154 157
 			{
155 158
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156
-			}
157
-			else
159
+			} else
158 160
 			{
159 161
 				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
160 162
 			}
@@ -176,8 +178,7 @@  discard block
 block discarded – undo
176 178
 		if($point)
177 179
 		{
178 180
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
179
-		}
180
-		else
181
+		} else
181 182
 		{
182 183
 			@cubrid_rollback($connection);
183 184
 		}
@@ -251,8 +252,7 @@  discard block
 block discarded – undo
251 252
 								return false;
252 253
 							}
253 254
 						}
254
-					}
255
-					else
255
+					} else
256 256
 					{
257 257
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258 258
 						if(!$bound)
@@ -343,8 +343,7 @@  discard block
 block discarded – undo
343 343
 			if($arrayIndexEndValue)
344 344
 			{
345 345
 				$output[$arrayIndexEndValue--] = $tmp;
346
-			}
347
-			else
346
+			} else
348 347
 			{
349 348
 				$output[] = $tmp;
350 349
 			}
@@ -395,8 +394,9 @@  discard block
 block discarded – undo
395 394
 	 */
396 395
 	function _makeSequence()
397 396
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
399
-			return;
397
+		if($_GLOBALS['XE_EXISTS_SEQUENCE']) {
398
+					return;
399
+		}
400 400
 
401 401
 		// check cubrid serial
402 402
 		$query = sprintf('select count(*) as "count" from "db_serial" where name=\'%ssequence\'', $this->prefix);
@@ -421,8 +421,7 @@  discard block
 block discarded – undo
421 421
 			if($srl < 1)
422 422
 			{
423 423
 				$start = 1;
424
-			}
425
-			else
424
+			} else
426 425
 			{
427 426
 				$start = $srl + 1000000;
428 427
 			}
@@ -445,8 +444,7 @@  discard block
 block discarded – undo
445 444
 		if($target_name == 'sequence')
446 445
 		{
447 446
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448
-		}
449
-		else
447
+		} else
450 448
 		{
451 449
 			$query = sprintf("select \"class_name\" from \"db_class\" where \"class_name\" = '%s%s'", $this->prefix, $target_name);
452 450
 		}
@@ -455,8 +453,7 @@  discard block
 block discarded – undo
455 453
 		if(cubrid_num_rows($result) > 0)
456 454
 		{
457 455
 			$output = TRUE;
458
-		}
459
-		else
456
+		} else
460 457
 		{
461 458
 			$output = FALSE;
462 459
 		}
@@ -500,8 +497,7 @@  discard block
 block discarded – undo
500 497
 		if($size)
501 498
 		{
502 499
 			$query .= sprintf("%s(%s) ", $type, $size);
503
-		}
504
-		else
500
+		} else
505 501
 		{
506 502
 			$query .= sprintf("%s ", $type);
507 503
 		}
@@ -511,8 +507,7 @@  discard block
 block discarded – undo
511 507
 			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 508
 			{
513 509
 				$query .= sprintf("default %d ", $default);
514
-			}
515
-			else
510
+			} else
516 511
 			{
517 512
 				$query .= sprintf("default '%s' ", $default);
518 513
 			}
@@ -553,8 +548,7 @@  discard block
 block discarded – undo
553 548
 		if(cubrid_num_rows($result) > 0)
554 549
 		{
555 550
 			$output = TRUE;
556
-		}
557
-		else
551
+		} else
558 552
 		{
559 553
 			$output = FALSE;
560 554
 		}
@@ -674,8 +668,7 @@  discard block
 block discarded – undo
674 668
 		if(!is_array($output))
675 669
 		{
676 670
 			$indexes_to_be_deleted = array($output);
677
-		}
678
-		else
671
+		} else
679 672
 		{
680 673
 			$indexes_to_be_deleted = $output;
681 674
 		}
@@ -758,8 +751,7 @@  discard block
 block discarded – undo
758 751
 		if(!is_array($xml_obj->table->column))
759 752
 		{
760 753
 			$columns[] = $xml_obj->table->column;
761
-		}
762
-		else
754
+		} else
763 755
 		{
764 756
 			$columns = $xml_obj->table->column;
765 757
 		}
@@ -799,8 +791,9 @@  discard block
 block discarded – undo
799 791
 
800 792
 			if($type == 'varchar' || $type == 'char')
801 793
 			{
802
-				if($size)
803
-					$size = $size * 3;
794
+				if($size) {
795
+									$size = $size * 3;
796
+				}
804 797
 			}
805 798
 
806 799
 
@@ -809,12 +802,10 @@  discard block
 block discarded – undo
809 802
 			if($primary_key)
810 803
 			{
811 804
 				$primary_list[] = $name;
812
-			}
813
-			else if($unique)
805
+			} else if($unique)
814 806
 			{
815 807
 				$unique_list[$unique][] = $name;
816
-			}
817
-			else if($index)
808
+			} else if($index)
818 809
 			{
819 810
 				$index_list[$index][] = $name;
820 811
 			}
@@ -964,8 +955,7 @@  discard block
 block discarded – undo
964 955
 		if($limit && $limit->isPageHandler())
965 956
 		{
966 957
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967
-		}
968
-		else
958
+		} else
969 959
 		{
970 960
 			$query = $this->getSelectSql($queryObject, $with_values);
971 961
 			if(is_a($query, 'BaseObject'))
@@ -1009,8 +999,9 @@  discard block
 block discarded – undo
1009 999
 			$buff->data = array();
1010 1000
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 1001
 			return $buff;
1012
-		}else
1013
-			return;
1002
+		} else {
1003
+					return;
1004
+		}
1014 1005
 	}
1015 1006
 
1016 1007
 	/**
@@ -1069,8 +1060,7 @@  discard block
 block discarded – undo
1069 1060
 		if($total_count)
1070 1061
 		{
1071 1062
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072
-		}
1073
-		else
1063
+		} else
1074 1064
 		{
1075 1065
 			$total_page = 1;
1076 1066
 		}
Please login to merge, or discard this patch.
classes/db/DBMssql.class.php 3 patches
Doc Comments   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	/**
112 112
 	 * DB transaction start
113 113
 	 * this method is private
114
-	 * @return boolean
114
+	 * @return null|boolean
115 115
 	 */
116 116
 	function _begin($transactionLevel = 0)
117 117
 	{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * this method is private
171 171
 	 * @param string $query
172 172
 	 * @param resource $connection
173
-	 * @return resource|boolean Returns a statement resource on success and FALSE if an error occurred.
173
+	 * @return resource Returns a statement resource on success and FALSE if an error occurred.
174 174
 	 */
175 175
 	function __query($query, $connection)
176 176
 	{
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param int $size column size
376 376
 	 * @param string|int $default default value
377 377
 	 * @param boolean $notnull not null status, default value is false
378
-	 * @return void
378
+	 * @return null|resource
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * Check column exist status of the table
432 432
 	 * @param string $table_name table name
433 433
 	 * @param string $column_name column name
434
-	 * @return boolean
434
+	 * @return null|boolean
435 435
 	 */
436 436
 	function isColumnExists($table_name, $column_name)
437 437
 	{
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * Check index status of the table
496 496
 	 * @param string $table_name table name
497 497
 	 * @param string $index_name index name
498
-	 * @return boolean
498
+	 * @return null|boolean
499 499
 	 */
500 500
 	function isIndexExists($table_name, $index_name)
501 501
 	{
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 	/**
676 676
 	 * Return update query string
677
-	 * @param object $query
677
+	 * @param BaseObject $query
678 678
 	 * @param boolean $with_values
679 679
 	 * @param boolean $with_priority
680 680
 	 * @return string
@@ -726,8 +726,9 @@  discard block
 block discarded – undo
726 726
 
727 727
 	/**
728 728
 	 * Return select query string
729
-	 * @param object $query
729
+	 * @param BaseObject $query
730 730
 	 * @param boolean $with_values
731
+	 * @param resource $connection
731 732
 	 * @return string
732 733
 	 */
733 734
 	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	function __construct($auto_connect = TRUE)
46 46
 	{
47 47
 		$this->_setDBInfo();
48
-		if($auto_connect) $this->_connect();
48
+		if ($auto_connect) $this->_connect();
49 49
 	}
50 50
 
51 51
 	/**
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 		//sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
71 71
 		$result = @sqlsrv_connect($connection["db_hostname"], array('Database' => $connection["db_database"], 'UID' => $connection["db_userid"], 'PWD' => $connection["db_password"]));
72 72
 
73
-		if(!$result)
73
+		if (!$result)
74 74
 		{
75 75
 			$errors = print_r(sqlsrv_errors(), true);
76
-			$this->setError(-1, 'database connect fail' . PHP_EOL . $errors);
76
+			$this->setError(-1, 'database connect fail'.PHP_EOL.$errors);
77 77
 			return;
78 78
 		}
79 79
 		return $result;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	function addQuotes($string)
101 101
 	{
102
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
102
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
103 103
 		{
104 104
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
105 105
 		}
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	{
118 118
 		$connection = $this->_getConnection('master');
119 119
 
120
-		if(!$transactionLevel)
120
+		if (!$transactionLevel)
121 121
 		{
122
-			if(sqlsrv_begin_transaction($connection) === false)
122
+			if (sqlsrv_begin_transaction($connection) === false)
123 123
 			{
124 124
 				return;
125 125
 			}
126 126
 		}
127 127
 		else
128 128
 		{
129
-			$this->_query("SAVE TRANS SP" . $transactionLevel, $connection);
129
+			$this->_query("SAVE TRANS SP".$transactionLevel, $connection);
130 130
 		}
131 131
 		return true;
132 132
 	}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$point = $transactionLevel - 1;
144 144
 
145
-		if($point)
145
+		if ($point)
146 146
 		{
147
-			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
147
+			$this->_query("ROLLBACK TRANS SP".$point, $connection);
148 148
 		}
149 149
 		else
150 150
 		{
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		$_param = array();
178 178
 
179
-		if(count($this->param))
179
+		if (count($this->param))
180 180
 		{
181
-			foreach($this->param as $k => $o)
181
+			foreach ($this->param as $k => $o)
182 182
 			{
183
-				if($o->isColumnName())
183
+				if ($o->isColumnName())
184 184
 				{
185 185
 					continue;
186 186
 				}
187
-				if($o->getType() == 'number')
187
+				if ($o->getType() == 'number')
188 188
 				{
189 189
 					$value = $o->getUnescapedValue();
190
-					if(is_array($value))
190
+					if (is_array($value))
191 191
 					{
192 192
 						$_param = array_merge($_param, $value);
193 193
 					}
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 				else
200 200
 				{
201 201
 					$value = $o->getUnescapedValue();
202
-					if(is_array($value))
202
+					if (is_array($value))
203 203
 					{
204
-						foreach($value as $v)
204
+						foreach ($value as $v)
205 205
 						{
206 206
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 207
 						}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
 		// Run the query statement
218 218
 		$result = false;
219
-		if(count($_param))
219
+		if (count($_param))
220 220
 		{
221 221
 			$args = $this->_getParametersByReference($_param);
222 222
 			$stmt = sqlsrv_prepare($connection, $query, $args);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$stmt = sqlsrv_prepare($connection, $query);
227 227
 		}
228 228
 
229
-		if(!$stmt)
229
+		if (!$stmt)
230 230
 		{
231 231
 			$result = false;
232 232
 		}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 
238 238
 		// Error Check
239
-		if(!$result)
239
+		if (!$result)
240 240
 		{
241 241
 			$this->setError(print_r(sqlsrv_errors(), true));
242 242
 		}
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 		$copy = array();
260 260
 		$args = array();
261 261
 		$i = 0;
262
-		foreach($_param as $key => $value)
262
+		foreach ($_param as $key => $value)
263 263
 		{
264
-			if(is_array($value))
264
+			if (is_array($value))
265 265
 			{
266 266
 				$value_copy = $value;
267 267
 				$value_arg = array();
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	function _fetch($result, $arrayIndexEndValue = NULL)
289 289
 	{
290 290
 		$output = array();
291
-		if(!$this->isConnected() || $this->isError() || !$result)
291
+		if (!$this->isConnected() || $this->isError() || !$result)
292 292
 		{
293 293
 			return $output;
294 294
 		}
@@ -296,18 +296,18 @@  discard block
 block discarded – undo
296 296
 		$c = sqlsrv_num_fields($result);
297 297
 		$m = null;
298 298
 
299
-		while(sqlsrv_fetch($result))
299
+		while (sqlsrv_fetch($result))
300 300
 		{
301
-			if(!$m)
301
+			if (!$m)
302 302
 			{
303 303
 				$m = sqlsrv_field_metadata($result);
304 304
 			}
305 305
 			unset($row);
306
-			for($i = 0; $i < $c; $i++)
306
+			for ($i = 0; $i < $c; $i++)
307 307
 			{
308 308
 				$row->{$m[$i]['Name']} = sqlsrv_get_field($result, $i, SQLSRV_PHPTYPE_STRING('utf-8'));
309 309
 			}
310
-			if($arrayIndexEndValue)
310
+			if ($arrayIndexEndValue)
311 311
 			{
312 312
 				$output[$arrayIndexEndValue--] = $row;
313 313
 			}
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 		}
319 319
 
320
-		if(count($output) == 1)
320
+		if (count($output) == 1)
321 321
 		{
322
-			if(isset($arrayIndexEndValue))
322
+			if (isset($arrayIndexEndValue))
323 323
 			{
324 324
 				return $output;
325 325
 			}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		$result = $this->_query($query);
361 361
 		$tmp = $this->_fetch($result);
362 362
 
363
-		if(!$tmp)
363
+		if (!$tmp)
364 364
 		{
365 365
 			return false;
366 366
 		}
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
382
-		if($this->isColumnExists($table_name, $column_name))
382
+		if ($this->isColumnExists($table_name, $column_name))
383 383
 		{
384 384
 			return;
385 385
 		}
386 386
 		$type = $this->column_type[$type];
387
-		if(strtoupper($type) == 'INTEGER')
387
+		if (strtoupper($type) == 'INTEGER')
388 388
 		{
389 389
 			$size = '';
390 390
 		}
391 391
 
392 392
 		$query = sprintf("alter table %s%s add \"%s\" ", $this->prefix, $table_name, $column_name);
393
-		if($size)
393
+		if ($size)
394 394
 		{
395 395
 			$query .= sprintf(" %s(%s) ", $type, $size);
396 396
 		}
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 			$query .= sprintf(" %s ", $type);
400 400
 		}
401 401
 
402
-		if(isset($default))
402
+		if (isset($default))
403 403
 		{
404 404
 			$query .= sprintf(" default '%s' ", $default);
405 405
 		}
406
-		if($notnull)
406
+		if ($notnull)
407 407
 		{
408 408
 			$query .= " not null ";
409 409
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	function dropColumn($table_name, $column_name)
421 421
 	{
422
-		if(!$this->isColumnExists($table_name, $column_name))
422
+		if (!$this->isColumnExists($table_name, $column_name))
423 423
 		{
424 424
 			return;
425 425
 		}
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
 	{
438 438
 		$query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name);
439 439
 		$result = $this->_query($query);
440
-		if($this->isError())
440
+		if ($this->isError())
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 		$tmp = $this->_fetch($result);
445
-		if(!$tmp->name)
445
+		if (!$tmp->name)
446 446
 		{
447 447
 			return false;
448 448
 		}
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = false)
463 463
 	{
464
-		if($this->isIndexExists($table_name, $index_name))
464
+		if ($this->isIndexExists($table_name, $index_name))
465 465
 		{
466 466
 			return;
467 467
 		}
468
-		if(!is_array($target_columns))
468
+		if (!is_array($target_columns))
469 469
 		{
470 470
 			$target_columns = array($target_columns);
471 471
 		}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	function dropIndex($table_name, $index_name, $is_unique = false)
485 485
 	{
486
-		if(!$this->isIndexExists($table_name, $index_name))
486
+		if (!$this->isIndexExists($table_name, $index_name))
487 487
 		{
488 488
 			return;
489 489
 		}
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 		$query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name);
503 503
 
504 504
 		$result = $this->_query($query);
505
-		if($this->isError())
505
+		if ($this->isError())
506 506
 		{
507 507
 			return;
508 508
 		}
509 509
 		$tmp = $this->_fetch($result);
510 510
 
511
-		if(!$tmp->name)
511
+		if (!$tmp->name)
512 512
 		{
513 513
 			return false;
514 514
 		}
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	function createTableByXmlFile($file_name)
534 534
 	{
535
-		if(!file_exists($file_name))
535
+		if (!file_exists($file_name))
536 536
 		{
537 537
 			return;
538 538
 		}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 		$xml_obj = $oXml->parse($xml_doc);
558 558
 		// Create a table schema
559 559
 		$table_name = $xml_obj->table->attrs->name;
560
-		if($this->isTableExists($table_name))
560
+		if ($this->isTableExists($table_name))
561 561
 		{
562 562
 			return;
563 563
 		}
564 564
 
565
-		if($table_name == 'sequence')
565
+		if ($table_name == 'sequence')
566 566
 		{
567
-			$table_name = $this->prefix . $table_name;
567
+			$table_name = $this->prefix.$table_name;
568 568
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
569 569
 			return $this->_query($query);
570 570
 		}
571 571
 		else
572 572
 		{
573
-			$table_name = $this->prefix . $table_name;
573
+			$table_name = $this->prefix.$table_name;
574 574
 
575
-			if(!is_array($xml_obj->table->column))
575
+			if (!is_array($xml_obj->table->column))
576 576
 			{
577 577
 				$columns[] = $xml_obj->table->column;
578 578
 			}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			$index_list = array();
587 587
 
588 588
 			$typeList = array('number' => 1, 'text' => 1);
589
-			foreach($columns as $column)
589
+			foreach ($columns as $column)
590 590
 			{
591 591
 				$name = $column->attrs->name;
592 592
 				$type = $column->attrs->type;
@@ -598,48 +598,48 @@  discard block
 block discarded – undo
598 598
 				$default = $column->attrs->default;
599 599
 				$auto_increment = $column->attrs->auto_increment;
600 600
 
601
-				$column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : '');
601
+				$column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : '');
602 602
 
603
-				if($primary_key)
603
+				if ($primary_key)
604 604
 				{
605 605
 					$primary_list[] = $name;
606 606
 				}
607
-				else if($unique)
607
+				else if ($unique)
608 608
 				{
609 609
 					$unique_list[$unique][] = $name;
610 610
 				}
611
-				else if($index)
611
+				else if ($index)
612 612
 				{
613 613
 					$index_list[$index][] = $name;
614 614
 				}
615 615
 			}
616 616
 
617
-			if(count($primary_list))
617
+			if (count($primary_list))
618 618
 			{
619
-				$column_schema[] = sprintf("primary key (%s)", '"' . implode($primary_list, '","') . '"');
619
+				$column_schema[] = sprintf("primary key (%s)", '"'.implode($primary_list, '","').'"');
620 620
 			}
621 621
 
622 622
 			$schema = sprintf('create table [%s] (%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"));
623 623
 			$output = $this->_query($schema);
624
-			if(!$output)
624
+			if (!$output)
625 625
 			{
626 626
 				return false;
627 627
 			}
628 628
 
629
-			if(count($unique_list))
629
+			if (count($unique_list))
630 630
 			{
631
-				foreach($unique_list as $key => $val)
631
+				foreach ($unique_list as $key => $val)
632 632
 				{
633
-					$query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
633
+					$query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']');
634 634
 					$this->_query($query);
635 635
 				}
636 636
 			}
637 637
 
638
-			if(count($index_list))
638
+			if (count($index_list))
639 639
 			{
640
-				foreach($index_list as $key => $val)
640
+				foreach ($index_list as $key => $val)
641 641
 				{
642
-					$query = sprintf("create index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
642
+					$query = sprintf("create index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']');
643 643
 					$this->_query($query);
644 644
 				}
645 645
 			}
@@ -682,34 +682,34 @@  discard block
 block discarded – undo
682 682
 	function getUpdateSql($query, $with_values = true, $with_priority = false)
683 683
 	{
684 684
 		$columnsList = $query->getUpdateString($with_values);
685
-		if($columnsList == '')
685
+		if ($columnsList == '')
686 686
 		{
687 687
 			return new BaseObject(-1, "Invalid query");
688 688
 		}
689 689
 
690 690
 		$from = $query->getFromString($with_values);
691
-		if($from == '')
691
+		if ($from == '')
692 692
 		{
693 693
 			return new BaseObject(-1, "Invalid query");
694 694
 		}
695 695
 
696 696
 		$tables = $query->getTables();
697 697
 		$alias_list = '';
698
-		foreach($tables as $table)
698
+		foreach ($tables as $table)
699 699
 		{
700 700
 			$alias_list .= $table->getAlias();
701 701
 		}
702 702
 		implode(',', explode(' ', $alias_list));
703 703
 
704 704
 		$where = $query->getWhereString($with_values);
705
-		if($where != '')
705
+		if ($where != '')
706 706
 		{
707
-			$where = ' WHERE ' . $where;
707
+			$where = ' WHERE '.$where;
708 708
 		}
709 709
 
710 710
 		$priority = $with_priority ? $query->getPriority() : '';
711 711
 
712
-		return "UPDATE $priority $alias_list SET $columnsList FROM " . $from . $where;
712
+		return "UPDATE $priority $alias_list SET $columnsList FROM ".$from.$where;
713 713
 	}
714 714
 
715 715
 	/**
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @param boolean $with_values
731 731
 	 * @return string
732 732
 	 */
733
-	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
733
+	function getSelectSql($query, $with_values = TRUE, $connection = NULL)
734 734
 	{
735 735
 		$with_values = false;
736 736
 
@@ -740,75 +740,75 @@  discard block
 block discarded – undo
740 740
 		$limit = '';
741 741
 		$limitCount = '';
742 742
 		$limitQueryPart = $query->getLimit();
743
-		if($limitQueryPart)
743
+		if ($limitQueryPart)
744 744
 		{
745 745
 			$limitCount = $limitQueryPart->getLimit();
746 746
 		}
747
-		if($limitCount != '')
747
+		if ($limitCount != '')
748 748
 		{
749
-			$limit = 'SELECT TOP ' . $limitCount;
749
+			$limit = 'SELECT TOP '.$limitCount;
750 750
 		}
751 751
 
752 752
 		$select = $query->getSelectString($with_values);
753
-		if($select == '')
753
+		if ($select == '')
754 754
 		{
755 755
 			return new BaseObject(-1, "Invalid query");
756 756
 		}
757
-		if($limit != '')
757
+		if ($limit != '')
758 758
 		{
759
-			$select = $limit . ' ' . $select;
759
+			$select = $limit.' '.$select;
760 760
 		}
761 761
 		else
762 762
 		{
763
-			$select = 'SELECT ' . $select;
763
+			$select = 'SELECT '.$select;
764 764
 		}
765 765
 
766 766
 		$from = $query->getFromString($with_values);
767
-		if($from == '')
767
+		if ($from == '')
768 768
 		{
769 769
 			return new BaseObject(-1, "Invalid query");
770 770
 		}
771
-		$from = ' FROM ' . $from;
771
+		$from = ' FROM '.$from;
772 772
 
773 773
 		$where = $query->getWhereString($with_values);
774
-		if($where != '')
774
+		if ($where != '')
775 775
 		{
776
-			$where = ' WHERE ' . $where;
776
+			$where = ' WHERE '.$where;
777 777
 		}
778 778
 
779 779
 		$groupBy = $query->getGroupByString();
780
-		if($groupBy != '')
780
+		if ($groupBy != '')
781 781
 		{
782
-			$groupBy = ' GROUP BY ' . $groupBy;
782
+			$groupBy = ' GROUP BY '.$groupBy;
783 783
 		}
784 784
 
785 785
 		$orderBy = $query->getOrderByString();
786
-		if($orderBy != '')
786
+		if ($orderBy != '')
787 787
 		{
788
-			$orderBy = ' ORDER BY ' . $orderBy;
788
+			$orderBy = ' ORDER BY '.$orderBy;
789 789
 		}
790 790
 
791
-		if($limitCount != '' && $query->limit->start > 0)
791
+		if ($limitCount != '' && $query->limit->start > 0)
792 792
 		{
793 793
 			$order = $query->getOrder();
794 794
 			$first_columns = array();
795
-			foreach($order as $val)
795
+			foreach ($order as $val)
796 796
 			{
797 797
 				$tmpColumnName = $val->getPureColumnName();
798
-				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder()=='asc'?'max':'min', $tmpColumnName, $tmpColumnName);
798
+				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder() == 'asc' ? 'max' : 'min', $tmpColumnName, $tmpColumnName);
799 799
 				$first_sub_columns[] = $tmpColumnName;
800 800
 			}
801 801
 
802
-			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',',$first_columns),  $query->limit->start, implode(',',$first_sub_columns), $from, $where, $groupBy, $orderBy);
802
+			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',', $first_columns), $query->limit->start, implode(',', $first_sub_columns), $from, $where, $groupBy, $orderBy);
803 803
 			$this->param = $query->getArguments();
804 804
 			$result = $this->__query($first_query, $connection);
805 805
 			$tmp = $this->_fetch($result);
806 806
 
807 807
 			$sub_cond = array();
808
-			foreach($order as $k => $v)
808
+			foreach ($order as $k => $v)
809 809
 			{
810 810
 				//for example... use Document
811
-				if(get_class($v->sort_order) == 'SortArgument')
811
+				if (get_class($v->sort_order) == 'SortArgument')
812 812
 				{
813 813
 					$sort_order = $v->sort_order->value;
814 814
 				}
@@ -818,19 +818,19 @@  discard block
 block discarded – undo
818 818
 					$sort_order = $v->sort_order;
819 819
 				}
820 820
 
821
-				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order=='asc'?'>':'<', $tmp->{$v->getPureColumnName()});
821
+				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order == 'asc' ? '>' : '<', $tmp->{$v->getPureColumnName()});
822 822
 			}
823 823
 
824
-			if(!$where)
824
+			if (!$where)
825 825
 			{
826
-				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
826
+				$sub_condition = ' WHERE ( '.implode(' and ', $sub_cond).' )';
827 827
 			}
828 828
 			else
829 829
 			{
830
-				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
830
+				$sub_condition = ' and ( '.implode(' and ', $sub_cond).' )';
831 831
 			}
832 832
 		}
833
-		return $select . ' ' . $from . ' ' . $where .$sub_condition. ' ' . $groupBy . ' ' . $orderBy;
833
+		return $select.' '.$from.' '.$where.$sub_condition.' '.$groupBy.' '.$orderBy;
834 834
 	}
835 835
 
836 836
 	/**
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	{
846 846
 		$query = $this->getSelectSql($queryObject, true, $connection);
847 847
 
848
-		if(strpos($query, "substr"))
848
+		if (strpos($query, "substr"))
849 849
 		{
850 850
 			$query = str_replace("substr", "substring", $query);
851 851
 		}
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
 		// TODO Decide if we continue to pass parameters like this
854 854
 		$this->param = $queryObject->getArguments();
855 855
 
856
-		$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
856
+		$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
857 857
 		$result = $this->_query($query, $connection);
858 858
 
859
-		if($this->isError())
859
+		if ($this->isError())
860 860
 		{
861 861
 			return $this->queryError($queryObject);
862 862
 		}
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	function queryError($queryObject)
885 885
 	{
886 886
 		$limit = $queryObject->getLimit();
887
-		if($limit && $limit->isPageHandler())
887
+		if ($limit && $limit->isPageHandler())
888 888
 		{
889 889
 			$buff = new BaseObject();
890 890
 			$buff->total_count = 0;
@@ -910,52 +910,52 @@  discard block
 block discarded – undo
910 910
 	function queryPageLimit($queryObject, $result, $connection)
911 911
 	{
912 912
 		$limit = $queryObject->getLimit();
913
-		if($limit && $limit->isPageHandler())
913
+		if ($limit && $limit->isPageHandler())
914 914
 		{
915 915
 			// Total count
916 916
 			$temp_where = $queryObject->getWhereString(true, false);
917
-			$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
917
+			$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '.$temp_where));
918 918
 
919 919
 			// Check for distinct query and if found update count query structure
920 920
 			$temp_select = $queryObject->getSelectString(true);
921 921
 			$uses_distinct = stripos($temp_select, "distinct") !== false;
922 922
 			$uses_groupby = $queryObject->getGroupByString() != '';
923
-			if($uses_distinct || $uses_groupby)
923
+			if ($uses_distinct || $uses_groupby)
924 924
 			{
925 925
 				$count_query = sprintf('select %s %s %s %s'
926 926
 						, $temp_select
927
-						, 'FROM ' . $queryObject->getFromString(true)
928
-						, ($temp_where === '' ? '' : ' WHERE ' . $temp_where)
929
-						, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
927
+						, 'FROM '.$queryObject->getFromString(true)
928
+						, ($temp_where === '' ? '' : ' WHERE '.$temp_where)
929
+						, ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '')
930 930
 				);
931 931
 
932 932
 				// If query uses grouping or distinct, count from original select
933 933
 				$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
934 934
 			}
935 935
 
936
-			$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
936
+			$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
937 937
 			$this->param = $queryObject->getArguments();
938 938
 			$result_count = $this->_query($count_query, $connection);
939 939
 			$count_output = $this->_fetch($result_count);
940 940
 			$total_count = (int) $count_output->count;
941 941
 
942 942
 			$list_count = $limit->list_count->getValue();
943
-			if(!$list_count)
943
+			if (!$list_count)
944 944
 			{
945 945
 				$list_count = 20;
946 946
 			}
947 947
 			$page_count = $limit->page_count->getValue();
948
-			if(!$page_count)
948
+			if (!$page_count)
949 949
 			{
950 950
 				$page_count = 10;
951 951
 			}
952 952
 			$page = $limit->page->getValue();
953
-			if(!$page || $page < 1)
953
+			if (!$page || $page < 1)
954 954
 			{
955 955
 				$page = 1;
956 956
 			}
957 957
 			// Total pages
958
-			if($total_count)
958
+			if ($total_count)
959 959
 			{
960 960
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961 961
 			}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 			}
966 966
 
967 967
 			// check the page variables
968
-			if($page > $total_page)
968
+			if ($page > $total_page)
969 969
 			{
970 970
 				// If requested page is bigger than total number of pages, return empty list
971 971
 
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
978 978
 				return $buff;
979 979
 
980
-				if($queryObject->usesClickCount())
980
+				if ($queryObject->usesClickCount())
981 981
 				{
982 982
 					$update_query = $this->getClickCountQuery($queryObject);
983 983
 					$this->_executeUpdateAct($update_query);
Please login to merge, or discard this patch.
Braces   +24 added lines, -43 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 	function __construct($auto_connect = TRUE)
46 46
 	{
47 47
 		$this->_setDBInfo();
48
-		if($auto_connect) $this->_connect();
48
+		if($auto_connect) {
49
+			$this->_connect();
50
+		}
49 51
 	}
50 52
 
51 53
 	/**
@@ -123,8 +125,7 @@  discard block
 block discarded – undo
123 125
 			{
124 126
 				return;
125 127
 			}
126
-		}
127
-		else
128
+		} else
128 129
 		{
129 130
 			$this->_query("SAVE TRANS SP" . $transactionLevel, $connection);
130 131
 		}
@@ -145,8 +146,7 @@  discard block
 block discarded – undo
145 146
 		if($point)
146 147
 		{
147 148
 			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
148
-		}
149
-		else
149
+		} else
150 150
 		{
151 151
 			sqlsrv_rollback($connection);
152 152
 		}
@@ -190,13 +190,11 @@  discard block
 block discarded – undo
190 190
 					if(is_array($value))
191 191
 					{
192 192
 						$_param = array_merge($_param, $value);
193
-					}
194
-					else
193
+					} else
195 194
 					{
196 195
 						$_param[] = $o->getUnescapedValue();
197 196
 					}
198
-				}
199
-				else
197
+				} else
200 198
 				{
201 199
 					$value = $o->getUnescapedValue();
202 200
 					if(is_array($value))
@@ -205,8 +203,7 @@  discard block
 block discarded – undo
205 203
 						{
206 204
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 205
 						}
208
-					}
209
-					else
206
+					} else
210 207
 					{
211 208
 						$_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
212 209
 					}
@@ -220,8 +217,7 @@  discard block
 block discarded – undo
220 217
 		{
221 218
 			$args = $this->_getParametersByReference($_param);
222 219
 			$stmt = sqlsrv_prepare($connection, $query, $args);
223
-		}
224
-		else
220
+		} else
225 221
 		{
226 222
 			$stmt = sqlsrv_prepare($connection, $query);
227 223
 		}
@@ -229,8 +225,7 @@  discard block
 block discarded – undo
229 225
 		if(!$stmt)
230 226
 		{
231 227
 			$result = false;
232
-		}
233
-		else
228
+		} else
234 229
 		{
235 230
 			$result = sqlsrv_execute($stmt);
236 231
 		}
@@ -268,8 +263,7 @@  discard block
 block discarded – undo
268 263
 				$value_arg[] = &$value_copy[0];
269 264
 				$value_arg[] = $value_copy[1];
270 265
 				$value_arg[] = $value_copy[2];
271
-			}
272
-			else
266
+			} else
273 267
 			{
274 268
 				$value_arg = $value;
275 269
 			}
@@ -310,8 +304,7 @@  discard block
 block discarded – undo
310 304
 			if($arrayIndexEndValue)
311 305
 			{
312 306
 				$output[$arrayIndexEndValue--] = $row;
313
-			}
314
-			else
307
+			} else
315 308
 			{
316 309
 				$output[] = $row;
317 310
 			}
@@ -322,8 +315,7 @@  discard block
 block discarded – undo
322 315
 			if(isset($arrayIndexEndValue))
323 316
 			{
324 317
 				return $output;
325
-			}
326
-			else
318
+			} else
327 319
 			{
328 320
 				return $output[0];
329 321
 			}
@@ -393,8 +385,7 @@  discard block
 block discarded – undo
393 385
 		if($size)
394 386
 		{
395 387
 			$query .= sprintf(" %s(%s) ", $type, $size);
396
-		}
397
-		else
388
+		} else
398 389
 		{
399 390
 			$query .= sprintf(" %s ", $type);
400 391
 		}
@@ -567,16 +558,14 @@  discard block
 block discarded – undo
567 558
 			$table_name = $this->prefix . $table_name;
568 559
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
569 560
 			return $this->_query($query);
570
-		}
571
-		else
561
+		} else
572 562
 		{
573 563
 			$table_name = $this->prefix . $table_name;
574 564
 
575 565
 			if(!is_array($xml_obj->table->column))
576 566
 			{
577 567
 				$columns[] = $xml_obj->table->column;
578
-			}
579
-			else
568
+			} else
580 569
 			{
581 570
 				$columns = $xml_obj->table->column;
582 571
 			}
@@ -603,12 +592,10 @@  discard block
 block discarded – undo
603 592
 				if($primary_key)
604 593
 				{
605 594
 					$primary_list[] = $name;
606
-				}
607
-				else if($unique)
595
+				} else if($unique)
608 596
 				{
609 597
 					$unique_list[$unique][] = $name;
610
-				}
611
-				else if($index)
598
+				} else if($index)
612 599
 				{
613 600
 					$index_list[$index][] = $name;
614 601
 				}
@@ -757,8 +744,7 @@  discard block
 block discarded – undo
757 744
 		if($limit != '')
758 745
 		{
759 746
 			$select = $limit . ' ' . $select;
760
-		}
761
-		else
747
+		} else
762 748
 		{
763 749
 			$select = 'SELECT ' . $select;
764 750
 		}
@@ -824,8 +810,7 @@  discard block
 block discarded – undo
824 810
 			if(!$where)
825 811
 			{
826 812
 				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
827
-			}
828
-			else
813
+			} else
829 814
 			{
830 815
 				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
831 816
 			}
@@ -859,8 +844,7 @@  discard block
 block discarded – undo
859 844
 		if($this->isError())
860 845
 		{
861 846
 			return $this->queryError($queryObject);
862
-		}
863
-		else
847
+		} else
864 848
 		{
865 849
 			return $this->queryPageLimit($queryObject, $result, $connection);
866 850
 		}
@@ -893,8 +877,7 @@  discard block
 block discarded – undo
893 877
 			$buff->data = array();
894 878
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
895 879
 			return $buff;
896
-		}
897
-		else
880
+		} else
898 881
 		{
899 882
 			return;
900 883
 		}
@@ -958,8 +941,7 @@  discard block
 block discarded – undo
958 941
 			if($total_count)
959 942
 			{
960 943
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961
-			}
962
-			else
944
+			} else
963 945
 			{
964 946
 				$total_page = 1;
965 947
 			}
@@ -995,8 +977,7 @@  discard block
 block discarded – undo
995 977
 			$buff->page = $page;
996 978
 			$buff->data = $data;
997 979
 			$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
998
-		}
999
-		else
980
+		} else
1000 981
 		{
1001 982
 			$data = $this->_fetch($result);
1002 983
 			$buff = new BaseObject();
Please login to merge, or discard this patch.