GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#1947)
by
unknown
12:00
created
config/config.inc.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @file   config/config.inc.php
8 8
  * @author NAVER ([email protected])
9 9
  */
10
-if(version_compare(PHP_VERSION, '5.4.0', '<'))
10
+if (version_compare(PHP_VERSION, '5.4.0', '<'))
11 11
 {
12 12
 	@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);
13 13
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT);
17 17
 }
18 18
 
19
-if(!defined('__XE__'))
19
+if (!defined('__XE__'))
20 20
 {
21 21
 	exit();
22 22
 }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 ini_set('session.use_only_cookies', 0);
54 54
 
55 55
 
56
-if(file_exists(_XE_PATH_ . 'config/package.inc.php'))
56
+if (file_exists(_XE_PATH_.'config/package.inc.php'))
57 57
 {
58
-	require _XE_PATH_ . 'config/package.inc.php';
58
+	require _XE_PATH_.'config/package.inc.php';
59 59
 }
60 60
 else
61 61
 {
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
  * define('__ENABLE_PHPUNIT_TEST__', 0);
98 98
  * define('__PROXY_SERVER__', 'http://domain:port/path');
99 99
  */
100
-if(file_exists(_XE_PATH_ . 'config/config.user.inc.php'))
100
+if (file_exists(_XE_PATH_.'config/config.user.inc.php'))
101 101
 {
102
-	require _XE_PATH_ . 'config/config.user.inc.php';
102
+	require _XE_PATH_.'config/config.user.inc.php';
103 103
 }
104 104
 
105
-if(!defined('__DEBUG__'))
105
+if (!defined('__DEBUG__'))
106 106
 {
107 107
 	/**
108 108
 	 * output debug message(bit value)
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	define('__DEBUG__', 0);
118 118
 }
119 119
 
120
-if(!defined('__DEBUG_OUTPUT__'))
120
+if (!defined('__DEBUG_OUTPUT__'))
121 121
 {
122 122
 	/**
123 123
 	 * output location of debug message
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	define('__DEBUG_OUTPUT__', 0);
132 132
 }
133 133
 
134
-if(!defined('__DEBUG_PROTECT__'))
134
+if (!defined('__DEBUG_PROTECT__'))
135 135
 {
136 136
 	/**
137 137
 	 * output comments of the firePHP console and browser
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	define('__DEBUG_PROTECT__', 1);
145 145
 }
146 146
 
147
-if(!defined('__DEBUG_PROTECT_IP__'))
147
+if (!defined('__DEBUG_PROTECT_IP__'))
148 148
 {
149 149
 	/**
150 150
 	 * Set a ip address to allow debug
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	define('__DEBUG_PROTECT_IP__', '127.0.0.1');
153 153
 }
154 154
 
155
-if(!defined('__DEBUG_DB_OUTPUT__'))
155
+if (!defined('__DEBUG_DB_OUTPUT__'))
156 156
 {
157 157
 	/**
158 158
 	 * DB error message definition
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	define('__DEBUG_DB_OUTPUT__', 0);
166 166
 }
167 167
 
168
-if(!defined('__LOG_SLOW_QUERY__'))
168
+if (!defined('__LOG_SLOW_QUERY__'))
169 169
 {
170 170
 	/**
171 171
 	 * Query log for only timeout query among DB queries
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	define('__LOG_SLOW_QUERY__', 0);
180 180
 }
181 181
 
182
-if(!defined('__LOG_SLOW_TRIGGER__'))
182
+if (!defined('__LOG_SLOW_TRIGGER__'))
183 183
 {
184 184
 	/**
185 185
 	 * Trigger excute time log
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	define('__LOG_SLOW_TRIGGER__', 0);
194 194
 }
195 195
 
196
-if(!defined('__LOG_SLOW_ADDON__'))
196
+if (!defined('__LOG_SLOW_ADDON__'))
197 197
 {
198 198
 	/**
199 199
 	 * Addon excute time log
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	define('__LOG_SLOW_ADDON__', 0);
208 208
 }
209 209
 
210
-if(!defined('__LOG_SLOW_WIDGET__'))
210
+if (!defined('__LOG_SLOW_WIDGET__'))
211 211
 {
212 212
 	/**
213 213
 	 * Widget excute time log
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	define('__LOG_SLOW_WIDGET__', 0);
222 222
 }
223 223
 
224
-if(!defined('__DEBUG_QUERY__'))
224
+if (!defined('__DEBUG_QUERY__'))
225 225
 {
226 226
 	/**
227 227
 	 * Leave DB query information
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	define('__DEBUG_QUERY__', 0);
235 235
 }
236 236
 
237
-if(!defined('__OB_GZHANDLER_ENABLE__'))
237
+if (!defined('__OB_GZHANDLER_ENABLE__'))
238 238
 {
239 239
 	/**
240 240
 	 * option to enable/disable a compression feature using ob_gzhandler
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	define('__OB_GZHANDLER_ENABLE__', 1);
249 249
 }
250 250
 
251
-if(!defined('__ENABLE_PHPUNIT_TEST__'))
251
+if (!defined('__ENABLE_PHPUNIT_TEST__'))
252 252
 {
253 253
 	/**
254 254
 	 * decide to use/not use the php unit test (Path/tests/index.php)
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	define('__ENABLE_PHPUNIT_TEST__', 0);
262 262
 }
263 263
 
264
-if(!defined('__PROXY_SERVER__'))
264
+if (!defined('__PROXY_SERVER__'))
265 265
 {
266 266
 	/**
267 267
 	 * __PROXY_SERVER__ has server information to request to the external through the target server
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	define('__PROXY_SERVER__', NULL);
271 271
 }
272 272
 
273
-if(!defined('__ERROR_LOG__'))
273
+if (!defined('__ERROR_LOG__'))
274 274
 {
275 275
 	/**
276 276
 	 * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다.
@@ -282,25 +282,25 @@  discard block
 block discarded – undo
282 282
 }
283 283
 
284 284
 // Require specific files when using Firebug console output
285
-if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)
285
+if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)
286 286
 {
287
-	require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php';
287
+	require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
288 288
 }
289 289
 
290 290
 // Set Timezone as server time
291
-if(version_compare(PHP_VERSION, '5.3.0') >= 0)
291
+if (version_compare(PHP_VERSION, '5.3.0') >= 0)
292 292
 {
293 293
 	date_default_timezone_set(@date_default_timezone_get());
294 294
 }
295 295
 
296 296
 // Require a function-defined-file for simple use
297
-require(_XE_PATH_ . 'config/func.inc.php');
297
+require(_XE_PATH_.'config/func.inc.php');
298 298
 
299
-if(__DEBUG__) {
299
+if (__DEBUG__) {
300 300
 	define('__StartTime__', getMicroTime());
301 301
 }
302 302
 
303
-if(__DEBUG__) {
303
+if (__DEBUG__) {
304 304
 	$GLOBALS['__elapsed_class_load__'] = 0;
305 305
 }
306 306
 
@@ -402,38 +402,38 @@  discard block
 block discarded – undo
402 402
 
403 403
 function __xe_autoload($class_name)
404 404
 {
405
-	if(__DEBUG__) {
405
+	if (__DEBUG__) {
406 406
 		$time_at = getMicroTime();
407 407
 	}
408 408
 
409
-	if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))
409
+	if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))
410 410
 	{
411
-		require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];
411
+		require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];
412 412
 	}
413
-	elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches))
413
+	elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches))
414 414
 	{
415 415
 		$candidate_filename = array();
416
-		$candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1];
417
-		if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';
416
+		$candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1];
417
+		if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';
418 418
 		$candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class';
419 419
 		$candidate_filename[] = 'php';
420 420
 
421 421
 		$candidate_filename = implode('.', $candidate_filename);
422 422
 
423
-		if(file_exists(_XE_PATH_ . $candidate_filename))
423
+		if (file_exists(_XE_PATH_.$candidate_filename))
424 424
 		{
425
-			require _XE_PATH_ . $candidate_filename;
425
+			require _XE_PATH_.$candidate_filename;
426 426
 		}
427 427
 	}
428 428
 
429
-	if(__DEBUG__) {
429
+	if (__DEBUG__) {
430 430
 		$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at;
431 431
 	}
432 432
 }
433 433
 spl_autoload_register('__xe_autoload');
434 434
 
435
-if(file_exists(_XE_PATH_  . '/vendor/autoload.php')) {
436
-	require _XE_PATH_  . '/vendor/autoload.php';
435
+if (file_exists(_XE_PATH_.'/vendor/autoload.php')) {
436
+	require _XE_PATH_.'/vendor/autoload.php';
437 437
 }
438 438
 /* End of file config.inc.php */
439 439
 /* Location: ./config/config.inc.php */
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 2 patches
Braces   +31 added lines, -47 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
 				{
112 112
 					register_shutdown_function(array($this, 'shutdownHandler'));
113 113
 				}
114
-			}
115
-			else if(__DEBUG_PROTECT__ === 0)
114
+			} else if(__DEBUG_PROTECT__ === 0)
116 115
 			{
117 116
 				set_error_handler(array($this, 'xeErrorLog'), 3);
118 117
 				if(3 & E_ERROR)
@@ -126,7 +125,9 @@  discard block
 block discarded – undo
126 125
 		$called_position = 'before_module_init';
127 126
 		$oAddonController = getController('addon');
128 127
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
129
-		if(file_exists($addon_file)) include($addon_file);
128
+		if(file_exists($addon_file)) {
129
+			include($addon_file);
130
+		}
130 131
 	}
