GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 70ade0...99f185 )
by gyeong-won
16:09 queued 04:57
created
classes/module/ModuleHandler.class.php 1 patch
Spacing   +162 added lines, -162 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
 			}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$called_position = 'before_module_init';
108 108
 		$oAddonController = getController('addon');
109 109
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
110
-		if(file_exists($addon_file)) include($addon_file);
110
+		if (file_exists($addon_file)) include($addon_file);
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
 		// if success_return_url and error_return_url is incorrect
123 123
 		$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
124
-		foreach($urls as $url)
124
+		foreach ($urls as $url)
125 125
 		{
126
-			if(empty($url))
126
+			if (empty($url))
127 127
 			{
128 128
 				continue;
129 129
 			}
@@ -135,29 +135,29 @@  discard block
 block discarded – undo
135 135
 			$defaultUrlInfo = parse_url($dbInfo->default_url);
136 136
 			$defaultHost = $defaultUrlInfo['host'];
137 137
 		
138
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
138
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
139 139
 			{
140 140
 				throw new Exception('msg_default_url_is_null');
141 141
 			}
142 142
 		}
143 143
 		
144
-		if(!$this->document_srl && $this->mid && $this->entry)
144
+		if (!$this->document_srl && $this->mid && $this->entry)
145 145
 		{
146 146
 			$oDocumentModel = getModel('document');
147 147
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
148
-			if($this->document_srl)
148
+			if ($this->document_srl)
149 149
 			{
150 150
 				Context::set('document_srl', $this->document_srl);
151 151
 			}
152 152
 		}
153 153
 
154 154
 		// Get module's information based on document_srl, if it's specified
