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:04 queued 12s
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   +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,20 +102,20 @@  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'), 3);
110
-				if(3 & E_ERROR)
110
+				if (3 & E_ERROR)
111 111
 				{
112 112
 					register_shutdown_function(array($this, 'shutdownHandler'));
113 113
 				}
114 114
 			}
115
-			else if(__DEBUG_PROTECT__ === 0)
115
+			else if (__DEBUG_PROTECT__ === 0)
116 116
 			{
117 117
 				set_error_handler(array($this, 'xeErrorLog'), 3);
118
-				if(3 & E_ERROR)
118
+				if (3 & E_ERROR)
119 119
 				{
120 120
 					register_shutdown_function(array($this, 'shutdownHandler'));
121 121
 				}
@@ -126,42 +126,42 @@  discard block
 block discarded – undo
126 126
 		$called_position = 'before_module_init';
127 127
 		$oAddonController = getController('addon');
128 128
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
129
-		if(file_exists($addon_file)) include($addon_file);
129
+		if (file_exists($addon_file)) include($addon_file);
130 130
 	}
131 131
 
132 132
 	function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
133 133
 	{
134
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
134
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
135 135
 		{
136 136
 			return false;
137 137
 		}
138 138
 
139 139
 		set_error_handler(array($this, 'dummyHandler'), ~0);
140 140
 
141
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
141
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
142 142
 		$debug_file_exist = file_exists($debug_file);
143
-		if(!$debug_file_exist)
143
+		if (!$debug_file_exist)
144 144
 		{
145 145
 			$print[] = '<?php exit() ?>';
146 146
 		}
147 147
 
148 148
 		$errorname = self::getErrorType($errnumber);
149 149
 		$print[] = '['.date('Y-m-d H:i:s').']';
150
-		$print[] = $errorname . ' : ' . $errormassage;
150
+		$print[] = $errorname.' : '.$errormassage;
151 151
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
152 152
 		$backtrace = debug_backtrace($backtrace_args);
153
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
153
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
154 154
 		{
155 155
 			array_shift($backtrace);
156 156
 		}
157 157
 
158
-		foreach($backtrace as $key => $value)
158
+		foreach ($backtrace as $key => $value)
159 159
 		{
160
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
160
+			$message = '    - '.$value['file'].' : '.$value['line'];
161 161
 			$print[] = $message;
162 162
 		}
163 163
 		$print[] = PHP_EOL;
164
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
164
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
165 165
 		restore_error_handler();
166 166
 
167 167
 		return true;
@@ -177,22 +177,22 @@  discard block
 block discarded – undo
177 177
 
178 178
 		set_error_handler(array($this, 'dummyHandler'), ~0);
179 179
 
180
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
180
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
181 181
 		$debug_file_exist = file_exists($debug_file);
182
-		if(!$debug_file_exist)
182
+		if (!$debug_file_exist)
183 183
 		{
184 184
 			$print[] = '<?php exit() ?>';
185 185
 		}
186 186
 
187 187
 		$errorname = self::getErrorType($errinfo['type']);
188 188
 		$print[] = '['.date('Y-m-d H:i:s').']';
189
-		$print[] = $errorname . ' : ' . $errinfo['message'];
189
+		$print[] = $errorname.' : '.$errinfo['message'];
190 190
 
191
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
191
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
192 192
 		$print[] = $message;
193 193
 
194 194
 		$print[] = PHP_EOL;
195
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
195
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
196 196
 		set_error_handler(array($this, 'dummyHandler'), ~0);
197 197
 	}
198 198
 
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 
238 238
 		// if success_return_url and error_return_url is incorrect
239 239
 		$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
240
-		foreach($urls as $url)
240
+		foreach ($urls as $url)
241 241
 		{
242
-			if(empty($url))
242
+			if (empty($url))
243 243
 			{
244 244
 				continue;
245 245
 			}
@@ -251,29 +251,29 @@  discard block
 block discarded – undo
251 251
 			$defaultUrlInfo = parse_url($dbInfo->default_url);
252 252
 			$defaultHost = $defaultUrlInfo['host'];
253 253
 		
254
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
254
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
255 255
 			{
256 256
 				throw new Exception('msg_default_url_is_null');
257 257
 			}
258 258
 		}
259 259
 		