131 132
 
132 133
 	function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -249,8 +250,7 @@  discard block
 block discarded – undo
249 250
 			if(!$module_info)
250 251
 			{
251 252
 				unset($this->document_srl);
252
-			}
253
-			else
253
+			} else
254 254
 			{
255 255
 				// If it exists, compare mid based on the module information
256 256
 				// if mids are not matching, set it as the document's mid
@@ -262,8 +262,7 @@  discard block
 block discarded – undo
262 262
 						$this->mid = $module_info->mid;
263 263
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
264 264
 						return FALSE;
265
-					}
266
-					else
265
+					} else
267 266
 					{
268 267
 						$this->mid = $module_info->mid;
269 268
 						Context::set('mid', $this->mid);
@@ -314,15 +313,13 @@  discard block
 block discarded – undo
314 313
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
315 314
 				$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'));
316 315
 				// If it's called from a virtual site, though it's not a module of the virtual site
317
-			}
318
-			else
316
+			} else
319 317
 			{
320 318
 				$db_info = Context::getDBInfo();
321 319
 				if(!$db_info->default_url)
322 320
 				{
323 321
 					return Context::getLang('msg_default_url_is_not_defined');
324
-				}
325
-				else
322
+				} else
326 323
 				{
327 324
 					$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'));
328 325
 				}
@@ -347,8 +344,7 @@  discard block
 block discarded – undo
347 344
 			{
348 345
 				$oLayoutAdminModel = getAdminModel('layout');
349 346
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
350
-			}
351
-			else
347
+			} else
352 348
 			{
353 349
 				$layoutSrl = $module_info->{$targetSrl};
354 350
 			}
@@ -475,8 +471,7 @@  discard block
 block discarded – undo
475 471
 			if(!$allowedMethod)
476 472
 			{
477 473
 				$allowedMethodList[0] = 'POST';
478
-			}
479
-			else
474
+			} else
480 475
 			{
481 476
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
482 477
 			}
@@ -534,8 +529,7 @@  discard block
 block discarded – undo
534 529
 				Mobile::setMobile(FALSE);
535 530
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
536 531
 			}
537
-		}
538
-		else
532
+		} else
539 533
 		{
540 534
 			// create a module instance
541 535
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -588,8 +582,7 @@  discard block
 block discarded – undo
588 582
 					$forward->type = $xml_info->action->{$this->act}->type;
589 583
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
590 584
 					$forward->act = $this->act;
591
-				}
592
-				else
585
+				} else
593 586
 				{
594 587
 					$this->error = 'msg_invalid_request';
595 588
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -625,8 +618,7 @@  discard block
 block discarded – undo
625 618
 					if(!$allowedMethod)
626 619
 					{
627 620
 						$allowedMethodList[0] = 'POST';
628
-					}
629
-					else
621
+					} else
630 622
 					{
631 623
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
632 624
 					}
@@ -654,8 +646,7 @@  discard block
 block discarded – undo
654 646
 						Mobile::setMobile(FALSE);
655 647
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
656 648
 					}
657
-				}
658
-				else
649
+				} else
659 650
 				{
660 651
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
661 652
 				}
@@ -685,8 +676,7 @@  discard block
 block discarded – undo
685 676
 							$oModule->setLayoutPath("./modules/admin/tpl");
