GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 4690c8...bf80d8 )
by gyeong-won
08:37
created
classes/module/ModuleHandler.class.php 2 patches
Spacing   +180 added lines, -180 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
 			}
@@ -477,17 +477,17 @@  discard block
 block discarded – undo
477 477
 			Context::addMetaTag('robots', 'noindex');
478 478
 		}
479 479
 
480
-		if(!$kind && $this->module == 'admin')
480
+		if (!$kind && $this->module == 'admin')
481 481
 		{
482 482
 			$kind = 'admin';
483 483
 		}
484 484
 
485 485
 		// check REQUEST_METHOD in controller
486
-		if($type == 'controller')
486
+		if ($type == 'controller')
487 487
 		{
488 488
 			$allowedMethod = $xml_info->action->{$this->act}->method;
489 489
 
490
-			if(!$allowedMethod)
490
+			if (!$allowedMethod)
491 491
 			{
492 492
 				$allowedMethodList[0] = 'POST';
493 493
 			}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
497 497
 			}
498 498
 
499
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
499
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
500 500
 			{
501 501
 				$this->error = "msg_invalid_request";
502 502
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 			}
508 508
 		}
509 509
 
510
-		if($this->module_info->use_mobile != "Y")
510
+		if ($this->module_info->use_mobile != "Y")
511 511
 		{
512 512
 			Mobile::setMobile(FALSE);
513 513
 		}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 
517 517
 		// check CSRF for non-GET actions
518 518
 		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
519
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
519
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
520 520
 		{
521 521
 			$this->error = 'msg_invalid_request';
522 522
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		}
528 528
 
529 529
 		// Admin ip
530
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
530
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
531 531
 		{
532 532
 			$this->_setInputErrorToContext();
533 533
 			$this->error = "msg_not_permitted_act";
@@ -539,13 +539,13 @@  discard block
 block discarded – undo
539 539
 		}
540 540
 
541 541
 		// if(type == view, and case for using mobilephone)