260
-		if(!$this->document_srl && $this->mid && $this->entry)
260
+		if (!$this->document_srl && $this->mid && $this->entry)
261 261
 		{
262 262
 			$oDocumentModel = getModel('document');
263 263
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
264
-			if($this->document_srl)
264
+			if ($this->document_srl)
265 265
 			{
266 266
 				Context::set('document_srl', $this->document_srl);
267 267
 			}
268 268
 		}
269 269
 
270 270
 		// Get module's information based on document_srl, if it's specified
271
-		if($this->document_srl)
271
+		if ($this->document_srl)
272 272
 		{
273 273
 			
274 274
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
275 275
 			// If the document does not exist, remove document_srl
276
-			if(!$module_info)
276
+			if (!$module_info)
277 277
 			{
278 278
 				unset($this->document_srl);
279 279
 			}
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 			{
282 282
 				// If it exists, compare mid based on the module information
283 283
 				// if mids are not matching, set it as the document's mid
284
-				if(!$this->mid || ($this->mid != $module_info->mid))
284
+				if (!$this->mid || ($this->mid != $module_info->mid))
285 285
 				{
286 286
 					
287
-					if(Context::getRequestMethod() == 'GET')
287
+					if (Context::getRequestMethod() == 'GET')
288 288
 					{
289 289
 						$this->mid = $module_info->mid;
290
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
290
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
291 291
 						return FALSE;
292 292
 					}
293 293
 					else
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 					
299 299
 				}
300 300
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
301
-				if($this->module && $module_info->module != $this->module)
301
+				if ($this->module && $module_info->module != $this->module)
302 302
 				{
303 303
 					unset($module_info);
304 304
 				}
@@ -307,36 +307,36 @@  discard block
 block discarded – undo
307 307
 		}
308 308
 
309 309
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
310
-		if(!$module_info && $this->mid)
310
+		if (!$module_info && $this->mid)
311 311
 		{
312 312
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
313 313
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
314 314
 		}
315 315
 
316 316
 		// redirect, if module_site_srl and site_srl are different
317
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
317
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
318 318
 		{
319 319
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
320
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
320
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
321 321
 			return FALSE;
322 322
 		}
323 323
 
324 324
 		// If module_info is not set still, and $module does not exist, find the default module
325
-		if(!$module_info && !$this->module && !$this->mid)
325
+		if (!$module_info && !$this->module && !$this->mid)
326 326
 		{
327 327
 			$module_info = $site_module_info;
328 328
 		}
329 329
 
330
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
330
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
331 331
 		{
332 332
 			$module_info = $site_module_info;
333 333
 		}
334 334
 
335 335
 		// redirect, if site_srl of module_info is different from one of site's module_info
336
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
336
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
337 337
 		{
338 338
 			// If the module is of virtual site
339
-			if($module_info->site_srl)
339
+			if ($module_info->site_srl)
340 340
 			{
341 341
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
342 342
 				$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'));
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			else
346 346
 			{
347 347
 				$db_info = Context::getDBInfo();
348
-				if(!$db_info->default_url)
348
+				if (!$db_info->default_url)
349 349
 				{
350 350
 					return Context::getLang('msg_default_url_is_not_defined');
351 351
 				}
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 					$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'));
355 355
 				}
356 356
 			}
357
-			header("location:" . $redirect_url);
357
+			header("location:".$redirect_url);
358 358
 			return FALSE;
359 359
 		}
360 360
 
361 361
 		// If module info was set, retrieve variables from the module information
362
-		if($module_info)
362
+		if ($module_info)
363 363
 		{
364 364
 			$this->module = $module_info->module;
365 365
 			$this->mid = $module_info->mid;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
371 371
 
372 372
 			// use the site default layout.
373
-			if($module_info->{$targetSrl} == -1)
373
+			if ($module_info->{$targetSrl} == -1)
374 374
 			{
375 375
 				$oLayoutAdminModel = getAdminModel('layout');
376 376
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		}
389 389
 
390 390
 		// Set module and mid into module_info
391
-		if(!isset($this->module_info))
391
+		if (!isset($this->module_info))
392 392
 		{
393 393
 			$this->module_info = new stdClass();
394 394
 		}
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
 		$this->module_info->site_srl = $site_module_info->site_srl;
400 400
 
401 401
 		// Still no module? it's an error
402
-		if(!$this->module)
402
+		if (!$this->module)
403 403
 		{
404 404
 			$this->error = 'msg_module_is_not_exists';
405 405
 			$this->httpStatusCode = '404';
406 406
 		}
407 407
 
408 408
 		// If mid exists, set mid into context
409
-		if($this->mid)
409
+		if ($this->mid)
410 410
 		{
411 411
 			Context::set('mid', $this->mid, TRUE);
412 412
 		}
413 413
 		
414 414
 		// Call a trigger after moduleHandler init
415 415
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
416
-		if(!$output->toBool())
416
+		if (!$output->toBool())
417 417
 		{
418 418
 			$this->error = $output->getMessage();
419 419
 			return TRUE;
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
436 436
 
437 437
 		// If error occurred while preparation, return a message instance
438
-		if($this->error)
438
+		if ($this->error)
439 439
 		{
440 440
 			$this->_setInputErrorToContext();
441 441
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
442 442
 			$oMessageObject->setError(-1);
443 443
 			$oMessageObject->setMessage($this->error);
444 444
 			$oMessageObject->dispMessage();
445
-			if($this->httpStatusCode)
445
+			if ($this->httpStatusCode)
446 446
 			{
447 447
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
448 448
 			}
@@ -453,22 +453,22 @@  discard block
 block discarded – undo
453 453
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
454 454
 
455 455
 		// If not installed yet, modify act
456
-		if($this->module == "install")
456
+		if ($this->module == "install")
457 457
 		{
458
-			if(!$this->act || !$xml_info->action->{$this->act})
458
+			if (!$this->act || !$xml_info->action->{$this->act})
459 459
 			{
460 460
 				$this->act = $xml_info->default_index_act;
461 461
 			}
462 462
 		}
463 463
 
464 464
 		// if act exists, find type of the action, if not use default index act
465
-		if(!$this->act)
465
+		if (!$this->act)
466 466
 		{
467 467
 			$this->act = $xml_info->default_index_act;
468 468
 		}
469 469
 
470 470
 		// still no act means error
471
-		if(!$this->act)
471
+		if (!$this->act)
472 472
 		{
473 473
 			$this->error = 'msg_module_is_not_exists';
474 474
 			$this->httpStatusCode = '404';
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			$oMessageObject->setError(-1);
479 479
 			$oMessageObject->setMessage($this->error);
480 480
 			$oMessageObject->dispMessage();
481
-			if($this->httpStatusCode)
481
+			if ($this->httpStatusCode)
482 482
 			{
483 483
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
484 484
 			}
@@ -489,17 +489,17 @@  discard block
 block discarded – undo
489 489
 		$type = $xml_info->action->{$this->act}->type;
490 490
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
491 491
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
492
-		if(!$kind && $this->module == 'admin')
492
+		if (!$kind && $this->module == 'admin')
493 493
 		{
494 494
 			$kind = 'admin';
495 495
 		}
496 496
 
497 497
 		// check REQUEST_METHOD in controller
498
-		if($type == 'controller')
498
+		if ($type == 'controller')
499 499
 		{
500 500
 			$allowedMethod = $xml_info->action->{$this->act}->method;
501 501
 
502
-			if(!$allowedMethod)
502
+			if (!$allowedMethod)
503 503
 			{
504 504
 				$allowedMethodList[0] = 'POST';
505 505
 			}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
509 509
 			}
510 510
 
511
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
511
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
512 512
 			{
513 513
 				$this->error = "msg_invalid_request";
514 514
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 			}
520 520
 		}
521 521
 
522
-		if($this->module_info->use_mobile != "Y")
522
+		if ($this->module_info->use_mobile != "Y")
523 523
 		{
524 524
 			Mobile::setMobile(FALSE);
525 525
 		}
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		$logged_info = Context::get('logged_info');
528 528
 
529 529
 		// check CSRF for POST actions
530
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
530
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
531 531
 			$this->error = 'msg_invalid_request';
532 532
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
533 533
 			$oMessageObject->setError(-1);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 		}
538 538
 
539 539
 		// Admin ip
540
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
540
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
541 541
 		{
542 542
 			$this->_setInputErrorToContext();
543 543
 			$this->error = "msg_not_permitted_act";
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 		}
550 550
 
551 551
 		// if(type == view, and case for using mobilephone)
552
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
552
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
553 553
 		{
554 554
 			$orig_type = "view";
555 555
 			$type = "mobile";
556 556
 			// create a module instance
557 557
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
558
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
558
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
559 559
 			{
560 560
 				$type = $orig_type;
561 561
 				Mobile::setMobile(FALSE);
@@ -568,14 +568,14 @@  discard block
 block discarded – undo
568 568
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
569 569
 		}
570 570
 
571
-		if(!is_object($oModule))
571
+		if (!is_object($oModule))
572 572
 		{
573 573
 			$this->_setInputErrorToContext();
574 574
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
575 575
 			$oMessageObject->setError(-1);
576 576
 			$oMessageObject->setMessage($this->error);
577 577
 			$oMessageObject->dispMessage();
578
-			if($this->httpStatusCode)
578
+			if ($this->httpStatusCode)
579 579
 			{
580 580
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
581 581
 			}
@@ -583,10 +583,10 @@  discard block
 block discarded – undo
583 583
 		}
584 584
 
585 585
 		// If there is no such action in the module object
586
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
586
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
587 587
 		{
588 588
 
589
-			if(!Context::isInstalled())
589
+			if (!Context::isInstalled())
590 590
 			{
591 591
 				$this->_setInputErrorToContext();
592 592
 				$this->error = 'msg_invalid_request';
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 				$oMessageObject->setError(-1);
595 595
 				$oMessageObject->setMessage($this->error);
596 596
 				$oMessageObject->dispMessage();
597
-				if($this->httpStatusCode)
597
+				if ($this->httpStatusCode)
598 598
 				{
599 599
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
600 600
 				}
@@ -603,12 +603,12 @@  discard block
 block discarded – undo
603 603
 
604 604
 			$forward = NULL;
605 605
 			// 1. Look for the module with action name
606
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
606
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
607 607
 			{
608
-				$module = strtolower($matches[2] . $matches[3]);
608
+				$module = strtolower($matches[2].$matches[3]);
609 609
 				$xml_info = $oModuleModel->getModuleActionXml($module);
610 610
 
611
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
611
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
612 612
 				{
613 613
 					$forward = new stdClass();
614 614
 					$forward->module = $module;
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 				}
629 629
 			}
630 630
 
631
-			if(!$forward)
631
+			if (!$forward)
632 632
 			{
633 633
 				$forward = $oModuleModel->getActionForward($this->act);
634 634
 			}
635 635
 
636
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
636
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
637 637
 			{
638 638
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
639 639
 				$type = $forward->type;
@@ -645,11 +645,11 @@  discard block
 block discarded – undo
645 645
 
646 646
 				// SECISSUE also check foward act method
647 647
 				// check REQUEST_METHOD in controller
648
-				if($type == 'controller')
648
+				if ($type == 'controller')
649 649
 				{
650 650
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
651 651
 
652
-					if(!$allowedMethod)
652
+					if (!$allowedMethod)
653 653
 					{
654 654
 						$allowedMethodList[0] = 'POST';
655 655
 					}
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
659 659
 					}
660 660
 
661
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
661
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
662 662
 					{
663 663
 						$this->error = "msg_invalid_request";
664 664
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -669,13 +669,13 @@  discard block
 block discarded – undo
669 669
 					}
670 670
 				}
671 671
 
672
-				if($type == "view" && Mobile::isFromMobilePhone())
672
+				if ($type == "view" && Mobile::isFromMobilePhone())
673 673
 				{
674 674
 					$orig_type = "view";
675 675
 					$type = "mobile";
676 676
 					// create a module instance
677 677
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
678
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
678
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
679 679
 					{
680 680
 						$type = $orig_type;
681 681
 						Mobile::setMobile(FALSE);
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
688 688
 				}
689 689
 
690
-				if(!is_object($oModule))
690
+				if (!is_object($oModule))
691 691
 				{
692 692
 					$this->_setInputErrorToContext();
693 693
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
694 694
 					$oMessageObject->setError(-1);
695 695
 					$oMessageObject->setMessage('msg_module_is_not_exists');
696 696
 					$oMessageObject->dispMessage();
697
-					if($this->httpStatusCode)
697
+					if ($this->httpStatusCode)
698 698
 					{
699 699
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
700 700
 					}
701 701
 					return $oMessageObject;
702 702
 				}
703 703
 
704
-				if($this->module == "admin" && $type == "view")
704
+				if ($this->module == "admin" && $type == "view")
705 705
 				{
706
-					if($logged_info->is_admin == 'Y')
706
+					if ($logged_info->is_admin == 'Y')
707 707
 					{
708
-						if($this->act != 'dispLayoutAdminLayoutModify')
708
+						if ($this->act != 'dispLayoutAdminLayoutModify')
709 709
 						{
710 710
 							$oAdminView = getAdminView('admin');
711 711
 							$oAdminView->makeGnbUrl($forward->module);
@@ -725,10 +725,10 @@  discard block
 block discarded – undo
725 725
 						return $oMessageObject;
726 726
 					}
727 727
 				}
728
-				if($kind == 'admin')
728
+				if ($kind == 'admin')
729 729
 				{
730 730
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
731
-					if(!$grant->manager)
731
+					if (!$grant->manager)
732 732
 					{
733 733
 						$this->_setInputErrorToContext();
734 734
 						$this->error = 'msg_is_not_manager';
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 					}
741 741
 					else
742 742
 					{
743
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
743
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
744 744
 						{
745 745
 							$this->_setInputErrorToContext();
746 746
 							$this->error = 'msg_is_not_administrator';
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 					}
754 754
 				}
755 755
 			}
756
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
756
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
757 757
 			{
758 758
 				$this->act = $xml_info->default_index_act;
759 759
 			}
@@ -767,16 +767,16 @@  discard block
 block discarded – undo
767 767
 		}
768 768
 
769 769
 		// ruleset check...
770
-		if(!empty($ruleset))
770
+		if (!empty($ruleset))
771 771
 		{
772 772
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
773 773
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
774
-			if(!empty($rulesetFile))
774
+			if (!empty($rulesetFile))
775 775
 			{
776
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
776
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
777 777
 				{
778 778
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
779
-					foreach($errorLang as $key => $val)
779
+					foreach ($errorLang as $key => $val)
780 780
 					{
781 781
 						Context::setLang($key, $val);
782 782
 					}
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 				$Validator = new Validator($rulesetFile);
787 787
 				$result = $Validator->validate();
788
-				if(!$result)
788
+				if (!$result)
789 789
 				{
790 790
 					$lastError = $Validator->getLastError();
791 791
 					$returnUrl = Context::get('error_return_url');
@@ -817,26 +817,26 @@  discard block
 block discarded – undo
817 817
 				'dispLayoutPreviewWithModule' => 1
818 818
 		);
819 819
 		$db_use_mobile = Mobile::isMobileEnabled();
820
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
820
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
821 821
 		{
822 822
 			global $lang;
823 823
 			$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>';
824
-			$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>';
824
+			$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>';
825 825
 			Context::addHtmlHeader($header);
826 826
 			Context::addHtmlFooter($footer);
827 827
 		}
828 828
 
829
-		if($type == "view" && $kind != 'admin')
829
+		if ($type == "view" && $kind != 'admin')
830 830
 		{
831 831
 			$module_config = $oModuleModel->getModuleConfig('module');
832
-			if($module_config->htmlFooter)
832
+			if ($module_config->htmlFooter)
833 833
 			{
834 834
 				Context::addHtmlFooter($module_config->htmlFooter);
835 835
 			}
836
-			if($module_config->siteTitle)
836
+			if ($module_config->siteTitle)
837 837
 			{
838 838
 				$siteTitle = Context::getBrowserTitle();
839
-				if(!$siteTitle)
839
+				if (!$siteTitle)
840 840
 				{
841 841
 					Context::setBrowserTitle($module_config->siteTitle);
842 842
 				}
@@ -849,18 +849,18 @@  discard block
 block discarded – undo
849 849
 		$procResult = $oModule->proc();
850 850
 
851 851
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
852
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
852
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
853 853
 		{
854 854
 			$error = $oModule->getError();
855 855
 			$message = $oModule->getMessage();
856 856
 			$messageType = $oModule->getMessageType();
857 857
 			$redirectUrl = $oModule->getRedirectUrl();
858
-			if($messageType == 'error') debugPrint($message, 'ERROR');
858
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
859 859
 
860
-			if(!$procResult)
860
+			if (!$procResult)
861 861
 			{
862 862
 				$this->error = $message;
863
-				if(!$redirectUrl && Context::get('error_return_url'))
863
+				if (!$redirectUrl && Context::get('error_return_url'))
864 864
 				{
865 865
 					$redirectUrl = Context::get('error_return_url');
866 866
 				}
@@ -873,13 +873,13 @@  discard block
 block discarded – undo
873 873
 
874 874
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
875 875
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
876
-			if($message != 'success')
876
+			if ($message != 'success')
877 877
 			{
878 878
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
879 879
 			}
880 880
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
881 881
 
882
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
882
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
883 883
 			{
884 884
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
885 885
 			}
@@ -895,27 +895,27 @@  discard block
 block discarded – undo
895 895
 	 * */
896 896
 	function _setInputErrorToContext()
897 897
 	{
898
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
898
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
899 899
 		{
900 900
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
901 901
 		}
902
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
902
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
903 903
 		{
904 904
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
905 905
 		}
906
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
906
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
907 907
 		{
908 908
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
909 909
 		}
910
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
910
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
911 911
 		{
912 912
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
913 913
 		}
914
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
914
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
915 915
 		{
916 916
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
917 917
 		}
918
-		if(count($_SESSION['INPUT_ERROR']))
918
+		if (count($_SESSION['INPUT_ERROR']))
919 919
 		{
920 920
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
921 921
 		}
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 	{
946 946
 		$requestVars = Context::getRequestVars();
947 947
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
948
-		foreach($requestVars AS $key => $value)
948
+		foreach ($requestVars AS $key => $value)
949 949
 		{
950 950
 			$_SESSION['INPUT_ERROR'][$key] = $value;
951 951
 		}
@@ -959,41 +959,41 @@  discard block
 block discarded – undo
959 959
 	function displayContent($oModule = NULL)
960 960
 	{
961 961
 		// If the module is not set or not an object, set error
962
-		if(!$oModule || !is_object($oModule))
962
+		if (!$oModule || !is_object($oModule))
963 963
 		{
964 964
 			$this->error = 'msg_module_is_not_exists';
965 965
 			$this->httpStatusCode = '404';
966 966
 		}
967 967
 
968 968
 		// If connection to DB has a problem even though it's not install module, set error
969
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
969
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
970 970
 		{
971 971
 			$this->error = 'msg_dbconnect_failed';
972 972
 		}
973 973
 
974 974
 		// Call trigger after moduleHandler proc
975 975
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
976
-		if(!$output->toBool())
976
+		if (!$output->toBool())
977 977
 		{
978 978
 			$this->error = $output->getMessage();
979 979
 		}
980 980
 
981 981
 		// Use message view object, if HTML call
982 982
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
983
-		if(!isset($methodList[Context::getRequestMethod()]))
983
+		if (!isset($methodList[Context::getRequestMethod()]))
984 984
 		{
985 985
 
986
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
986
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
987 987
 			{
988 988
 				$display_handler = new DisplayHandler();
989 989
 				$display_handler->_debugOutput();
990 990
 
991
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
991
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
992 992
 				return;
993 993
 			}
994 994
 
995 995
 			// If error occurred, handle it
996
-			if($this->error)
996
+			if ($this->error)
997 997
 			{
998 998
 				// display content with message module instance
999 999
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
 				$oMessageObject->setMessage($this->error);
1003 1003
 				$oMessageObject->dispMessage();
1004 1004
 
1005
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1005
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1006 1006
 				{
1007 1007
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1008 1008
 					$oMessageObject->setTemplateFile('http_status_code');
1009 1009
 				}
1010 1010
 
1011 1011
 				// If module was called normally, change the templates of the module into ones of the message view module
1012
-				if($oModule)
1012
+				if ($oModule)
1013 1013
 				{
1014 1014
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1015 1015
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 			}
1025 1025
 
1026 1026
 			// Check if layout_srl exists for the module
1027
-			if(Mobile::isFromMobilePhone())
1027
+			if (Mobile::isFromMobilePhone())
1028 1028
 			{
1029 1029
 				$layout_srl = $oModule->module_info->mlayout_srl;
1030 1030
 			}
@@ -1034,58 +1034,58 @@  discard block
 block discarded – undo
1034 1034
 			}
1035 1035
 
1036 1036
 			// if layout_srl is rollback by module, set default layout
1037
-			if($layout_srl == -1)
1037
+			if ($layout_srl == -1)
1038 1038
 			{
1039 1039
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1040 1040
 				$oLayoutAdminModel = getAdminModel('layout');
1041 1041
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1042 1042
 			}
1043 1043
 
1044
-			if($layout_srl && !$oModule->getLayoutFile())
1044
+			if ($layout_srl && !$oModule->getLayoutFile())
1045 1045
 			{
1046 1046
 
1047 1047
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1048 1048
 				$oLayoutModel = getModel('layout');
1049 1049
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1050
-				if($layout_info)
1050
+				if ($layout_info)
1051 1051
 				{
1052 1052
 
1053 1053
 					// Input extra_vars into $layout_info
1054
-					if($layout_info->extra_var_count)
1054
+					if ($layout_info->extra_var_count)
1055 1055
 					{
1056 1056
 
1057
-						foreach($layout_info->extra_var as $var_id => $val)
1057
+						foreach ($layout_info->extra_var as $var_id => $val)
1058 1058
 						{
1059
-							if($val->type == 'image')
1059
+							if ($val->type == 'image')
1060 1060
 							{
1061
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1061
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1062 1062
 								{
1063
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1063
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1064 1064
 								}
1065 1065
 							}
1066 1066
 							$layout_info->{$var_id} = $val->value;
1067 1067
 						}
1068 1068
 					}
1069 1069
 					// Set menus into context
1070
-					if($layout_info->menu_count)
1070
+					if ($layout_info->menu_count)
1071 1071
 					{
1072
-						foreach($layout_info->menu as $menu_id => $menu)
1072
+						foreach ($layout_info->menu as $menu_id => $menu)
1073 1073
 						{
1074 1074
 							// set default menu set(included home menu)
1075
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1075
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1076 1076
 							{
1077 1077
 								$oMenuAdminController = getAdminController('menu');
1078 1078
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1079 1079
 
1080
-								if(FileHandler::exists($homeMenuCacheFile))
1080
+								if (FileHandler::exists($homeMenuCacheFile))
1081 1081
 								{
1082 1082
 									include($homeMenuCacheFile);
1083 1083
 								}
1084 1084
 
1085
-								if(!$menu->menu_srl)
1085
+								if (!$menu->menu_srl)
1086 1086
 								{
1087
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1088
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1087
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1088
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1089 1089
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1090 1090
 								}
1091 1091
 								else
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 							}
1097 1097
 
1098 1098
 							$php_file = FileHandler::exists($menu->php_file);
1099
-							if($php_file)
1099
+							if ($php_file)
1100 1100
 							{
1101 1101
 								include($php_file);
1102 1102
 							}
@@ -1112,17 +1112,17 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 					// If layout was modified, use the modified version
1114 1114
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1115
-					if(file_exists($edited_layout))
1115
+					if (file_exists($edited_layout))
1116 1116
 					{
1117 1117
 						$oModule->setEditedLayoutFile($edited_layout);
1118 1118
 					}
1119 1119
 				}
1120 1120
 			}
1121 1121
 			$isLayoutDrop = Context::get('isLayoutDrop');
1122
-			if($isLayoutDrop)
1122
+			if ($isLayoutDrop)
1123 1123
 			{
1124 1124
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1125
-				if($kind == 'admin')
1125
+				if ($kind == 'admin')
1126 1126
 				{
1127 1127
 					$oModule->setLayoutFile('popup_layout');
1128 1128
 				}
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1161 1161
 	{
1162 1162
 
1163
-		if(__DEBUG__ == 3)
1163
+		if (__DEBUG__ == 3)
1164 1164
 		{
1165 1165
 			$start_time = getMicroTime();
1166 1166
 		}
@@ -1170,51 +1170,51 @@  discard block
 block discarded – undo
1170 1170
 		$type = strtolower($type);
1171 1171
 
1172 1172
 		$kinds = array('svc' => 1, 'admin' => 1);
1173
-		if(!isset($kinds[$kind]))
1173
+		if (!isset($kinds[$kind]))
1174 1174
 		{
1175 1175
 			$kind = 'svc';
1176 1176
 		}
1177 1177
 
1178
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1178
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1179 1179
 
1180
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1180
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1181 1181
 		{
1182 1182
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1183 1183
 		}
1184 1184
 
1185 1185
 		// if there is no instance of the module in global variable, create a new one
1186
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1186
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1187 1187
 		{
1188 1188
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1189 1189
 
1190
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1190
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1191 1191
 			{
1192 1192
 				$module = $parent_module;
1193 1193
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1194 1194
 			}
1195 1195
 
1196 1196
 			// Check if the base class and instance class exist
1197
-			if(!class_exists($module, true))
1197
+			if (!class_exists($module, true))
1198 1198
 			{
1199 1199
 				return NULL;
1200 1200
 			}
1201
-			if(!class_exists($instance_name, true))
1201
+			if (!class_exists($instance_name, true))
1202 1202
 			{
1203 1203
 				return NULL;
1204 1204
 			}
1205 1205
 
1206 1206
 			// Create an instance
1207 1207
 			$oModule = new $instance_name();
1208
-			if(!is_object($oModule))
1208
+			if (!is_object($oModule))
1209 1209
 			{
1210 1210
 				return NULL;
1211 1211
 			}
1212 1212
 
1213 1213
 			// Load language files for the class
1214
-			Context::loadLang($class_path . 'lang');
1215
-			if($extend_module)
1214
+			Context::loadLang($class_path.'lang');
1215
+			if ($extend_module)
1216 1216
 			{
1217
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1217
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1218 1218
 			}
1219 1219
 
1220 1220
 			// Set variables to the instance
@@ -1222,10 +1222,10 @@  discard block
 block discarded – undo
1222 1222
 			$oModule->setModulePath($class_path);
1223 1223
 
1224 1224
 			// If the module has a constructor, run it.
1225
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1225
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1226 1226
 			{
1227 1227
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1228
-				if(@method_exists($oModule, $instance_name))
1228
+				if (@method_exists($oModule, $instance_name))
1229 1229
 				{
1230 1230
 					$oModule->{$instance_name}();
1231 1231
 				}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1236 1236
 		}
1237 1237
 
1238
-		if(__DEBUG__ == 3)
1238
+		if (__DEBUG__ == 3)
1239 1239
 		{
1240 1240
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1241 1241
 		}
@@ -1251,17 +1251,17 @@  discard block
 block discarded – undo
1251 1251
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1252 1252
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1253 1253
 
1254
-		$types = array('view','controller','model','api','wap','mobile','class');
1255
-		if(!in_array($type, $types))
1254
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1255
+		if (!in_array($type, $types))
1256 1256
 		{
1257 1257
 			$type = $types[0];
1258 1258
 		}
1259
-		if($type == 'class')
1259
+		if ($type == 'class')
1260 1260
 		{
1261 1261
 			$instanceName = '%s';
1262 1262
 			$classFile = '%s%s.%s.php';
1263 1263
 		}
1264
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1264
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1265 1265
 		{
1266 1266
 			$instanceName = '%sAdmin%s';
1267 1267
 			$classFile = '%s%s.admin.%s.php';
@@ -1286,26 +1286,26 @@  discard block
 block discarded – undo
1286 1286
 	function triggerCall($trigger_name, $called_position, &$obj)
1287 1287
 	{
1288 1288
 		// skip if not installed
1289
-		if(!Context::isInstalled())
1289
+		if (!Context::isInstalled())
1290 1290
 		{
1291 1291
 			return new Object();
1292 1292
 		}
1293 1293
 
1294 1294
 		$oModuleModel = getModel('module');
1295 1295
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1296
-		if(!$triggers || count($triggers) < 1)
1296
+		if (!$triggers || count($triggers) < 1)
1297 1297
 		{
1298 1298
 			return new Object();
1299 1299
 		}
1300 1300
 		
1301 1301
 		//store before trigger call time
1302 1302
 		$before_trigger_time = NULL;
1303
-		if(__LOG_SLOW_TRIGGER__> 0)
1303
+		if (__LOG_SLOW_TRIGGER__ > 0)
1304 1304
 		{
1305 1305
 			$before_trigger_time = microtime(true);
1306 1306
 		}
1307 1307
 
1308
-		foreach($triggers as $item)
1308
+		foreach ($triggers as $item)
1309 1309
 		{
1310 1310
 			$module = $item->module;
1311 1311
 			$type = $item->type;
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
 			// todo why don't we call a normal class object ?
1315 1315
 			$oModule = getModule($module, $type);
1316
-			if(!$oModule || !method_exists($oModule, $called_method))
1316
+			if (!$oModule || !method_exists($oModule, $called_method))
1317 1317
 			{
1318 1318
 				continue;
1319 1319
 			}
@@ -1326,12 +1326,12 @@  discard block
 block discarded – undo
1326 1326
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1327 1327
 
1328 1328
 			$slowlog = new stdClass;
1329
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1330
-			$slowlog->called = $module . '.' . $called_method;
1329
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1330
+			$slowlog->called = $module.'.'.$called_method;
1331 1331
 			$slowlog->called_extension = $module;
1332
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1332
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1333 1333
 
1334
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1334
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1335 1335
 			{
1336 1336
 				return $output;
1337 1337
 			}
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 			'505' => 'HTTP Version Not Supported',
1392 1392
 		);
1393 1393
 		$statusMessage = $statusMessageList[$code];
1394
-		if(!$statusMessage)
1394
+		if (!$statusMessage)
1395 1395
 		{
1396 1396
 			$statusMessage = 'OK';
1397 1397
 		}
Please login to merge, or discard this patch.