686 677
 							$oModule->setLayoutFile("layout.html");
687 678
 						}
688
-					}
689
-					else
679
+					} else
690 680
 					{
691 681
 						$this->_setInputErrorToContext();
692 682
 
@@ -710,8 +700,7 @@  discard block
 block discarded – undo
710 700
 						$oMessageObject->setMessage($this->error);
711 701
 						$oMessageObject->dispMessage();
712 702
 						return $oMessageObject;
713
-					}
714
-					else
703
+					} else
715 704
 					{
716 705
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
717 706
 						{
@@ -725,12 +714,10 @@  discard block
 block discarded – undo
725 714
 						}
726 715
 					}
727 716
 				}
728
-			}
729
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
717
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
730 718
 			{
731 719
 				$this->act = $xml_info->default_index_act;
732
-			}
733
-			else
720
+			} else
734 721
 			{
735 722
 				$this->error = 'msg_invalid_request';
736 723
 				$oModule->setError(-1);
@@ -828,7 +815,9 @@  discard block
 block discarded – undo
828 815
 			$message = $oModule->getMessage();
829 816
 			$messageType = $oModule->getMessageType();
830 817
 			$redirectUrl = $oModule->getRedirectUrl();
831
-			if($messageType == 'error') debugPrint($message, 'ERROR');
818
+			if($messageType == 'error') {
819
+				debugPrint($message, 'ERROR');
820
+			}
832 821
 
833 822
 			if(!$procResult)
834 823
 			{
@@ -838,8 +827,7 @@  discard block
 block discarded – undo
838 827
 					$redirectUrl = Context::get('error_return_url');
839 828
 				}
840 829
 				$this->_setInputValueToSession();
841
-			}
842
-			else
830
+			} else
843 831
 			{
844 832
 
845 833
 			}
@@ -987,8 +975,7 @@  discard block
 block discarded – undo
987 975
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
988 976
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
989 977
 					// Otherwise, set message instance as the target module
990
-				}
991
-				else
978
+				} else
992 979
 				{
993 980
 					$oModule = $oMessageObject;
994 981
 				}
@@ -1000,8 +987,7 @@  discard block
 block discarded – undo
1000 987
 			if(Mobile::isFromMobilePhone())
1001 988
 			{
1002 989
 				$layout_srl = $oModule->module_info->mlayout_srl;
1003
-			}
1004
-			else
990
+			} else
1005 991
 			{
1006 992
 				$layout_srl = $oModule->module_info->layout_srl;
1007 993
 			}
@@ -1060,8 +1046,7 @@  discard block
 block discarded – undo