542
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
542
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
543 543
 		{
544 544
 			$orig_type = "view";
545 545
 			$type = "mobile";
546 546
 			// create a module instance
547 547
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
548
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
548
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
549 549
 			{
550 550
 				$type = $orig_type;
551 551
 				Mobile::setMobile(FALSE);
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
559 559
 		}
560 560
 
561
-		if(!is_object($oModule))
561
+		if (!is_object($oModule))
562 562
 		{
563 563
 			$this->_setInputErrorToContext();
564 564
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
565 565
 			$oMessageObject->setError(-1);
566 566
 			$oMessageObject->setMessage($this->error);
567 567
 			$oMessageObject->dispMessage();
568
-			if($this->httpStatusCode)
568
+			if ($this->httpStatusCode)
569 569
 			{
570 570
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
571 571
 			}
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
 		}
574 574
 
575 575
 		// If there is no such action in the module object
576
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
576
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
577 577
 		{
578 578
 
579
-			if(!Context::isInstalled())
579
+			if (!Context::isInstalled())
580 580
 			{
581 581
 				$this->_setInputErrorToContext();
582 582
 				$this->error = 'msg_invalid_request';
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				$oMessageObject->setError(-1);
585 585
 				$oMessageObject->setMessage($this->error);
586 586
 				$oMessageObject->dispMessage();
587
-				if($this->httpStatusCode)
587
+				if ($this->httpStatusCode)
588 588
 				{
589 589
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
590 590
 				}
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 
594 594
 			$forward = NULL;
595 595
 			// 1. Look for the module with action name
596
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
596
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
597 597
 			{
598
-				$module = strtolower($matches[2] . $matches[3]);
598
+				$module = strtolower($matches[2].$matches[3]);
599 599
 				$xml_info = $oModuleModel->getModuleActionXml($module);
600 600
 
601
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
601
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
602 602
 				{
603 603
 					$forward = new stdClass();
604 604
 					$forward->module = $module;
@@ -619,12 +619,12 @@  discard block
 block discarded – undo
619 619
 				}
620 620
 			}
621 621
 
622
-			if(!$forward)
622
+			if (!$forward)
623 623
 			{
624 624
 				$forward = $oModuleModel->getActionForward($this->act);
625 625
 			}
626 626
 
627
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
627
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
628 628
 			{
629 629
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
630 630
 				$type = $forward->type;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 				$tpl_path = $oModule->getTemplatePath();
633 633
 				$orig_module = $oModule;
634 634
 
635
-				if($forward->meta_noindex === 'true') {
635
+				if ($forward->meta_noindex === 'true') {
636 636
 					Context::addMetaTag('robots', 'noindex');
637 637
 				}
638 638
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 				// check CSRF for non-GET actions
642 642
 				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
643
-				if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
643
+				if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
644 644
 				{
645 645
 					$this->error = 'msg_invalid_request';
646 646
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -652,11 +652,11 @@  discard block
 block discarded – undo
652 652
 
653 653
 				// SECISSUE also check foward act method
654 654
 				// check REQUEST_METHOD in controller
655
-				if($type == 'controller')
655
+				if ($type == 'controller')
656 656
 				{
657 657
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
658 658
 
659
-					if(!$allowedMethod)
659
+					if (!$allowedMethod)
660 660
 					{
661 661
 						$allowedMethodList[0] = 'POST';
662 662
 					}
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
666 666
 					}
667 667
 
668
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
668
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
669 669
 					{
670 670
 						$this->error = "msg_invalid_request";
671 671
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -676,13 +676,13 @@  discard block
 block discarded – undo
676 676
 					}
677 677
 				}
678 678
 
679
-				if($type == "view" && Mobile::isFromMobilePhone())
679
+				if ($type == "view" && Mobile::isFromMobilePhone())
680 680
 				{
681 681
 					$orig_type = "view";
682 682
 					$type = "mobile";
683 683
 					// create a module instance
684 684
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
685
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
685
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
686 686
 					{
687 687
 						$type = $orig_type;
688 688
 						Mobile::setMobile(FALSE);
@@ -694,25 +694,25 @@  discard block
 block discarded – undo
694 694
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
695 695
 				}
696 696
 
697
-				if(!is_object($oModule))
697
+				if (!is_object($oModule))
698 698
 				{
699 699
 					$this->_setInputErrorToContext();
700 700
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
701 701
 					$oMessageObject->setError(-1);
702 702
 					$oMessageObject->setMessage('msg_module_is_not_exists');
703 703
 					$oMessageObject->dispMessage();
704
-					if($this->httpStatusCode)
704
+					if ($this->httpStatusCode)
705 705
 					{
706 706
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
707 707
 					}
708 708
 					return $oMessageObject;
709 709
 				}
710 710
 
711
-				if($this->module == "admin" && $type == "view")
711
+				if ($this->module == "admin" && $type == "view")
712 712
 				{
713
-					if($logged_info->is_admin == 'Y')
713
+					if ($logged_info->is_admin == 'Y')
714 714
 					{
715
-						if($this->act != 'dispLayoutAdminLayoutModify')
715
+						if ($this->act != 'dispLayoutAdminLayoutModify')
716 716
 						{
717 717
 							$oAdminView = getAdminView('admin');
718 718
 							$oAdminView->makeGnbUrl($forward->module);
@@ -732,10 +732,10 @@  discard block
 block discarded – undo
732 732
 						return $oMessageObject;
733 733
 					}
734 734
 				}
735
-				if($kind == 'admin')
735
+				if ($kind == 'admin')
736 736
 				{
737 737
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
738
-					if(!$grant->manager)
738
+					if (!$grant->manager)
739 739
 					{
740 740
 						$this->_setInputErrorToContext();
741 741
 						$this->error = 'msg_is_not_manager';
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 					}
748 748
 					else
749 749
 					{
750
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
750
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
751 751
 						{
752 752
 							$this->_setInputErrorToContext();
753 753
 							$this->error = 'msg_is_not_administrator';
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 					}
761 761
 				}
762 762
 			}
763
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
763
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
764 764
 			{
765 765
 				$this->act = $xml_info->default_index_act;
766 766
 			}
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
 		}
775 775
 
776 776
 		// ruleset check...
777
-		if(!empty($ruleset))
777
+		if (!empty($ruleset))
778 778
 		{
779 779
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
780 780
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
781
-			if(!empty($rulesetFile))
781
+			if (!empty($rulesetFile))
782 782
 			{
783
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
783
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
784 784
 				{
785 785
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
786
-					foreach($errorLang as $key => $val)
786
+					foreach ($errorLang as $key => $val)
787 787
 					{
788 788
 						Context::setLang($key, $val);
789 789
 					}
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 
793 793
 				$Validator = new Validator($rulesetFile);
794 794
 				$result = $Validator->validate();
795
-				if(!$result)
795
+				if (!$result)
796 796
 				{
797 797
 					$lastError = $Validator->getLastError();
798 798
 					$returnUrl = Context::get('error_return_url');
@@ -824,26 +824,26 @@  discard block
 block discarded – undo
824 824
 				'dispLayoutPreviewWithModule' => 1
825 825
 		);
826 826
 		$db_use_mobile = Mobile::isMobileEnabled();
827
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
827
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
828 828
 		{
829 829
 			global $lang;
830 830
 			$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>';
831
-			$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>';
831
+			$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>';
832 832
 			Context::addHtmlHeader($header);
833 833
 			Context::addHtmlFooter($footer);
834 834
 		}
835 835
 
836
-		if(($type == 'view' || $type == 'mobile') && $kind != 'admin')
836
+		if (($type == 'view' || $type == 'mobile') && $kind != 'admin')
837 837
 		{
838 838
 			$module_config = $oModuleModel->getModuleConfig('module');
839
-			if($module_config->htmlFooter)
839
+			if ($module_config->htmlFooter)
840 840
 			{
841 841
 				Context::addHtmlFooter($module_config->htmlFooter);
842 842
 			}
843
-			if($module_config->siteTitle)
843
+			if ($module_config->siteTitle)
844 844
 			{
845 845
 				$siteTitle = Context::getBrowserTitle();
846
-				if(!$siteTitle)
846
+				if (!$siteTitle)
847 847
 				{
848 848
 					Context::setBrowserTitle($module_config->siteTitle);
849 849
 				}
@@ -860,18 +860,18 @@  discard block
 block discarded – undo
860 860
 		$procResult = $oModule->proc();
861 861
 
862 862
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
863
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
863
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
864 864
 		{
865 865
 			$error = $oModule->getError();
866 866
 			$message = $oModule->getMessage();
867 867
 			$messageType = $oModule->getMessageType();
868 868
 			$redirectUrl = $oModule->getRedirectUrl();
869
-			if($messageType == 'error') debugPrint($message, 'ERROR');
869
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
870 870
 
871
-			if(!$procResult)
871
+			if (!$procResult)
872 872
 			{
873 873
 				$this->error = $message;
874
-				if(!$redirectUrl && Context::get('error_return_url'))
874
+				if (!$redirectUrl && Context::get('error_return_url'))
875 875
 				{
876 876
 					$redirectUrl = Context::get('error_return_url');
877 877
 				}
@@ -884,13 +884,13 @@  discard block
 block discarded – undo
884 884
 
885 885
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
886 886
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
887
-			if($message != 'success')
887
+			if ($message != 'success')
888 888
 			{
889 889
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
890 890
 			}
891 891
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
892 892
 
893
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
893
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
894 894
 			{
895 895
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
896 896
 			}
@@ -906,27 +906,27 @@  discard block
 block discarded – undo
906 906
 	 * */
907 907
 	function _setInputErrorToContext()
908 908
 	{
909
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
909
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
910 910
 		{
911 911
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
912 912
 		}
913
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
913
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
914 914
 		{
915 915
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
916 916
 		}
917
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
917
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
918 918
 		{
919 919
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
920 920
 		}
921
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
921
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
922 922
 		{
923 923
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
924 924
 		}
925
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
925
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
926 926
 		{
927 927
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
928 928
 		}
929
-		if(count($_SESSION['INPUT_ERROR']))
929
+		if (count($_SESSION['INPUT_ERROR']))
930 930
 		{
931 931
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
932 932
 		}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 	{
957 957
 		$requestVars = Context::getRequestVars();
958 958
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
959
-		foreach($requestVars AS $key => $value)
959
+		foreach ($requestVars AS $key => $value)
960 960
 		{
961 961
 			$_SESSION['INPUT_ERROR'][$key] = $value;
962 962
 		}
@@ -970,41 +970,41 @@  discard block
 block discarded – undo
970 970
 	function displayContent($oModule = NULL)
971 971
 	{
972 972
 		// If the module is not set or not an object, set error
973
-		if(!$oModule || !is_object($oModule))
973
+		if (!$oModule || !is_object($oModule))
974 974
 		{
975 975
 			$this->error = 'msg_module_is_not_exists';
976 976
 			$this->httpStatusCode = '404';
977 977
 		}
978 978
 
979 979
 		// If connection to DB has a problem even though it's not install module, set error
980
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
980
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
981 981
 		{
982 982
 			$this->error = 'msg_dbconnect_failed';
983 983
 		}
984 984
 
985 985
 		// Call trigger after moduleHandler proc
986 986
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
987
-		if(!$output->toBool())
987
+		if (!$output->toBool())
988 988
 		{
989 989
 			$this->error = $output->getMessage();
990 990
 		}
991 991
 
992 992
 		// Use message view object, if HTML call
993 993
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
994
-		if(!isset($methodList[Context::getRequestMethod()]))
994
+		if (!isset($methodList[Context::getRequestMethod()]))
995 995
 		{
996 996
 
997
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
997
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
998 998
 			{
999 999
 				$display_handler = new DisplayHandler();
1000 1000
 				$display_handler->_debugOutput();
1001 1001
 
1002
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
1002
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
1003 1003
 				return;
1004 1004
 			}
1005 1005
 
1006 1006
 			// If error occurred, handle it
1007
-			if($this->error)
1007
+			if ($this->error)
1008 1008
 			{
1009 1009
 				// display content with message module instance
1010 1010
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -1013,14 +1013,14 @@  discard block
 block discarded – undo
1013 1013
 				$oMessageObject->setMessage($this->error);
1014 1014
 				$oMessageObject->dispMessage();
1015 1015
 
1016
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1016
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1017 1017
 				{
1018 1018
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1019 1019
 					$oMessageObject->setTemplateFile('http_status_code');
1020 1020
 				}
1021 1021
 
1022 1022
 				// If module was called normally, change the templates of the module into ones of the message view module
1023
-				if($oModule)
1023
+				if ($oModule)
1024 1024
 				{
1025 1025
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1026 1026
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 			}
1036 1036
 
1037 1037
 			// Check if layout_srl exists for the module
1038
-			if(Mobile::isFromMobilePhone())
1038
+			if (Mobile::isFromMobilePhone())
1039 1039
 			{
1040 1040
 				$layout_srl = $oModule->module_info->mlayout_srl;
1041 1041
 			}
@@ -1045,58 +1045,58 @@  discard block
 block discarded – undo
1045 1045
 			}
1046 1046
 
1047 1047
 			// if layout_srl is rollback by module, set default layout
1048
-			if($layout_srl == -1)
1048
+			if ($layout_srl == -1)
1049 1049
 			{
1050 1050
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1051 1051
 				$oLayoutAdminModel = getAdminModel('layout');
1052 1052
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1053 1053
 			}
1054 1054
 
1055
-			if($layout_srl && !$oModule->getLayoutFile())
1055
+			if ($layout_srl && !$oModule->getLayoutFile())
1056 1056
 			{
1057 1057
 
1058 1058
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1059 1059
 				$oLayoutModel = getModel('layout');
1060 1060
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1061
-				if($layout_info)
1061
+				if ($layout_info)
1062 1062
 				{
1063 1063
 
1064 1064
 					// Input extra_vars into $layout_info
1065
-					if($layout_info->extra_var_count)
1065
+					if ($layout_info->extra_var_count)
1066 1066
 					{
1067 1067
 
1068
-						foreach($layout_info->extra_var as $var_id => $val)
1068
+						foreach ($layout_info->extra_var as $var_id => $val)
1069 1069
 						{
1070
-							if($val->type == 'image')
1070
+							if ($val->type == 'image')
1071 1071
 							{
1072
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1072
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1073 1073
 								{
1074
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1074
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1075 1075
 								}
1076 1076
 							}
1077 1077
 							$layout_info->{$var_id} = $val->value;
1078 1078
 						}
1079 1079
 					}
1080 1080
 					// Set menus into context
1081
-					if($layout_info->menu_count)
1081
+					if ($layout_info->menu_count)
1082 1082
 					{
1083
-						foreach($layout_info->menu as $menu_id => $menu)
1083
+						foreach ($layout_info->menu as $menu_id => $menu)
1084 1084
 						{
1085 1085
 							// set default menu set(included home menu)
1086
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1086
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1087 1087
 							{
1088 1088
 								$oMenuAdminController = getAdminController('menu');
1089 1089
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1090 1090
 
1091
-								if(FileHandler::exists($homeMenuCacheFile))
1091
+								if (FileHandler::exists($homeMenuCacheFile))
1092 1092
 								{
1093 1093
 									include($homeMenuCacheFile);
1094 1094
 								}
1095 1095
 
1096
-								if(!$menu->menu_srl)
1096
+								if (!$menu->menu_srl)
1097 1097
 								{
1098
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1099
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1098
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1099
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1100 1100
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1101 1101
 								}
1102 1102
 								else
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 							}
1108 1108
 
1109 1109
 							$php_file = FileHandler::exists($menu->php_file);
1110
-							if($php_file)
1110
+							if ($php_file)
1111 1111
 							{
1112 1112
 								include($php_file);
1113 1113
 							}
@@ -1123,17 +1123,17 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 					// If layout was modified, use the modified version
1125 1125
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1126
-					if(file_exists($edited_layout))
1126
+					if (file_exists($edited_layout))
1127 1127
 					{
1128 1128
 						$oModule->setEditedLayoutFile($edited_layout);
1129 1129
 					}
1130 1130
 				}
1131 1131
 			}
1132 1132
 			$isLayoutDrop = Context::get('isLayoutDrop');
1133
-			if($isLayoutDrop)
1133
+			if ($isLayoutDrop)
1134 1134
 			{
1135 1135
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1136
-				if($kind == 'admin')
1136
+				if ($kind == 'admin')
1137 1137
 				{
1138 1138
 					$oModule->setLayoutFile('popup_layout');
1139 1139
 				}
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1172 1172
 	{
1173 1173
 
1174
-		if(__DEBUG__ == 3)
1174
+		if (__DEBUG__ == 3)
1175 1175
 		{
1176 1176
 			$start_time = getMicroTime();
1177 1177
 		}
@@ -1181,51 +1181,51 @@  discard block
 block discarded – undo
1181 1181
 		$type = strtolower($type);
1182 1182
 
1183 1183
 		$kinds = array('svc' => 1, 'admin' => 1);
1184
-		if(!isset($kinds[$kind]))
1184
+		if (!isset($kinds[$kind]))
1185 1185
 		{
1186 1186
 			$kind = 'svc';
1187 1187
 		}
1188 1188
 
1189
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1189
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1190 1190
 
1191
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1191
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1192 1192
 		{
1193 1193
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1194 1194
 		}
1195 1195
 
1196 1196
 		// if there is no instance of the module in global variable, create a new one
1197
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1197
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1198 1198
 		{
1199 1199
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1200 1200
 
1201
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1201
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1202 1202
 			{
1203 1203
 				$module = $parent_module;
1204 1204
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1205 1205
 			}
1206 1206
 
1207 1207
 			// Check if the base class and instance class exist
1208
-			if(!class_exists($module, true))
1208
+			if (!class_exists($module, true))
1209 1209
 			{
1210 1210
 				return NULL;
1211 1211
 			}
1212
-			if(!class_exists($instance_name, true))
1212
+			if (!class_exists($instance_name, true))
1213 1213
 			{
1214 1214
 				return NULL;
1215 1215
 			}
1216 1216
 
1217 1217
 			// Create an instance
1218 1218
 			$oModule = new $instance_name();
1219
-			if(!is_object($oModule))
1219
+			if (!is_object($oModule))
1220 1220
 			{
1221 1221
 				return NULL;
1222 1222
 			}
1223 1223
 
1224 1224
 			// Load language files for the class
1225
-			Context::loadLang($class_path . 'lang');
1226
-			if($extend_module)
1225
+			Context::loadLang($class_path.'lang');
1226
+			if ($extend_module)
1227 1227
 			{
1228
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1228
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1229 1229
 			}
1230 1230
 
1231 1231
 			// Set variables to the instance
@@ -1233,10 +1233,10 @@  discard block
 block discarded – undo
1233 1233
 			$oModule->setModulePath($class_path);
1234 1234
 
1235 1235
 			// If the module has a constructor, run it.
1236
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1236
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1237 1237
 			{
1238 1238
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1239
-				if(@method_exists($oModule, $instance_name))
1239
+				if (@method_exists($oModule, $instance_name))
1240 1240
 				{
1241 1241
 					$oModule->{$instance_name}();
1242 1242
 				}
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1247 1247
 		}
1248 1248
 
1249
-		if(__DEBUG__ == 3)
1249
+		if (__DEBUG__ == 3)
1250 1250
 		{
1251 1251
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1252 1252
 		}
@@ -1262,17 +1262,17 @@  discard block
 block discarded – undo
1262 1262
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1263 1263
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1264 1264
 
1265
-		$types = array('view','controller','model','api','wap','mobile','class');
1266
-		if(!in_array($type, $types))
1265
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1266
+		if (!in_array($type, $types))
1267 1267
 		{
1268 1268
 			$type = $types[0];
1269 1269
 		}
1270
-		if($type == 'class')
1270
+		if ($type == 'class')
1271 1271
 		{
1272 1272
 			$instanceName = '%s';
1273 1273
 			$classFile = '%s%s.%s.php';
1274 1274
 		}
1275
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1275
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1276 1276
 		{
1277 1277
 			$instanceName = '%sAdmin%s';
1278 1278
 			$classFile = '%s%s.admin.%s.php';
@@ -1297,26 +1297,26 @@  discard block
 block discarded – undo
1297 1297
 	function triggerCall($trigger_name, $called_position, &$obj)
1298 1298
 	{
1299 1299
 		// skip if not installed
1300
-		if(!Context::isInstalled())
1300
+		if (!Context::isInstalled())
1301 1301
 		{
1302 1302
 			return new BaseObject();
1303 1303
 		}
1304 1304
 
1305 1305
 		$oModuleModel = getModel('module');
1306 1306
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1307
-		if(!$triggers || count($triggers) < 1)
1307
+		if (!$triggers || count($triggers) < 1)
1308 1308
 		{
1309 1309
 			return new BaseObject();
1310 1310
 		}
1311 1311
 
1312 1312
 		//store before trigger call time
1313 1313
 		$before_trigger_time = NULL;
1314
-		if(__LOG_SLOW_TRIGGER__> 0)
1314
+		if (__LOG_SLOW_TRIGGER__ > 0)
1315 1315
 		{
1316 1316
 			$before_trigger_time = microtime(true);
1317 1317
 		}
1318 1318
 
1319
-		foreach($triggers as $item)
1319
+		foreach ($triggers as $item)
1320 1320
 		{
1321 1321
 			$module = $item->module;
1322 1322
 			$type = $item->type;
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 
1325 1325
 			// todo why don't we call a normal class object ?
1326 1326
 			$oModule = getModule($module, $type);
1327
-			if(!$oModule || !method_exists($oModule, $called_method))
1327
+			if (!$oModule || !method_exists($oModule, $called_method))
1328 1328
 			{
1329 1329
 				continue;
1330 1330
 			}
@@ -1337,12 +1337,12 @@  discard block
 block discarded – undo
1337 1337
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1338 1338
 
1339 1339
 			$slowlog = new stdClass;
1340
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1341
-			$slowlog->called = $module . '.' . $called_method;
1340
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1341
+			$slowlog->called = $module.'.'.$called_method;
1342 1342
 			$slowlog->called_extension = $module;
1343
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1343
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1344 1344
 
1345
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1345
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1346 1346
 			{
1347 1347
 				return $output;
1348 1348
 			}
@@ -1427,9 +1427,9 @@  discard block
 block discarded – undo
1427 1427
 			'511' => 'Network Authentication Required',
1428 1428
 		);
1429 1429
 		$statusMessage = $statusMessageList[$code];
1430
-		if(!$statusMessage)
1430
+		if (!$statusMessage)
1431 1431
 		{
1432
-			$statusMessage = 'HTTP ' . $code;
1432
+			$statusMessage = 'HTTP '.$code;
1433 1433
 		}
1434 1434
 
1435 1435
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  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)) {
119
+			include($addon_file);
120
+		}
119 121
 	}
120 122
 
121 123
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -257,8 +259,7 @@  discard block
 block discarded – undo
257 259
 			if(!$module_info)
258 260
 			{
259 261
 				unset($this->document_srl);
260
-			}
261
-			else
262
+			} else
262 263
 			{
263 264
 				// If it exists, compare mid based on the module information
264 265
 				// if mids are not matching, set it as the document's mid
@@ -270,8 +271,7 @@  discard block
 block discarded – undo
270 271
 						$this->mid = $module_info->mid;
271 272
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 273
 						return FALSE;
273
-					}
274
-					else
274
+					} else
275 275
 					{
276 276
 						$this->mid = $module_info->mid;
277 277
 						Context::set('mid', $this->mid);
@@ -322,15 +322,13 @@  discard block
 block discarded – undo
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'));
324 324
 				// If it's called from a virtual site, though it's not a module of the virtual site
325
-			}
326
-			else
325
+			} else
327 326
 			{
328 327
 				$db_info = Context::getDBInfo();
329 328
 				if(!$db_info->default_url)
330 329
 				{
331 330
 					return Context::getLang('msg_default_url_is_not_defined');
332
-				}
333
-				else
331
+				} else
334 332
 				{
335 333
 					$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 334
 				}
@@ -355,8 +353,7 @@  discard block
 block discarded – undo
355 353
 			{
356 354
 				$oLayoutAdminModel = getAdminModel('layout');
357 355
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
358
-			}
359
-			else
356
+			} else
360 357
 			{
361 358
 				$layoutSrl = $module_info->{$targetSrl};
362 359
 			}
@@ -490,8 +487,7 @@  discard block
 block discarded – undo
490 487
 			if(!$allowedMethod)
491 488
 			{
492 489
 				$allowedMethodList[0] = 'POST';
493
-			}
494
-			else
490
+			} else
495 491
 			{
496 492
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
497 493
 			}
@@ -551,8 +547,7 @@  discard block
 block discarded – undo
551 547
 				Mobile::setMobile(FALSE);
552 548
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
553 549
 			}
554
-		}
555
-		else
550
+		} else
556 551
 		{
557 552
 			// create a module instance
558 553
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -606,8 +601,7 @@  discard block
 block discarded – undo
606 601
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
607 602
 					$forward->meta_noindex = $xml_info->action->{$this->act}->meta_noindex;
608 603
 					$forward->act = $this->act;
609
-				}
610
-				else
604
+				} else
611 605
 				{
612 606
 					$this->error = 'msg_invalid_request';
613 607
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -659,8 +653,7 @@  discard block
 block discarded – undo
659 653
 					if(!$allowedMethod)
660 654
 					{
661 655
 						$allowedMethodList[0] = 'POST';
662
-					}
663
-					else
656
+					} else
664 657
 					{
665 658
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
666 659
 					}
@@ -688,8 +681,7 @@  discard block
 block discarded – undo
688 681
 						Mobile::setMobile(FALSE);
689 682
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
690 683
 					}
691
-				}
692
-				else
684
+				} else
693 685
 				{
694 686
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
695 687
 				}
@@ -719,8 +711,7 @@  discard block
 block discarded – undo
719 711
 							$oModule->setLayoutPath("./modules/admin/tpl");
720 712
 							$oModule->setLayoutFile("layout.html");
721 713
 						}
722
-					}
723
-					else
714
+					} else
724 715
 					{
725 716
 						$this->_setInputErrorToContext();
726 717
 
@@ -744,8 +735,7 @@  discard block
 block discarded – undo
744 735
 						$oMessageObject->setMessage($this->error);
745 736
 						$oMessageObject->dispMessage();
746 737
 						return $oMessageObject;
747
-					}
748
-					else
738
+					} else
749 739
 					{
750 740
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
751 741
 						{
@@ -759,12 +749,10 @@  discard block
 block discarded – undo
759 749
 						}
760 750
 					}
761 751
 				}
762
-			}
763
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
752
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
764 753
 			{
765 754
 				$this->act = $xml_info->default_index_act;
766
-			}
767
-			else
755
+			} else
768 756
 			{
769 757
 				$this->error = 'msg_invalid_request';
770 758
 				$oModule->setError(-1);
@@ -866,7 +854,9 @@  discard block
 block discarded – undo
866 854
 			$message = $oModule->getMessage();
867 855
 			$messageType = $oModule->getMessageType();
868 856
 			$redirectUrl = $oModule->getRedirectUrl();
869
-			if($messageType == 'error') debugPrint($message, 'ERROR');
857
+			if($messageType == 'error') {
858
+				debugPrint($message, 'ERROR');
859
+			}
870 860
 
871 861
 			if(!$procResult)
872 862
 			{
@@ -876,8 +866,7 @@  discard block
 block discarded – undo
876 866
 					$redirectUrl = Context::get('error_return_url');
877 867
 				}
878 868
 				$this->_setInputValueToSession();
879
-			}
880
-			else
869
+			} else
881 870
 			{
882 871
 
883 872
 			}
@@ -1025,8 +1014,7 @@  discard block
 block discarded – undo
1025 1014
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1026 1015
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
1027 1016
 					// Otherwise, set message instance as the target module
1028
-				}
1029
-				else
1017
+				} else
1030 1018
 				{
1031 1019
 					$oModule = $oMessageObject;
1032 1020
 				}