155
-		if($this->document_srl)
155
+		if ($this->document_srl)
156 156
 		{
157 157
 			
158 158
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
159 159
 			// If the document does not exist, remove document_srl
160
-			if(!$module_info)
160
+			if (!$module_info)
161 161
 			{
162 162
 				unset($this->document_srl);
163 163
 			}
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 			{
166 166
 				// If it exists, compare mid based on the module information
167 167
 				// if mids are not matching, set it as the document's mid
168
-				if(!$this->mid || ($this->mid != $module_info->mid))
168
+				if (!$this->mid || ($this->mid != $module_info->mid))
169 169
 				{
170 170
 					
171
-					if(Context::getRequestMethod() == 'GET')
171
+					if (Context::getRequestMethod() == 'GET')
172 172
 					{
173 173
 						$this->mid = $module_info->mid;
174
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
174
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
175 175
 						return FALSE;
176 176
 					}
177 177
 					else
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 					
183 183
 				}
184 184
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
185
-				if($this->module && $module_info->module != $this->module)
185
+				if ($this->module && $module_info->module != $this->module)
186 186
 				{
187 187
 					unset($module_info);
188 188
 				}
@@ -191,36 +191,36 @@  discard block
 block discarded – undo
191 191
 		}
192 192
 
193 193
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
194
-		if(!$module_info && $this->mid)
194
+		if (!$module_info && $this->mid)
195 195
 		{
196 196
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
197 197
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
198 198
 		}
199 199
 
200 200
 		// redirect, if module_site_srl and site_srl are different
201
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
201
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
202 202
 		{
203 203
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
204
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
204
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
205 205
 			return FALSE;
206 206
 		}
207 207
 
208 208
 		// If module_info is not set still, and $module does not exist, find the default module
209
-		if(!$module_info && !$this->module && !$this->mid)
209
+		if (!$module_info && !$this->module && !$this->mid)
210 210
 		{
211 211
 			$module_info = $site_module_info;
212 212
 		}
213 213
 
214
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
214
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
215 215
 		{
216 216
 			$module_info = $site_module_info;
217 217
 		}
218 218
 
219 219
 		// redirect, if site_srl of module_info is different from one of site's module_info
220
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
220
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
221 221
 		{
222 222
 			// If the module is of virtual site
223
-			if($module_info->site_srl)
223
+			if ($module_info->site_srl)
224 224
 			{
225 225
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
226 226
 				$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'));
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			else
230 230
 			{
231 231
 				$db_info = Context::getDBInfo();
232
-				if(!$db_info->default_url)
232
+				if (!$db_info->default_url)
233 233
 				{
234 234
 					return Context::getLang('msg_default_url_is_not_defined');
235 235
 				}
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 					$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'));
239 239
 				}
240 240
 			}
241
-			header("location:" . $redirect_url);
241
+			header("location:".$redirect_url);
242 242
 			return FALSE;
243 243
 		}
244 244
 
245 245
 		// If module info was set, retrieve variables from the module information
246
-		if($module_info)
246
+		if ($module_info)
247 247
 		{
248 248
 			$this->module = $module_info->module;
249 249
 			$this->mid = $module_info->mid;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
255 255
 
256 256
 			// use the site default layout.
257
-			if($module_info->{$targetSrl} == -1)
257
+			if ($module_info->{$targetSrl} == -1)
258 258
 			{
259 259
 				$oLayoutAdminModel = getAdminModel('layout');
260 260
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		}
273 273
 
274 274
 		// Set module and mid into module_info
275
-		if(!isset($this->module_info))
275
+		if (!isset($this->module_info))
276 276
 		{
277 277
 			$this->module_info = new stdClass();
278 278
 		}
@@ -283,21 +283,21 @@  discard block
 block discarded – undo
283 283
 		$this->module_info->site_srl = $site_module_info->site_srl;
284 284
 
285 285
 		// Still no module? it's an error
286
-		if(!$this->module)
286
+		if (!$this->module)
287 287
 		{
288 288
 			$this->error = 'msg_module_is_not_exists';
289 289
 			$this->httpStatusCode = '404';
290 290
 		}
291 291
 
292 292
 		// If mid exists, set mid into context
293
-		if($this->mid)
293
+		if ($this->mid)
294 294
 		{
295 295
 			Context::set('mid', $this->mid, TRUE);
296 296
 		}
297 297
 		
298 298
 		// Call a trigger after moduleHandler init
299 299
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
300
-		if(!$output->toBool())
300
+		if (!$output->toBool())
301 301
 		{
302 302
 			$this->error = $output->getMessage();
303 303
 			return TRUE;
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
320 320
 
321 321
 		// If error occurred while preparation, return a message instance
322
-		if($this->error)
322
+		if ($this->error)
323 323
 		{
324 324
 			$this->_setInputErrorToContext();
325 325
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
326 326
 			$oMessageObject->setError(-1);
327 327
 			$oMessageObject->setMessage($this->error);
328 328
 			$oMessageObject->dispMessage();
329
-			if($this->httpStatusCode)
329
+			if ($this->httpStatusCode)
330 330
 			{
331 331
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
332 332
 			}
@@ -337,22 +337,22 @@  discard block
 block discarded – undo
337 337
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
338 338
 
339 339
 		// If not installed yet, modify act
340
-		if($this->module == "install")
340
+		if ($this->module == "install")
341 341
 		{
342
-			if(!$this->act || !$xml_info->action->{$this->act})
342
+			if (!$this->act || !$xml_info->action->{$this->act})
343 343
 			{
344 344
 				$this->act = $xml_info->default_index_act;
345 345
 			}
346 346
 		}
347 347
 
348 348
 		// if act exists, find type of the action, if not use default index act
349
-		if(!$this->act)
349
+		if (!$this->act)
350 350
 		{
351 351
 			$this->act = $xml_info->default_index_act;
352 352
 		}
353 353
 
354 354
 		// still no act means error
355
-		if(!$this->act)
355
+		if (!$this->act)
356 356
 		{
357 357
 			$this->error = 'msg_module_is_not_exists';
358 358
 			$this->httpStatusCode = '404';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			$oMessageObject->setError(-1);
363 363
 			$oMessageObject->setMessage($this->error);
364 364
 			$oMessageObject->dispMessage();
365
-			if($this->httpStatusCode)
365
+			if ($this->httpStatusCode)
366 366
 			{
367 367
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
368 368
 			}
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
 		$type = $xml_info->action->{$this->act}->type;
374 374
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
375 375
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
376
-		if(!$kind && $this->module == 'admin')
376
+		if (!$kind && $this->module == 'admin')
377 377
 		{
378 378
 			$kind = 'admin';
379 379
 		}
380 380
 
381 381
 		// check REQUEST_METHOD in controller
382
-		if($type == 'controller')
382
+		if ($type == 'controller')
383 383
 		{
384 384
 			$allowedMethod = $xml_info->action->{$this->act}->method;
385 385
 
386
-			if(!$allowedMethod)
386
+			if (!$allowedMethod)
387 387
 			{
388 388
 				$allowedMethodList[0] = 'POST';
389 389
 			}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
393 393
 			}
394 394
 
395
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
395
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
396 396
 			{
397 397
 				$this->error = "msg_invalid_request";
398 398
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			}
404 404
 		}
405 405
 
406
-		if($this->module_info->use_mobile != "Y")
406
+		if ($this->module_info->use_mobile != "Y")
407 407
 		{
408 408
 			Mobile::setMobile(FALSE);
409 409
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		$logged_info = Context::get('logged_info');
412 412
 
413 413
 		// check CSRF for POST actions
414
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
414
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
415 415
 			$this->error = 'msg_invalid_request';
416 416
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
417 417
 			$oMessageObject->setError(-1);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		}
422 422
 
423 423
 		// Admin ip
424
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
424
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
425 425
 		{
426 426
 			$this->_setInputErrorToContext();
427 427
 			$this->error = "msg_not_permitted_act";
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 		}
434 434
 
435 435
 		// if(type == view, and case for using mobilephone)
436
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
436
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
437 437
 		{
438 438
 			$orig_type = "view";
439 439
 			$type = "mobile";
440 440
 			// create a module instance
441 441
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
442
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
442
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
443 443
 			{
444 444
 				$type = $orig_type;
445 445
 				Mobile::setMobile(FALSE);
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
453 453
 		}
454 454
 
455
-		if(!is_object($oModule))
455
+		if (!is_object($oModule))
456 456
 		{
457 457
 			$this->_setInputErrorToContext();
458 458
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 
469 469
 		// If there is no such action in the module object
470
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
470
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
471 471
 		{
472 472
 
473
-			if(!Context::isInstalled())
473
+			if (!Context::isInstalled())
474 474
 			{
475 475
 				$this->_setInputErrorToContext();
476 476
 				$this->error = 'msg_invalid_request';
@@ -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
 				}
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 
488 488
 			$forward = NULL;
489 489
 			// 1. Look for the module with action name
490
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
490
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
491 491
 			{
492
-				$module = strtolower($matches[2] . $matches[3]);
492
+				$module = strtolower($matches[2].$matches[3]);
493 493
 				$xml_info = $oModuleModel->getModuleActionXml($module);
494 494
 
495
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
495
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
496 496
 				{
497 497
 					$forward = new stdClass();
498 498
 					$forward->module = $module;
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
 				}
513 513
 			}
514 514
 
515
-			if(!$forward)
515
+			if (!$forward)
516 516
 			{
517 517
 				$forward = $oModuleModel->getActionForward($this->act);
518 518
 			}
519 519
 
520
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
520
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
521 521
 			{
522 522
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
523 523
 				$type = $forward->type;
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 
530 530
 				// SECISSUE also check foward act method
531 531
 				// check REQUEST_METHOD in controller
532
-				if($type == 'controller')
532
+				if ($type == 'controller')
533 533
 				{
534 534
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
535 535
 
536
-					if(!$allowedMethod)
536
+					if (!$allowedMethod)
537 537
 					{
538 538
 						$allowedMethodList[0] = 'POST';
539 539
 					}
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
543 543
 					}
544 544
 
545
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
545
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
546 546
 					{
547 547
 						$this->error = "msg_invalid_request";
548 548
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 					}
554 554
 				}
555 555
 
556
-				if($type == "view" && Mobile::isFromMobilePhone())
556
+				if ($type == "view" && Mobile::isFromMobilePhone())
557 557
 				{
558 558
 					$orig_type = "view";
559 559
 					$type = "mobile";
560 560
 					// create a module instance
561 561
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
562
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
562
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
563 563
 					{
564 564
 						$type = $orig_type;
565 565
 						Mobile::setMobile(FALSE);
@@ -571,25 +571,25 @@  discard block
 block discarded – undo
571 571
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
572 572
 				}
573 573
 
574
-				if(!is_object($oModule))
574
+				if (!is_object($oModule))
575 575
 				{
576 576
 					$this->_setInputErrorToContext();
577 577
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
578 578
 					$oMessageObject->setError(-1);
579 579
 					$oMessageObject->setMessage('msg_module_is_not_exists');
580 580
 					$oMessageObject->dispMessage();
581
-					if($this->httpStatusCode)
581
+					if ($this->httpStatusCode)
582 582
 					{
583 583
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
584 584
 					}
585 585
 					return $oMessageObject;
586 586
 				}
587 587
 
588
-				if($this->module == "admin" && $type == "view")
588
+				if ($this->module == "admin" && $type == "view")
589 589
 				{
590
-					if($logged_info->is_admin == 'Y')
590
+					if ($logged_info->is_admin == 'Y')
591 591
 					{
592
-						if($this->act != 'dispLayoutAdminLayoutModify')
592
+						if ($this->act != 'dispLayoutAdminLayoutModify')
593 593
 						{
594 594
 							$oAdminView = getAdminView('admin');
595 595
 							$oAdminView->makeGnbUrl($forward->module);
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
 						return $oMessageObject;
610 610
 					}
611 611
 				}
612
-				if($kind == 'admin')
612
+				if ($kind == 'admin')
613 613
 				{
614 614
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
615
-					if(!$grant->manager)
615
+					if (!$grant->manager)
616 616
 					{
617 617
 						$this->_setInputErrorToContext();
618 618
 						$this->error = 'msg_is_not_manager';
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					}
625 625
 					else
626 626
 					{
627
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
627
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
628 628
 						{
629 629
 							$this->_setInputErrorToContext();
630 630
 							$this->error = 'msg_is_not_administrator';
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 					}
638 638
 				}
639 639
 			}
640
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
640
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
641 641
 			{
642 642
 				$this->act = $xml_info->default_index_act;
643 643
 			}
@@ -651,16 +651,16 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 
653 653
 		// ruleset check...
654
-		if(!empty($ruleset))
654
+		if (!empty($ruleset))
655 655
 		{
656 656
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
657 657
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
658
-			if(!empty($rulesetFile))
658
+			if (!empty($rulesetFile))
659 659
 			{
660
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
660
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
661 661
 				{
662 662
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
663
-					foreach($errorLang as $key => $val)
663
+					foreach ($errorLang as $key => $val)
664 664
 					{
665 665
 						Context::setLang($key, $val);
666 666
 					}
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 
670 670
 				$Validator = new Validator($rulesetFile);
671 671
 				$result = $Validator->validate();
672
-				if(!$result)
672
+				if (!$result)
673 673
 				{
674 674
 					$lastError = $Validator->getLastError();
675 675
 					$returnUrl = Context::get('error_return_url');
@@ -701,26 +701,26 @@  discard block
 block discarded – undo
701 701
 				'dispLayoutPreviewWithModule' => 1
702 702
 		);
703 703
 		$db_use_mobile = Mobile::isMobileEnabled();
704
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
704
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
705 705
 		{
706 706
 			global $lang;
707 707
 			$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>';
708
-			$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>';
708
+			$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>';
709 709
 			Context::addHtmlHeader($header);
710 710
 			Context::addHtmlFooter($footer);
711 711
 		}
712 712
 
713
-		if($type == "view" && $kind != 'admin')
713
+		if ($type == "view" && $kind != 'admin')
714 714
 		{
715 715
 			$module_config = $oModuleModel->getModuleConfig('module');
716
-			if($module_config->htmlFooter)
716
+			if ($module_config->htmlFooter)
717 717
 			{
718 718
 				Context::addHtmlFooter($module_config->htmlFooter);
719 719
 			}
720
-			if($module_config->siteTitle)
720
+			if ($module_config->siteTitle)
721 721
 			{
722 722
 				$siteTitle = Context::getBrowserTitle();
723
-				if(!$siteTitle)
723
+				if (!$siteTitle)
724 724
 				{
725 725
 					Context::setBrowserTitle($module_config->siteTitle);
726 726
 				}
@@ -733,18 +733,18 @@  discard block
 block discarded – undo
733 733
 		$procResult = $oModule->proc();
734 734
 
735 735
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
736
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
736
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
737 737
 		{
738 738
 			$error = $oModule->getError();
739 739
 			$message = $oModule->getMessage();
740 740
 			$messageType = $oModule->getMessageType();
741 741
 			$redirectUrl = $oModule->getRedirectUrl();
742
-			if($messageType == 'error') debugPrint($message, 'ERROR');
742
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
743 743
 
744
-			if(!$procResult)
744
+			if (!$procResult)
745 745
 			{
746 746
 				$this->error = $message;
747
-				if(!$redirectUrl && Context::get('error_return_url'))
747
+				if (!$redirectUrl && Context::get('error_return_url'))
748 748
 				{
749 749
 					$redirectUrl = Context::get('error_return_url');
750 750
 				}
@@ -757,13 +757,13 @@  discard block
 block discarded – undo
757 757
 
758 758
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
759 759
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
760
-			if($message != 'success')
760
+			if ($message != 'success')
761 761
 			{
762 762
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
763 763
 			}
764 764
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
765 765
 
766
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
766
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
767 767
 			{
768 768
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
769 769
 			}
@@ -779,27 +779,27 @@  discard block
 block discarded – undo
779 779
 	 * */
780 780
 	function _setInputErrorToContext()
781 781
 	{
782
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
782
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
783 783
 		{
784 784
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
785 785
 		}
786
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
786
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
787 787
 		{
788 788
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
789 789
 		}
790
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
790
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
791 791
 		{
792 792
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
793 793
 		}
794
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
794
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
795 795
 		{
796 796
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
797 797
 		}
798
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
798
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
799 799
 		{
800 800
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
801 801
 		}
802
-		if(count($_SESSION['INPUT_ERROR']))
802
+		if (count($_SESSION['INPUT_ERROR']))
803 803
 		{
804 804
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
805 805
 		}
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 	{
830 830
 		$requestVars = Context::getRequestVars();
831 831
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
832
-		foreach($requestVars AS $key => $value)
832
+		foreach ($requestVars AS $key => $value)
833 833
 		{
834 834
 			$_SESSION['INPUT_ERROR'][$key] = $value;
835 835
 		}
@@ -843,41 +843,41 @@  discard block
 block discarded – undo
843 843
 	function displayContent($oModule = NULL)
844 844
 	{
845 845
 		// If the module is not set or not an object, set error
846
-		if(!$oModule || !is_object($oModule))
846
+		if (!$oModule || !is_object($oModule))
847 847
 		{
848 848
 			$this->error = 'msg_module_is_not_exists';
849 849
 			$this->httpStatusCode = '404';
850 850
 		}
851 851
 
852 852
 		// If connection to DB has a problem even though it's not install module, set error
853
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
853
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
854 854
 		{
855 855
 			$this->error = 'msg_dbconnect_failed';
856 856
 		}
857 857
 
858 858
 		// Call trigger after moduleHandler proc
859 859
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
860
-		if(!$output->toBool())
860
+		if (!$output->toBool())
861 861
 		{
862 862
 			$this->error = $output->getMessage();
863 863
 		}
864 864
 
865 865
 		// Use message view object, if HTML call
866 866
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
867
-		if(!isset($methodList[Context::getRequestMethod()]))
867
+		if (!isset($methodList[Context::getRequestMethod()]))
868 868
 		{
869 869
 
870
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
870
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
871 871
 			{
872 872
 				$display_handler = new DisplayHandler();
873 873
 				$display_handler->_debugOutput();
874 874
 
875
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
875
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
876 876
 				return;
877 877
 			}
878 878
 
879 879
 			// If error occurred, handle it
880
-			if($this->error)
880
+			if ($this->error)
881 881
 			{
882 882
 				// display content with message module instance
883 883
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 				$oMessageObject->setMessage($this->error);
887 887
 				$oMessageObject->dispMessage();
888 888
 
889
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
889
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
890 890
 				{
891 891
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
892 892
 					$oMessageObject->setTemplateFile('http_status_code');
893 893
 				}
894 894
 
895 895
 				// If module was called normally, change the templates of the module into ones of the message view module
896
-				if($oModule)
896
+				if ($oModule)
897 897
 				{
898 898
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
899 899
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 			}
909 909
 
910 910
 			// Check if layout_srl exists for the module
911
-			if(Mobile::isFromMobilePhone())
911
+			if (Mobile::isFromMobilePhone())
912 912
 			{
913 913
 				$layout_srl = $oModule->module_info->mlayout_srl;
914 914
 			}
@@ -918,58 +918,58 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// if layout_srl is rollback by module, set default layout
921
-			if($layout_srl == -1)
921
+			if ($layout_srl == -1)
922 922
 			{
923 923
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
924 924
 				$oLayoutAdminModel = getAdminModel('layout');
925 925
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
926 926
 			}
927 927
 
928
-			if($layout_srl && !$oModule->getLayoutFile())
928
+			if ($layout_srl && !$oModule->getLayoutFile())
929 929
 			{
930 930
 
931 931
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
932 932
 				$oLayoutModel = getModel('layout');
933 933
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
934
-				if($layout_info)
934
+				if ($layout_info)
935 935
 				{
936 936
 
937 937
 					// Input extra_vars into $layout_info
938
-					if($layout_info->extra_var_count)
938
+					if ($layout_info->extra_var_count)
939 939
 					{
940 940
 
941
-						foreach($layout_info->extra_var as $var_id => $val)
941
+						foreach ($layout_info->extra_var as $var_id => $val)
942 942
 						{
943
-							if($val->type == 'image')
943
+							if ($val->type == 'image')
944 944
 							{
945
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
945
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
946 946
 								{
947
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
947
+									$val->value = Context::getRequestUri().substr($val->value, 2);
948 948
 								}
949 949
 							}
950 950
 							$layout_info->{$var_id} = $val->value;
951 951
 						}
952 952
 					}
953 953
 					// Set menus into context
954
-					if($layout_info->menu_count)
954
+					if ($layout_info->menu_count)
955 955
 					{
956
-						foreach($layout_info->menu as $menu_id => $menu)
956
+						foreach ($layout_info->menu as $menu_id => $menu)
957 957
 						{
958 958
 							// set default menu set(included home menu)
959
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
959
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
960 960
 							{
961 961
 								$oMenuAdminController = getAdminController('menu');
962 962
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
963 963
 
964
-								if(FileHandler::exists($homeMenuCacheFile))
964
+								if (FileHandler::exists($homeMenuCacheFile))
965 965
 								{
966 966
 									include($homeMenuCacheFile);
967 967
 								}
968 968
 
969
-								if(!$menu->menu_srl)
969
+								if (!$menu->menu_srl)
970 970
 								{
971
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
972
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
971
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
972
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
973 973
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
974 974
 								}
975 975
 								else
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 							}
981 981
 
982 982
 							$php_file = FileHandler::exists($menu->php_file);
983
-							if($php_file)
983
+							if ($php_file)
984 984
 							{
985 985
 								include($php_file);
986 986
 							}
@@ -996,17 +996,17 @@  discard block
 block discarded – undo
996 996
 
997 997
 					// If layout was modified, use the modified version
998 998
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
999
-					if(file_exists($edited_layout))
999
+					if (file_exists($edited_layout))
1000 1000
 					{
1001 1001
 						$oModule->setEditedLayoutFile($edited_layout);
1002 1002
 					}
1003 1003
 				}
1004 1004
 			}
1005 1005
 			$isLayoutDrop = Context::get('isLayoutDrop');
1006
-			if($isLayoutDrop)
1006
+			if ($isLayoutDrop)
1007 1007
 			{
1008 1008
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1009
-				if($kind == 'admin')
1009
+				if ($kind == 'admin')
1010 1010
 				{
1011 1011
 					$oModule->setLayoutFile('popup_layout');
1012 1012
 				}
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1045 1045
 	{
1046 1046
 
1047
-		if(__DEBUG__ == 3)
1047
+		if (__DEBUG__ == 3)
1048 1048
 		{
1049 1049
 			$start_time = getMicroTime();
1050 1050
 		}
@@ -1054,51 +1054,51 @@  discard block
 block discarded – undo
1054 1054
 		$type = strtolower($type);
1055 1055
 
1056 1056
 		$kinds = array('svc' => 1, 'admin' => 1);
1057
-		if(!isset($kinds[$kind]))
1057
+		if (!isset($kinds[$kind]))
1058 1058
 		{
1059 1059
 			$kind = 'svc';
1060 1060
 		}
1061 1061
 
1062
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1062
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1063 1063
 
1064
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1064
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1065 1065
 		{
1066 1066
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1067 1067
 		}
1068 1068
 
1069 1069
 		// if there is no instance of the module in global variable, create a new one
1070
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1070
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1071 1071
 		{
1072 1072
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1073 1073
 
1074
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1074
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1075 1075
 			{
1076 1076
 				$module = $parent_module;
1077 1077
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1078 1078
 			}
1079 1079
 
1080 1080
 			// Check if the base class and instance class exist
1081
-			if(!class_exists($module, true))
1081
+			if (!class_exists($module, true))
1082 1082
 			{
1083 1083
 				return NULL;
1084 1084
 			}
1085
-			if(!class_exists($instance_name, true))
1085
+			if (!class_exists($instance_name, true))
1086 1086
 			{
1087 1087
 				return NULL;
1088 1088
 			}
1089 1089
 
1090 1090
 			// Create an instance
1091 1091
 			$oModule = new $instance_name();
1092
-			if(!is_object($oModule))
1092
+			if (!is_object($oModule))
1093 1093
 			{
1094 1094
 				return NULL;
1095 1095
 			}
1096 1096
 
1097 1097
 			// Load language files for the class
1098
-			Context::loadLang($class_path . 'lang');
1099
-			if($extend_module)
1098
+			Context::loadLang($class_path.'lang');
1099
+			if ($extend_module)
1100 1100
 			{
1101
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1101
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1102 1102
 			}
1103 1103
 
1104 1104
 			// Set variables to the instance
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 			$oModule->setModulePath($class_path);
1107 1107
 
1108 1108
 			// If the module has a constructor, run it.
1109
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1109
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1110 1110
 			{
1111 1111
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1112
-				if(@method_exists($oModule, $instance_name))
1112
+				if (@method_exists($oModule, $instance_name))
1113 1113
 				{
1114 1114
 					$oModule->{$instance_name}();
1115 1115
 				}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1120 1120
 		}
1121 1121
 
1122
-		if(__DEBUG__ == 3)
1122
+		if (__DEBUG__ == 3)
1123 1123
 		{
1124 1124
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1125 1125
 		}
@@ -1135,17 +1135,17 @@  discard block
 block discarded – undo
1135 1135
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1136 1136
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1137 1137
 
1138
-		$types = array('view','controller','model','api','wap','mobile','class');
1139
-		if(!in_array($type, $types))
1138
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1139
+		if (!in_array($type, $types))
1140 1140
 		{
1141 1141
 			$type = $types[0];
1142 1142
 		}
1143
-		if($type == 'class')
1143
+		if ($type == 'class')
1144 1144
 		{
1145 1145
 			$instanceName = '%s';
1146 1146
 			$classFile = '%s%s.%s.php';
1147 1147
 		}
1148
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1148
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1149 1149
 		{
1150 1150
 			$instanceName = '%sAdmin%s';
1151 1151
 			$classFile = '%s%s.admin.%s.php';
@@ -1170,26 +1170,26 @@  discard block
 block discarded – undo
1170 1170
 	function triggerCall($trigger_name, $called_position, &$obj)
1171 1171
 	{
1172 1172
 		// skip if not installed
1173
-		if(!Context::isInstalled())
1173
+		if (!Context::isInstalled())
1174 1174
 		{
1175 1175
 			return new Object();
1176 1176
 		}
1177 1177
 
1178 1178
 		$oModuleModel = getModel('module');
1179 1179
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1180
-		if(!$triggers || count($triggers) < 1)
1180
+		if (!$triggers || count($triggers) < 1)
1181 1181
 		{
1182 1182
 			return new Object();
1183 1183
 		}
1184 1184
 		
1185 1185
 		//store before trigger call time
1186 1186
 		$before_trigger_time = NULL;
1187
-		if(__LOG_SLOW_TRIGGER__> 0)
1187
+		if (__LOG_SLOW_TRIGGER__ > 0)
1188 1188
 		{
1189 1189
 			$before_trigger_time = microtime(true);
1190 1190
 		}
1191 1191
 
1192
-		foreach($triggers as $item)
1192
+		foreach ($triggers as $item)
1193 1193
 		{
1194 1194
 			$module = $item->module;
1195 1195
 			$type = $item->type;
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 			// todo why don't we call a normal class object ?
1199 1199
 			$oModule = getModule($module, $type);
1200
-			if(!$oModule || !method_exists($oModule, $called_method))
1200
+			if (!$oModule || !method_exists($oModule, $called_method))
1201 1201
 			{
1202 1202
 				continue;
1203 1203
 			}
@@ -1210,12 +1210,12 @@  discard block
 block discarded – undo
1210 1210
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1211 1211
 
1212 1212
 			$slowlog = new stdClass;
1213
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1214
-			$slowlog->called = $module . '.' . $called_method;
1213
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1214
+			$slowlog->called = $module.'.'.$called_method;
1215 1215
 			$slowlog->called_extension = $module;
1216
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1216
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1217 1217
 
1218
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1218
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1219 1219
 			{
1220 1220
 				return $output;
1221 1221
 			}
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 			'505' => 'HTTP Version Not Supported',
1276 1276
 		);
1277 1277
 		$statusMessage = $statusMessageList[$code];
1278
-		if(!$statusMessage)
1278
+		if (!$statusMessage)
1279 1279
 		{
1280 1280
 			$statusMessage = 'OK';
1281 1281
 		}
Please login to merge, or discard this patch.