1060 1046
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1061 1047
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1062 1048
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1063
-								}
1064
-								else
1049
+								} else
1065 1050
 								{
1066 1051
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1067 1052
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1098,8 +1083,7 @@  discard block
 block discarded – undo
1098 1083
 				if($kind == 'admin')
1099 1084
 				{
1100 1085
 					$oModule->setLayoutFile('popup_layout');
1101
-				}
1102
-				else
1086
+				} else
1103 1087
 				{
1104 1088
 					$oModule->setLayoutPath('common/tpl');
1105 1089
 					$oModule->setLayoutFile('default_layout');
@@ -1233,13 +1217,11 @@  discard block
 block discarded – undo
1233 1217
 		{
1234 1218
 			$instanceName = '%s';
1235 1219
 			$classFile = '%s%s.%s.php';
1236
-		}
1237
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1220
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1238 1221
 		{
1239 1222
 			$instanceName = '%sAdmin%s';
1240 1223
 			$classFile = '%s%s.admin.%s.php';
1241
-		}
1242
-		else
1224
+		} else
1243 1225
 		{
1244 1226
 			$instanceName = '%s%s';
1245 1227
 			$classFile = '%s%s.%s.php';
@@ -1302,7 +1284,9 @@  discard block
 block discarded – undo
1302 1284
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1303 1285
 			$slowlog->called = $module . '.' . $called_method;
1304 1286
 			$slowlog->called_extension = $module;
1305
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1287
+			if($trigger_name != 'XE.writeSlowlog') {
1288
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1289
+			}
1306 1290
 
1307 1291
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1308 1292
 			{
Please login to merge, or discard this patch.
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
36 36
 	{
37 37
 		// If XE has not installed yet, set module as install
38
-		if(!Context::isInstalled())
38
+		if (!Context::isInstalled())
39 39
 		{
40 40
 			$this->module = 'install';
41 41
 			$this->act = Context::get('act');
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,14 +102,14 @@  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__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__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'));
111 111
 			}
112
-			else if(__DEBUG_PROTECT__ === 0)
112
+			else if (__DEBUG_PROTECT__ === 0)
113 113
 			{
114 114
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
115 115
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -120,41 +120,41 @@  discard block
 block discarded – undo
120 120
 		$called_position = 'before_module_init';
121 121
 		$oAddonController = getController('addon');
122 122
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
123
-		if(file_exists($addon_file)) include($addon_file);
123
+		if (file_exists($addon_file)) include($addon_file);
124 124
 	}
125 125
 
126 126
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
127 127
 	{
128
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
128
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
129 129
 		{
130 130
 			return false;
131 131
 		}
132 132
 
133 133
 		set_error_handler(function() { }, ~0);
134 134
 
135
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
135
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
136 136
 		$debug_file_exist = file_exists($debug_file);
137
-		if(!$debug_file_exist)
137
+		if (!$debug_file_exist)
138 138
 		{
139 139
 			$print[] = '<?php exit() ?>';
140 140
 		}
141 141
 
142 142
 		$errorname = self::getErrorType($errnumber);
143
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
143
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
144 144
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
145 145
 		$backtrace = debug_backtrace($backtrace_args);
146
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
146
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
147 147
 		{
148 148
 			array_shift($backtrace);
149 149
 		}
150 150
 
151
-		foreach($backtrace as $key => $value)
151
+		foreach ($backtrace as $key => $value)
152 152
 		{
153
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
153
+			$message = '    - '.$value['file'].' : '.$value['line'];
154 154
 			$print[] = $message;
155 155
 		}
156 156
 		$print[] = PHP_EOL;
157
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
157
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
158 158
 		restore_error_handler();
159 159
 
160 160
 		return true;
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 
171 171
 		set_error_handler(function() { }, ~0);
172 172
 
173
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
173
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
174 174
 		$debug_file_exist = file_exists($debug_file);
175
-		if(!$debug_file_exist)
175
+		if (!$debug_file_exist)
176 176
 		{
177 177
 			$print[] = '<?php exit() ?>';
178 178
 		}
179 179
 
180 180
 		$errorname = self::getErrorType($errinfo['type']);
181 181
 		$print[] = '['.date('Y-m-d H:i:s').']';
182
-		$print[] = $errorname . ' : ' . $errinfo['message'];
182
+		$print[] = $errorname.' : '.$errinfo['message'];
183 183
 
184
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
184
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
185 185
 		$print[] = $message;
186 186
 
187 187
 		$print[] = PHP_EOL;
188
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
188
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
189 189
 		set_error_handler(array($this, 'dummyHandler'), ~0);
190 190
 	}
191 191
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 
224 224
 		// if success_return_url and error_return_url is incorrect
225 225
 		$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
226
-		foreach($urls as $url)
226
+		foreach ($urls as $url)
227 227
 		{
228
-			if(empty($url))
228
+			if (empty($url))
229 229
 			{
230 230
 				continue;
231 231
 			}
@@ -237,29 +237,29 @@  discard block
 block discarded – undo
237 237
 			$defaultUrlInfo = parse_url($dbInfo->default_url);
238 238
 			$defaultHost = $defaultUrlInfo['host'];
239 239
 		
240
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
240
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
241 241
 			{
242 242
 				throw new Exception('msg_default_url_is_null');
243 243
 			}
244 244
 		}
245 245
 		
246
-		if(!$this->document_srl && $this->mid && $this->entry)
246
+		if (!$this->document_srl && $this->mid && $this->entry)
247 247
 		{
248 248
 			$oDocumentModel = getModel('document');
249 249
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
250
-			if($this->document_srl)
250
+			if ($this->document_srl)
251 251
 			{
252 252
 				Context::set('document_srl', $this->document_srl);
253 253
 			}
254 254
 		}
255 255
 
256 256
 		// Get module's information based on document_srl, if it's specified
257
-		if($this->document_srl)
257
+		if ($this->document_srl)
258 258
 		{
259 259
 			
260 260
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
261 261
 			// If the document does not exist, remove document_srl
262
-			if(!$module_info)
262
+			if (!$module_info)
263 263
 			{
264 264
 				unset($this->document_srl);
265 265
 			}
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 			{
268 268
 				// If it exists, compare mid based on the module information
269 269
 				// if mids are not matching, set it as the document's mid
270
-				if(!$this->mid || ($this->mid != $module_info->mid))
270
+				if (!$this->mid || ($this->mid != $module_info->mid))
271 271
 				{
272 272
 					
273
-					if(Context::getRequestMethod() == 'GET')
273
+					if (Context::getRequestMethod() == 'GET')
274 274
 					{
275 275
 						$this->mid = $module_info->mid;
276
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
276
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
277 277
 						return FALSE;
278 278
 					}
279 279
 					else
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 					
285 285
 				}
286 286
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
287
-				if($this->module && $module_info->module != $this->module)
287
+				if ($this->module && $module_info->module != $this->module)
288 288
 				{
289 289
 					unset($module_info);
290 290
 				}
@@ -293,36 +293,36 @@  discard block
 block discarded – undo
293 293
 		}
294 294
 
295 295
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
296
-		if(!$module_info && $this->mid)
296
+		if (!$module_info && $this->mid)
297 297
 		{
298 298
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
299 299
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
300 300
 		}
301 301
 
302 302
 		// redirect, if module_site_srl and site_srl are different
303
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
303
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
304 304
 		{
305 305
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
306
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
306
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
307 307
 			return FALSE;
308 308
 		}
309 309
 
310 310
 		// If module_info is not set still, and $module does not exist, find the default module
311
-		if(!$module_info && !$this->module && !$this->mid)
311
+		if (!$module_info && !$this->module && !$this->mid)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
316
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
317 317
 		{
318 318
 			$module_info = $site_module_info;
319 319
 		}
320 320
 
321 321
 		// redirect, if site_srl of module_info is different from one of site's module_info
322
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
322
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
323 323
 		{
324 324
 			// If the module is of virtual site
325
-			if($module_info->site_srl)
325
+			if ($module_info->site_srl)
326 326
 			{
327 327
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
328 328
 				$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'));
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			else
332 332
 			{
333 333
 				$db_info = Context::getDBInfo();
334
-				if(!$db_info->default_url)
334
+				if (!$db_info->default_url)
335 335
 				{
336 336
 					return Context::getLang('msg_default_url_is_not_defined');
337 337
 				}
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
 					$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'));
341 341
 				}
342 342
 			}
343
-			header("location:" . $redirect_url);
343
+			header("location:".$redirect_url);
344 344
 			return FALSE;
345 345
 		}
346 346
 
347 347
 		// If module info was set, retrieve variables from the module information
348
-		if($module_info)
348
+		if ($module_info)
349 349
 		{
350 350
 			$this->module = $module_info->module;
351 351
 			$this->mid = $module_info->mid;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
357 357
 
358 358
 			// use the site default layout.
359
-			if($module_info->{$targetSrl} == -1)
359
+			if ($module_info->{$targetSrl} == -1)
360 360
 			{
361 361
 				$oLayoutAdminModel = getAdminModel('layout');
362 362
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 		}
375 375
 
376 376
 		// Set module and mid into module_info
377
-		if(!isset($this->module_info))
377
+		if (!isset($this->module_info))
378 378
 		{
379 379
 			$this->module_info = new stdClass();
380 380
 		}
@@ -385,21 +385,21 @@  discard block
 block discarded – undo
385 385
 		$this->module_info->site_srl = $site_module_info->site_srl;
386 386
 
387 387
 		// Still no module? it's an error
388
-		if(!$this->module)
388
+		if (!$this->module)
389 389
 		{
390 390
 			$this->error = 'msg_module_is_not_exists';
391 391
 			$this->httpStatusCode = '404';
392 392
 		}
393 393
 
394 394
 		// If mid exists, set mid into context
395
-		if($this->mid)
395
+		if ($this->mid)
396 396
 		{
397 397
 			Context::set('mid', $this->mid, TRUE);
398 398
 		}
399 399
 		
400 400
 		// Call a trigger after moduleHandler init
401 401
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
402
-		if(!$output->toBool())
402
+		if (!$output->toBool())
403 403
 		{
404 404
 			$this->error = $output->getMessage();
405 405
 			return TRUE;
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
422 422
 
423 423
 		// If error occurred while preparation, return a message instance
424
-		if($this->error)
424
+		if ($this->error)
425 425
 		{
426 426
 			$this->_setInputErrorToContext();
427 427
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
428 428
 			$oMessageObject->setError(-1);
429 429
 			$oMessageObject->setMessage($this->error);
430 430
 			$oMessageObject->dispMessage();
431
-			if($this->httpStatusCode)
431
+			if ($this->httpStatusCode)
432 432
 			{
433 433
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
434 434
 			}
@@ -439,22 +439,22 @@  discard block
 block discarded – undo
439 439
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
440 440
 
441 441
 		// If not installed yet, modify act
442
-		if($this->module == "install")
442
+		if ($this->module == "install")
443 443
 		{
444
-			if(!$this->act || !$xml_info->action->{$this->act})
444
+			if (!$this->act || !$xml_info->action->{$this->act})
445 445
 			{
446 446
 				$this->act = $xml_info->default_index_act;
447 447
 			}
448 448
 		}
449 449
 
450 450
 		// if act exists, find type of the action, if not use default index act
451
-		if(!$this->act)
451
+		if (!$this->act)
452 452
 		{
453 453
 			$this->act = $xml_info->default_index_act;
454 454
 		}
455 455
 
456 456
 		// still no act means error
457
-		if(!$this->act)
457
+		if (!$this->act)
458 458
 		{
459 459
 			$this->error = 'msg_module_is_not_exists';
460 460
 			$this->httpStatusCode = '404';
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			$oMessageObject->setError(-1);
465 465
 			$oMessageObject->setMessage($this->error);
466 466
 			$oMessageObject->dispMessage();
467
-			if($this->httpStatusCode)
467
+			if ($this->httpStatusCode)
468 468
 			{
469 469
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
470 470
 			}
@@ -475,17 +475,17 @@  discard block
 block discarded – undo
475 475
 		$type = $xml_info->action->{$this->act}->type;
476 476
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
477 477
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
478
-		if(!$kind && $this->module == 'admin')
478
+		if (!$kind && $this->module == 'admin')
479 479
 		{
480 480
 			$kind = 'admin';
481 481
 		}
482 482
 
483 483
 		// check REQUEST_METHOD in controller
484
-		if($type == 'controller')
484
+		if ($type == 'controller')
485 485
 		{
486 486
 			$allowedMethod = $xml_info->action->{$this->act}->method;
487 487
 
488
-			if(!$allowedMethod)
488
+			if (!$allowedMethod)
489 489
 			{
490 490
 				$allowedMethodList[0] = 'POST';
491 491
 			}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
495 495
 			}
496 496
 
497
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
497
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
498 498
 			{
499 499
 				$this->error = "msg_invalid_request";
500 500
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 			}
506 506
 		}
507 507
 
508
-		if($this->module_info->use_mobile != "Y")
508
+		if ($this->module_info->use_mobile != "Y")
509 509
 		{
510 510
 			Mobile::setMobile(FALSE);
511 511
 		}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		$logged_info = Context::get('logged_info');
514 514
 
515 515
 		// check CSRF for POST actions
516
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
516
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
517 517
 			$this->error = 'msg_invalid_request';
518 518
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
519 519
 			$oMessageObject->setError(-1);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 		}
524 524
 
525 525
 		// Admin ip
526
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
526
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
527 527
 		{
528 528
 			$this->_setInputErrorToContext();
529 529
 			$this->error = "msg_not_permitted_act";
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 		}
536 536
 
537 537
 		// if(type == view, and case for using mobilephone)
538
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
538
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
539 539
 		{
540 540
 			$orig_type = "view";
541 541
 			$type = "mobile";
542 542
 			// create a module instance
543 543
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
544
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
544
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
545 545
 			{
546 546
 				$type = $orig_type;
547 547
 				Mobile::setMobile(FALSE);
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
555 555
 		}
556 556
 
557
-		if(!is_object($oModule))
557
+		if (!is_object($oModule))
558 558
 		{
559 559
 			$this->_setInputErrorToContext();
560 560
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
561 561
 			$oMessageObject->setError(-1);
562 562
 			$oMessageObject->setMessage($this->error);
563 563
 			$oMessageObject->dispMessage();
564
-			if($this->httpStatusCode)
564
+			if ($this->httpStatusCode)
565 565
 			{
566 566
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
567 567
 			}
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
 		}
570 570
 
571 571
 		// If there is no such action in the module object
572
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
572
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
573 573
 		{
574 574
 
575
-			if(!Context::isInstalled())
575
+			if (!Context::isInstalled())
576 576
 			{
577 577
 				$this->_setInputErrorToContext();
578 578
 				$this->error = 'msg_invalid_request';
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 				$oMessageObject->setError(-1);
581 581
 				$oMessageObject->setMessage($this->error);
582 582
 				$oMessageObject->dispMessage();
583
-				if($this->httpStatusCode)
583
+				if ($this->httpStatusCode)
584 584
 				{
585 585
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
586 586
 				}
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 
590 590
 			$forward = NULL;
591 591
 			// 1. Look for the module with action name
592
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
592
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
593 593
 			{
594
-				$module = strtolower($matches[2] . $matches[3]);
594
+				$module = strtolower($matches[2].$matches[3]);
595 595
 				$xml_info = $oModuleModel->getModuleActionXml($module);
596 596
 
597
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
597
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
598 598
 				{
599 599
 					$forward = new stdClass();
600 600
 					$forward->module = $module;
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
 				}
615 615
 			}
616 616
 
617
-			if(!$forward)
617
+			if (!$forward)
618 618
 			{
619 619
 				$forward = $oModuleModel->getActionForward($this->act);
620 620
 			}
621 621
 
622
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
622
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
623 623
 			{
624 624
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
625 625
 				$type = $forward->type;
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 
632 632
 				// SECISSUE also check foward act method
633 633
 				// check REQUEST_METHOD in controller
634
-				if($type == 'controller')
634
+				if ($type == 'controller')
635 635
 				{
636 636
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
637 637
 
638
-					if(!$allowedMethod)
638
+					if (!$allowedMethod)
639 639
 					{
640 640
 						$allowedMethodList[0] = 'POST';
641 641
 					}
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
645 645
 					}
646 646
 
647
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
647
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
648 648
 					{
649 649
 						$this->error = "msg_invalid_request";
650 650
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 					}
656 656
 				}
657 657
 
658
-				if($type == "view" && Mobile::isFromMobilePhone())
658
+				if ($type == "view" && Mobile::isFromMobilePhone())
659 659
 				{
660 660
 					$orig_type = "view";
661 661
 					$type = "mobile";
662 662
 					// create a module instance
663 663
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
664
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
664
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
665 665
 					{
666 666
 						$type = $orig_type;
667 667
 						Mobile::setMobile(FALSE);
@@ -673,25 +673,25 @@  discard block
 block discarded – undo
673 673
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
674 674
 				}
675 675
 
676
-				if(!is_object($oModule))
676
+				if (!is_object($oModule))
677 677
 				{
678 678
 					$this->_setInputErrorToContext();
679 679
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
680 680
 					$oMessageObject->setError(-1);
681 681
 					$oMessageObject->setMessage('msg_module_is_not_exists');
682 682
 					$oMessageObject->dispMessage();
683
-					if($this->httpStatusCode)
683
+					if ($this->httpStatusCode)
684 684
 					{
685 685
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
686 686
 					}
687 687
 					return $oMessageObject;
688 688
 				}
689 689
 
690
-				if($this->module == "admin" && $type == "view")
690
+				if ($this->module == "admin" && $type == "view")
691 691
 				{
692
-					if($logged_info->is_admin == 'Y')
692
+					if ($logged_info->is_admin == 'Y')
693 693
 					{
694
-						if($this->act != 'dispLayoutAdminLayoutModify')
694
+						if ($this->act != 'dispLayoutAdminLayoutModify')
695 695
 						{
696 696
 							$oAdminView = getAdminView('admin');
697 697
 							$oAdminView->makeGnbUrl($forward->module);
@@ -711,10 +711,10 @@  discard block
 block discarded – undo
711 711
 						return $oMessageObject;
712 712
 					}
713 713
 				}
714
-				if($kind == 'admin')
714
+				if ($kind == 'admin')
715 715
 				{
716 716
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
717
-					if(!$grant->manager)
717
+					if (!$grant->manager)
718 718
 					{
719 719
 						$this->_setInputErrorToContext();
720 720
 						$this->error = 'msg_is_not_manager';
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 					}
727 727
 					else
728 728
 					{
729
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
729
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
730 730
 						{
731 731
 							$this->_setInputErrorToContext();
732 732
 							$this->error = 'msg_is_not_administrator';
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 					}
740 740
 				}
741 741
 			}
742
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
742
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
743 743
 			{
744 744
 				$this->act = $xml_info->default_index_act;
745 745
 			}
@@ -753,16 +753,16 @@  discard block
 block discarded – undo
753 753
 		}
754 754
 
755 755
 		// ruleset check...
756
-		if(!empty($ruleset))
756
+		if (!empty($ruleset))
757 757
 		{
758 758
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
759 759
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
760
-			if(!empty($rulesetFile))
760
+			if (!empty($rulesetFile))
761 761
 			{
762
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
762
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
763 763
 				{
764 764
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
765
-					foreach($errorLang as $key => $val)
765
+					foreach ($errorLang as $key => $val)
766 766
 					{
767 767
 						Context::setLang($key, $val);
768 768
 					}
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 				$Validator = new Validator($rulesetFile);
773 773
 				$result = $Validator->validate();
774
-				if(!$result)
774
+				if (!$result)
775 775
 				{
776 776
 					$lastError = $Validator->getLastError();
777 777
 					$returnUrl = Context::get('error_return_url');
@@ -803,26 +803,26 @@  discard block
 block discarded – undo
803 803
 				'dispLayoutPreviewWithModule' => 1
804 804
 		);
805 805
 		$db_use_mobile = Mobile::isMobileEnabled();
806
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
806
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
807 807
 		{
808 808
 			global $lang;
809 809
 			$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>';
810
-			$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>';
810
+			$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>';
811 811
 			Context::addHtmlHeader($header);
812 812
 			Context::addHtmlFooter($footer);
813 813
 		}
814 814
 
815
-		if($type == "view" && $kind != 'admin')
815
+		if ($type == "view" && $kind != 'admin')
816 816
 		{
817 817
 			$module_config = $oModuleModel->getModuleConfig('module');
818
-			if($module_config->htmlFooter)
818
+			if ($module_config->htmlFooter)
819 819
 			{
820 820
 				Context::addHtmlFooter($module_config->htmlFooter);
821 821
 			}
822
-			if($module_config->siteTitle)
822
+			if ($module_config->siteTitle)
823 823
 			{
824 824
 				$siteTitle = Context::getBrowserTitle();
825
-				if(!$siteTitle)
825
+				if (!$siteTitle)
826 826
 				{
827 827
 					Context::setBrowserTitle($module_config->siteTitle);
828 828
 				}
@@ -835,18 +835,18 @@  discard block
 block discarded – undo
835 835
 		$procResult = $oModule->proc();
836 836
 
837 837
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
838
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
838
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
839 839
 		{
840 840
 			$error = $oModule->getError();
841 841
 			$message = $oModule->getMessage();
842 842
 			$messageType = $oModule->getMessageType();
843 843
 			$redirectUrl = $oModule->getRedirectUrl();
844
-			if($messageType == 'error') debugPrint($message, 'ERROR');
844
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
845 845
 
846
-			if(!$procResult)
846
+			if (!$procResult)
847 847
 			{
848 848
 				$this->error = $message;
849
-				if(!$redirectUrl && Context::get('error_return_url'))
849
+				if (!$redirectUrl && Context::get('error_return_url'))
850 850
 				{
851 851
 					$redirectUrl = Context::get('error_return_url');
852 852
 				}
@@ -859,13 +859,13 @@  discard block
 block discarded – undo
859 859
 
860 860
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
861 861
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
862
-			if($message != 'success')
862
+			if ($message != 'success')
863 863
 			{
864 864
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
865 865
 			}
866 866
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
867 867
 
868
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
868
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
869 869
 			{
870 870
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
871 871
 			}
@@ -881,27 +881,27 @@  discard block
 block discarded – undo
881 881
 	 * */
882 882
 	function _setInputErrorToContext()
883 883
 	{
884
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
884
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
885 885
 		{
886 886
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
887 887
 		}
888
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
888
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
889 889
 		{
890 890
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
891 891
 		}
892
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
892
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
893 893
 		{
894 894
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
895 895
 		}
896
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
896
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
897 897
 		{
898 898
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
899 899
 		}
900
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
900
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
901 901
 		{
902 902
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
903 903
 		}
904
-		if(count($_SESSION['INPUT_ERROR']))
904
+		if (count($_SESSION['INPUT_ERROR']))
905 905
 		{
906 906
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
907 907
 		}
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 	{
932 932
 		$requestVars = Context::getRequestVars();
933 933
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
934
-		foreach($requestVars AS $key => $value)
934
+		foreach ($requestVars AS $key => $value)
935 935
 		{
936 936
 			$_SESSION['INPUT_ERROR'][$key] = $value;
937 937
 		}
@@ -945,41 +945,41 @@  discard block
 block discarded – undo
945 945
 	function displayContent($oModule = NULL)
946 946
 	{
947 947
 		// If the module is not set or not an object, set error
948
-		if(!$oModule || !is_object($oModule))
948
+		if (!$oModule || !is_object($oModule))
949 949
 		{
950 950
 			$this->error = 'msg_module_is_not_exists';
951 951
 			$this->httpStatusCode = '404';
952 952
 		}
953 953
 
954 954
 		// If connection to DB has a problem even though it's not install module, set error
955
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
955
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
956 956
 		{
957 957
 			$this->error = 'msg_dbconnect_failed';
958 958
 		}
959 959
 
960 960
 		// Call trigger after moduleHandler proc
961 961
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
962
-		if(!$output->toBool())
962
+		if (!$output->toBool())
963 963
 		{
964 964
 			$this->error = $output->getMessage();
965 965
 		}
966 966
 
967 967
 		// Use message view object, if HTML call
968 968
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
969
-		if(!isset($methodList[Context::getRequestMethod()]))
969
+		if (!isset($methodList[Context::getRequestMethod()]))
970 970
 		{
971 971
 
972
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
972
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
973 973
 			{
974 974
 				$display_handler = new DisplayHandler();
975 975
 				$display_handler->_debugOutput();
976 976
 
977
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
977
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
978 978
 				return;
979 979
 			}
980 980
 
981 981
 			// If error occurred, handle it
982
-			if($this->error)
982
+			if ($this->error)
983 983
 			{
984 984
 				// display content with message module instance
985 985
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -988,14 +988,14 @@  discard block
 block discarded – undo
988 988
 				$oMessageObject->setMessage($this->error);
989 989
 				$oMessageObject->dispMessage();
990 990
 
991
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
991
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
992 992
 				{
993 993
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
994 994
 					$oMessageObject->setTemplateFile('http_status_code');
995 995
 				}
996 996
 
997 997
 				// If module was called normally, change the templates of the module into ones of the message view module
998
-				if($oModule)
998
+				if ($oModule)
999 999
 				{
1000 1000
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1001 1001
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			}
1011 1011
 
1012 1012
 			// Check if layout_srl exists for the module
1013
-			if(Mobile::isFromMobilePhone())
1013
+			if (Mobile::isFromMobilePhone())
1014 1014
 			{
1015 1015
 				$layout_srl = $oModule->module_info->mlayout_srl;
1016 1016
 			}
@@ -1020,58 +1020,58 @@  discard block
 block discarded – undo
1020 1020
 			}
1021 1021
 
1022 1022
 			// if layout_srl is rollback by module, set default layout
1023
-			if($layout_srl == -1)
1023
+			if ($layout_srl == -1)
1024 1024
 			{
1025 1025
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1026 1026
 				$oLayoutAdminModel = getAdminModel('layout');
1027 1027
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1028 1028
 			}
1029 1029
 
1030
-			if($layout_srl && !$oModule->getLayoutFile())
1030
+			if ($layout_srl && !$oModule->getLayoutFile())
1031 1031
 			{
1032 1032
 
1033 1033
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1034 1034
 				$oLayoutModel = getModel('layout');
1035 1035
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1036
-				if($layout_info)
1036
+				if ($layout_info)
1037 1037
 				{
1038 1038
 
1039 1039
 					// Input extra_vars into $layout_info
1040
-					if($layout_info->extra_var_count)
1040
+					if ($layout_info->extra_var_count)
1041 1041
 					{
1042 1042
 
1043
-						foreach($layout_info->extra_var as $var_id => $val)
1043
+						foreach ($layout_info->extra_var as $var_id => $val)
1044 1044
 						{
1045
-							if($val->type == 'image')
1045
+							if ($val->type == 'image')
1046 1046
 							{
1047
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1047
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1048 1048
 								{
1049
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1049
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1050 1050
 								}
1051 1051
 							}
1052 1052
 							$layout_info->{$var_id} = $val->value;
1053 1053
 						}
1054 1054
 					}
1055 1055
 					// Set menus into context
1056
-					if($layout_info->menu_count)
1056
+					if ($layout_info->menu_count)
1057 1057
 					{
1058
-						foreach($layout_info->menu as $menu_id => $menu)
1058
+						foreach ($layout_info->menu as $menu_id => $menu)
1059 1059
 						{
1060 1060
 							// set default menu set(included home menu)
1061
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1061
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1062 1062
 							{
1063 1063
 								$oMenuAdminController = getAdminController('menu');
1064 1064
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1065 1065
 
1066
-								if(FileHandler::exists($homeMenuCacheFile))
1066
+								if (FileHandler::exists($homeMenuCacheFile))
1067 1067
 								{
1068 1068
 									include($homeMenuCacheFile);
1069 1069
 								}
1070 1070
 
1071
-								if(!$menu->menu_srl)
1071
+								if (!$menu->menu_srl)
1072 1072
 								{
1073
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1074
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1073
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1074
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1075 1075
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1076 1076
 								}
1077 1077
 								else
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 							}
1083 1083
 
1084 1084
 							$php_file = FileHandler::exists($menu->php_file);
1085
-							if($php_file)
1085
+							if ($php_file)
1086 1086
 							{
1087 1087
 								include($php_file);
1088 1088
 							}
@@ -1098,17 +1098,17 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
 					// If layout was modified, use the modified version
1100 1100
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1101
-					if(file_exists($edited_layout))
1101
+					if (file_exists($edited_layout))
1102 1102
 					{
1103 1103
 						$oModule->setEditedLayoutFile($edited_layout);
1104 1104
 					}
1105 1105
 				}
1106 1106
 			}
1107 1107
 			$isLayoutDrop = Context::get('isLayoutDrop');
1108
-			if($isLayoutDrop)
1108
+			if ($isLayoutDrop)
1109 1109
 			{
1110 1110
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1111
-				if($kind == 'admin')
1111
+				if ($kind == 'admin')
1112 1112
 				{
1113 1113
 					$oModule->setLayoutFile('popup_layout');
1114 1114
 				}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1147 1147
 	{
1148 1148
 
1149
-		if(__DEBUG__ == 3)
1149
+		if (__DEBUG__ == 3)
1150 1150
 		{
1151 1151
 			$start_time = getMicroTime();
1152 1152
 		}
@@ -1156,51 +1156,51 @@  discard block
 block discarded – undo
1156 1156
 		$type = strtolower($type);
1157 1157
 
1158 1158
 		$kinds = array('svc' => 1, 'admin' => 1);
1159
-		if(!isset($kinds[$kind]))
1159
+		if (!isset($kinds[$kind]))
1160 1160
 		{
1161 1161
 			$kind = 'svc';
1162 1162
 		}
1163 1163
 
1164
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1164
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1165 1165
 
1166
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1166
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1167 1167
 		{
1168 1168
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1169 1169
 		}
1170 1170
 
1171 1171
 		// if there is no instance of the module in global variable, create a new one
1172
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1172
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1173 1173
 		{
1174 1174
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1175 1175
 
1176
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1176
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1177 1177
 			{
1178 1178
 				$module = $parent_module;
1179 1179
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1180 1180
 			}
1181 1181
 
1182 1182
 			// Check if the base class and instance class exist
1183
-			if(!class_exists($module, true))
1183
+			if (!class_exists($module, true))
1184 1184
 			{
1185 1185
 				return NULL;
1186 1186
 			}
1187
-			if(!class_exists($instance_name, true))
1187
+			if (!class_exists($instance_name, true))
1188 1188
 			{
1189 1189
 				return NULL;
1190 1190
 			}
1191 1191
 
1192 1192
 			// Create an instance
1193 1193
 			$oModule = new $instance_name();
1194
-			if(!is_object($oModule))
1194
+			if (!is_object($oModule))
1195 1195
 			{
1196 1196
 				return NULL;
1197 1197
 			}
1198 1198
 
1199 1199
 			// Load language files for the class
1200
-			Context::loadLang($class_path . 'lang');
1201
-			if($extend_module)
1200
+			Context::loadLang($class_path.'lang');
1201
+			if ($extend_module)
1202 1202
 			{
1203
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1203
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1204 1204
 			}
1205 1205
 
1206 1206
 			// Set variables to the instance
@@ -1208,10 +1208,10 @@  discard block
 block discarded – undo
1208 1208
 			$oModule->setModulePath($class_path);
1209 1209
 
1210 1210
 			// If the module has a constructor, run it.
1211
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1211
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1212 1212
 			{
1213 1213
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1214
-				if(@method_exists($oModule, $instance_name))
1214
+				if (@method_exists($oModule, $instance_name))
1215 1215
 				{
1216 1216
 					$oModule->{$instance_name}();
1217 1217
 				}
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1222 1222
 		}
1223 1223
 
1224
-		if(__DEBUG__ == 3)
1224
+		if (__DEBUG__ == 3)
1225 1225
 		{
1226 1226
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1227 1227
 		}
@@ -1237,17 +1237,17 @@  discard block
 block discarded – undo
1237 1237
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1238 1238
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1239 1239
 
1240
-		$types = array('view','controller','model','api','wap','mobile','class');
1241
-		if(!in_array($type, $types))
1240
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1241
+		if (!in_array($type, $types))
1242 1242
 		{
1243 1243
 			$type = $types[0];
1244 1244
 		}
1245
-		if($type == 'class')
1245
+		if ($type == 'class')
1246 1246
 		{
1247 1247
 			$instanceName = '%s';
1248 1248
 			$classFile = '%s%s.%s.php';
1249 1249
 		}
1250
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1250
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1251 1251
 		{
1252 1252
 			$instanceName = '%sAdmin%s';
1253 1253
 			$classFile = '%s%s.admin.%s.php';
@@ -1272,26 +1272,26 @@  discard block
 block discarded – undo
1272 1272
 	function triggerCall($trigger_name, $called_position, &$obj)
1273 1273
 	{
1274 1274
 		// skip if not installed
1275
-		if(!Context::isInstalled())
1275
+		if (!Context::isInstalled())
1276 1276
 		{
1277 1277
 			return new Object();
1278 1278
 		}
1279 1279
 
1280 1280
 		$oModuleModel = getModel('module');
1281 1281
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1282
-		if(!$triggers || count($triggers) < 1)
1282
+		if (!$triggers || count($triggers) < 1)
1283 1283
 		{
1284 1284
 			return new Object();
1285 1285
 		}
1286 1286
 		
1287 1287
 		//store before trigger call time
1288 1288
 		$before_trigger_time = NULL;
1289
-		if(__LOG_SLOW_TRIGGER__> 0)
1289
+		if (__LOG_SLOW_TRIGGER__ > 0)
1290 1290
 		{
1291 1291
 			$before_trigger_time = microtime(true);
1292 1292
 		}
1293 1293
 
1294
-		foreach($triggers as $item)
1294
+		foreach ($triggers as $item)
1295 1295
 		{
1296 1296
 			$module = $item->module;
1297 1297
 			$type = $item->type;
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
 			// todo why don't we call a normal class object ?
1301 1301
 			$oModule = getModule($module, $type);
1302
-			if(!$oModule || !method_exists($oModule, $called_method))
1302
+			if (!$oModule || !method_exists($oModule, $called_method))
1303 1303
 			{
1304 1304
 				continue;
1305 1305
 			}
@@ -1312,12 +1312,12 @@  discard block
 block discarded – undo
1312 1312
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1313 1313
 
1314 1314
 			$slowlog = new stdClass;
1315
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1316
-			$slowlog->called = $module . '.' . $called_method;
1315
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1316
+			$slowlog->called = $module.'.'.$called_method;
1317 1317
 			$slowlog->called_extension = $module;
1318
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1318
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1319 1319
 
1320
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1320
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1321 1321
 			{
1322 1322
 				return $output;
1323 1323
 			}
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 			'505' => 'HTTP Version Not Supported',
1378 1378
 		);
1379 1379
 		$statusMessage = $statusMessageList[$code];
1380
-		if(!$statusMessage)
1380
+		if (!$statusMessage)
1381 1381
 		{
1382 1382
 			$statusMessage = 'OK';
1383 1383
 		}
Please login to merge, or discard this patch.