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 (#2075)
by Sanghyuck
12:25
created
modules/module/module.model.php 1 patch
Spacing   +364 added lines, -364 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
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,23 +918,23 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
937
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
938 938
 
939 939
 					$index = $action->attrs->index;
940 940
 					$admin_index = $action->attrs->admin_index;
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 					$info->action->{$name}->ruleset = $ruleset;
950 950
 					$info->action->{$name}->method = $method;
951 951
 					$info->action->{$name}->check_csrf = $check_csrf;
952
-					if($action->attrs->menu_name)
952
+					if ($action->attrs->menu_name)
953 953
 					{
954
-						if($menu_index == 'true')
954
+						if ($menu_index == 'true')
955 955
 						{
956 956
 							$info->menu->{$action->attrs->menu_name}->index = $name;
957 957
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
958 958
 						}
959
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
959
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
960 960
 						{
961 961
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
962 962
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -974,22 +974,22 @@  discard block
 block discarded – undo
974 974
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
975 975
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
976 976
 
977
-					if($index=='true')
977
+					if ($index == 'true')
978 978
 					{
979 979
 						$default_index_act = $name;
980 980
 						$info->default_index_act = $name;
981 981
 					}
982
-					if($admin_index=='true')
982
+					if ($admin_index == 'true')
983 983
 					{
984 984
 						$admin_index_act = $name;
985 985
 						$info->admin_index_act = $name;
986 986
 					}
987
-					if($setup_index=='true')
987
+					if ($setup_index == 'true')
988 988
 					{
989 989
 						$setup_index_act = $name;
990 990
 						$info->setup_index_act = $name;
991 991
 					}
992
-					if($simple_setup_index=='true')
992
+					if ($simple_setup_index == 'true')
993 993
 					{
994 994
 						$simple_setup_index_act = $name;
995 995
 						$info->simple_setup_index_act = $name;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			return $info;
1011 1011
 		}
1012 1012
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1013
+		if (file_exists($cache_file)) return include($cache_file);
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	{
1022 1022
 		$module = Context::get('module_type');
1023 1023
 
1024
-		if($module == 'ARTICLE')
1024
+		if ($module == 'ARTICLE')
1025 1025
 		{
1026 1026
 			$module = 'page';
1027 1027
 		}
@@ -1041,26 +1041,26 @@  discard block
 block discarded – undo
1041 1041
 	 */
1042 1042
 	function getSkins($path, $dir = 'skins')
1043 1043
 	{
1044
-		if(substr($path, -1) == '/')
1044
+		if (substr($path, -1) == '/')
1045 1045
 		{
1046 1046
 			$path = substr($path, 0, -1);
1047 1047
 		}
1048 1048
 
1049 1049
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1050
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1051
+		if (!count($list)) return;
1052 1052
 
1053 1053
 		natcasesort($list);
1054 1054
 
1055
-		foreach($list as $skin_name)
1055
+		foreach ($list as $skin_name)
1056 1056
 		{
1057
-			if(!is_dir($skin_path . $skin_name))
1057
+			if (!is_dir($skin_path.$skin_name))
1058 1058
 			{
1059 1059
 				continue;
1060 1060
 			}
1061 1061
 			unset($skin_info);
1062 1062
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1063
-			if(!$skin_info)
1063
+			if (!$skin_info)
1064 1064
 			{
1065 1065
 				$skin_info = new stdClass();
1066 1066
 				$skin_info->title = $skin_name;
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
 		$tmpPath = trim($tmpPath);
1074 1074
 		$module = array_pop(explode(' ', $tmpPath));
1075 1075
 
1076
-		if($dir == 'skins')
1076
+		if ($dir == 'skins')
1077 1077
 		{
1078 1078
 			$oAdminModel = getAdminModel('admin');
1079 1079
 			$themesInfo = $oAdminModel->getThemeList();
1080 1080
 
1081
-			foreach($themesInfo as $themeName => $info)
1081
+			foreach ($themesInfo as $themeName => $info)
1082 1082
 			{
1083 1083
 				$skinInfos = $info->skin_infos;
1084
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1084
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1085 1085
 				{
1086 1086
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1087 1087
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		$oMenuAdminModel = getAdminModel('menu');
1094 1094
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1095 1095
 		$moduleName = $module;
1096
-		if($moduleName === 'page')
1096
+		if ($moduleName === 'page')
1097 1097
 		{
1098 1098
 			$moduleName = 'ARTICLE';
1099 1099
 		}
1100
-		if(array_key_exists($moduleName, $installedMenuTypes))
1100
+		if (array_key_exists($moduleName, $installedMenuTypes))
1101 1101
 		{
1102
-			if($dir == 'skins')
1102
+			if ($dir == 'skins')
1103 1103
 			{
1104 1104
 				$type = 'P';
1105 1105
 			}
@@ -1109,12 +1109,12 @@  discard block
 block discarded – undo
1109 1109
 			}
1110 1110
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1111 1111
 
1112
-			if(isset($defaultSkinName))
1112
+			if (isset($defaultSkinName))
1113 1113
 			{
1114 1114
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1115 1115
 
1116 1116
 				$useDefault = new stdClass();
1117
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1117
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1118 1118
 
1119 1119
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1120 1120
 
@@ -1131,20 +1131,20 @@  discard block
 block discarded – undo
1131 1131
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1132
 	{
1133 1133
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1134
+		if (substr($path, -1) != '/') $path .= '/';
1135 1135
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1136
+		if (!file_exists($skin_xml_file)) return;
1137 1137
 		// Create XmlParser object
1138 1138
 		$oXmlParser = new XmlParser();
1139 1139
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1140
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1141
+		if (!$_xml_obj->skin) return;
1142 1142
 		$xml_obj = $_xml_obj->skin;
1143 1143
 		// Skin Name
1144 1144
 		$skin_info = new stdClass();
1145 1145
 		$skin_info->title = $xml_obj->title->body;
1146 1146
 		// Author information
1147
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1147
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1148 1148
 		{
1149 1149
 			// skin format v0.2
1150 1150
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1155,10 +1155,10 @@  discard block
 block discarded – undo
1155 1155
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1156
 			$skin_info->description = $xml_obj->description->body;
1157 1157
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1158
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159 1159
 			else $author_list = $xml_obj->author;
1160 1160
 
1161
-			foreach($author_list as $author)
1161
+			foreach ($author_list as $author)
1162 1162
 			{
1163 1163
 				$author_obj = new stdClass();
1164 1164
 				$author_obj->name = $author->name->body;
@@ -1167,25 +1167,25 @@  discard block
 block discarded – undo
1167 1167
 				$skin_info->author[] = $author_obj;
1168 1168
 			}
1169 1169
 			// List extra vars
1170
-			if($xml_obj->extra_vars)
1170
+			if ($xml_obj->extra_vars)
1171 1171
 			{
1172 1172
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1173
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1175 1175
 
1176
-				foreach($extra_var_groups as $group)
1176
+				foreach ($extra_var_groups as $group)
1177 1177
 				{
1178 1178
 					$extra_vars = $group->var;
1179
-					if(!$extra_vars)
1179
+					if (!$extra_vars)
1180 1180
 					{
1181 1181
 						continue;
1182 1182
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1183
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1184 1184
 
1185
-					foreach($extra_vars as $key => $val)
1185
+					foreach ($extra_vars as $key => $val)
1186 1186
 					{
1187 1187
 						$obj = new stdClass();
1188
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1188
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1189 1189
 
1190 1190
 						$obj->group = $group->title->body;
1191 1191
 						$obj->name = $val->attrs->name;
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 						$obj->description = $val->description->body;
1195 1195
 						$obj->value = $extra_vals->{$obj->name};
1196 1196
 						$obj->default = $val->attrs->default;
1197
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1197
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1199 1199
 						// Get an option list from 'select'type
1200
-						if(is_array($val->options))
1200
+						if (is_array($val->options))
1201 1201
 						{
1202 1202
 							$option_count = count($val->options);
1203 1203
 
1204
-							for($i = 0; $i < $option_count; $i++)
1204
+							for ($i = 0; $i < $option_count; $i++)
1205 1205
 							{
1206 1206
 								$obj->options[$i] = new stdClass();
1207 1207
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1238,18 +1238,18 @@  discard block
 block discarded – undo
1238 1238
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1239
 			// Variables used in the skin
1240 1240
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1241
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1243 1243
 
1244
-			foreach($extra_var_groups as $group)
1244
+			foreach ($extra_var_groups as $group)
1245 1245
 			{
1246 1246
 				$extra_vars = $group->var;
1247 1247
 
1248
-				if($extra_vars)
1248
+				if ($extra_vars)
1249 1249
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1250
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1251 1251
 
1252
-					foreach($extra_vars as $var)
1252
+					foreach ($extra_vars as $var)
1253 1253
 					{
1254 1254
 						unset($obj);
1255 1255
 						unset($options);
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
 						$title = $var->title->body;
1261 1261
 						$description = $var->description->body;
1262 1262
 						// Get an option list from 'select'type.
1263
-						if(is_array($var->default))
1263
+						if (is_array($var->default))
1264 1264
 						{
1265 1265
 							$option_count = count($var->default);
1266 1266
 
1267
-							for($i = 0; $i < $option_count; $i++)
1267
+							for ($i = 0; $i < $option_count; $i++)
1268 1268
 							{
1269 1269
 								$options[$i]->title = $var->default[$i]->body;
1270 1270
 								$options[$i]->value = $var->default[$i]->body;
@@ -1298,19 +1298,19 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
 		// colorset
1300 1300
 		$colorset = $xml_obj->colorset->color;
1301
-		if($colorset)
1301
+		if ($colorset)
1302 1302
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1303
+			if (!is_array($colorset)) $colorset = array($colorset);
1304 1304
 
1305
-			foreach($colorset as $color)
1305
+			foreach ($colorset as $color)
1306 1306
 			{
1307 1307
 				$name = $color->attrs->name;
1308 1308
 				$title = $color->title->body;
1309 1309
 				$screenshot = $color->attrs->src;
1310
-				if($screenshot)
1310
+				if ($screenshot)
1311 1311
 				{
1312 1312
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1313
+					if (!file_exists($screenshot)) $screenshot = "";
1314 1314
 				}
1315 1315
 				else $screenshot = "";
1316 1316
 
@@ -1322,19 +1322,19 @@  discard block
 block discarded – undo
1322 1322
 			}
1323 1323
 		}
1324 1324
 		// Menu type (settings for layout)
1325
-		if($xml_obj->menus->menu)
1325
+		if ($xml_obj->menus->menu)
1326 1326
 		{
1327 1327
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1328
+			if (!is_array($menus)) $menus = array($menus);
1329 1329
 
1330 1330
 			$menu_count = count($menus);
1331 1331
 			$skin_info->menu_count = $menu_count;
1332
-			for($i=0;$i<$menu_count;$i++)
1332
+			for ($i = 0; $i < $menu_count; $i++)
1333 1333
 			{
1334 1334
 				unset($obj);
1335 1335
 
1336 1336
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1337
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1338 1338
 				$obj->title = $menus[$i]->title->body;
1339 1339
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1340
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		}
1344 1344
 
1345 1345
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1346
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1346
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1347 1347
 		return $skin_info;
1348 1348
 	}
1349 1349
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	{
1355 1355
 		$args = new stdClass;
1356 1356
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1357
+		if (!is_null($module)) $args->module = $module;
1358 1358
 		$output = executeQuery('module.getModuleCount', $args);
1359 1359
 		return $output->data->count;
1360 1360
 	}
@@ -1368,26 +1368,26 @@  discard block
 block discarded – undo
1368 1368
 		$config = false;
1369 1369
 		// cache controll
1370 1370
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1371
-		if($oCacheHandler->isSupport())
1371
+		if ($oCacheHandler->isSupport())
1372 1372
 		{
1373
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1373
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1374 1374
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1375 1375
 			$config = $oCacheHandler->get($cache_key);
1376 1376
 		}
1377 1377
 
1378
-		if($config === false)
1378
+		if ($config === false)
1379 1379
 		{
1380
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1380
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1381 1381
 			{
1382 1382
 				$args = new stdClass();
1383 1383
 				$args->module = $module;
1384 1384
 				$args->site_srl = $site_srl;
1385 1385
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1386
+				if ($output->data->config) $config = unserialize($output->data->config);
1387 1387
 				else $config = null;
1388 1388
 
1389 1389
 				//insert in cache
1390
-				if($oCacheHandler->isSupport())
1390
+				if ($oCacheHandler->isSupport())
1391 1391
 				{
1392 1392
 					$oCacheHandler->put($cache_key, $config);
1393 1393
 				}
@@ -1408,26 +1408,26 @@  discard block
 block discarded – undo
1408 1408
 		$config = false;
1409 1409
 		// cache controll
1410 1410
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1411
-		if($oCacheHandler->isSupport())
1411
+		if ($oCacheHandler->isSupport())
1412 1412
 		{
1413 1413
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1414 1414
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1415 1415
 			$config = $oCacheHandler->get($cache_key);
1416 1416
 		}
1417 1417
 
1418
-		if($config === false)
1418
+		if ($config === false)
1419 1419
 		{
1420
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1420
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1421 1421
 			{
1422 1422
 				$args = new stdClass();
1423 1423
 				$args->module = $module;
1424 1424
 				$args->module_srl = $module_srl;
1425 1425
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1426
+				if ($output->data->config) $config = unserialize($output->data->config);
1427 1427
 				else $config = null;
1428 1428
 
1429 1429
 				//insert in cache
1430
-				if($oCacheHandler->isSupport())
1430
+				if ($oCacheHandler->isSupport())
1431 1431
 				{
1432 1432
 					$oCacheHandler->put($cache_key, $config);
1433 1433
 				}
@@ -1446,11 +1446,11 @@  discard block
 block discarded – undo
1446 1446
 	{
1447 1447
 		$args = new stdClass();
1448 1448
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1449
+		if ($site_srl) $args->site_srl = $site_srl;
1450 1450
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1451
+		if (!$output->toBool() || !$output->data) return array();
1452 1452
 
1453
-		foreach($output->data as $key => $val)
1453
+		foreach ($output->data as $key => $val)
1454 1454
 		{
1455 1455
 			$result[$val->module_srl] = unserialize($val->config);
1456 1456
 		}
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1467
 		// Get data from the DB
1468 1468
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1469
+		if (!$output->toBool()) return $output;
1470 1470
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1471
+		if (!$list) return;
1472
+		if (!is_array($list)) $list = array($list);
1473 1473
 
1474
-		foreach($list as $val)
1474
+		foreach ($list as $val)
1475 1475
 		{
1476 1476
 			$category_list[$val->module_category_srl] = $val;
1477 1477
 		}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		$args = new stdClass;
1488 1488
 		$args->module_category_srl = $module_category_srl;
1489 1489
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1490
+		if (!$output->toBool()) return $output;
1491 1491
 		return $output->data;
1492 1492
 	}
1493 1493
 
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 		// Get a list of downloaded and installed modules
1500 1500
 		$searched_list = FileHandler::readDir('./modules');
1501 1501
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1502
+		if (!$searched_count) return;
1503 1503
 		sort($searched_list);
1504 1504
 
1505
-		for($i=0;$i<$searched_count;$i++)
1505
+		for ($i = 0; $i < $searched_count; $i++)
1506 1506
 		{
1507 1507
 			// Module name
1508 1508
 			$module_name = $searched_list[$i];
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 			$info = $this->getModuleInfoXml($module_name);
1513 1513
 			unset($obj);
1514 1514
 
1515
-			if(!isset($info)) continue;
1515
+			if (!isset($info)) continue;
1516 1516
 			$info->module = $module_name;
1517 1517
 			$info->created_table_count = $created_table_count;
1518 1518
 			$info->table_count = $table_count;
@@ -1529,19 +1529,19 @@  discard block
 block discarded – undo
1529 1529
 		$info = null;
1530 1530
 
1531 1531
 		$moduledir = ModuleHandler::getModulePath($module_name);
1532
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1532
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1533 1533
 		{
1534 1534
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1535 1535
 			$table_count = count($tmp_files);
1536 1536
 			// Check if the table is created
1537 1537
 			$created_table_count = 0;
1538
-			for($j=0;$j<count($tmp_files);$j++)
1538
+			for ($j = 0; $j < count($tmp_files); $j++)
1539 1539
 			{
1540
-				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1540
+				list($table_name) = explode(".", $tmp_files[$j]);
1541
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1542 1542
 			}
1543 1543
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1544
+			if ($table_count > $created_table_count) return true;
1545 1545
 			else return false;
1546 1546
 		}
1547 1547
 		return false;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 	{
1552 1552
 		// Check if it is upgraded to module.class.php on each module
1553 1553
 		$oDummy = getModule($module_name, 'class');
1554
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1554
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1555 1555
 		{
1556 1556
 			return $oDummy->checkUpdate();
1557 1557
 		}
@@ -1570,31 +1570,31 @@  discard block
 block discarded – undo
1570 1570
 		sort($searched_list);
1571 1571
 
1572 1572
 		$searched_count = count($searched_list);
1573
-		if(!$searched_count) return;
1573
+		if (!$searched_count) return;
1574 1574
 
1575
-		for($i=0;$i<$searched_count;$i++)
1575
+		for ($i = 0; $i < $searched_count; $i++)
1576 1576
 		{
1577 1577
 			// module name
1578 1578
 			$module_name = $searched_list[$i];
1579 1579
 
1580 1580
 			$path = ModuleHandler::getModulePath($module_name);
1581
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1581
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1582 1582
 
1583 1583
 			// Get the number of xml files to create a table in schemas
1584 1584
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1585 1585
 			$table_count = count($tmp_files);
1586 1586
 			// Check if the table is created
1587 1587
 			$created_table_count = 0;
1588
-			for($j=0;$j<$table_count;$j++)
1588
+			for ($j = 0; $j < $table_count; $j++)
1589 1589
 			{
1590
-				list($table_name) = explode('.',$tmp_files[$j]);
1591
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1590
+				list($table_name) = explode('.', $tmp_files[$j]);
1591
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1592 1592
 			}
1593 1593
 			// Get information of the module
1594 1594
 			$info = NULL;
1595 1595
 			$info = $this->getModuleInfoXml($module_name);
1596 1596
 
1597
-			if(!$info) continue;
1597
+			if (!$info) continue;
1598 1598
 
1599 1599
 			$info->module = $module_name;
1600 1600
 			$info->category = $info->category;
@@ -1603,12 +1603,12 @@  discard block
 block discarded – undo
1603 1603
 			$info->path = $path;
1604 1604
 			$info->admin_index_act = $info->admin_index_act;
1605 1605
 			// Check if DB is installed
1606
-			if($table_count > $created_table_count) $info->need_install = true;
1606
+			if ($table_count > $created_table_count) $info->need_install = true;
1607 1607
 			else $info->need_install = false;
1608 1608
 			// Check if it is upgraded to module.class.php on each module
1609 1609
 			$oDummy = null;
1610 1610
 			$oDummy = getModule($module_name, 'class');
1611
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1611
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1612 1612
 			{
1613 1613
 				$info->need_update = $oDummy->checkUpdate();
1614 1614
 			}
@@ -1629,15 +1629,15 @@  discard block
 block discarded – undo
1629 1629
 	 */
1630 1630
 	function syncModuleToSite(&$data)
1631 1631
 	{
1632
-		if(!$data) return;
1632
+		if (!$data) return;
1633 1633
 
1634
-		if(is_array($data))
1634
+		if (is_array($data))
1635 1635
 		{
1636
-			foreach($data as $key => $val)
1636
+			foreach ($data as $key => $val)
1637 1637
 			{
1638 1638
 				$module_srls[] = $val->module_srl;
1639 1639
 			}
1640
-			if(!count($module_srls)) return;
1640
+			if (!count($module_srls)) return;
1641 1641
 		}
1642 1642
 		else
1643 1643
 		{
@@ -1645,17 +1645,17 @@  discard block
 block discarded – undo
1645 1645
 		}
1646 1646
 
1647 1647
 		$args = new stdClass();
1648
-		$args->module_srls = implode(',',$module_srls);
1648
+		$args->module_srls = implode(',', $module_srls);
1649 1649
 		$output = executeQueryArray('module.getModuleSites', $args);
1650
-		if(!$output->data) return array();
1651
-		foreach($output->data as $key => $val)
1650
+		if (!$output->data) return array();
1651
+		foreach ($output->data as $key => $val)
1652 1652
 		{
1653 1653
 			$modules[$val->module_srl] = $val;
1654 1654
 		}
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
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1661 1661
 			}
@@ -1671,14 +1671,14 @@  discard block
 block discarded – undo
1671 1671
 	 */
1672 1672
 	function isSiteAdmin($member_info, $site_srl = null)
1673 1673
 	{
1674
-		if(!$member_info->member_srl) return false;
1675
-		if($member_info->is_admin == 'Y') return true;
1674
+		if (!$member_info->member_srl) return false;
1675
+		if ($member_info->is_admin == 'Y') return true;
1676 1676
 
1677 1677
 		$args = new stdClass();
1678
-		if(!isset($site_srl))
1678
+		if (!isset($site_srl))
1679 1679
 		{
1680 1680
 			$site_module_info = Context::get('site_module_info');
1681
-			if(!$site_module_info) return;
1681
+			if (!$site_module_info) return;
1682 1682
 			$args->site_srl = $site_module_info->site_srl;
1683 1683
 		}
1684 1684
 		else
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 
1689 1689
 		$args->member_srl = $member_info->member_srl;
1690 1690
 		$output = executeQuery('module.isSiteAdmin', $args);
1691
-		if($output->data->member_srl == $args->member_srl) return true;
1691
+		if ($output->data->member_srl == $args->member_srl) return true;
1692 1692
 		return false;
1693 1693
 	}
1694 1694
 
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 		$obj = new stdClass();
1712 1712
 		$obj->module_srl = $module_srl;
1713 1713
 		$output = executeQueryArray('module.getAdminID', $obj);
1714
-		if(!$output->toBool() || !$output->data) return;
1714
+		if (!$output->toBool() || !$output->data) return;
1715 1715
 
1716 1716
 		return $output->data;
1717 1717
 	}
@@ -1724,20 +1724,20 @@  discard block
 block discarded – undo
1724 1724
 	{
1725 1725
 		$extra_vars = array();
1726 1726
 		$get_module_srls = array();
1727
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1727
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1728 1728
 
1729 1729
 		$vars = false;
1730 1730
 		// cache controll
1731 1731
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1732
-		if($oCacheHandler->isSupport())
1732
+		if ($oCacheHandler->isSupport())
1733 1733
 		{
1734
-			foreach($list_module_srl as $module_srl)
1734
+			foreach ($list_module_srl as $module_srl)
1735 1735
 			{
1736 1736
 				$object_key = 'module_extra_vars:'.$module_srl;
1737 1737
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1738 1738
 				$vars = $oCacheHandler->get($cache_key);
1739 1739
 
1740
-				if($vars)
1740
+				if ($vars)
1741 1741
 				{
1742 1742
 					$extra_vars[$module_srl] = $vars;
1743 1743
 				}
@@ -1752,35 +1752,35 @@  discard block
 block discarded – undo
1752 1752
 			$get_module_srls = $list_module_srl;
1753 1753
 		}
1754 1754
 
1755
-		if(count($get_module_srls) > 0)
1755
+		if (count($get_module_srls) > 0)
1756 1756
 		{
1757 1757
 			$args = new stdClass();
1758 1758
 			$args->module_srl = implode(',', $get_module_srls);
1759 1759
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1760 1760
 
1761
-			if(!$output->toBool())
1761
+			if (!$output->toBool())
1762 1762
 			{
1763 1763
 				return;
1764 1764
 			}
1765 1765
 
1766
-			if(!$output->data)
1766
+			if (!$output->data)
1767 1767
 			{
1768
-				foreach($get_module_srls as $module_srl)
1768
+				foreach ($get_module_srls as $module_srl)
1769 1769
 				{
1770 1770
 					$extra_vars[$module_srl] = new stdClass;
1771 1771
 				}
1772 1772
 			}
1773
-			foreach($output->data as $key => $val)
1773
+			foreach ($output->data as $key => $val)
1774 1774
 			{
1775
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1775
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1776 1776
 
1777
-				if(!isset($extra_vars[$val->module_srl]))
1777
+				if (!isset($extra_vars[$val->module_srl]))
1778 1778
 				{
1779 1779
 					$extra_vars[$val->module_srl] = new stdClass();
1780 1780
 				}
1781 1781
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1782 1782
 
1783
-				if($oCacheHandler->isSupport())
1783
+				if ($oCacheHandler->isSupport())
1784 1784
 				{
1785 1785
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1786 1786
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1799,27 +1799,27 @@  discard block
 block discarded – undo
1799 1799
 	{
1800 1800
 		$skin_vars = false;
1801 1801
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1802
-		if($oCacheHandler->isSupport())
1802
+		if ($oCacheHandler->isSupport())
1803 1803
 		{
1804 1804
 			$object_key = 'module_skin_vars:'.$module_srl;
1805 1805
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1806 1806
 			$skin_vars = $oCacheHandler->get($cache_key);
1807 1807
 		}
1808 1808
 
1809
-		if($skin_vars === false)
1809
+		if ($skin_vars === false)
1810 1810
 		{
1811 1811
 			$args = new stdClass();
1812 1812
 			$args->module_srl = $module_srl;
1813
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1814
-			if(!$output->toBool()) return;
1813
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1814
+			if (!$output->toBool()) return;
1815 1815
 
1816 1816
 			$skin_vars = array();
1817
-			foreach($output->data as $vars)
1817
+			foreach ($output->data as $vars)
1818 1818
 			{
1819 1819
 				$skin_vars[$vars->name] = $vars;
1820 1820
 			}
1821 1821
 
1822
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1822
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1823 1823
 		}
1824 1824
 
1825 1825
 		return $skin_vars;
@@ -1831,32 +1831,32 @@  discard block
 block discarded – undo
1831 1831
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1832 1832
 	{
1833 1833
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1834
-		if(!$site_srl) $site_srl = 0;
1834
+		if (!$site_srl) $site_srl = 0;
1835 1835
 
1836 1836
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1837
-		if(is_readable($designInfoFile))
1837
+		if (is_readable($designInfoFile))
1838 1838
 		{
1839 1839
 			include($designInfoFile);
1840 1840
 
1841 1841
 			$skinName = $designInfo->module->{$module_name}->{$target};
1842 1842
 		}
1843
-		if(!$skinName)
1843
+		if (!$skinName)
1844 1844
 		{
1845 1845
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1846 1846
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1847 1847
 
1848
-			if(is_dir($moduleSkinPath.'default'))
1848
+			if (is_dir($moduleSkinPath.'default'))
1849 1849
 			{
1850 1850
 				$skinName = 'default';
1851 1851
 			}
1852
-			else if(is_dir($moduleSkinPath.'xe_default'))
1852
+			else if (is_dir($moduleSkinPath.'xe_default'))
1853 1853
 			{
1854 1854
 				$skinName = 'xe_default';
1855 1855
 			}
1856 1856
 			else
1857 1857
 			{
1858 1858
 				$skins = FileHandler::readDir($moduleSkinPath);
1859
-				if(count($skins) > 0)
1859
+				if (count($skins) > 0)
1860 1860
 				{
1861 1861
 					$skinName = $skins[0];
1862 1862
 				}
@@ -1866,9 +1866,9 @@  discard block
 block discarded – undo
1866 1866
 				}
1867 1867
 			}
1868 1868
 
1869
-			if($updateCache && $skinName)
1869
+			if ($updateCache && $skinName)
1870 1870
 			{
1871
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1871
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1872 1872
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1873 1873
 
1874 1874
 				$oAdminController = getAdminController('admin');
@@ -1884,10 +1884,10 @@  discard block
 block discarded – undo
1884 1884
 	 */
1885 1885
 	function syncSkinInfoToModuleInfo(&$module_info)
1886 1886
 	{
1887
-		if(!$module_info->module_srl) return;
1887
+		if (!$module_info->module_srl) return;
1888 1888
 
1889 1889
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1890
-		if(Mobile::isFromMobilePhone())
1890
+		if (Mobile::isFromMobilePhone())
1891 1891
 		{
1892 1892
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1893 1893
 		}
@@ -1896,11 +1896,11 @@  discard block
 block discarded – undo
1896 1896
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1897 1897
 		}
1898 1898
 
1899
-		if(!$skin_vars) return;
1899
+		if (!$skin_vars) return;
1900 1900
 
1901
-		foreach($skin_vars as $name => $val)
1901
+		foreach ($skin_vars as $name => $val)
1902 1902
 		{
1903
-			if(isset($module_info->{$name})) continue;
1903
+			if (isset($module_info->{$name})) continue;
1904 1904
 			$module_info->{$name} = $val->value;
1905 1905
 		}
1906 1906
 	}
@@ -1914,27 +1914,27 @@  discard block
 block discarded – undo
1914 1914
 	{
1915 1915
 		$skin_vars = false;
1916 1916
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1917
-		if($oCacheHandler->isSupport())
1917
+		if ($oCacheHandler->isSupport())
1918 1918
 		{
1919 1919
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1920 1920
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1921 1921
 			$skin_vars = $oCacheHandler->get($cache_key);
1922 1922
 		}
1923 1923
 
1924
-		if($skin_vars === false)
1924
+		if ($skin_vars === false)
1925 1925
 		{
1926 1926
 			$args = new stdClass();
1927 1927
 			$args->module_srl = $module_srl;
1928
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1929
-			if(!$output->toBool() || !$output->data) return;
1928
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1929
+			if (!$output->toBool() || !$output->data) return;
1930 1930
 
1931 1931
 			$skin_vars = array();
1932
-			foreach($output->data as $vars)
1932
+			foreach ($output->data as $vars)
1933 1933
 			{
1934 1934
 				$skin_vars[$vars->name] = $vars;
1935 1935
 			}
1936 1936
 
1937
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1937
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1938 1938
 		}
1939 1939
 
1940 1940
 		return $skin_vars;
@@ -1946,32 +1946,32 @@  discard block
 block discarded – undo
1946 1946
 	 */
1947 1947
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1948 1948
 	{
1949
-		if(!$module_info->module_srl) return;
1949
+		if (!$module_info->module_srl) return;
1950 1950
 		$skin_vars = false;
1951 1951
 		// cache controll
1952 1952
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1953
-		if($oCacheHandler->isSupport())
1953
+		if ($oCacheHandler->isSupport())
1954 1954
 		{
1955 1955
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1956 1956
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1957 1957
 			$skin_vars = $oCacheHandler->get($cache_key);
1958 1958
 		}
1959
-		if($skin_vars === false)
1959
+		if ($skin_vars === false)
1960 1960
 		{
1961 1961
 			$args = new stdClass;
1962 1962
 			$args->module_srl = $module_info->module_srl;
1963
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1964
-			if(!$output->toBool()) return;
1963
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1964
+			if (!$output->toBool()) return;
1965 1965
 			$skin_vars = $output->data;
1966 1966
 
1967 1967
 			//insert in cache
1968
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1968
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1969 1969
 		}
1970
-		if(!$skin_vars) return;
1970
+		if (!$skin_vars) return;
1971 1971
 
1972
-		foreach($output->data as $val)
1972
+		foreach ($output->data as $val)
1973 1973
 		{
1974
-			if(isset($module_info->{$val->name})) continue;
1974
+			if (isset($module_info->{$val->name})) continue;
1975 1975
 			$module_info->{$val->name} = $val->value;
1976 1976
 		}
1977 1977
 	}
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 	{
1984 1984
 		$grant = new stdClass();
1985 1985
 
1986
-		if(!$xml_info)
1986
+		if (!$xml_info)
1987 1987
 		{
1988 1988
 			$module = $module_info->module;
1989 1989
 			$xml_info = $this->getModuleActionXml($module);
@@ -1991,9 +1991,9 @@  discard block
 block discarded – undo
1991 1991
 		// Set variables to grant group permission
1992 1992
 		$module_srl = $module_info->module_srl;
1993 1993
 		$grant_info = $xml_info->grant;
1994
-		if($member_info->member_srl)
1994
+		if ($member_info->member_srl)
1995 1995
 		{
1996
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1996
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1997 1997
 			else $group_list = array();
1998 1998
 		}
1999 1999
 		else
@@ -2001,10 +2001,10 @@  discard block
 block discarded – undo
2001 2001
 			$group_list = array();
2002 2002
 		}
2003 2003
 		// If module_srl doesn't exist(if unable to set permissions)
2004
-		if(!$module_srl)
2004
+		if (!$module_srl)
2005 2005
 		{
2006 2006
 			$grant->access = true;
2007
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2007
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2008 2008
 			{
2009 2009
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2010 2010
 			}
@@ -2015,23 +2015,23 @@  discard block
 block discarded – undo
2015 2015
 		{
2016 2016
 			// If module_srl exists
2017 2017
 			// Get a type of granted permission
2018
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2018
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false;
2019 2019
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2020 2020
 			// If a just logged-in member is, check if the member is a module administrator
2021
-			if(!$grant->manager && $member_info->member_srl)
2021
+			if (!$grant->manager && $member_info->member_srl)
2022 2022
 			{
2023 2023
 				$args = new stdClass();
2024 2024
 				$args->module_srl = $module_srl;
2025 2025
 				$args->member_srl = $member_info->member_srl;
2026
-				$output = executeQuery('module.getModuleAdmin',$args);
2027
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2026
+				$output = executeQuery('module.getModuleAdmin', $args);
2027
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2028 2028
 			}
2029 2029
 			// If not an administrator, get information from the DB and grant manager privilege.
2030
-			if(!$grant->manager)
2030
+			if (!$grant->manager)
2031 2031
 			{
2032 2032
 				$args = new stdClass();
2033 2033
 				// If planet, get permission settings from the planet home
2034
-				if($module_info->module == 'planet')
2034
+				if ($module_info->module == 'planet')
2035 2035
 				{
2036 2036
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2037 2037
 				}
@@ -2044,37 +2044,37 @@  discard block
 block discarded – undo
2044 2044
 
2045 2045
 				$grant_exists = $granted = array();
2046 2046
 
2047
-				if($output->data)
2047
+				if ($output->data)
2048 2048
 				{
2049 2049
 					// Arrange names and groups who has privileges
2050
-					foreach($output->data as $val)
2050
+					foreach ($output->data as $val)
2051 2051
 					{
2052 2052
 						$grant_exists[$val->name] = true;
2053
-						if($granted[$val->name]) continue;
2053
+						if ($granted[$val->name]) continue;
2054 2054
 						// Log-in member only
2055
-						if($val->group_srl == -1)
2055
+						if ($val->group_srl == -1)
2056 2056
 						{
2057 2057
 							$granted[$val->name] = true;
2058
-							if($member_info->member_srl) $grant->{$val->name} = true;
2058
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2059 2059
 							// Site-joined member only
2060 2060
 						}
2061
-						elseif($val->group_srl == -2)
2061
+						elseif ($val->group_srl == -2)
2062 2062
 						{
2063 2063
 							$granted[$val->name] = true;
2064 2064
 							// Do not grant any permission for non-logged member
2065
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2065
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2066 2066
 							// Log-in member
2067 2067
 							else
2068 2068
 							{
2069 2069
 								$site_module_info = Context::get('site_module_info');
2070 2070
 								// Permission granted if no information of the currently connected site exists
2071
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2071
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2072 2072
 								// Permission is not granted if information of the currently connected site exists
2073
-								elseif(count($group_list)) $grant->{$val->name} = true;
2073
+								elseif (count($group_list)) $grant->{$val->name} = true;
2074 2074
 							}
2075 2075
 							// All of non-logged members
2076 2076
 						}
2077
-						elseif($val->group_srl == 0)
2077
+						elseif ($val->group_srl == 0)
2078 2078
 						{
2079 2079
 							$granted[$val->name] = true;
2080 2080
 							$grant->{$val->name} = true;
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
 						}
2083 2083
 						else
2084 2084
 						{
2085
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2085
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2086 2086
 							{
2087 2087
 								$grant->{$val->name} = true;
2088 2088
 								$granted[$val->name] = true;
@@ -2091,29 +2091,29 @@  discard block
 block discarded – undo
2091 2091
 					}
2092 2092
 				}
2093 2093
 				// Separate processing for the virtual group access
2094
-				if(!$grant_exists['access']) $grant->access = true;
2095
-				if(count($grant_info))
2094
+				if (!$grant_exists['access']) $grant->access = true;
2095
+				if (count($grant_info))
2096 2096
 				{
2097
-					foreach($grant_info as  $grant_name => $grant_item)
2097
+					foreach ($grant_info as  $grant_name => $grant_item)
2098 2098
 					{
2099
-						if($grant_exists[$grant_name]) continue;
2100
-						switch($grant_item->default)
2099
+						if ($grant_exists[$grant_name]) continue;
2100
+						switch ($grant_item->default)
2101 2101
 						{
2102 2102
 							case 'guest' :
2103 2103
 								$grant->{$grant_name} = true;
2104 2104
 								break;
2105 2105
 							case 'member' :
2106
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2106
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2107 2107
 								else $grant->{$grant_name} = false;
2108 2108
 								break;
2109 2109
 							case 'site' :
2110 2110
 								$site_module_info = Context::get('site_module_info');
2111
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2111
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2112 2112
 								else $grant->{$grant_name} = false;
2113 2113
 								break;
2114 2114
 							case 'manager' :
2115 2115
 							case 'root' :
2116
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2116
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2117 2117
 								else $grant->{$grant_name} = false;
2118 2118
 								break;
2119 2119
 						}
@@ -2121,12 +2121,12 @@  discard block
 block discarded – undo
2121 2121
 				}
2122 2122
 			}
2123 2123
 			// Set true to grant all privileges if an administrator is
2124
-			if($grant->manager)
2124
+			if ($grant->manager)
2125 2125
 			{
2126 2126
 				$grant->access = true;
2127
-				if(count($grant_info))
2127
+				if (count($grant_info))
2128 2128
 				{
2129
-					foreach($grant_info as $key => $val)
2129
+					foreach ($grant_info as $key => $val)
2130 2130
 					{
2131 2131
 						$grant->{$key} = true;
2132 2132
 					}
@@ -2158,27 +2158,27 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 	function unserializeAttributes($module_filebox_list)
2160 2160
 	{
2161
-		if(is_array($module_filebox_list->data))
2161
+		if (is_array($module_filebox_list->data))
2162 2162
 		{
2163
-			foreach($module_filebox_list->data as &$item)
2163
+			foreach ($module_filebox_list->data as &$item)
2164 2164
 			{
2165
-				if(empty($item->comment))
2165
+				if (empty($item->comment))
2166 2166
 				{
2167 2167
 					continue;
2168 2168
 				}
2169 2169
 
2170 2170
 				$attributes = explode(';', $item->comment);
2171
-				foreach($attributes as $attribute)
2171
+				foreach ($attributes as $attribute)
2172 2172
 				{
2173 2173
 					$values = explode(':', $attribute);
2174
-					if((count($values) % 2) ==1)
2174
+					if ((count($values) % 2) == 1)
2175 2175
 					{
2176
-						for($i=2;$i<count($values);$i++)
2176
+						for ($i = 2; $i < count($values); $i++)
2177 2177
 						{
2178
-							$values[1].=":".$values[$i];
2178
+							$values[1] .= ":".$values[$i];
2179 2179
 						}
2180 2180
 					}
2181
-					$atts[$values[0]]=$values[1];
2181
+					$atts[$values[0]] = $values[1];
2182 2182
 				}
2183 2183
 				$item->attributes = $atts;
2184 2184
 				unset($atts);
@@ -2190,16 +2190,16 @@  discard block
 block discarded – undo
2190 2190
 	function getFileBoxListHtml()
2191 2191
 	{
2192 2192
 		$logged_info = Context::get('logged_info');
2193
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2193
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2194 2194
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2195
-		$link_params = explode('&',$link['query']);
2195
+		$link_params = explode('&', $link['query']);
2196 2196
 		foreach ($link_params as $param)
2197 2197
 		{
2198
-			$param = explode("=",$param);
2199
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2198
+			$param = explode("=", $param);
2199
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2200 2200
 		}
2201 2201
 		$oWidgetModel = getModel('widget');
2202
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2202
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2203 2203
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2204 2204
 
2205 2205
 		$oModuleModel = getModel('module');
@@ -2215,24 +2215,24 @@  discard block
 block discarded – undo
2215 2215
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2216 2216
 
2217 2217
 		$oTemplate = &TemplateHandler::getInstance();
2218
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2218
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2219 2219
 
2220 2220
 		$this->add('html', $html);
2221 2221
 	}
2222 2222
 
2223 2223
 	function getModuleFileBoxPath($module_filebox_srl)
2224 2224
 	{
2225
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2225
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2226 2226
 	}
2227 2227
 
2228 2228
 	/**
2229 2229
 	 * @brief Return ruleset cache file path
2230 2230
 	 * @param module, act
2231 2231
 	 */
2232
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2232
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2233 2233
 	{
2234 2234
 		// load dynamic ruleset xml file
2235
-		if(strpos($ruleset, '@') !== false)
2235
+		if (strpos($ruleset, '@') !== false)
2236 2236
 		{
2237 2237
 			$rulsetFile = str_replace('@', '', $ruleset);
2238 2238
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2242,20 +2242,20 @@  discard block
 block discarded – undo
2242 2242
 		{
2243 2243
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2244 2244
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2245
-			if(is_readable($xml_file))
2245
+			if (is_readable($xml_file))
2246 2246
 				return FileHandler::getRealPath($xml_file);
2247
-			else{
2247
+			else {
2248 2248
 				$ruleset = str_replace('#', '', $ruleset);
2249 2249
 			}
2250 2250
 
2251 2251
 		}
2252 2252
 		// Get a path of the requested module. Return if not exists.
2253 2253
 		$class_path = ModuleHandler::getModulePath($module);
2254
-		if(!$class_path) return;
2254
+		if (!$class_path) return;
2255 2255
 
2256 2256
 		// Check if module.xml exists in the path. Return if not exist
2257 2257
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2258
-		if(!file_exists($xml_file)) return;
2258
+		if (!file_exists($xml_file)) return;
2259 2259
 
2260 2260
 		return $xml_file;
2261 2261
 	}
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
 		$requestVars = Context::getRequestVars();
2268 2268
 
2269 2269
 		$args = new stdClass;
2270
-		$args->site_srl = (int)$requestVars->site_srl;
2270
+		$args->site_srl = (int) $requestVars->site_srl;
2271 2271
 		$args->page = 1; // /< Page
2272 2272
 		$args->list_count = 100; // /< the number of posts to display on a single page
2273 2273
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2279,9 +2279,9 @@  discard block
 block discarded – undo
2279 2279
 
2280 2280
 		$list = array();
2281 2281
 
2282
-		if($output->toBool())
2282
+		if ($output->toBool())
2283 2283
 		{
2284
-			foreach((array)$output->data as $code_info)
2284
+			foreach ((array) $output->data as $code_info)
2285 2285
 			{
2286 2286
 				unset($codeInfo);
2287 2287
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
36 36
 	{
37 37
 		// If XE has not installed yet, set module as install
38
-		if(!Context::isInstalled())
38
+		if (!Context::isInstalled())
39 39
 		{
40 40
 			$this->module = 'install';
41 41
 			$this->act = Context::get('act');
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// call a trigger before moduleHandler init
104 104
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
105
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
106 106
 		{
107
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110 110
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -115,40 +115,40 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if (file_exists($addon_file)) include($addon_file);
119 119
 	}
120 120
 
121 121
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
122 122
 	{
123
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
123
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
124 124
 		{
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		set_error_handler(function() { }, ~0);
129 129
 
130
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
131
-		if(!file_exists($debug_file))
130
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
131
+		if (!file_exists($debug_file))
132 132
 		{
133 133
 			$print[] = '<?php exit() ?>';
134 134
 		}
135 135
 
136 136
 		$errorname = self::getErrorType($errnumber);
137
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
137
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
138 138
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
139 139
 		$backtrace = debug_backtrace($backtrace_args);
140
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
140
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
141 141
 		{
142 142
 			array_shift($backtrace);
143 143
 		}
144 144
 
145
-		foreach($backtrace as $key => $value)
145
+		foreach ($backtrace as $key => $value)
146 146
 		{
147
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
147
+			$message = '    - '.$value['file'].' : '.$value['line'];
148 148
 			$print[] = $message;
149 149
 		}
150 150
 		$print[] = PHP_EOL;
151
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
151
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
152 152
 		restore_error_handler();
153 153
 
154 154
 		return true;
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 
165 165
 		set_error_handler(function() { }, ~0);
166 166
 
167
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
168
-		if(!file_exists($debug_file))
167
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
168
+		if (!file_exists($debug_file))
169 169
 		{
170 170
 			$print[] = '<?php exit() ?>';
171 171
 		}
172 172
 
173 173
 		$errorname = self::getErrorType($errinfo['type']);
174 174
 		$print[] = '['.date('Y-m-d H:i:s').']';
175
-		$print[] = $errorname . ' : ' . $errinfo['message'];
175
+		$print[] = $errorname.' : '.$errinfo['message'];
176 176
 
177
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
177
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
178 178
 		$print[] = $message;
179 179
 
180 180
 		$print[] = PHP_EOL;
181
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
181
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
182 182
 		set_error_handler(array($this, 'dummyHandler'), ~0);
183 183
 
184 184
 		return true;
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
223 223
 		$defaultHost = $defaultUrlInfo['host'];
224 224
 
225
-		foreach($urls as $url)
225
+		foreach ($urls as $url)
226 226
 		{
227
-			if(empty($url))
227
+			if (empty($url))
228 228
 			{
229 229
 				continue;
230 230
 			}
@@ -232,29 +232,29 @@  discard block
 block discarded – undo
232 232
 			$urlInfo = parse_url($url);
233 233
 			$host = $urlInfo['host'];
234 234
 
235
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
235
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
236 236
 			{
237 237
 				throw new Exception('msg_default_url_is_null');
238 238
 			}
239 239
 		}
240 240
 
241
-		if(!$this->document_srl && $this->mid && $this->entry)
241
+		if (!$this->document_srl && $this->mid && $this->entry)
242 242
 		{
243 243
 			$oDocumentModel = getModel('document');
244 244
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
245
-			if($this->document_srl)
245
+			if ($this->document_srl)
246 246
 			{
247 247
 				Context::set('document_srl', $this->document_srl);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		// Get module's information based on document_srl, if it's specified
252
-		if($this->document_srl)
252
+		if ($this->document_srl)
253 253
 		{
254 254
 
255 255
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
256 256
 			// If the document does not exist, remove document_srl
257
-			if(!$module_info)
257
+			if (!$module_info)
258 258
 			{
259 259
 				unset($this->document_srl);
260 260
 			}
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			{
263 263
 				// If it exists, compare mid based on the module information
264 264
 				// if mids are not matching, set it as the document's mid
265
-				if(!$this->mid || ($this->mid != $module_info->mid))
265
+				if (!$this->mid || ($this->mid != $module_info->mid))
266 266
 				{
267 267
 
268
-					if(Context::getRequestMethod() == 'GET')
268
+					if (Context::getRequestMethod() == 'GET')
269 269
 					{
270 270
 						$this->mid = $module_info->mid;
271
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
271
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 272
 						return FALSE;
273 273
 					}
274 274
 					else
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 				}
281 281
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
282
-				if($this->module && $module_info->module != $this->module)
282
+				if ($this->module && $module_info->module != $this->module)
283 283
 				{
284 284
 					unset($module_info);
285 285
 				}
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
291
-		if(!$module_info && $this->mid)
291
+		if (!$module_info && $this->mid)
292 292
 		{
293 293
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
294 294
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
295 295
 		}
296 296
 
297 297
 		// redirect, if module_site_srl and site_srl are different
298
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
298
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
299 299
 		{
300 300
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
301
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
301
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
302 302
 			return FALSE;
303 303
 		}
304 304
 
305 305
 		// If module_info is not set still, and $module does not exist, find the default module
306
-		if(!$module_info && !$this->module && !$this->mid)
306
+		if (!$module_info && !$this->module && !$this->mid)
307 307
 		{
308 308
 			$module_info = $site_module_info;
309 309
 		}
310 310
 
311
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
311
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316 316
 		// redirect, if site_srl of module_info is different from one of site's module_info
317
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
317
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
318 318
 		{
319 319
 			// If the module is of virtual site
320
-			if($module_info->site_srl)
320
+			if ($module_info->site_srl)
321 321
 			{
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			else
327 327
 			{
328 328
 				$db_info = Context::getDBInfo();
329
-				if(!$db_info->default_url)
329
+				if (!$db_info->default_url)
330 330
 				{
331 331
 					return Context::getLang('msg_default_url_is_not_defined');
332 332
 				}
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
336 336
 				}
337 337
 			}
338
-			header("location:" . $redirect_url);
338
+			header("location:".$redirect_url);
339 339
 			return FALSE;
340 340
 		}
341 341
 
342 342
 		// If module info was set, retrieve variables from the module information
343
-		if($module_info)
343
+		if ($module_info)
344 344
 		{
345 345
 			$this->module = $module_info->module;
346 346
 			$this->mid = $module_info->mid;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
352 352
 
353 353
 			// use the site default layout.
354
-			if($module_info->{$targetSrl} == -1)
354
+			if ($module_info->{$targetSrl} == -1)
355 355
 			{
356 356
 				$oLayoutAdminModel = getAdminModel('layout');
357 357
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// Set module and mid into module_info
372
-		if(!isset($this->module_info))
372
+		if (!isset($this->module_info))
373 373
 		{
374 374
 			$this->module_info = new stdClass();
375 375
 		}
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		$this->module_info->site_srl = $site_module_info->site_srl;
381 381
 
382 382
 		// Still no module? it's an error
383
-		if(!$this->module)
383
+		if (!$this->module)
384 384
 		{
385 385
 			$this->error = 'msg_module_is_not_exists';
386 386
 			$this->httpStatusCode = '404';
387 387
 		}
388 388
 
389 389
 		// If mid exists, set mid into context
390
-		if($this->mid)
390
+		if ($this->mid)
391 391
 		{
392 392
 			Context::set('mid', $this->mid, TRUE);
393 393
 		}
394 394
 
395 395
 		// Call a trigger after moduleHandler init
396 396
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
397
-		if(!$output->toBool())
397
+		if (!$output->toBool())
398 398
 		{
399 399
 			$this->error = $output->getMessage();
400 400
 			return TRUE;
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
417 417
 
418 418
 		// If error occurred while preparation, return a message instance
419
-		if($this->error)
419
+		if ($this->error)
420 420
 		{
421 421
 			$this->_setInputErrorToContext();
422 422
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
423 423
 			$oMessageObject->setError(-1);
424 424
 			$oMessageObject->setMessage($this->error);
425 425
 			$oMessageObject->dispMessage();
426
-			if($this->httpStatusCode)
426
+			if ($this->httpStatusCode)
427 427
 			{
428 428
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
429 429
 			}
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
435 435
 
436 436
 		// If not installed yet, modify act
437
-		if($this->module == "install")
437
+		if ($this->module == "install")
438 438
 		{
439
-			if(!$this->act || !$xml_info->action->{$this->act})
439
+			if (!$this->act || !$xml_info->action->{$this->act})
440 440
 			{
441 441
 				$this->act = $xml_info->default_index_act;
442 442
 			}
443 443
 		}
444 444
 
445 445
 		// if act exists, find type of the action, if not use default index act
446
-		if(!$this->act)
446
+		if (!$this->act)
447 447
 		{
448 448
 			$this->act = $xml_info->default_index_act;
449 449
 		}
450 450
 
451 451
 		// still no act means error
452
-		if(!$this->act)
452
+		if (!$this->act)
453 453
 		{
454 454
 			$this->error = 'msg_module_is_not_exists';
455 455
 			$this->httpStatusCode = '404';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 		$type = $xml_info->action->{$this->act}->type;
471 471
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
472 472
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
473
-		if(!$kind && $this->module == 'admin')
473
+		if (!$kind && $this->module == 'admin')
474 474
 		{
475 475
 			$kind = 'admin';
476 476
 		}
477 477
 
478 478
 		// check REQUEST_METHOD in controller
479
-		if($type == 'controller')
479
+		if ($type == 'controller')
480 480
 		{
481 481
 			$allowedMethod = $xml_info->action->{$this->act}->method;
482 482
 
483
-			if(!$allowedMethod)
483
+			if (!$allowedMethod)
484 484
 			{
485 485
 				$allowedMethodList[0] = 'POST';
486 486
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 490
 			}
491 491
 
492
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
492
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
493 493
 			{
494 494
 				$this->error = "msg_invalid_request";
495 495
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if($this->module_info->use_mobile != "Y")
503
+		if ($this->module_info->use_mobile != "Y")
504 504
 		{
505 505
 			Mobile::setMobile(FALSE);
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 
510 510
 		// check CSRF for non-GET actions
511 511
 		$use_check_csrf = !isset($xml_info->action->{$this->act}) || $xml_info->action->{$this->act}->check_csrf !== 'false';
512
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
512
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
513 513
 		{
514 514
 			$this->error = 'msg_invalid_request';
515 515
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		}
521 521
 
522 522
 		// Admin ip
523
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
523
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
524 524
 		{
525 525
 			$this->_setInputErrorToContext();
526 526
 			$this->error = "msg_not_permitted_act";
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
 		}
533 533
 
534 534
 		// if(type == view, and case for using mobilephone)
535
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
535
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
536 536
 		{
537 537
 			$orig_type = "view";
538 538
 			$type = "mobile";
539 539
 			// create a module instance
540 540
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
541
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
541
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
542 542
 			{
543 543
 				$type = $orig_type;
544 544
 				Mobile::setMobile(FALSE);
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
552 552
 		}
553 553
 
554
-		if(!is_object($oModule))
554
+		if (!is_object($oModule))
555 555
 		{
556 556
 			$this->_setInputErrorToContext();
557 557
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
558 558
 			$oMessageObject->setError(-1);
559 559
 			$oMessageObject->setMessage($this->error);
560 560
 			$oMessageObject->dispMessage();
561
-			if($this->httpStatusCode)
561
+			if ($this->httpStatusCode)
562 562
 			{
563 563
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
564 564
 			}
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 		// If there is no such action in the module object
569
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
569
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
570 570
 		{
571 571
 
572
-			if(!Context::isInstalled())
572
+			if (!Context::isInstalled())
573 573
 			{
574 574
 				$this->_setInputErrorToContext();
575 575
 				$this->error = 'msg_invalid_request';
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 				$oMessageObject->setError(-1);
578 578
 				$oMessageObject->setMessage($this->error);
579 579
 				$oMessageObject->dispMessage();
580
-				if($this->httpStatusCode)
580
+				if ($this->httpStatusCode)
581 581
 				{
582 582
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
583 583
 				}
@@ -586,12 +586,12 @@  discard block
 block discarded – undo
586 586
 
587 587
 			$forward = NULL;
588 588
 			// 1. Look for the module with action name
589
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
589
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
590 590
 			{
591
-				$module = strtolower($matches[2] . $matches[3]);
591
+				$module = strtolower($matches[2].$matches[3]);
592 592
 				$xml_info = $oModuleModel->getModuleActionXml($module);
593 593
 
594
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
594
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
595 595
 				{
596 596
 					$forward = new stdClass();
597 597
 					$forward->module = $module;
@@ -611,12 +611,12 @@  discard block
 block discarded – undo
611 611
 				}
612 612
 			}
613 613
 
614
-			if(!$forward)
614
+			if (!$forward)
615 615
 			{
616 616
 				$forward = $oModuleModel->getActionForward($this->act);
617 617
 			}
618 618
 
619
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
619
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
620 620
 			{
621 621
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
622 622
 				$type = $forward->type;
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 
629 629
 				// SECISSUE also check foward act method
630 630
 				// check REQUEST_METHOD in controller
631
-				if($type == 'controller')
631
+				if ($type == 'controller')
632 632
 				{
633 633
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
634 634
 
635
-					if(!$allowedMethod)
635
+					if (!$allowedMethod)
636 636
 					{
637 637
 						$allowedMethodList[0] = 'POST';
638 638
 					}
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
642 642
 					}
643 643
 
644
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
644
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
645 645
 					{
646 646
 						$this->error = "msg_invalid_request";
647 647
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
 					}
653 653
 				}
654 654
 
655
-				if($type == "view" && Mobile::isFromMobilePhone())
655
+				if ($type == "view" && Mobile::isFromMobilePhone())
656 656
 				{
657 657
 					$orig_type = "view";
658 658
 					$type = "mobile";
659 659
 					// create a module instance
660 660
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
661
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
661
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
662 662
 					{
663 663
 						$type = $orig_type;
664 664
 						Mobile::setMobile(FALSE);
@@ -670,25 +670,25 @@  discard block
 block discarded – undo
670 670
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
671 671
 				}
672 672
 
673
-				if(!is_object($oModule))
673
+				if (!is_object($oModule))
674 674
 				{
675 675
 					$this->_setInputErrorToContext();
676 676
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
677 677
 					$oMessageObject->setError(-1);
678 678
 					$oMessageObject->setMessage('msg_module_is_not_exists');
679 679
 					$oMessageObject->dispMessage();
680
-					if($this->httpStatusCode)
680
+					if ($this->httpStatusCode)
681 681
 					{
682 682
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
683 683
 					}
684 684
 					return $oMessageObject;
685 685
 				}
686 686
 
687
-				if($this->module == "admin" && $type == "view")
687
+				if ($this->module == "admin" && $type == "view")
688 688
 				{
689
-					if($logged_info->is_admin == 'Y')
689
+					if ($logged_info->is_admin == 'Y')
690 690
 					{
691
-						if($this->act != 'dispLayoutAdminLayoutModify')
691
+						if ($this->act != 'dispLayoutAdminLayoutModify')
692 692
 						{
693 693
 							$oAdminView = getAdminView('admin');
694 694
 							$oAdminView->makeGnbUrl($forward->module);
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
 						return $oMessageObject;
709 709
 					}
710 710
 				}
711
-				if($kind == 'admin')
711
+				if ($kind == 'admin')
712 712
 				{
713 713
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
714
-					if(!$grant->manager)
714
+					if (!$grant->manager)
715 715
 					{
716 716
 						$this->_setInputErrorToContext();
717 717
 						$this->error = 'msg_is_not_manager';
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 					}
724 724
 					else
725 725
 					{
726
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
726
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
727 727
 						{
728 728
 							$this->_setInputErrorToContext();
729 729
 							$this->error = 'msg_is_not_administrator';
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 					}
737 737
 				}
738 738
 			}
739
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
739
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
740 740
 			{
741 741
 				$this->act = $xml_info->default_index_act;
742 742
 			}
@@ -750,16 +750,16 @@  discard block
 block discarded – undo
750 750
 		}
751 751
 
752 752
 		// ruleset check...
753
-		if(!empty($ruleset))
753
+		if (!empty($ruleset))
754 754
 		{
755 755
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
756 756
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
757
-			if(!empty($rulesetFile))
757
+			if (!empty($rulesetFile))
758 758
 			{
759
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
759
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
760 760
 				{
761 761
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
762
-					foreach($errorLang as $key => $val)
762
+					foreach ($errorLang as $key => $val)
763 763
 					{
764 764
 						Context::setLang($key, $val);
765 765
 					}
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 
769 769
 				$Validator = new Validator($rulesetFile);
770 770
 				$result = $Validator->validate();
771
-				if(!$result)
771
+				if (!$result)
772 772
 				{
773 773
 					$lastError = $Validator->getLastError();
774 774
 					$returnUrl = Context::get('error_return_url');
@@ -800,26 +800,26 @@  discard block
 block discarded – undo
800 800
 				'dispLayoutPreviewWithModule' => 1
801 801
 		);
802 802
 		$db_use_mobile = Mobile::isMobileEnabled();
803
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
803
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
804 804
 		{
805 805
 			global $lang;
806 806
 			$header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
807
-			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
807
+			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>';
808 808
 			Context::addHtmlHeader($header);
809 809
 			Context::addHtmlFooter($footer);
810 810
 		}
811 811
 
812
-		if($type == "view" && $kind != 'admin')
812
+		if ($type == "view" && $kind != 'admin')
813 813
 		{
814 814
 			$module_config = $oModuleModel->getModuleConfig('module');
815
-			if($module_config->htmlFooter)
815
+			if ($module_config->htmlFooter)
816 816
 			{
817 817
 				Context::addHtmlFooter($module_config->htmlFooter);
818 818
 			}
819
-			if($module_config->siteTitle)
819
+			if ($module_config->siteTitle)
820 820
 			{
821 821
 				$siteTitle = Context::getBrowserTitle();
822
-				if(!$siteTitle)
822
+				if (!$siteTitle)
823 823
 				{
824 824
 					Context::setBrowserTitle($module_config->siteTitle);
825 825
 				}
@@ -832,18 +832,18 @@  discard block
 block discarded – undo
832 832
 		$procResult = $oModule->proc();
833 833
 
834 834
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
835
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
835
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
836 836
 		{
837 837
 			$error = $oModule->getError();
838 838
 			$message = $oModule->getMessage();
839 839
 			$messageType = $oModule->getMessageType();
840 840
 			$redirectUrl = $oModule->getRedirectUrl();
841
-			if($messageType == 'error') debugPrint($message, 'ERROR');
841
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
842 842
 
843
-			if(!$procResult)
843
+			if (!$procResult)
844 844
 			{
845 845
 				$this->error = $message;
846
-				if(!$redirectUrl && Context::get('error_return_url'))
846
+				if (!$redirectUrl && Context::get('error_return_url'))
847 847
 				{
848 848
 					$redirectUrl = Context::get('error_return_url');
849 849
 				}
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
858 858
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
859
-			if($message != 'success')
859
+			if ($message != 'success')
860 860
 			{
861 861
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
862 862
 			}
863 863
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
864 864
 
865
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
865
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
866 866
 			{
867 867
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
868 868
 			}
@@ -878,27 +878,27 @@  discard block
 block discarded – undo
878 878
 	 * */
879 879
 	function _setInputErrorToContext()
880 880
 	{
881
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
881
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
882 882
 		{
883 883
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
884 884
 		}
885
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
885
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
886 886
 		{
887 887
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
888 888
 		}
889
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
889
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
890 890
 		{
891 891
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
892 892
 		}
893
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
893
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
894 894
 		{
895 895
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
896 896
 		}
897
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
897
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
898 898
 		{
899 899
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
900 900
 		}
901
-		if(count($_SESSION['INPUT_ERROR']))
901
+		if (count($_SESSION['INPUT_ERROR']))
902 902
 		{
903 903
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
904 904
 		}
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	{
929 929
 		$requestVars = Context::getRequestVars();
930 930
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
931
-		foreach($requestVars AS $key => $value)
931
+		foreach ($requestVars AS $key => $value)
932 932
 		{
933 933
 			$_SESSION['INPUT_ERROR'][$key] = $value;
934 934
 		}
@@ -942,41 +942,41 @@  discard block
 block discarded – undo
942 942
 	function displayContent($oModule = NULL)
943 943
 	{
944 944
 		// If the module is not set or not an object, set error
945
-		if(!$oModule || !is_object($oModule))
945
+		if (!$oModule || !is_object($oModule))
946 946
 		{
947 947
 			$this->error = 'msg_module_is_not_exists';
948 948
 			$this->httpStatusCode = '404';
949 949
 		}
950 950
 
951 951
 		// If connection to DB has a problem even though it's not install module, set error
952
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
952
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
953 953
 		{
954 954
 			$this->error = 'msg_dbconnect_failed';
955 955
 		}
956 956
 
957 957
 		// Call trigger after moduleHandler proc
958 958
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
959
-		if(!$output->toBool())
959
+		if (!$output->toBool())
960 960
 		{
961 961
 			$this->error = $output->getMessage();
962 962
 		}
963 963
 
964 964
 		// Use message view object, if HTML call
965 965
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
966
-		if(!isset($methodList[Context::getRequestMethod()]))
966
+		if (!isset($methodList[Context::getRequestMethod()]))
967 967
 		{
968 968
 
969
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
969
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
970 970
 			{
971 971
 				$display_handler = new DisplayHandler();
972 972
 				$display_handler->_debugOutput();
973 973
 
974
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
974
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
975 975
 				return;
976 976
 			}
977 977
 
978 978
 			// If error occurred, handle it
979
-			if($this->error)
979
+			if ($this->error)
980 980
 			{
981 981
 				// display content with message module instance
982 982
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -985,14 +985,14 @@  discard block
 block discarded – undo
985 985
 				$oMessageObject->setMessage($this->error);
986 986
 				$oMessageObject->dispMessage();
987 987
 
988
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
988
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
989 989
 				{
990 990
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
991 991
 					$oMessageObject->setTemplateFile('http_status_code');
992 992
 				}
993 993
 
994 994
 				// If module was called normally, change the templates of the module into ones of the message view module
995
-				if($oModule)
995
+				if ($oModule)
996 996
 				{
997 997
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
998 998
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			}
1008 1008
 
1009 1009
 			// Check if layout_srl exists for the module
1010
-			if(Mobile::isFromMobilePhone())
1010
+			if (Mobile::isFromMobilePhone())
1011 1011
 			{
1012 1012
 				$layout_srl = $oModule->module_info->mlayout_srl;
1013 1013
 			}
@@ -1017,58 +1017,58 @@  discard block
 block discarded – undo
1017 1017
 			}
1018 1018
 
1019 1019
 			// if layout_srl is rollback by module, set default layout
1020
-			if($layout_srl == -1)
1020
+			if ($layout_srl == -1)
1021 1021
 			{
1022 1022
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1023 1023
 				$oLayoutAdminModel = getAdminModel('layout');
1024 1024
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1025 1025
 			}
1026 1026
 
1027
-			if($layout_srl && !$oModule->getLayoutFile())
1027
+			if ($layout_srl && !$oModule->getLayoutFile())
1028 1028
 			{
1029 1029
 
1030 1030
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1031 1031
 				$oLayoutModel = getModel('layout');
1032 1032
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1033
-				if($layout_info)
1033
+				if ($layout_info)
1034 1034
 				{
1035 1035
 
1036 1036
 					// Input extra_vars into $layout_info
1037
-					if($layout_info->extra_var_count)
1037
+					if ($layout_info->extra_var_count)
1038 1038
 					{
1039 1039
 
1040
-						foreach($layout_info->extra_var as $var_id => $val)
1040
+						foreach ($layout_info->extra_var as $var_id => $val)
1041 1041
 						{
1042
-							if($val->type == 'image')
1042
+							if ($val->type == 'image')
1043 1043
 							{
1044
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1044
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1045 1045
 								{
1046
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1046
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1047 1047
 								}
1048 1048
 							}
1049 1049
 							$layout_info->{$var_id} = $val->value;
1050 1050
 						}
1051 1051
 					}
1052 1052
 					// Set menus into context
1053
-					if($layout_info->menu_count)
1053
+					if ($layout_info->menu_count)
1054 1054
 					{
1055
-						foreach($layout_info->menu as $menu_id => $menu)
1055
+						foreach ($layout_info->menu as $menu_id => $menu)
1056 1056
 						{
1057 1057
 							// set default menu set(included home menu)
1058
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1058
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1059 1059
 							{
1060 1060
 								$oMenuAdminController = getAdminController('menu');
1061 1061
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1062 1062
 
1063
-								if(FileHandler::exists($homeMenuCacheFile))
1063
+								if (FileHandler::exists($homeMenuCacheFile))
1064 1064
 								{
1065 1065
 									include($homeMenuCacheFile);
1066 1066
 								}
1067 1067
 
1068
-								if(!$menu->menu_srl)
1068
+								if (!$menu->menu_srl)
1069 1069
 								{
1070
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1071
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1070
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1071
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1072 1072
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1073 1073
 								}
1074 1074
 								else
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 							}
1080 1080
 
1081 1081
 							$php_file = FileHandler::exists($menu->php_file);
1082
-							if($php_file)
1082
+							if ($php_file)
1083 1083
 							{
1084 1084
 								include($php_file);
1085 1085
 							}
@@ -1095,17 +1095,17 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 					// If layout was modified, use the modified version
1097 1097
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1098
-					if(file_exists($edited_layout))
1098
+					if (file_exists($edited_layout))
1099 1099
 					{
1100 1100
 						$oModule->setEditedLayoutFile($edited_layout);
1101 1101
 					}
1102 1102
 				}
1103 1103
 			}
1104 1104
 			$isLayoutDrop = Context::get('isLayoutDrop');
1105
-			if($isLayoutDrop)
1105
+			if ($isLayoutDrop)
1106 1106
 			{
1107 1107
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1108
-				if($kind == 'admin')
1108
+				if ($kind == 'admin')
1109 1109
 				{
1110 1110
 					$oModule->setLayoutFile('popup_layout');
1111 1111
 				}
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1144 1144
 	{
1145 1145
 
1146
-		if(__DEBUG__ == 3)
1146
+		if (__DEBUG__ == 3)
1147 1147
 		{
1148 1148
 			$start_time = getMicroTime();
1149 1149
 		}
@@ -1153,51 +1153,51 @@  discard block
 block discarded – undo
1153 1153
 		$type = strtolower($type);
1154 1154
 
1155 1155
 		$kinds = array('svc' => 1, 'admin' => 1);
1156
-		if(!isset($kinds[$kind]))
1156
+		if (!isset($kinds[$kind]))
1157 1157
 		{
1158 1158
 			$kind = 'svc';
1159 1159
 		}
1160 1160
 
1161
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1161
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1162 1162
 
1163
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1163
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1164 1164
 		{
1165 1165
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1166 1166
 		}
1167 1167
 
1168 1168
 		// if there is no instance of the module in global variable, create a new one
1169
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1169
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1170 1170
 		{
1171 1171
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1172 1172
 
1173
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1173
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1174 1174
 			{
1175 1175
 				$module = $parent_module;
1176 1176
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1177 1177
 			}
1178 1178
 
1179 1179
 			// Check if the base class and instance class exist
1180
-			if(!class_exists($module, true))
1180
+			if (!class_exists($module, true))
1181 1181
 			{
1182 1182
 				return NULL;
1183 1183
 			}
1184
-			if(!class_exists($instance_name, true))
1184
+			if (!class_exists($instance_name, true))
1185 1185
 			{
1186 1186
 				return NULL;
1187 1187
 			}
1188 1188
 
1189 1189
 			// Create an instance
1190 1190
 			$oModule = new $instance_name();
1191
-			if(!is_object($oModule))
1191
+			if (!is_object($oModule))
1192 1192
 			{
1193 1193
 				return NULL;
1194 1194
 			}
1195 1195
 
1196 1196
 			// Load language files for the class
1197
-			Context::loadLang($class_path . 'lang');
1198
-			if($extend_module)
1197
+			Context::loadLang($class_path.'lang');
1198
+			if ($extend_module)
1199 1199
 			{
1200
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1200
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1201 1201
 			}
1202 1202
 
1203 1203
 			// Set variables to the instance
@@ -1205,10 +1205,10 @@  discard block
 block discarded – undo
1205 1205
 			$oModule->setModulePath($class_path);
1206 1206
 
1207 1207
 			// If the module has a constructor, run it.
1208
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1208
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1209 1209
 			{
1210 1210
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1211
-				if(@method_exists($oModule, $instance_name))
1211
+				if (@method_exists($oModule, $instance_name))
1212 1212
 				{
1213 1213
 					$oModule->{$instance_name}();
1214 1214
 				}
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1219 1219
 		}
1220 1220
 
1221
-		if(__DEBUG__ == 3)
1221
+		if (__DEBUG__ == 3)
1222 1222
 		{
1223 1223
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1224 1224
 		}
@@ -1234,17 +1234,17 @@  discard block
 block discarded – undo
1234 1234
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1235 1235
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1236 1236
 
1237
-		$types = array('view','controller','model','api','wap','mobile','class');
1238
-		if(!in_array($type, $types))
1237
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1238
+		if (!in_array($type, $types))
1239 1239
 		{
1240 1240
 			$type = $types[0];
1241 1241
 		}
1242
-		if($type == 'class')
1242
+		if ($type == 'class')
1243 1243
 		{
1244 1244
 			$instanceName = '%s';
1245 1245
 			$classFile = '%s%s.%s.php';
1246 1246
 		}
1247
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1247
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1248 1248
 		{
1249 1249
 			$instanceName = '%sAdmin%s';
1250 1250
 			$classFile = '%s%s.admin.%s.php';
@@ -1269,26 +1269,26 @@  discard block
 block discarded – undo
1269 1269
 	function triggerCall($trigger_name, $called_position, &$obj)
1270 1270
 	{
1271 1271
 		// skip if not installed
1272
-		if(!Context::isInstalled())
1272
+		if (!Context::isInstalled())
1273 1273
 		{
1274 1274
 			return new Object();
1275 1275
 		}
1276 1276
 
1277 1277
 		$oModuleModel = getModel('module');
1278 1278
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1279
-		if(!$triggers || count($triggers) < 1)
1279
+		if (!$triggers || count($triggers) < 1)
1280 1280
 		{
1281 1281
 			return new Object();
1282 1282
 		}
1283 1283
 
1284 1284
 		//store before trigger call time
1285 1285
 		$before_trigger_time = NULL;
1286
-		if(__LOG_SLOW_TRIGGER__> 0)
1286
+		if (__LOG_SLOW_TRIGGER__ > 0)
1287 1287
 		{
1288 1288
 			$before_trigger_time = microtime(true);
1289 1289
 		}
1290 1290
 
1291
-		foreach($triggers as $item)
1291
+		foreach ($triggers as $item)
1292 1292
 		{
1293 1293
 			$module = $item->module;
1294 1294
 			$type = $item->type;
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 
1297 1297
 			// todo why don't we call a normal class object ?
1298 1298
 			$oModule = getModule($module, $type);
1299
-			if(!$oModule || !method_exists($oModule, $called_method))
1299
+			if (!$oModule || !method_exists($oModule, $called_method))
1300 1300
 			{
1301 1301
 				continue;
1302 1302
 			}
@@ -1309,12 +1309,12 @@  discard block
 block discarded – undo
1309 1309
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1310 1310
 
1311 1311
 			$slowlog = new stdClass;
1312
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1313
-			$slowlog->called = $module . '.' . $called_method;
1312
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1313
+			$slowlog->called = $module.'.'.$called_method;
1314 1314
 			$slowlog->called_extension = $module;
1315
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1315
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1316 1316
 
1317
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1317
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1318 1318
 			{
1319 1319
 				return $output;
1320 1320
 			}
@@ -1399,9 +1399,9 @@  discard block
 block discarded – undo
1399 1399
 			'511' => 'Network Authentication Required',
1400 1400
 		);
1401 1401
 		$statusMessage = $statusMessageList[$code];
1402
-		if(!$statusMessage)
1402
+		if (!$statusMessage)
1403 1403
 		{
1404
-			$statusMessage = 'HTTP ' . $code;
1404
+			$statusMessage = 'HTTP '.$code;
1405 1405
 		}
1406 1406
 
1407 1407
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.