@@ -1038,8 +1026,7 @@  discard block
 block discarded – undo
1038 1026
 			if(Mobile::isFromMobilePhone())
1039 1027
 			{
1040 1028
 				$layout_srl = $oModule->module_info->mlayout_srl;
1041
-			}
1042
-			else
1029
+			} else
1043 1030
 			{
1044 1031
 				$layout_srl = $oModule->module_info->layout_srl;
1045 1032
 			}
@@ -1098,8 +1085,7 @@  discard block
 block discarded – undo
1098 1085
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1099 1086
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1100 1087
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1101
-								}
1102
-								else
1088
+								} else
1103 1089
 								{
1104 1090
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1105 1091
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1136,8 +1122,7 @@  discard block
 block discarded – undo
1136 1122
 				if($kind == 'admin')
1137 1123
 				{
1138 1124
 					$oModule->setLayoutFile('popup_layout');
1139
-				}
1140
-				else
1125
+				} else
1141 1126
 				{
1142 1127
 					$oModule->setLayoutPath('common/tpl');
1143 1128
 					$oModule->setLayoutFile('default_layout');
@@ -1271,13 +1256,11 @@  discard block
 block discarded – undo
1271 1256
 		{
1272 1257
 			$instanceName = '%s';
1273 1258
 			$classFile = '%s%s.%s.php';
1274
-		}
1275
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1259
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1276 1260
 		{
1277 1261
 			$instanceName = '%sAdmin%s';
1278 1262
 			$classFile = '%s%s.admin.%s.php';
1279
-		}
1280
-		else
1263
+		} else
1281 1264
 		{
1282 1265
 			$instanceName = '%s%s';
1283 1266
 			$classFile = '%s%s.%s.php';
@@ -1340,7 +1323,9 @@  discard block
 block discarded – undo
1340 1323
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1341 1324
 			$slowlog->called = $module . '.' . $called_method;
1342 1325
 			$slowlog->called_extension = $module;
1343
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1326
+			if($trigger_name != 'XE.writeSlowlog') {
1327
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1328
+			}
1344 1329
 
1345 1330
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1346 1331
 			{
Please login to merge, or discard this patch.
modules/seo/seo.controller.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		if (Context::getResponseMethod() != 'HTML') return;
45 45
 		if (Context::get('module') == 'admin') return;
46 46
 
47
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
47
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
48 48
 
49 49
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
50 50
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		$piece->image = array();
89 89
 		$piece->author = null;
90 90
 
91
-		if(stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) {
91
+		if (stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) {
92 92
 			$single_image = true;
93 93
 		}
94 94
 
95 95
 
96
-		if($current_module_info->module_srl !== $site_module_info->module_srl) {
96
+		if ($current_module_info->module_srl !== $site_module_info->module_srl) {
97 97
 			$mdoulePartConfig = $oModuleModel->getModulePartConfig('seo', $current_module_info->module_srl);
98
-			if($mdoulePartConfig && isset($mdoulePartConfig->meta_description) && trim($mdoulePartConfig->meta_description)) {
98
+			if ($mdoulePartConfig && isset($mdoulePartConfig->meta_description) && trim($mdoulePartConfig->meta_description)) {
99 99
 				$piece->description = trim($mdoulePartConfig->meta_description);
100 100
 			}
101 101
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		if ($is_article) {
117 117
 			if (!$oDocument->isSecret()) {
118 118
 				$piece->document_title = $oDocument->getTitleText();
119
-				$piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl',$document_srl);
119
+				$piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl);
120 120
 				$piece->type = 'article';
121 121
 				$piece->description = trim(str_replace('&nbsp;', ' ', $oDocument->getContentText(400)));
122 122
 				$piece->author = $oDocument->getNickName();
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 				if (count($tags)) $piece->tags = $tags;
125 125
 
126 126
 				$document_images = false;
127
-				if($oCacheHandler->isSupport()) {
128
-					$cache_key_document_images = 'seo:document_images:' . $document_srl;
127
+				if ($oCacheHandler->isSupport()) {
128
+					$cache_key_document_images = 'seo:document_images:'.$document_srl;
129 129
 					$document_images = $oCacheHandler->get($cache_key_document_images);
130 130
 				}
131 131
 
132
-				if($document_images === false && $oDocument->hasUploadedFiles()) {
132
+				if ($document_images === false && $oDocument->hasUploadedFiles()) {
133 133
 					$image_ext = array('bmp', 'gif', 'jpg', 'jpeg', 'png');
134 134
 					$document_images = array();
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 						if (!in_array(strtolower($ext), $image_ext)) continue;
142 142
 						list($width, $height) = @getimagesize($file->uploaded_filename);
143
-						if($width < 100 && $height < 100) continue;
143
+						if ($width < 100 && $height < 100) continue;
144 144
 
145 145
 						$image = array(
146 146
 							'filepath' => $file->uploaded_filename,
@@ -148,35 +148,35 @@  discard block
 block discarded – undo
148 148
 							'height' => $height
149 149
 						);
150 150
 
151
-						if($file->cover_image === 'Y') {
151
+						if ($file->cover_image === 'Y') {
152 152
 							array_unshift($document_images, $image);
153 153
 						} else {
154 154
 							$document_images[] = $image;
155 155
 						}
156 156
 					}
157 157
 
158
-					if($oCacheHandler->isSupport()) {
158
+					if ($oCacheHandler->isSupport()) {
159 159
 						$oCacheHandler->put($cache_key_document_images, $document_images);
160 160
 					}
161 161
 				}
162 162
 
163
-				if($document_images) $piece->image = $document_images;
163
+				if ($document_images) $piece->image = $document_images;
164 164
 			} else {
165 165
 				$piece->url = getFullUrl('', 'mid', $current_module_info->mid);
166 166
 			}
167 167
 		} else {
168 168
 			if (!$is_index) {
169 169
 				$page = (Context::get('page') > 1) ? Context::get('page') : null;
170
-				$piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page',$page);
170
+				$piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page', $page);
171 171
 			}
172 172
 		}
173 173
 
174 174
 		$piece->title = $this->getBrowserTitle($piece->document_title);
175 175
 
176
-		if($oCacheHandler->isSupport()) {
176
+		if ($oCacheHandler->isSupport()) {
177 177
 			$cache_key = 'seo:site_image';
178 178
 			$site_image = $oCacheHandler->get($cache_key);
179
-			if($site_image) {
179
+			if ($site_image) {
180 180
 				$site_image['url'] = $config->site_image_url;
181 181
 			}
182 182
 			$piece->image[] = $site_image;
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 		$this->addMeta('og:site_name', $config->site_name);
194 194
 		$this->addMeta('og:title', $piece->title);
195 195
 		$this->addMeta('og:description', $piece->description);
196
-		if($is_article) {
197
-			if(Context::getLangType() !== $oDocument->getLangCode()) {
196
+		if ($is_article) {
197
+			if (Context::getLangType() !== $oDocument->getLangCode()) {
198 198
 				$this->addMeta('og:locale:alternate', $locales[$oDocument->getLangCode()]);
199 199
 			}
200 200
 			$this->addMeta('article:published_time', $oDocument->getRegdate('c'));
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 
207 207
 		foreach ($piece->image as $img) {
208
-			if(!$img['url']) {
209
-				if(!$img['filepath']) continue;
210
-				$img['url'] = $request_uri . $img['filepath'];
208
+			if (!$img['url']) {
209
+				if (!$img['filepath']) continue;
210
+				$img['url'] = $request_uri.$img['filepath'];
211 211
 			}
212 212
 
213 213
 			$this->addMeta('og:image', $img['url']);
214 214
 			$this->addMeta('og:image:width', $img['width']);
215 215
 			$this->addMeta('og:image:height', $img['height']);
216
-			if($single_image) break;
216
+			if ($single_image) break;
217 217
 		}
218 218
 
219 219
 		$this->canonical_url = $piece->url;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function triggerAfterFileDeleteFile($data)
227 227
 	{
228 228
 		$document_srl = $data->upload_target_srl;
229
-		if(!$document_srl) return $this->makeObject();
229
+		if (!$document_srl) return $this->makeObject();
230 230
 
231 231
 		$this->deleteCacheDocumentImages($document_srl);
232 232
 	}
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	private function deleteCacheDocumentImages($document_srl)
247 247
 	{
248 248
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
249
-		if($oCacheHandler->isSupport()) {
250
-			$cache_key_document_images = 'seo:document_images:' . $document_srl;
249
+		if ($oCacheHandler->isSupport()) {
250
+			$cache_key_document_images = 'seo:document_images:'.$document_srl;
251 251
 			$oCacheHandler->delete($cache_key_document_images);
252 252
 		}
253 253
 	}
Please login to merge, or discard this patch.
modules/module/module.model.php 1 patch
Spacing   +369 added lines, -369 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
 					$meta_noindex = $action->attrs->{'meta-noindex'} === 'true' ? 'true' : 'false';
939 939
 
940 940
 					$index = $action->attrs->index;
@@ -951,14 +951,14 @@  discard block
 block discarded – undo
951 951
 					$info->action->{$name}->method = $method;
952 952
 					$info->action->{$name}->check_csrf = $check_csrf;
953 953
 					$info->action->{$name}->meta_noindex = $meta_noindex;
954
-					if($action->attrs->menu_name)
954
+					if ($action->attrs->menu_name)
955 955
 					{
956
-						if($menu_index == 'true')
956
+						if ($menu_index == 'true')
957 957
 						{
958 958
 							$info->menu->{$action->attrs->menu_name}->index = $name;
959 959
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
960 960
 						}
961
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
961
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
962 962
 						{
963 963
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
964 964
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -977,22 +977,22 @@  discard block
 block discarded – undo
977 977
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
978 978
 					$buff[] = sprintf('$info->action->%s->meta_noindex=\'%s\';', $name, $meta_noindex);
979 979
 
980
-					if($index=='true')
980
+					if ($index == 'true')
981 981
 					{
982 982
 						$default_index_act = $name;
983 983
 						$info->default_index_act = $name;
984 984
 					}
985
-					if($admin_index=='true')
985
+					if ($admin_index == 'true')
986 986
 					{
987 987
 						$admin_index_act = $name;
988 988
 						$info->admin_index_act = $name;
989 989
 					}
990
-					if($setup_index=='true')
990
+					if ($setup_index == 'true')
991 991
 					{
992 992
 						$setup_index_act = $name;
993 993
 						$info->setup_index_act = $name;
994 994
 					}
995
-					if($simple_setup_index=='true')
995
+					if ($simple_setup_index == 'true')
996 996
 					{
997 997
 						$simple_setup_index_act = $name;
998 998
 						$info->simple_setup_index_act = $name;
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			return $info;
1014 1014
 		}
1015 1015
 
1016
-		if(file_exists($cache_file)) return include($cache_file);
1016
+		if (file_exists($cache_file)) return include($cache_file);
1017 1017
 	}
1018 1018
 
1019 1019
 	/**
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	{
1025 1025
 		$module = Context::get('module_type');
1026 1026
 
1027
-		if($module == 'ARTICLE')
1027
+		if ($module == 'ARTICLE')
1028 1028
 		{
1029 1029
 			$module = 'page';
1030 1030
 		}
@@ -1044,26 +1044,26 @@  discard block
 block discarded – undo
1044 1044
 	 */
1045 1045
 	function getSkins($path, $dir = 'skins')
1046 1046
 	{
1047
-		if(substr($path, -1) == '/')
1047
+		if (substr($path, -1) == '/')
1048 1048
 		{
1049 1049
 			$path = substr($path, 0, -1);
1050 1050
 		}
1051 1051
 
1052 1052
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1053 1053
 		$list = FileHandler::readDir($skin_path);
1054
-		if(!count($list)) return;
1054
+		if (!count($list)) return;
1055 1055
 
1056 1056
 		natcasesort($list);
1057 1057
 
1058
-		foreach($list as $skin_name)
1058
+		foreach ($list as $skin_name)
1059 1059
 		{
1060
-			if(!is_dir($skin_path . $skin_name))
1060
+			if (!is_dir($skin_path.$skin_name))
1061 1061
 			{
1062 1062
 				continue;
1063 1063
 			}
1064 1064
 			unset($skin_info);
1065 1065
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1066
-			if(!$skin_info)
1066
+			if (!$skin_info)
1067 1067
 			{
1068 1068
 				$skin_info = new stdClass();
1069 1069
 				$skin_info->title = $skin_name;
@@ -1076,15 +1076,15 @@  discard block
 block discarded – undo
1076 1076
 		$tmpPath = trim($tmpPath);
1077 1077
 		$module = array_pop(explode(' ', $tmpPath));
1078 1078
 
1079
-		if($dir == 'skins')
1079
+		if ($dir == 'skins')
1080 1080
 		{
1081 1081
 			$oAdminModel = getAdminModel('admin');
1082 1082
 			$themesInfo = $oAdminModel->getThemeList();
1083 1083
 
1084
-			foreach($themesInfo as $themeName => $info)
1084
+			foreach ($themesInfo as $themeName => $info)
1085 1085
 			{
1086 1086
 				$skinInfos = $info->skin_infos;
1087
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1087
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1088 1088
 				{
1089 1089
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1090 1090
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1096,13 +1096,13 @@  discard block
 block discarded – undo
1096 1096
 		$oMenuAdminModel = getAdminModel('menu');
1097 1097
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1098 1098
 		$moduleName = $module;
1099
-		if($moduleName === 'page')
1099
+		if ($moduleName === 'page')
1100 1100
 		{
1101 1101
 			$moduleName = 'ARTICLE';
1102 1102
 		}
1103
-		if(array_key_exists($moduleName, $installedMenuTypes))
1103
+		if (array_key_exists($moduleName, $installedMenuTypes))
1104 1104
 		{
1105
-			if($dir == 'skins')
1105
+			if ($dir == 'skins')
1106 1106
 			{
1107 1107
 				$type = 'P';
1108 1108
 			}
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
 			}
1113 1113
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1114 1114
 
1115
-			if(isset($defaultSkinName))
1115
+			if (isset($defaultSkinName))
1116 1116
 			{
1117 1117
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1118 1118
 
1119 1119
 				$useDefault = new stdClass();
1120
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1120
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1121 1121
 
1122 1122
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1123 1123
 
@@ -1134,20 +1134,20 @@  discard block
 block discarded – undo
1134 1134
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1135 1135
 	{
1136 1136
 		// Read xml file having skin information
1137
-		if(substr($path,-1)!='/') $path .= '/';
1137
+		if (substr($path, -1) != '/') $path .= '/';
1138 1138
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1139
-		if(!file_exists($skin_xml_file)) return;
1139
+		if (!file_exists($skin_xml_file)) return;
1140 1140
 		// Create XmlParser object
1141 1141
 		$oXmlParser = new XmlParser();
1142 1142
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1143 1143
 		// Return if no skin information is
1144
-		if(!$_xml_obj->skin) return;
1144
+		if (!$_xml_obj->skin) return;
1145 1145
 		$xml_obj = $_xml_obj->skin;
1146 1146
 		// Skin Name
1147 1147
 		$skin_info = new stdClass();
1148 1148
 		$skin_info->title = $xml_obj->title->body;
1149 1149
 		// Author information
1150
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1150
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1151 1151
 		{
1152 1152
 			// skin format v0.2
1153 1153
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1159 1159
 			$skin_info->description = $xml_obj->description->body;
1160 1160
 
1161
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1161
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1162 1162
 			else $author_list = $xml_obj->author;
1163 1163
 
1164
-			foreach($author_list as $author)
1164
+			foreach ($author_list as $author)
1165 1165
 			{
1166 1166
 				$author_obj = new stdClass();
1167 1167
 				$author_obj->name = $author->name->body;
@@ -1170,25 +1170,25 @@  discard block
 block discarded – undo
1170 1170
 				$skin_info->author[] = $author_obj;
1171 1171
 			}
1172 1172
 			// List extra vars
1173
-			if($xml_obj->extra_vars)
1173
+			if ($xml_obj->extra_vars)
1174 1174
 			{
1175 1175
 				$extra_var_groups = $xml_obj->extra_vars->group;
1176
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1177
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1176
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1177
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1178 1178
 
1179
-				foreach($extra_var_groups as $group)
1179
+				foreach ($extra_var_groups as $group)
1180 1180
 				{
1181 1181
 					$extra_vars = $group->var;
1182
-					if(!$extra_vars)
1182
+					if (!$extra_vars)
1183 1183
 					{
1184 1184
 						continue;
1185 1185
 					}
1186
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1186
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1187 1187
 
1188
-					foreach($extra_vars as $key => $val)
1188
+					foreach ($extra_vars as $key => $val)
1189 1189
 					{
1190 1190
 						$obj = new stdClass();
1191
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1191
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1192 1192
 
1193 1193
 						$obj->group = $group->title->body;
1194 1194
 						$obj->name = $val->attrs->name;
@@ -1197,14 +1197,14 @@  discard block
 block discarded – undo
1197 1197
 						$obj->description = $val->description->body;
1198 1198
 						$obj->value = $extra_vals->{$obj->name};
1199 1199
 						$obj->default = $val->attrs->default;
1200
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1201
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1200
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1201
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1202 1202
 						// Get an option list from 'select'type
1203
-						if(is_array($val->options))
1203
+						if (is_array($val->options))
1204 1204
 						{
1205 1205
 							$option_count = count($val->options);
1206 1206
 
1207
-							for($i = 0; $i < $option_count; $i++)
1207
+							for ($i = 0; $i < $option_count; $i++)
1208 1208
 							{
1209 1209
 								$obj->options[$i] = new stdClass();
1210 1210
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1241,18 +1241,18 @@  discard block
 block discarded – undo
1241 1241
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1242 1242
 			// Variables used in the skin
1243 1243
 			$extra_var_groups = $xml_obj->extra_vars->group;
1244
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1245
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1244
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1245
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1246 1246
 
1247
-			foreach($extra_var_groups as $group)
1247
+			foreach ($extra_var_groups as $group)
1248 1248
 			{
1249 1249
 				$extra_vars = $group->var;
1250 1250
 
1251
-				if($extra_vars)
1251
+				if ($extra_vars)
1252 1252
 				{
1253
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1253
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1254 1254
 
1255
-					foreach($extra_vars as $var)
1255
+					foreach ($extra_vars as $var)
1256 1256
 					{
1257 1257
 						unset($obj);
1258 1258
 						unset($options);
@@ -1263,11 +1263,11 @@  discard block
 block discarded – undo
1263 1263
 						$title = $var->title->body;
1264 1264
 						$description = $var->description->body;
1265 1265
 						// Get an option list from 'select'type.
1266
-						if(is_array($var->default))
1266
+						if (is_array($var->default))
1267 1267
 						{
1268 1268
 							$option_count = count($var->default);
1269 1269
 
1270
-							for($i = 0; $i < $option_count; $i++)
1270
+							for ($i = 0; $i < $option_count; $i++)
1271 1271
 							{
1272 1272
 								$options[$i]->title = $var->default[$i]->body;
1273 1273
 								$options[$i]->value = $var->default[$i]->body;
@@ -1301,19 +1301,19 @@  discard block
 block discarded – undo
1301 1301
 
1302 1302
 		// colorset
1303 1303
 		$colorset = $xml_obj->colorset->color;
1304
-		if($colorset)
1304
+		if ($colorset)
1305 1305
 		{
1306
-			if(!is_array($colorset)) $colorset = array($colorset);
1306
+			if (!is_array($colorset)) $colorset = array($colorset);
1307 1307
 
1308
-			foreach($colorset as $color)
1308
+			foreach ($colorset as $color)
1309 1309
 			{
1310 1310
 				$name = $color->attrs->name;
1311 1311
 				$title = $color->title->body;
1312 1312
 				$screenshot = $color->attrs->src;
1313
-				if($screenshot)
1313
+				if ($screenshot)
1314 1314
 				{
1315 1315
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1316
-					if(!file_exists($screenshot)) $screenshot = "";
1316
+					if (!file_exists($screenshot)) $screenshot = "";
1317 1317
 				}
1318 1318
 				else $screenshot = "";
1319 1319
 
@@ -1325,19 +1325,19 @@  discard block
 block discarded – undo
1325 1325
 			}
1326 1326
 		}
1327 1327
 		// Menu type (settings for layout)
1328
-		if($xml_obj->menus->menu)
1328
+		if ($xml_obj->menus->menu)
1329 1329
 		{
1330 1330
 			$menus = $xml_obj->menus->menu;
1331
-			if(!is_array($menus)) $menus = array($menus);
1331
+			if (!is_array($menus)) $menus = array($menus);
1332 1332
 
1333 1333
 			$menu_count = count($menus);
1334 1334
 			$skin_info->menu_count = $menu_count;
1335
-			for($i=0;$i<$menu_count;$i++)
1335
+			for ($i = 0; $i < $menu_count; $i++)
1336 1336
 			{
1337 1337
 				unset($obj);
1338 1338
 
1339 1339
 				$obj->name = $menus[$i]->attrs->name;
1340
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1340
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1341 1341
 				$obj->title = $menus[$i]->title->body;
1342 1342
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1343 1343
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 		}
1347 1347
 
1348 1348
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1349
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1349
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1350 1350
 		return $skin_info;
1351 1351
 	}
1352 1352
 
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	{
1358 1358
 		$args = new stdClass;
1359 1359
 		$args->site_srl = $site_srl;
1360
-		if(!is_null($module)) $args->module = $module;
1360
+		if (!is_null($module)) $args->module = $module;
1361 1361
 		$output = executeQuery('module.getModuleCount', $args);
1362 1362
 		return $output->data->count;
1363 1363
 	}
@@ -1371,26 +1371,26 @@  discard block
 block discarded – undo
1371 1371
 		$config = false;
1372 1372
 		// cache controll
1373 1373
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1374
-		if($oCacheHandler->isSupport())
1374
+		if ($oCacheHandler->isSupport())
1375 1375
 		{
1376
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1376
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1377 1377
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1378 1378
 			$config = $oCacheHandler->get($cache_key);
1379 1379
 		}
1380 1380
 
1381
-		if($config === false)
1381
+		if ($config === false)
1382 1382
 		{
1383
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1383
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1384 1384
 			{
1385 1385
 				$args = new stdClass();
1386 1386
 				$args->module = $module;
1387 1387
 				$args->site_srl = $site_srl;
1388 1388
 				$output = executeQuery('module.getModuleConfig', $args);
1389
-				if($output->data->config) $config = unserialize($output->data->config);
1389
+				if ($output->data->config) $config = unserialize($output->data->config);
1390 1390
 				else $config = null;
1391 1391
 
1392 1392
 				//insert in cache
1393
-				if($oCacheHandler->isSupport())
1393
+				if ($oCacheHandler->isSupport())
1394 1394
 				{
1395 1395
 					$oCacheHandler->put($cache_key, $config);
1396 1396
 				}
@@ -1411,26 +1411,26 @@  discard block
 block discarded – undo
1411 1411
 		$config = false;
1412 1412
 		// cache controll
1413 1413
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1414
-		if($oCacheHandler->isSupport())
1414
+		if ($oCacheHandler->isSupport())
1415 1415
 		{
1416 1416
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1417 1417
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1418 1418
 			$config = $oCacheHandler->get($cache_key);
1419 1419
 		}
1420 1420
 
1421
-		if($config === false)
1421
+		if ($config === false)
1422 1422
 		{
1423
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1423
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1424 1424
 			{
1425 1425
 				$args = new stdClass();
1426 1426
 				$args->module = $module;
1427 1427
 				$args->module_srl = $module_srl;
1428 1428
 				$output = executeQuery('module.getModulePartConfig', $args);
1429
-				if($output->data->config) $config = unserialize($output->data->config);
1429
+				if ($output->data->config) $config = unserialize($output->data->config);
1430 1430
 				else $config = null;
1431 1431
 
1432 1432
 				//insert in cache
1433
-				if($oCacheHandler->isSupport())
1433
+				if ($oCacheHandler->isSupport())
1434 1434
 				{
1435 1435
 					$oCacheHandler->put($cache_key, $config);
1436 1436
 				}
@@ -1449,11 +1449,11 @@  discard block
 block discarded – undo
1449 1449
 	{
1450 1450
 		$args = new stdClass();
1451 1451
 		$args->module = $module;
1452
-		if($site_srl) $args->site_srl = $site_srl;
1452
+		if ($site_srl) $args->site_srl = $site_srl;
1453 1453
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1454
-		if(!$output->toBool() || !$output->data) return array();
1454
+		if (!$output->toBool() || !$output->data) return array();
1455 1455
 
1456
-		foreach($output->data as $key => $val)
1456
+		foreach ($output->data as $key => $val)
1457 1457
 		{
1458 1458
 			$result[$val->module_srl] = unserialize($val->config);
1459 1459
 		}
@@ -1469,12 +1469,12 @@  discard block
 block discarded – undo
1469 1469
 		$args->moduleCategorySrl = $moduleCategorySrl;
1470 1470
 		// Get data from the DB
1471 1471
 		$output = executeQuery('module.getModuleCategories', $args);
1472
-		if(!$output->toBool()) return $output;
1472
+		if (!$output->toBool()) return $output;
1473 1473
 		$list = $output->data;
1474
-		if(!$list) return;
1475
-		if(!is_array($list)) $list = array($list);
1474
+		if (!$list) return;
1475
+		if (!is_array($list)) $list = array($list);
1476 1476
 
1477
-		foreach($list as $val)
1477
+		foreach ($list as $val)
1478 1478
 		{
1479 1479
 			$category_list[$val->module_category_srl] = $val;
1480 1480
 		}
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 		$args = new stdClass;
1491 1491
 		$args->module_category_srl = $module_category_srl;
1492 1492
 		$output = executeQuery('module.getModuleCategory', $args);
1493
-		if(!$output->toBool()) return $output;
1493
+		if (!$output->toBool()) return $output;
1494 1494
 		return $output->data;
1495 1495
 	}
1496 1496
 
@@ -1502,10 +1502,10 @@  discard block
 block discarded – undo
1502 1502
 		// Get a list of downloaded and installed modules
1503 1503
 		$searched_list = FileHandler::readDir('./modules');
1504 1504
 		$searched_count = count($searched_list);
1505
-		if(!$searched_count) return;
1505
+		if (!$searched_count) return;
1506 1506
 		sort($searched_list);
1507 1507
 
1508
-		for($i=0;$i<$searched_count;$i++)
1508
+		for ($i = 0; $i < $searched_count; $i++)
1509 1509
 		{
1510 1510
 			// Module name
1511 1511
 			$module_name = $searched_list[$i];
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 			$info = $this->getModuleInfoXml($module_name);
1516 1516
 			unset($obj);
1517 1517
 
1518
-			if(!isset($info)) continue;
1518
+			if (!isset($info)) continue;
1519 1519
 			$info->module = $module_name;
1520 1520
 			$info->created_table_count = $created_table_count;
1521 1521
 			$info->table_count = $table_count;
@@ -1532,19 +1532,19 @@  discard block
 block discarded – undo
1532 1532
 		$info = null;
1533 1533
 
1534 1534
 		$moduledir = ModuleHandler::getModulePath($module_name);
1535
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1535
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1536 1536
 		{
1537 1537
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1538 1538
 			$table_count = count($tmp_files);
1539 1539
 			// Check if the table is created
1540 1540
 			$created_table_count = 0;
1541
-			for($j=0;$j<count($tmp_files);$j++)
1541
+			for ($j = 0; $j < count($tmp_files); $j++)
1542 1542
 			{
1543
-				list($table_name) = explode(".",$tmp_files[$j]);
1544
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1543
+				list($table_name) = explode(".", $tmp_files[$j]);
1544
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1545 1545
 			}
1546 1546
 			// Check if DB is installed
1547
-			if($table_count > $created_table_count) return true;
1547
+			if ($table_count > $created_table_count) return true;
1548 1548
 			else return false;
1549 1549
 		}
1550 1550
 		return false;
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 	{
1555 1555
 		// Check if it is upgraded to module.class.php on each module
1556 1556
 		$oDummy = getModule($module_name, 'class');
1557
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1557
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1558 1558
 		{
1559 1559
 			return $oDummy->checkUpdate();
1560 1560
 		}
@@ -1568,15 +1568,15 @@  discard block
 block discarded – undo
1568 1568
 	 */
1569 1569
 	public function needUpdate($update_id)
1570 1570
 	{
1571
-		if(!is_array($update_id)) $update_id = array($update_id);
1571
+		if (!is_array($update_id)) $update_id = array($update_id);
1572 1572
 
1573 1573
 		$args = new stdClass();
1574 1574
 		$args->update_id = implode(',', $update_id);
1575 1575
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1576 1576
 
1577
-		if(!!$output->error) return false;
1578
-		if(!$output->data) $output->data = array();
1579
-		if(count($update_id) === count($output->data)) return false;
1577
+		if (!!$output->error) return false;
1578
+		if (!$output->data) $output->data = array();
1579
+		if (count($update_id) === count($output->data)) return false;
1580 1580
 
1581 1581
 		return true;
1582 1582
 	}
@@ -1593,31 +1593,31 @@  discard block
 block discarded – undo
1593 1593
 		sort($searched_list);
1594 1594
 
1595 1595
 		$searched_count = count($searched_list);
1596
-		if(!$searched_count) return;
1596
+		if (!$searched_count) return;
1597 1597
 
1598
-		for($i=0;$i<$searched_count;$i++)
1598
+		for ($i = 0; $i < $searched_count; $i++)
1599 1599
 		{
1600 1600
 			// module name
1601 1601
 			$module_name = $searched_list[$i];
1602 1602
 
1603 1603
 			$path = ModuleHandler::getModulePath($module_name);
1604
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1604
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1605 1605
 
1606 1606
 			// Get the number of xml files to create a table in schemas
1607 1607
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1608 1608
 			$table_count = count($tmp_files);
1609 1609
 			// Check if the table is created
1610 1610
 			$created_table_count = 0;
1611
-			for($j=0;$j<$table_count;$j++)
1611
+			for ($j = 0; $j < $table_count; $j++)
1612 1612
 			{
1613
-				list($table_name) = explode('.',$tmp_files[$j]);
1614
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1613
+				list($table_name) = explode('.', $tmp_files[$j]);
1614
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1615 1615
 			}
1616 1616
 			// Get information of the module
1617 1617
 			$info = NULL;
1618 1618
 			$info = $this->getModuleInfoXml($module_name);
1619 1619
 
1620
-			if(!$info) continue;
1620
+			if (!$info) continue;
1621 1621
 
1622 1622
 			$info->module = $module_name;
1623 1623
 			$info->category = $info->category;
@@ -1626,12 +1626,12 @@  discard block
 block discarded – undo
1626 1626
 			$info->path = $path;
1627 1627
 			$info->admin_index_act = $info->admin_index_act;
1628 1628
 			// Check if DB is installed
1629
-			if($table_count > $created_table_count) $info->need_install = true;
1629
+			if ($table_count > $created_table_count) $info->need_install = true;
1630 1630
 			else $info->need_install = false;
1631 1631
 			// Check if it is upgraded to module.class.php on each module
1632 1632
 			$oDummy = null;
1633 1633
 			$oDummy = getModule($module_name, 'class');
1634
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1634
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1635 1635
 			{
1636 1636
 				$info->need_update = $oDummy->checkUpdate();
1637 1637
 			}
@@ -1652,15 +1652,15 @@  discard block
 block discarded – undo
1652 1652
 	 */
1653 1653
 	function syncModuleToSite(&$data)
1654 1654
 	{
1655
-		if(!$data) return;
1655
+		if (!$data) return;
1656 1656
 
1657
-		if(is_array($data))
1657
+		if (is_array($data))
1658 1658
 		{
1659
-			foreach($data as $key => $val)
1659
+			foreach ($data as $key => $val)
1660 1660
 			{
1661 1661
 				$module_srls[] = $val->module_srl;
1662 1662
 			}
1663
-			if(!count($module_srls)) return;
1663
+			if (!count($module_srls)) return;
1664 1664
 		}
1665 1665
 		else
1666 1666
 		{
@@ -1668,17 +1668,17 @@  discard block
 block discarded – undo
1668 1668
 		}
1669 1669
 
1670 1670
 		$args = new stdClass();
1671
-		$args->module_srls = implode(',',$module_srls);
1671
+		$args->module_srls = implode(',', $module_srls);
1672 1672
 		$output = executeQueryArray('module.getModuleSites', $args);
1673
-		if(!$output->data) return array();
1674
-		foreach($output->data as $key => $val)
1673
+		if (!$output->data) return array();
1674
+		foreach ($output->data as $key => $val)
1675 1675
 		{
1676 1676
 			$modules[$val->module_srl] = $val;
1677 1677
 		}
1678 1678
 
1679
-		if(is_array($data))
1679
+		if (is_array($data))
1680 1680
 		{
1681
-			foreach($data as $key => $val)
1681
+			foreach ($data as $key => $val)
1682 1682
 			{
1683 1683
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1684 1684
 			}
@@ -1694,14 +1694,14 @@  discard block
 block discarded – undo
1694 1694
 	 */
1695 1695
 	function isSiteAdmin($member_info, $site_srl = null)
1696 1696
 	{
1697
-		if(!$member_info->member_srl) return false;
1698
-		if($member_info->is_admin == 'Y') return true;
1697
+		if (!$member_info->member_srl) return false;
1698
+		if ($member_info->is_admin == 'Y') return true;
1699 1699
 
1700 1700
 		$args = new stdClass();
1701
-		if(!isset($site_srl))
1701
+		if (!isset($site_srl))
1702 1702
 		{
1703 1703
 			$site_module_info = Context::get('site_module_info');
1704
-			if(!$site_module_info) return;
1704
+			if (!$site_module_info) return;
1705 1705
 			$args->site_srl = $site_module_info->site_srl;
1706 1706
 		}
1707 1707
 		else
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 		$args->member_srl = $member_info->member_srl;
1713 1713
 		$output = executeQuery('module.isSiteAdmin', $args);
1714
-		if($output->data->member_srl == $args->member_srl) return true;
1714
+		if ($output->data->member_srl == $args->member_srl) return true;
1715 1715
 		return false;
1716 1716
 	}
1717 1717
 
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 		$obj = new stdClass();
1735 1735
 		$obj->module_srl = $module_srl;
1736 1736
 		$output = executeQueryArray('module.getAdminID', $obj);
1737
-		if(!$output->toBool() || !$output->data) return;
1737
+		if (!$output->toBool() || !$output->data) return;
1738 1738
 
1739 1739
 		return $output->data;
1740 1740
 	}
@@ -1747,20 +1747,20 @@  discard block
 block discarded – undo
1747 1747
 	{
1748 1748
 		$extra_vars = array();
1749 1749
 		$get_module_srls = array();
1750
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1750
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1751 1751
 
1752 1752
 		$vars = false;
1753 1753
 		// cache controll
1754 1754
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1755
-		if($oCacheHandler->isSupport())
1755
+		if ($oCacheHandler->isSupport())
1756 1756
 		{
1757
-			foreach($list_module_srl as $module_srl)
1757
+			foreach ($list_module_srl as $module_srl)
1758 1758
 			{
1759 1759
 				$object_key = 'module_extra_vars:'.$module_srl;
1760 1760
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1761 1761
 				$vars = $oCacheHandler->get($cache_key);
1762 1762
 
1763
-				if($vars)
1763
+				if ($vars)
1764 1764
 				{
1765 1765
 					$extra_vars[$module_srl] = $vars;
1766 1766
 				}
@@ -1775,35 +1775,35 @@  discard block
 block discarded – undo
1775 1775
 			$get_module_srls = $list_module_srl;
1776 1776
 		}
1777 1777
 
1778
-		if(count($get_module_srls) > 0)
1778
+		if (count($get_module_srls) > 0)
1779 1779
 		{
1780 1780
 			$args = new stdClass();
1781 1781
 			$args->module_srl = implode(',', $get_module_srls);
1782 1782
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1783 1783
 
1784
-			if(!$output->toBool())
1784
+			if (!$output->toBool())
1785 1785
 			{
1786 1786
 				return;
1787 1787
 			}
1788 1788
 
1789
-			if(!$output->data)
1789
+			if (!$output->data)
1790 1790
 			{
1791
-				foreach($get_module_srls as $module_srl)
1791
+				foreach ($get_module_srls as $module_srl)
1792 1792
 				{
1793 1793
 					$extra_vars[$module_srl] = new stdClass;
1794 1794
 				}
1795 1795
 			}
1796
-			foreach($output->data as $key => $val)
1796
+			foreach ($output->data as $key => $val)
1797 1797
 			{
1798
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1798
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1799 1799
 
1800
-				if(!isset($extra_vars[$val->module_srl]))
1800
+				if (!isset($extra_vars[$val->module_srl]))
1801 1801
 				{
1802 1802
 					$extra_vars[$val->module_srl] = new stdClass();
1803 1803
 				}
1804 1804
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1805 1805
 
1806
-				if($oCacheHandler->isSupport())
1806
+				if ($oCacheHandler->isSupport())
1807 1807
 				{
1808 1808
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1809 1809
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1822,27 +1822,27 @@  discard block
 block discarded – undo
1822 1822
 	{
1823 1823
 		$skin_vars = false;
1824 1824
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1825
-		if($oCacheHandler->isSupport())
1825
+		if ($oCacheHandler->isSupport())
1826 1826
 		{
1827 1827
 			$object_key = 'module_skin_vars:'.$module_srl;
1828 1828
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1829 1829
 			$skin_vars = $oCacheHandler->get($cache_key);
1830 1830
 		}
1831 1831
 
1832
-		if($skin_vars === false)
1832
+		if ($skin_vars === false)
1833 1833
 		{
1834 1834
 			$args = new stdClass();
1835 1835
 			$args->module_srl = $module_srl;
1836
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1837
-			if(!$output->toBool()) return;
1836
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1837
+			if (!$output->toBool()) return;
1838 1838
 
1839 1839
 			$skin_vars = array();
1840
-			foreach($output->data as $vars)
1840
+			foreach ($output->data as $vars)
1841 1841
 			{
1842 1842
 				$skin_vars[$vars->name] = $vars;
1843 1843
 			}
1844 1844
 
1845
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1845
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1846 1846
 		}
1847 1847
 
1848 1848
 		return $skin_vars;
@@ -1854,32 +1854,32 @@  discard block
 block discarded – undo
1854 1854
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1855 1855
 	{
1856 1856
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1857
-		if(!$site_srl) $site_srl = 0;
1857
+		if (!$site_srl) $site_srl = 0;
1858 1858
 
1859 1859
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1860
-		if(is_readable($designInfoFile))
1860
+		if (is_readable($designInfoFile))
1861 1861
 		{
1862 1862
 			include($designInfoFile);
1863 1863
 
1864 1864
 			$skinName = $designInfo->module->{$module_name}->{$target};
1865 1865
 		}
1866
-		if(!$skinName)
1866
+		if (!$skinName)
1867 1867
 		{
1868 1868
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1869 1869
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1870 1870
 
1871
-			if(is_dir($moduleSkinPath.'default'))
1871
+			if (is_dir($moduleSkinPath.'default'))
1872 1872
 			{
1873 1873
 				$skinName = 'default';
1874 1874
 			}
1875
-			else if(is_dir($moduleSkinPath.'xe_default'))
1875
+			else if (is_dir($moduleSkinPath.'xe_default'))
1876 1876
 			{
1877 1877
 				$skinName = 'xe_default';
1878 1878
 			}
1879 1879
 			else
1880 1880
 			{
1881 1881
 				$skins = FileHandler::readDir($moduleSkinPath);
1882
-				if(count($skins) > 0)
1882
+				if (count($skins) > 0)
1883 1883
 				{
1884 1884
 					$skinName = $skins[0];
1885 1885
 				}
@@ -1889,9 +1889,9 @@  discard block
 block discarded – undo
1889 1889
 				}
1890 1890
 			}
1891 1891
 
1892
-			if($updateCache && $skinName)
1892
+			if ($updateCache && $skinName)
1893 1893
 			{
1894
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1894
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1895 1895
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1896 1896
 
1897 1897
 				$oAdminController = getAdminController('admin');
@@ -1907,10 +1907,10 @@  discard block
 block discarded – undo
1907 1907
 	 */
1908 1908
 	function syncSkinInfoToModuleInfo(&$module_info)
1909 1909
 	{
1910
-		if(!$module_info->module_srl) return;
1910
+		if (!$module_info->module_srl) return;
1911 1911
 
1912 1912
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1913
-		if(Mobile::isFromMobilePhone())
1913
+		if (Mobile::isFromMobilePhone())
1914 1914
 		{
1915 1915
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1916 1916
 		}
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1920 1920
 		}
1921 1921
 
1922
-		if(!$skin_vars) return;
1922
+		if (!$skin_vars) return;
1923 1923
 
1924
-		foreach($skin_vars as $name => $val)
1924
+		foreach ($skin_vars as $name => $val)
1925 1925
 		{
1926
-			if(isset($module_info->{$name})) continue;
1926
+			if (isset($module_info->{$name})) continue;
1927 1927
 			$module_info->{$name} = $val->value;
1928 1928
 		}
1929 1929
 	}
@@ -1937,27 +1937,27 @@  discard block
 block discarded – undo
1937 1937
 	{
1938 1938
 		$skin_vars = false;
1939 1939
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1940
-		if($oCacheHandler->isSupport())
1940
+		if ($oCacheHandler->isSupport())
1941 1941
 		{
1942 1942
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1943 1943
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1944 1944
 			$skin_vars = $oCacheHandler->get($cache_key);
1945 1945
 		}
1946 1946
 
1947
-		if($skin_vars === false)
1947
+		if ($skin_vars === false)
1948 1948
 		{
1949 1949
 			$args = new stdClass();
1950 1950
 			$args->module_srl = $module_srl;
1951
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1952
-			if(!$output->toBool() || !$output->data) return;
1951
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1952
+			if (!$output->toBool() || !$output->data) return;
1953 1953
 
1954 1954
 			$skin_vars = array();
1955
-			foreach($output->data as $vars)
1955
+			foreach ($output->data as $vars)
1956 1956
 			{
1957 1957
 				$skin_vars[$vars->name] = $vars;
1958 1958
 			}
1959 1959
 
1960
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1960
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1961 1961
 		}
1962 1962
 
1963 1963
 		return $skin_vars;
@@ -1969,32 +1969,32 @@  discard block
 block discarded – undo
1969 1969
 	 */
1970 1970
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1971 1971
 	{
1972
-		if(!$module_info->module_srl) return;
1972
+		if (!$module_info->module_srl) return;
1973 1973
 		$skin_vars = false;
1974 1974
 		// cache controll
1975 1975
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1976
-		if($oCacheHandler->isSupport())
1976
+		if ($oCacheHandler->isSupport())
1977 1977
 		{
1978 1978
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1979 1979
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1980 1980
 			$skin_vars = $oCacheHandler->get($cache_key);
1981 1981
 		}
1982
-		if($skin_vars === false)
1982
+		if ($skin_vars === false)
1983 1983
 		{
1984 1984
 			$args = new stdClass;
1985 1985
 			$args->module_srl = $module_info->module_srl;
1986
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1987
-			if(!$output->toBool()) return;
1986
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1987
+			if (!$output->toBool()) return;
1988 1988
 			$skin_vars = $output->data;
1989 1989
 
1990 1990
 			//insert in cache
1991
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1991
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1992 1992
 		}
1993
-		if(!$skin_vars) return;
1993
+		if (!$skin_vars) return;
1994 1994
 
1995
-		foreach($output->data as $val)
1995
+		foreach ($output->data as $val)
1996 1996
 		{
1997
-			if(isset($module_info->{$val->name})) continue;
1997
+			if (isset($module_info->{$val->name})) continue;
1998 1998
 			$module_info->{$val->name} = $val->value;
1999 1999
 		}
2000 2000
 	}
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 	{
2007 2007
 		$grant = new stdClass();
2008 2008
 
2009
-		if(!$xml_info)
2009
+		if (!$xml_info)
2010 2010
 		{
2011 2011
 			$module = $module_info->module;
2012 2012
 			$xml_info = $this->getModuleActionXml($module);
@@ -2014,9 +2014,9 @@  discard block
 block discarded – undo
2014 2014
 		// Set variables to grant group permission
2015 2015
 		$module_srl = $module_info->module_srl;
2016 2016
 		$grant_info = $xml_info->grant;
2017
-		if($member_info->member_srl)
2017
+		if ($member_info->member_srl)
2018 2018
 		{
2019
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2019
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2020 2020
 			else $group_list = array();
2021 2021
 		}
2022 2022
 		else
@@ -2024,10 +2024,10 @@  discard block
 block discarded – undo
2024 2024
 			$group_list = array();
2025 2025
 		}
2026 2026
 		// If module_srl doesn't exist(if unable to set permissions)
2027
-		if(!$module_srl)
2027
+		if (!$module_srl)
2028 2028
 		{
2029 2029
 			$grant->access = true;
2030
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2030
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2031 2031
 			{
2032 2032
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2033 2033
 			}
@@ -2038,23 +2038,23 @@  discard block
 block discarded – undo
2038 2038
 		{
2039 2039
 			// If module_srl exists
2040 2040
 			// Get a type of granted permission
2041
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2041
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2042 2042
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2043 2043
 			// If a just logged-in member is, check if the member is a module administrator
2044
-			if(!$grant->manager && $member_info->member_srl)
2044
+			if (!$grant->manager && $member_info->member_srl)
2045 2045
 			{
2046 2046
 				$args = new stdClass();
2047 2047
 				$args->module_srl = $module_srl;
2048 2048
 				$args->member_srl = $member_info->member_srl;
2049
-				$output = executeQuery('module.getModuleAdmin',$args);
2050
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2049
+				$output = executeQuery('module.getModuleAdmin', $args);
2050
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2051 2051
 			}
2052 2052
 			// If not an administrator, get information from the DB and grant manager privilege.
2053
-			if(!$grant->manager)
2053
+			if (!$grant->manager)
2054 2054
 			{
2055 2055
 				$args = new stdClass();
2056 2056
 				// If planet, get permission settings from the planet home
2057
-				if($module_info->module == 'planet')
2057
+				if ($module_info->module == 'planet')
2058 2058
 				{
2059 2059
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2060 2060
 				}
@@ -2067,42 +2067,42 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 				$grant_exists = $granted = array();
2069 2069
 
2070
-				if($output->data)
2070
+				if ($output->data)
2071 2071
 				{
2072 2072
 					// Arrange names and groups who has privileges
2073
-					foreach($output->data as $val)
2073
+					foreach ($output->data as $val)
2074 2074
 					{
2075 2075
 						$grant_exists[$val->name] = true;
2076
-						if($granted[$val->name]) continue;
2076
+						if ($granted[$val->name]) continue;
2077 2077
 						// Log-in member only
2078
-						if($val->group_srl == -1)
2078
+						if ($val->group_srl == -1)
2079 2079
 						{
2080 2080
 							$granted[$val->name] = true;
2081
-							if($member_info->member_srl) $grant->{$val->name} = true;
2081
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2082 2082
 							// Site-joined member only
2083 2083
 						}
2084
-						elseif($val->group_srl == -2)
2084
+						elseif ($val->group_srl == -2)
2085 2085
 						{
2086 2086
 							$granted[$val->name] = true;
2087 2087
 							// Do not grant any permission for non-logged member
2088
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2088
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2089 2089
 							// Log-in member
2090 2090
 							else
2091 2091
 							{
2092 2092
 								$site_module_info = Context::get('site_module_info');
2093 2093
 								// Permission granted if no information of the currently connected site exists
2094
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2094
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2095 2095
 								// Permission is not granted if information of the currently connected site exists
2096
-								elseif(count($group_list)) $grant->{$val->name} = true;
2096
+								elseif (count($group_list)) $grant->{$val->name} = true;
2097 2097
 							}
2098 2098
 							// All of non-logged members
2099 2099
 						}
2100
-						elseif($val->group_srl == -3)
2100
+						elseif ($val->group_srl == -3)
2101 2101
 						{
2102 2102
 							$granted[$val->name] = true;
2103 2103
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2104 2104
 						}
2105
-						elseif($val->group_srl == 0)
2105
+						elseif ($val->group_srl == 0)
2106 2106
 						{
2107 2107
 							$granted[$val->name] = true;
2108 2108
 							$grant->{$val->name} = true;
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 						}
2111 2111
 						else
2112 2112
 						{
2113
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2113
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2114 2114
 							{
2115 2115
 								$grant->{$val->name} = true;
2116 2116
 								$granted[$val->name] = true;
@@ -2119,29 +2119,29 @@  discard block
 block discarded – undo
2119 2119
 					}
2120 2120
 				}
2121 2121
 				// Separate processing for the virtual group access
2122
-				if(!$grant_exists['access']) $grant->access = true;
2123
-				if(count($grant_info))
2122
+				if (!$grant_exists['access']) $grant->access = true;
2123
+				if (count($grant_info))
2124 2124
 				{
2125
-					foreach($grant_info as  $grant_name => $grant_item)
2125
+					foreach ($grant_info as  $grant_name => $grant_item)
2126 2126
 					{
2127
-						if($grant_exists[$grant_name]) continue;
2128
-						switch($grant_item->default)
2127
+						if ($grant_exists[$grant_name]) continue;
2128
+						switch ($grant_item->default)
2129 2129
 						{
2130 2130
 							case 'guest' :
2131 2131
 								$grant->{$grant_name} = true;
2132 2132
 								break;
2133 2133
 							case 'member' :
2134
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2134
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2135 2135
 								else $grant->{$grant_name} = false;
2136 2136
 								break;
2137 2137
 							case 'site' :
2138 2138
 								$site_module_info = Context::get('site_module_info');
2139
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2139
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2140 2140
 								else $grant->{$grant_name} = false;
2141 2141
 								break;
2142 2142
 							case 'manager' :
2143 2143
 							case 'root' :
2144
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2144
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2145 2145
 								else $grant->{$grant_name} = false;
2146 2146
 								break;
2147 2147
 						}
@@ -2149,12 +2149,12 @@  discard block
 block discarded – undo
2149 2149
 				}
2150 2150
 			}
2151 2151
 			// Set true to grant all privileges if an administrator is
2152
-			if($grant->manager)
2152
+			if ($grant->manager)
2153 2153
 			{
2154 2154
 				$grant->access = true;
2155
-				if(count($grant_info))
2155
+				if (count($grant_info))
2156 2156
 				{
2157
-					foreach($grant_info as $key => $val)
2157
+					foreach ($grant_info as $key => $val)
2158 2158
 					{
2159 2159
 						$grant->{$key} = true;
2160 2160
 					}
@@ -2186,27 +2186,27 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
 	function unserializeAttributes($module_filebox_list)
2188 2188
 	{
2189
-		if(is_array($module_filebox_list->data))
2189
+		if (is_array($module_filebox_list->data))
2190 2190
 		{
2191
-			foreach($module_filebox_list->data as &$item)
2191
+			foreach ($module_filebox_list->data as &$item)
2192 2192
 			{
2193
-				if(empty($item->comment))
2193
+				if (empty($item->comment))
2194 2194
 				{
2195 2195
 					continue;
2196 2196
 				}
2197 2197
 
2198 2198
 				$attributes = explode(';', $item->comment);
2199
-				foreach($attributes as $attribute)
2199
+				foreach ($attributes as $attribute)
2200 2200
 				{
2201 2201
 					$values = explode(':', $attribute);
2202
-					if((count($values) % 2) ==1)
2202
+					if ((count($values) % 2) == 1)
2203 2203
 					{
2204
-						for($i=2;$i<count($values);$i++)
2204
+						for ($i = 2; $i < count($values); $i++)
2205 2205
 						{
2206
-							$values[1].=":".$values[$i];
2206
+							$values[1] .= ":".$values[$i];
2207 2207
 						}
2208 2208
 					}
2209
-					$atts[$values[0]]=$values[1];
2209
+					$atts[$values[0]] = $values[1];
2210 2210
 				}
2211 2211
 				$item->attributes = $atts;
2212 2212
 				unset($atts);
@@ -2218,16 +2218,16 @@  discard block
 block discarded – undo
2218 2218
 	function getFileBoxListHtml()
2219 2219
 	{
2220 2220
 		$logged_info = Context::get('logged_info');
2221
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2221
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2222 2222
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2223
-		$link_params = explode('&',$link['query']);
2223
+		$link_params = explode('&', $link['query']);
2224 2224
 		foreach ($link_params as $param)
2225 2225
 		{
2226
-			$param = explode("=",$param);
2227
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2226
+			$param = explode("=", $param);
2227
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2228 2228
 		}
2229 2229
 		$oWidgetModel = getModel('widget');
2230
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2230
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2231 2231
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2232 2232
 
2233 2233
 		$oModuleModel = getModel('module');
@@ -2243,24 +2243,24 @@  discard block
 block discarded – undo
2243 2243
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2244 2244
 
2245 2245
 		$oTemplate = &TemplateHandler::getInstance();
2246
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2246
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2247 2247
 
2248 2248
 		$this->add('html', $html);
2249 2249
 	}
2250 2250
 
2251 2251
 	function getModuleFileBoxPath($module_filebox_srl)
2252 2252
 	{
2253
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2253
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2254 2254
 	}
2255 2255
 
2256 2256
 	/**
2257 2257
 	 * @brief Return ruleset cache file path
2258 2258
 	 * @param module, act
2259 2259
 	 */
2260
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2260
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2261 2261
 	{
2262 2262
 		// load dynamic ruleset xml file
2263
-		if(strpos($ruleset, '@') !== false)
2263
+		if (strpos($ruleset, '@') !== false)
2264 2264
 		{
2265 2265
 			$rulsetFile = str_replace('@', '', $ruleset);
2266 2266
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2270,20 +2270,20 @@  discard block
 block discarded – undo
2270 2270
 		{
2271 2271
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2272 2272
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2273
-			if(is_readable($xml_file))
2273
+			if (is_readable($xml_file))
2274 2274
 				return FileHandler::getRealPath($xml_file);
2275
-			else{
2275
+			else {
2276 2276
 				$ruleset = str_replace('#', '', $ruleset);
2277 2277
 			}
2278 2278
 
2279 2279
 		}
2280 2280
 		// Get a path of the requested module. Return if not exists.
2281 2281
 		$class_path = ModuleHandler::getModulePath($module);
2282
-		if(!$class_path) return;
2282
+		if (!$class_path) return;
2283 2283
 
2284 2284
 		// Check if module.xml exists in the path. Return if not exist
2285 2285
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2286
-		if(!file_exists($xml_file)) return;
2286
+		if (!file_exists($xml_file)) return;
2287 2287
 
2288 2288
 		return $xml_file;
2289 2289
 	}
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 		$requestVars = Context::getRequestVars();
2296 2296
 
2297 2297
 		$args = new stdClass;
2298
-		$args->site_srl = (int)$requestVars->site_srl;
2298
+		$args->site_srl = (int) $requestVars->site_srl;
2299 2299
 		$args->page = 1; // /< Page
2300 2300
 		$args->list_count = 100; // /< the number of posts to display on a single page
2301 2301
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2307,9 +2307,9 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
 		$list = array();
2309 2309
 
2310
-		if($output->toBool())
2310
+		if ($output->toBool())
2311 2311
 		{
2312
-			foreach((array)$output->data as $code_info)
2312
+			foreach ((array) $output->data as $code_info)
2313 2313
 			{
2314 2314
 				unset($codeInfo);
2315 2315
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.