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 (#1872)
by
unknown
17:31
created
classes/module/ModuleHandler.class.php 2 patches
Spacing   +151 added lines, -151 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,11 +87,11 @@  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) {
94
+				if (Context::get('_https_port') != null) {
95 95
 					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
96 96
 				} else {
97 97
 					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
@@ -102,13 +102,13 @@  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(__DEBUG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__DEBUG__ == 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
 			}
111
-			else if(__DEBUG_PROTECT__ === 0)
111
+			else if (__DEBUG_PROTECT__ === 0)
112 112
 			{
113 113
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
114 114
 			}
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 		$called_position = 'before_module_init';
119 119
 		$oAddonController = getController('addon');
120 120
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
121
-		if(file_exists($addon_file)) include($addon_file);
121
+		if (file_exists($addon_file)) include($addon_file);
122 122
 	}
123 123
 
124 124
 	function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
125 125
 	{
126
-		if($errnumber != E_WARNING)
126
+		if ($errnumber != E_WARNING)
127 127
 		{
128 128
 			return false;
129 129
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		{
132 132
 			$errorname = 'Warrning!';
133 133
 		}
134
-		$buff = "\n".$errorname . " : ";
134
+		$buff = "\n" . $errorname . " : ";
135 135
 		$buff .= $errormassage . "\n";
136 136
 		$buff .= "file : " . $errorfile . " line : ";
137 137
 		$buff .= $errorline . "\n";
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 
152 152
 		// if success_return_url and error_return_url is incorrect
153 153
 		$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
154
-		foreach($urls as $url)
154
+		foreach ($urls as $url)
155 155
 		{
156
-			if(empty($url))
156
+			if (empty($url))
157 157
 			{
158 158
 				continue;
159 159
 			}
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
 			$defaultUrlInfo = parse_url($dbInfo->default_url);
166 166
 			$defaultHost = $defaultUrlInfo['host'];
167 167
 		
168
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
168
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
169 169
 			{
170 170
 				throw new Exception('msg_default_url_is_null');
171 171
 			}
172 172
 		}
173 173
 		
174
-		if(!$this->document_srl && $this->mid && $this->entry)
174
+		if (!$this->document_srl && $this->mid && $this->entry)
175 175
 		{
176 176
 			$oDocumentModel = getModel('document');
177 177
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
178
-			if($this->document_srl)
178
+			if ($this->document_srl)
179 179
 			{
180 180
 				Context::set('document_srl', $this->document_srl);
181 181
 			}
182 182
 		}
183 183
 
184 184
 		// Get module's information based on document_srl, if it's specified
185
-		if($this->document_srl)
185
+		if ($this->document_srl)
186 186
 		{
187 187
 			
188 188
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
189 189
 			// If the document does not exist, remove document_srl
190
-			if(!$module_info)
190
+			if (!$module_info)
191 191
 			{
192 192
 				unset($this->document_srl);
193 193
 			}
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 			{
196 196
 				// If it exists, compare mid based on the module information
197 197
 				// if mids are not matching, set it as the document's mid
198
-				if(!$this->mid || ($this->mid != $module_info->mid))
198
+				if (!$this->mid || ($this->mid != $module_info->mid))
199 199
 				{
200 200
 					
201
-					if(Context::getRequestMethod() == 'GET')
201
+					if (Context::getRequestMethod() == 'GET')
202 202
 					{
203 203
 						$this->mid = $module_info->mid;
204 204
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 					
213 213
 				}
214 214
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
215
-				if($this->module && $module_info->module != $this->module)
215
+				if ($this->module && $module_info->module != $this->module)
216 216
 				{
217 217
 					unset($module_info);
218 218
 				}
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 		}
222 222
 
223 223
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
224
-		if(!$module_info && $this->mid)
224
+		if (!$module_info && $this->mid)
225 225
 		{
226 226
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
227 227
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
228 228
 		}
229 229
 
230 230
 		// redirect, if module_site_srl and site_srl are different
231
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
231
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
232 232
 		{
233 233
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
234 234
 			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 
238 238
 		// If module_info is not set still, and $module does not exist, find the default module
239
-		if(!$module_info && !$this->module && !$this->mid)
239
+		if (!$module_info && !$this->module && !$this->mid)
240 240
 		{
241 241
 			$module_info = $site_module_info;
242 242
 		}
243 243
 
244
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
244
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
245 245
 		{
246 246
 			$module_info = $site_module_info;
247 247
 		}
248 248
 
249 249
 		// redirect, if site_srl of module_info is different from one of site's module_info
250
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
250
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
251 251
 		{
252 252
 			// If the module is of virtual site
253
-			if($module_info->site_srl)
253
+			if ($module_info->site_srl)
254 254
 			{
255 255
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
256 256
 				$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'));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 			else
260 260
 			{
261 261
 				$db_info = Context::getDBInfo();
262
-				if(!$db_info->default_url)
262
+				if (!$db_info->default_url)
263 263
 				{
264 264
 					return Context::getLang('msg_default_url_is_not_defined');
265 265
 				}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		}
274 274
 
275 275
 		// If module info was set, retrieve variables from the module information
276
-		if($module_info)
276
+		if ($module_info)
277 277
 		{
278 278
 			$this->module = $module_info->module;
279 279
 			$this->mid = $module_info->mid;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
285 285
 
286 286
 			// use the site default layout.
287
-			if($module_info->{$targetSrl} == -1)
287
+			if ($module_info->{$targetSrl} == -1)
288 288
 			{
289 289
 				$oLayoutAdminModel = getAdminModel('layout');
290 290
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		}
303 303
 
304 304
 		// Set module and mid into module_info
305
-		if(!isset($this->module_info))
305
+		if (!isset($this->module_info))
306 306
 		{
307 307
 			$this->module_info = new stdClass();
308 308
 		}
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
 		$this->module_info->site_srl = $site_module_info->site_srl;
314 314
 
315 315
 		// Still no module? it's an error
316
-		if(!$this->module)
316
+		if (!$this->module)
317 317
 		{
318 318
 			$this->error = 'msg_module_is_not_exists';
319 319
 			$this->httpStatusCode = '404';
320 320
 		}
321 321
 
322 322
 		// If mid exists, set mid into context
323
-		if($this->mid)
323
+		if ($this->mid)
324 324
 		{
325 325
 			Context::set('mid', $this->mid, TRUE);
326 326
 		}
327 327
 		
328 328
 		// Call a trigger after moduleHandler init
329 329
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
330
-		if(!$output->toBool())
330
+		if (!$output->toBool())
331 331
 		{
332 332
 			$this->error = $output->getMessage();
333 333
 			return TRUE;
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
350 350
 
351 351
 		// If error occurred while preparation, return a message instance
352
-		if($this->error)
352
+		if ($this->error)
353 353
 		{
354 354
 			$this->_setInputErrorToContext();
355 355
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
356 356
 			$oMessageObject->setError(-1);
357 357
 			$oMessageObject->setMessage($this->error);
358 358
 			$oMessageObject->dispMessage();
359
-			if($this->httpStatusCode)
359
+			if ($this->httpStatusCode)
360 360
 			{
361 361
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
362 362
 			}
@@ -367,22 +367,22 @@  discard block
 block discarded – undo
367 367
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
368 368
 
369 369
 		// If not installed yet, modify act
370
-		if($this->module == "install")
370
+		if ($this->module == "install")
371 371
 		{
372
-			if(!$this->act || !$xml_info->action->{$this->act})
372
+			if (!$this->act || !$xml_info->action->{$this->act})
373 373
 			{
374 374
 				$this->act = $xml_info->default_index_act;
375 375
 			}
376 376
 		}
377 377
 
378 378
 		// if act exists, find type of the action, if not use default index act
379
-		if(!$this->act)
379
+		if (!$this->act)
380 380
 		{
381 381
 			$this->act = $xml_info->default_index_act;
382 382
 		}
383 383
 
384 384
 		// still no act means error
385
-		if(!$this->act)
385
+		if (!$this->act)
386 386
 		{
387 387
 			$this->error = 'msg_module_is_not_exists';
388 388
 			$this->httpStatusCode = '404';
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 			$oMessageObject->setError(-1);
393 393
 			$oMessageObject->setMessage($this->error);
394 394
 			$oMessageObject->dispMessage();
395
-			if($this->httpStatusCode)
395
+			if ($this->httpStatusCode)
396 396
 			{
397 397
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
398 398
 			}
@@ -403,17 +403,17 @@  discard block
 block discarded – undo
403 403
 		$type = $xml_info->action->{$this->act}->type;
404 404
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
405 405
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
406
-		if(!$kind && $this->module == 'admin')
406
+		if (!$kind && $this->module == 'admin')
407 407
 		{
408 408
 			$kind = 'admin';
409 409
 		}
410 410
 
411 411
 		// check REQUEST_METHOD in controller
412
-		if($type == 'controller')
412
+		if ($type == 'controller')
413 413
 		{
414 414
 			$allowedMethod = $xml_info->action->{$this->act}->method;
415 415
 
416
-			if(!$allowedMethod)
416
+			if (!$allowedMethod)
417 417
 			{
418 418
 				$allowedMethodList[0] = 'POST';
419 419
 			}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
423 423
 			}
424 424
 
425
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
425
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
426 426
 			{
427 427
 				$this->error = "msg_invalid_request";
428 428
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			}
434 434
 		}
435 435
 
436
-		if($this->module_info->use_mobile != "Y")
436
+		if ($this->module_info->use_mobile != "Y")
437 437
 		{
438 438
 			Mobile::setMobile(FALSE);
439 439
 		}
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 		$logged_info = Context::get('logged_info');
442 442
 
443 443
 		// check CSRF for POST actions
444
-		if(Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
444
+		if (Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
445 445
 			$this->error = 'msg_invalid_request';
446 446
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
447 447
 			$oMessageObject->setError(-1);
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 		}
452 452
 
453 453
 		// Admin ip
454
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
454
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
455 455
 		{
456 456
 			$this->_setInputErrorToContext();
457 457
 			$this->error = "msg_not_permitted_act";
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		// if(type == view, and case for using mobilephone)
466
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
466
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
467 467
 		{
468 468
 			$orig_type = "view";
469 469
 			$type = "mobile";
470 470
 			// create a module instance
471 471
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
472
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
472
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
473 473
 			{
474 474
 				$type = $orig_type;
475 475
 				Mobile::setMobile(FALSE);
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
483 483
 		}
484 484
 
485
-		if(!is_object($oModule))
485
+		if (!is_object($oModule))
486 486
 		{
487 487
 			$this->_setInputErrorToContext();
488 488
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
489 489
 			$oMessageObject->setError(-1);
490 490
 			$oMessageObject->setMessage($this->error);
491 491
 			$oMessageObject->dispMessage();
492
-			if($this->httpStatusCode)
492
+			if ($this->httpStatusCode)
493 493
 			{
494 494
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
495 495
 			}
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 		}
498 498
 
499 499
 		// If there is no such action in the module object
500
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
500
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
501 501
 		{
502 502
 
503
-			if(!Context::isInstalled())
503
+			if (!Context::isInstalled())
504 504
 			{
505 505
 				$this->_setInputErrorToContext();
506 506
 				$this->error = 'msg_invalid_request';
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 				$oMessageObject->setError(-1);
509 509
 				$oMessageObject->setMessage($this->error);
510 510
 				$oMessageObject->dispMessage();
511
-				if($this->httpStatusCode)
511
+				if ($this->httpStatusCode)
512 512
 				{
513 513
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
514 514
 				}
@@ -517,12 +517,12 @@  discard block
 block discarded – undo
517 517
 
518 518
 			$forward = NULL;
519 519
 			// 1. Look for the module with action name
520
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
520
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
521 521
 			{
522 522
 				$module = strtolower($matches[2] . $matches[3]);
523 523
 				$xml_info = $oModuleModel->getModuleActionXml($module);
524 524
 
525
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
525
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
526 526
 				{
527 527
 					$forward = new stdClass();
528 528
 					$forward->module = $module;
@@ -542,12 +542,12 @@  discard block
 block discarded – undo
542 542
 				}
543 543
 			}
544 544
 
545
-			if(!$forward)
545
+			if (!$forward)
546 546
 			{
547 547
 				$forward = $oModuleModel->getActionForward($this->act);
548 548
 			}
549 549
 
550
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
550
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
551 551
 			{
552 552
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
553 553
 				$type = $forward->type;
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 
560 560
 				// SECISSUE also check foward act method
561 561
 				// check REQUEST_METHOD in controller
562
-				if($type == 'controller')
562
+				if ($type == 'controller')
563 563
 				{
564 564
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
565 565
 
566
-					if(!$allowedMethod)
566
+					if (!$allowedMethod)
567 567
 					{
568 568
 						$allowedMethodList[0] = 'POST';
569 569
 					}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
573 573
 					}
574 574
 
575
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
575
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
576 576
 					{
577 577
 						$this->error = "msg_invalid_request";
578 578
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 					}
584 584
 				}
585 585
 
586
-				if($type == "view" && Mobile::isFromMobilePhone())
586
+				if ($type == "view" && Mobile::isFromMobilePhone())
587 587
 				{
588 588
 					$orig_type = "view";
589 589
 					$type = "mobile";
590 590
 					// create a module instance
591 591
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
592
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
592
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
593 593
 					{
594 594
 						$type = $orig_type;
595 595
 						Mobile::setMobile(FALSE);
@@ -601,25 +601,25 @@  discard block
 block discarded – undo
601 601
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
602 602
 				}
603 603
 
604
-				if(!is_object($oModule))
604
+				if (!is_object($oModule))
605 605
 				{
606 606
 					$this->_setInputErrorToContext();
607 607
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
608 608
 					$oMessageObject->setError(-1);
609 609
 					$oMessageObject->setMessage('msg_module_is_not_exists');
610 610
 					$oMessageObject->dispMessage();
611
-					if($this->httpStatusCode)
611
+					if ($this->httpStatusCode)
612 612
 					{
613 613
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
614 614
 					}
615 615
 					return $oMessageObject;
616 616
 				}
617 617
 
618
-				if($this->module == "admin" && $type == "view")
618
+				if ($this->module == "admin" && $type == "view")
619 619
 				{
620
-					if($logged_info->is_admin == 'Y')
620
+					if ($logged_info->is_admin == 'Y')
621 621
 					{
622
-						if($this->act != 'dispLayoutAdminLayoutModify')
622
+						if ($this->act != 'dispLayoutAdminLayoutModify')
623 623
 						{
624 624
 							$oAdminView = getAdminView('admin');
625 625
 							$oAdminView->makeGnbUrl($forward->module);
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 						return $oMessageObject;
640 640
 					}
641 641
 				}
642
-				if($kind == 'admin')
642
+				if ($kind == 'admin')
643 643
 				{
644 644
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
645
-					if(!$grant->manager)
645
+					if (!$grant->manager)
646 646
 					{
647 647
 						$this->_setInputErrorToContext();
648 648
 						$this->error = 'msg_is_not_manager';
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 					}
655 655
 					else
656 656
 					{
657
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
657
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
658 658
 						{
659 659
 							$this->_setInputErrorToContext();
660 660
 							$this->error = 'msg_is_not_administrator';
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 					}
668 668
 				}
669 669
 			}
670
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
670
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
671 671
 			{
672 672
 				$this->act = $xml_info->default_index_act;
673 673
 			}
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
 		}
682 682
 
683 683
 		// ruleset check...
684
-		if(!empty($ruleset))
684
+		if (!empty($ruleset))
685 685
 		{
686 686
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
687 687
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
688
-			if(!empty($rulesetFile))
688
+			if (!empty($rulesetFile))
689 689
 			{
690
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
690
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
691 691
 				{
692 692
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
693
-					foreach($errorLang as $key => $val)
693
+					foreach ($errorLang as $key => $val)
694 694
 					{
695 695
 						Context::setLang($key, $val);
696 696
 					}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 
700 700
 				$Validator = new Validator($rulesetFile);
701 701
 				$result = $Validator->validate();
702
-				if(!$result)
702
+				if (!$result)
703 703
 				{
704 704
 					$lastError = $Validator->getLastError();
705 705
 					$returnUrl = Context::get('error_return_url');
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 				'dispLayoutPreviewWithModule' => 1
732 732
 		);
733 733
 		$db_use_mobile = Mobile::isMobileEnabled();
734
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
734
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
735 735
 		{
736 736
 			global $lang;
737 737
 			$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>';
@@ -740,17 +740,17 @@  discard block
 block discarded – undo
740 740
 			Context::addHtmlFooter($footer);
741 741
 		}
742 742
 
743
-		if($type == "view" && $kind != 'admin')
743
+		if ($type == "view" && $kind != 'admin')
744 744
 		{
745 745
 			$module_config = $oModuleModel->getModuleConfig('module');
746
-			if($module_config->htmlFooter)
746
+			if ($module_config->htmlFooter)
747 747
 			{
748 748
 				Context::addHtmlFooter($module_config->htmlFooter);
749 749
 			}
750
-			if($module_config->siteTitle)
750
+			if ($module_config->siteTitle)
751 751
 			{
752 752
 				$siteTitle = Context::getBrowserTitle();
753
-				if(!$siteTitle)
753
+				if (!$siteTitle)
754 754
 				{
755 755
 					Context::setBrowserTitle($module_config->siteTitle);
756 756
 				}
@@ -763,18 +763,18 @@  discard block
 block discarded – undo
763 763
 		$procResult = $oModule->proc();
764 764
 
765 765
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
766
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
766
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
767 767
 		{
768 768
 			$error = $oModule->getError();
769 769
 			$message = $oModule->getMessage();
770 770
 			$messageType = $oModule->getMessageType();
771 771
 			$redirectUrl = $oModule->getRedirectUrl();
772
-			if($messageType == 'error') debugPrint($message, 'ERROR');
772
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
773 773
 
774
-			if(!$procResult)
774
+			if (!$procResult)
775 775
 			{
776 776
 				$this->error = $message;
777
-				if(!$redirectUrl && Context::get('error_return_url'))
777
+				if (!$redirectUrl && Context::get('error_return_url'))
778 778
 				{
779 779
 					$redirectUrl = Context::get('error_return_url');
780 780
 				}
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
 
788 788
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
789 789
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
790
-			if($message != 'success')
790
+			if ($message != 'success')
791 791
 			{
792 792
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
793 793
 			}
794 794
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
795 795
 
796
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
796
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
797 797
 			{
798 798
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
799 799
 			}
@@ -809,27 +809,27 @@  discard block
 block discarded – undo
809 809
 	 * */
810 810
 	function _setInputErrorToContext()
811 811
 	{
812
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
812
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
813 813
 		{
814 814
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
815 815
 		}
816
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
816
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
817 817
 		{
818 818
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
819 819
 		}
820
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
820
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
821 821
 		{
822 822
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
823 823
 		}
824
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
824
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
825 825
 		{
826 826
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
827 827
 		}
828
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
828
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
829 829
 		{
830 830
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
831 831
 		}
832
-		if(count($_SESSION['INPUT_ERROR']))
832
+		if (count($_SESSION['INPUT_ERROR']))
833 833
 		{
834 834
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
835 835
 		}
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 	{
860 860
 		$requestVars = Context::getRequestVars();
861 861
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
862
-		foreach($requestVars AS $key => $value)
862
+		foreach ($requestVars AS $key => $value)
863 863
 		{
864 864
 			$_SESSION['INPUT_ERROR'][$key] = $value;
865 865
 		}
@@ -873,31 +873,31 @@  discard block
 block discarded – undo
873 873
 	function displayContent($oModule = NULL)
874 874
 	{
875 875
 		// If the module is not set or not an object, set error
876
-		if(!$oModule || !is_object($oModule))
876
+		if (!$oModule || !is_object($oModule))
877 877
 		{
878 878
 			$this->error = 'msg_module_is_not_exists';
879 879
 			$this->httpStatusCode = '404';
880 880
 		}
881 881
 
882 882
 		// If connection to DB has a problem even though it's not install module, set error
883
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
883
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
884 884
 		{
885 885
 			$this->error = 'msg_dbconnect_failed';
886 886
 		}
887 887
 
888 888
 		// Call trigger after moduleHandler proc
889 889
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
890
-		if(!$output->toBool())
890
+		if (!$output->toBool())
891 891
 		{
892 892
 			$this->error = $output->getMessage();
893 893
 		}
894 894
 
895 895
 		// Use message view object, if HTML call
896 896
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
897
-		if(!isset($methodList[Context::getRequestMethod()]))
897
+		if (!isset($methodList[Context::getRequestMethod()]))
898 898
 		{
899 899
 
900
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
900
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
901 901
 			{
902 902
 				$display_handler = new DisplayHandler();
903 903
 				$display_handler->_debugOutput();
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 			}
908 908
 
909 909
 			// If error occurred, handle it
910
-			if($this->error)
910
+			if ($this->error)
911 911
 			{
912 912
 				// display content with message module instance
913 913
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -916,14 +916,14 @@  discard block
 block discarded – undo
916 916
 				$oMessageObject->setMessage($this->error);
917 917
 				$oMessageObject->dispMessage();
918 918
 
919
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
919
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
920 920
 				{
921 921
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
922 922
 					$oMessageObject->setTemplateFile('http_status_code');
923 923
 				}
924 924
 
925 925
 				// If module was called normally, change the templates of the module into ones of the message view module
926
-				if($oModule)
926
+				if ($oModule)
927 927
 				{
928 928
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
929 929
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 			}
939 939
 
940 940
 			// Check if layout_srl exists for the module
941
-			if(Mobile::isFromMobilePhone())
941
+			if (Mobile::isFromMobilePhone())
942 942
 			{
943 943
 				$layout_srl = $oModule->module_info->mlayout_srl;
944 944
 			}
@@ -948,31 +948,31 @@  discard block
 block discarded – undo
948 948
 			}
949 949
 
950 950
 			// if layout_srl is rollback by module, set default layout
951
-			if($layout_srl == -1)
951
+			if ($layout_srl == -1)
952 952
 			{
953 953
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
954 954
 				$oLayoutAdminModel = getAdminModel('layout');
955 955
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
956 956
 			}
957 957
 
958
-			if($layout_srl && !$oModule->getLayoutFile())
958
+			if ($layout_srl && !$oModule->getLayoutFile())
959 959
 			{
960 960
 
961 961
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
962 962
 				$oLayoutModel = getModel('layout');
963 963
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
964
-				if($layout_info)
964
+				if ($layout_info)
965 965
 				{
966 966
 
967 967
 					// Input extra_vars into $layout_info
968
-					if($layout_info->extra_var_count)
968
+					if ($layout_info->extra_var_count)
969 969
 					{
970 970
 
971
-						foreach($layout_info->extra_var as $var_id => $val)
971
+						foreach ($layout_info->extra_var as $var_id => $val)
972 972
 						{
973
-							if($val->type == 'image')
973
+							if ($val->type == 'image')
974 974
 							{
975
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
975
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
976 976
 								{
977 977
 									$val->value = Context::getRequestUri() . substr($val->value, 2);
978 978
 								}
@@ -981,22 +981,22 @@  discard block
 block discarded – undo
981 981
 						}
982 982
 					}
983 983
 					// Set menus into context
984
-					if($layout_info->menu_count)
984
+					if ($layout_info->menu_count)
985 985
 					{
986
-						foreach($layout_info->menu as $menu_id => $menu)
986
+						foreach ($layout_info->menu as $menu_id => $menu)
987 987
 						{
988 988
 							// set default menu set(included home menu)
989
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
989
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
990 990
 							{
991 991
 								$oMenuAdminController = getAdminController('menu');
992 992
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
993 993
 
994
-								if(FileHandler::exists($homeMenuCacheFile))
994
+								if (FileHandler::exists($homeMenuCacheFile))
995 995
 								{
996 996
 									include($homeMenuCacheFile);
997 997
 								}
998 998
 
999
-								if(!$menu->menu_srl)
999
+								if (!$menu->menu_srl)
1000 1000
 								{
1001 1001
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1002 1002
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 							}
1011 1011
 
1012 1012
 							$php_file = FileHandler::exists($menu->php_file);
1013
-							if($php_file)
1013
+							if ($php_file)
1014 1014
 							{
1015 1015
 								include($php_file);
1016 1016
 							}
@@ -1026,17 +1026,17 @@  discard block
 block discarded – undo
1026 1026
 
1027 1027
 					// If layout was modified, use the modified version
1028 1028
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1029
-					if(file_exists($edited_layout))
1029
+					if (file_exists($edited_layout))
1030 1030
 					{
1031 1031
 						$oModule->setEditedLayoutFile($edited_layout);
1032 1032
 					}
1033 1033
 				}
1034 1034
 			}
1035 1035
 			$isLayoutDrop = Context::get('isLayoutDrop');
1036
-			if($isLayoutDrop)
1036
+			if ($isLayoutDrop)
1037 1037
 			{
1038 1038
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1039
-				if($kind == 'admin')
1039
+				if ($kind == 'admin')
1040 1040
 				{
1041 1041
 					$oModule->setLayoutFile('popup_layout');
1042 1042
 				}
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1075 1075
 	{
1076 1076
 
1077
-		if(__DEBUG__ == 3)
1077
+		if (__DEBUG__ == 3)
1078 1078
 		{
1079 1079
 			$start_time = getMicroTime();
1080 1080
 		}
@@ -1084,49 +1084,49 @@  discard block
 block discarded – undo
1084 1084
 		$type = strtolower($type);
1085 1085
 
1086 1086
 		$kinds = array('svc' => 1, 'admin' => 1);
1087
-		if(!isset($kinds[$kind]))
1087
+		if (!isset($kinds[$kind]))
1088 1088
 		{
1089 1089
 			$kind = 'svc';
1090 1090
 		}
1091 1091
 
1092 1092
 		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1093 1093
 
1094
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1094
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1095 1095
 		{
1096 1096
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1097 1097
 		}
1098 1098
 
1099 1099
 		// if there is no instance of the module in global variable, create a new one
1100
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1100
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1101 1101
 		{
1102 1102
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1103 1103
 
1104
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1104
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1105 1105
 			{
1106 1106
 				$module = $parent_module;
1107 1107
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1108 1108
 			}
1109 1109
 
1110 1110
 			// Check if the base class and instance class exist
1111
-			if(!class_exists($module, true))
1111
+			if (!class_exists($module, true))
1112 1112
 			{
1113 1113
 				return NULL;
1114 1114
 			}
1115
-			if(!class_exists($instance_name, true))
1115
+			if (!class_exists($instance_name, true))
1116 1116
 			{
1117 1117
 				return NULL;
1118 1118
 			}
1119 1119
 
1120 1120
 			// Create an instance
1121 1121
 			$oModule = new $instance_name();
1122
-			if(!is_object($oModule))
1122
+			if (!is_object($oModule))
1123 1123
 			{
1124 1124
 				return NULL;
1125 1125
 			}
1126 1126
 
1127 1127
 			// Load language files for the class
1128 1128
 			Context::loadLang($class_path . 'lang');
1129
-			if($extend_module)
1129
+			if ($extend_module)
1130 1130
 			{
1131 1131
 				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1132 1132
 			}
@@ -1136,10 +1136,10 @@  discard block
 block discarded – undo
1136 1136
 			$oModule->setModulePath($class_path);
1137 1137
 
1138 1138
 			// If the module has a constructor, run it.
1139
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1139
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1140 1140
 			{
1141 1141
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1142
-				if(@method_exists($oModule, $instance_name))
1142
+				if (@method_exists($oModule, $instance_name))
1143 1143
 				{
1144 1144
 					$oModule->{$instance_name}();
1145 1145
 				}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1150 1150
 		}
1151 1151
 
1152
-		if(__DEBUG__ == 3)
1152
+		if (__DEBUG__ == 3)
1153 1153
 		{
1154 1154
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1155 1155
 		}
@@ -1165,17 +1165,17 @@  discard block
 block discarded – undo
1165 1165
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1166 1166
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1167 1167
 
1168
-		$types = array('view','controller','model','api','wap','mobile','class');
1169
-		if(!in_array($type, $types))
1168
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1169
+		if (!in_array($type, $types))
1170 1170
 		{
1171 1171
 			$type = $types[0];
1172 1172
 		}
1173
-		if($type == 'class')
1173
+		if ($type == 'class')
1174 1174
 		{
1175 1175
 			$instanceName = '%s';
1176 1176
 			$classFile = '%s%s.%s.php';
1177 1177
 		}
1178
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1178
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1179 1179
 		{
1180 1180
 			$instanceName = '%sAdmin%s';
1181 1181
 			$classFile = '%s%s.admin.%s.php';
@@ -1200,26 +1200,26 @@  discard block
 block discarded – undo
1200 1200
 	function triggerCall($trigger_name, $called_position, &$obj)
1201 1201
 	{
1202 1202
 		// skip if not installed
1203
-		if(!Context::isInstalled())
1203
+		if (!Context::isInstalled())
1204 1204
 		{
1205 1205
 			return new Object();
1206 1206
 		}
1207 1207
 
1208 1208
 		$oModuleModel = getModel('module');
1209 1209
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1210
-		if(!$triggers || count($triggers) < 1)
1210
+		if (!$triggers || count($triggers) < 1)
1211 1211
 		{
1212 1212
 			return new Object();
1213 1213
 		}
1214 1214
 		
1215 1215
 		//store before trigger call time
1216 1216
 		$before_trigger_time = NULL;
1217
-		if(__LOG_SLOW_TRIGGER__> 0)
1217
+		if (__LOG_SLOW_TRIGGER__ > 0)
1218 1218
 		{
1219 1219
 			$before_trigger_time = microtime(true);
1220 1220
 		}
1221 1221
 
1222
-		foreach($triggers as $item)
1222
+		foreach ($triggers as $item)
1223 1223
 		{
1224 1224
 			$module = $item->module;
1225 1225
 			$type = $item->type;
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 			// todo why don't we call a normal class object ?
1229 1229
 			$oModule = getModule($module, $type);
1230
-			if(!$oModule || !method_exists($oModule, $called_method))
1230
+			if (!$oModule || !method_exists($oModule, $called_method))
1231 1231
 			{
1232 1232
 				continue;
1233 1233
 			}
@@ -1243,9 +1243,9 @@  discard block
 block discarded – undo
1243 1243
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1244 1244
 			$slowlog->called = $module . '.' . $called_method;
1245 1245
 			$slowlog->called_extension = $module;
1246
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1246
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1247 1247
 
1248
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1248
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1249 1249
 			{
1250 1250
 				return $output;
1251 1251
 			}
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
 			'505' => 'HTTP Version Not Supported',
1306 1306
 		);
1307 1307
 		$statusMessage = $statusMessageList[$code];
1308
-		if(!$statusMessage)
1308
+		if (!$statusMessage)
1309 1309
 		{
1310 1310
 			$statusMessage = 'OK';
1311 1311
 		}
Please login to merge, or discard this patch.
Braces   +32 added lines, -49 removed lines patch added patch discarded remove patch
@@ -107,8 +107,7 @@  discard block
 block discarded – undo
107 107
 			if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110
-			}
111
-			else if(__DEBUG_PROTECT__ === 0)
110
+			} else if(__DEBUG_PROTECT__ === 0)
112 111
 			{
113 112
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
114 113
 			}
@@ -118,7 +117,9 @@  discard block
 block discarded – undo
118 117
 		$called_position = 'before_module_init';
119 118
 		$oAddonController = getController('addon');
120 119
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
121
-		if(file_exists($addon_file)) include($addon_file);
120
+		if(file_exists($addon_file)) {
121
+			include($addon_file);
122
+		}
122 123
 	}
123 124
 
124 125
 	function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -126,8 +127,7 @@  discard block
 block discarded – undo
126 127
 		if($errnumber != E_WARNING)
127 128
 		{
128 129
 			return false;
129
-		}
130
-		else
130
+		} else
131 131
 		{
132 132
 			$errorname = 'Warrning!';
133 133
 		}
@@ -190,8 +190,7 @@  discard block
 block discarded – undo
190 190
 			if(!$module_info)
191 191
 			{
192 192
 				unset($this->document_srl);
193
-			}
194
-			else
193
+			} else
195 194
 			{
196 195
 				// If it exists, compare mid based on the module information
197 196
 				// if mids are not matching, set it as the document's mid
@@ -203,8 +202,7 @@  discard block
 block discarded – undo
203 202
 						$this->mid = $module_info->mid;
204 203
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
205 204
 						return FALSE;
206
-					}
207
-					else
205
+					} else
208 206
 					{
209 207
 						$this->mid = $module_info->mid;
210 208
 						Context::set('mid', $this->mid);
@@ -255,15 +253,13 @@  discard block
 block discarded – undo
255 253
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
256 254
 				$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'));
257 255
 				// If it's called from a virtual site, though it's not a module of the virtual site
258
-			}
259
-			else
256
+			} else
260 257
 			{
261 258
 				$db_info = Context::getDBInfo();
262 259
 				if(!$db_info->default_url)
263 260
 				{
264 261
 					return Context::getLang('msg_default_url_is_not_defined');
265
-				}
266
-				else
262
+				} else
267 263
 				{
268 264
 					$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'));
269 265
 				}
@@ -288,8 +284,7 @@  discard block
 block discarded – undo
288 284
 			{
289 285
 				$oLayoutAdminModel = getAdminModel('layout');
290 286
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
291
-			}
292
-			else
287
+			} else
293 288
 			{
294 289
 				$layoutSrl = $module_info->{$targetSrl};
295 290
 			}
@@ -416,8 +411,7 @@  discard block
 block discarded – undo
416 411
 			if(!$allowedMethod)
417 412
 			{
418 413
 				$allowedMethodList[0] = 'POST';
419
-			}
420
-			else
414
+			} else
421 415
 			{
422 416
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
423 417
 			}
@@ -475,8 +469,7 @@  discard block
 block discarded – undo
475 469
 				Mobile::setMobile(FALSE);
476 470
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
477 471
 			}
478
-		}
479
-		else
472
+		} else
480 473
 		{
481 474
 			// create a module instance
482 475
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -529,8 +522,7 @@  discard block
 block discarded – undo
529 522
 					$forward->type = $xml_info->action->{$this->act}->type;
530 523
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
531 524
 					$forward->act = $this->act;
532
-				}
533
-				else
525
+				} else
534 526
 				{
535 527
 					$this->error = 'msg_invalid_request';
536 528
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -566,8 +558,7 @@  discard block
 block discarded – undo
566 558
 					if(!$allowedMethod)
567 559
 					{
568 560
 						$allowedMethodList[0] = 'POST';
569
-					}
570
-					else
561
+					} else
571 562
 					{
572 563
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
573 564
 					}
@@ -595,8 +586,7 @@  discard block
 block discarded – undo
595 586
 						Mobile::setMobile(FALSE);
596 587
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
597 588
 					}
598
-				}
599
-				else
589
+				} else
600 590
 				{
601 591
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
602 592
 				}
@@ -626,8 +616,7 @@  discard block
 block discarded – undo
626 616
 							$oModule->setLayoutPath("./modules/admin/tpl");
627 617
 							$oModule->setLayoutFile("layout.html");
628 618
 						}
629
-					}
630
-					else
619
+					} else
631 620
 					{
632 621
 						$this->_setInputErrorToContext();
633 622
 
@@ -651,8 +640,7 @@  discard block
 block discarded – undo
651 640
 						$oMessageObject->setMessage($this->error);
652 641
 						$oMessageObject->dispMessage();
653 642
 						return $oMessageObject;
654
-					}
655
-					else
643
+					} else
656 644
 					{
657 645
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
658 646
 						{
@@ -666,12 +654,10 @@  discard block
 block discarded – undo
666 654
 						}
667 655
 					}
668 656
 				}
669
-			}
670
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
657
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
671 658
 			{
672 659
 				$this->act = $xml_info->default_index_act;
673
-			}
674
-			else
660
+			} else
675 661
 			{
676 662
 				$this->error = 'msg_invalid_request';
677 663
 				$oModule->setError(-1);
@@ -769,7 +755,9 @@  discard block
 block discarded – undo
769 755
 			$message = $oModule->getMessage();
770 756
 			$messageType = $oModule->getMessageType();
771 757
 			$redirectUrl = $oModule->getRedirectUrl();
772
-			if($messageType == 'error') debugPrint($message, 'ERROR');
758
+			if($messageType == 'error') {
759
+				debugPrint($message, 'ERROR');
760
+			}
773 761
 
774 762
 			if(!$procResult)
775 763
 			{
@@ -779,8 +767,7 @@  discard block
 block discarded – undo
779 767
 					$redirectUrl = Context::get('error_return_url');
780 768
 				}
781 769
 				$this->_setInputValueToSession();
782
-			}
783
-			else
770
+			} else
784 771
 			{
785 772
 
786 773
 			}
@@ -928,8 +915,7 @@  discard block
 block discarded – undo
928 915
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
929 916
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
930 917
 					// Otherwise, set message instance as the target module
931
-				}
932
-				else
918
+				} else
933 919
 				{
934 920
 					$oModule = $oMessageObject;
935 921
 				}
@@ -941,8 +927,7 @@  discard block
 block discarded – undo
941 927
 			if(Mobile::isFromMobilePhone())
942 928
 			{
943 929
 				$layout_srl = $oModule->module_info->mlayout_srl;
944
-			}
945
-			else
930
+			} else
946 931
 			{
947 932
 				$layout_srl = $oModule->module_info->layout_srl;
948 933
 			}
@@ -1001,8 +986,7 @@  discard block
 block discarded – undo
1001 986
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1002 987
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1003 988
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1004
-								}
1005
-								else
989
+								} else
1006 990
 								{
1007 991
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1008 992
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1039,8 +1023,7 @@  discard block
 block discarded – undo
1039 1023
 				if($kind == 'admin')
1040 1024
 				{
1041 1025
 					$oModule->setLayoutFile('popup_layout');
1042
-				}
1043
-				else
1026
+				} else
1044 1027
 				{
1045 1028
 					$oModule->setLayoutPath('common/tpl');
1046 1029
 					$oModule->setLayoutFile('default_layout');
@@ -1174,13 +1157,11 @@  discard block
 block discarded – undo
1174 1157
 		{
1175 1158
 			$instanceName = '%s';
1176 1159
 			$classFile = '%s%s.%s.php';
1177
-		}
1178
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1160
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1179 1161
 		{
1180 1162
 			$instanceName = '%sAdmin%s';
1181 1163
 			$classFile = '%s%s.admin.%s.php';
1182
-		}
1183
-		else
1164
+		} else
1184 1165
 		{
1185 1166
 			$instanceName = '%s%s';
1186 1167
 			$classFile = '%s%s.%s.php';
@@ -1243,7 +1224,9 @@  discard block
 block discarded – undo
1243 1224
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1244 1225
 			$slowlog->called = $module . '.' . $called_method;
1245 1226
 			$slowlog->called_extension = $module;
1246
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1227
+			if($trigger_name != 'XE.writeSlowlog') {
1228
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1229
+			}
1247 1230
 
1248 1231
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1249 1232
 			{
Please login to merge, or discard this patch.