GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( ba9f3c...6bcce1 )
by gyeong-won
07:26
created
classes/context/Context.class.php 3 patches
Doc Comments   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	/**
158 158
 	 * returns static context object (Singleton). It's to use Context without declaration of an object
159 159
 	 *
160
-	 * @return object Instance
160
+	 * @return Context Instance
161 161
 	 */
162 162
 	function &getInstance()
163 163
 	{
@@ -891,6 +891,7 @@  discard block
 block discarded – undo
891 891
 	 * Evaluation of xml language file
892 892
 	 *
893 893
 	 * @param string Path of the language file
894
+	 * @param string $path
894 895
 	 * @return void
895 896
 	 */
896 897
 	function _evalxmlLang($path)
@@ -1030,7 +1031,7 @@  discard block
 block discarded – undo
1030 1031
 	/**
1031 1032
 	 * Convert strings of variables in $source_object into UTF-8
1032 1033
 	 *
1033
-	 * @param object $source_obj Conatins strings to convert
1034
+	 * @param stdClass $source_obj Conatins strings to convert
1034 1035
 	 * @return object converted object
1035 1036
 	 */
1036 1037
 	function convertEncoding($source_obj)
@@ -1065,11 +1066,11 @@  discard block
 block discarded – undo
1065 1066
 	/**
1066 1067
 	 * Check flag
1067 1068
 	 *
1068
-	 * @param mixed $val
1069
+	 * @param boolean $val
1069 1070
 	 * @param string $key
1070 1071
 	 * @param mixed $charset charset
1071 1072
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1072
-	 * @return void
1073
+	 * @return null|boolean
1073 1074
 	 */
1074 1075
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1076
 	{
@@ -1935,7 +1936,7 @@  discard block
 block discarded – undo
1935 1936
 	 *
1936 1937
 	 * @param string $key Key
1937 1938
 	 * @param mixed $val Value
1938
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1939
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1939 1940
 	 * @return void
1940 1941
 	 */
1941 1942
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1977,7 +1978,7 @@  discard block
 block discarded – undo
1977 1978
 	/**
1978 1979
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1979 1980
 	 *
1980
-	 * @return object
1981
+	 * @return null|stdClass
1981 1982
 	 */
1982 1983
 	function gets()
1983 1984
 	{
@@ -2050,7 +2051,7 @@  discard block
 block discarded – undo
2050 2051
 	/**
2051 2052
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
2052 2053
 	 *
2053
-	 * @param string $action act name
2054
+	 * @param string[] $action_array
2054 2055
 	 * @return void
2055 2056
 	 */
2056 2057
 	function addSSLActions($action_array)
@@ -2221,7 +2222,7 @@  discard block
 block discarded – undo
2221 2222
 	 * @param string $file File name with path
2222 2223
 	 * @param string $optimized optimized (That seems to not use)
2223 2224
 	 * @param string $targetie target IE
2224
-	 * @param string $index index
2225
+	 * @param integer $index index
2225 2226
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2226 2227
 	 * @param bool $isRuleset Use ruleset
2227 2228
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2331,7 +2332,7 @@  discard block
 block discarded – undo
2331 2332
 	 * @param string $optimized optimized (That seems to not use)
2332 2333
 	 * @param string $media Media query
2333 2334
 	 * @param string $targetie target IE
2334
-	 * @param string $index index
2335
+	 * @param integer $index index
2335 2336
 	 * @return void
2336 2337
 	 *
2337 2338
 	 */
Please login to merge, or discard this patch.
Spacing   +314 added lines, -314 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		ob_end_clean();
458 458
 
459 459
 		// If master_db information does not exist, the config file needs to be updated
460
-		if(!isset($db_info->master_db))
460
+		if (!isset($db_info->master_db))
461 461
 		{
462 462
 			$db_info->master_db = array();
463 463
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
476 476
 			unset($db_info->db_table_prefix);
477 477
 
478
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
478
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
479 479
 			{
480 480
 				$db_info->master_db["db_table_prefix"] .= '_';
481 481
 			}
@@ -487,36 +487,36 @@  discard block
 block discarded – undo
487 487
 			$oInstallController->makeConfigFile();
488 488
 		}
489 489
 
490
-		if(!$db_info->use_prepared_statements)
490
+		if (!$db_info->use_prepared_statements)
491 491
 		{
492 492
 			$db_info->use_prepared_statements = 'Y';
493 493
 		}
494 494
 
495
-		if(!$db_info->time_zone)
495
+		if (!$db_info->time_zone)
496 496
 			$db_info->time_zone = date('O');
497 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 498
 
499
-		if($db_info->qmail_compatibility != 'Y')
499
+		if ($db_info->qmail_compatibility != 'Y')
500 500
 			$db_info->qmail_compatibility = 'N';
501 501
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 502
 
503
-		if(!$db_info->use_db_session)
503
+		if (!$db_info->use_db_session)
504 504
 			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
505
+		if (!$db_info->use_ssl)
506 506
 			$db_info->use_ssl = 'none';
507 507
 		$this->set('_use_ssl', $db_info->use_ssl);
508 508
 
509 509
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
510 510
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
511 511
 
512
-		if(!$db_info->sitelock_whitelist) {
512
+		if (!$db_info->sitelock_whitelist) {
513 513
 			$db_info->sitelock_whitelist = '127.0.0.1';
514 514
 		}
515 515
 
516 516
 		// @see https://github.com/xpressengine/xe-core/issues/2301
517
-		if($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
517
+		if ($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
518 518
 
519
-		if(is_string($db_info->sitelock_whitelist)) {
519
+		if (is_string($db_info->sitelock_whitelist)) {
520 520
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
521 521
 		}
522 522
 
@@ -587,10 +587,10 @@  discard block
 block discarded – undo
587 587
 	function loadLangSupported()
588 588
 	{
589 589
 		static $lang_supported = null;
590
-		if(!$lang_supported)
590
+		if (!$lang_supported)
591 591
 		{
592
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
593
-			foreach($langs as $val)
592
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
593
+			foreach ($langs as $val)
594 594
 			{
595 595
 				list($lang_prefix, $lang_text) = explode(',', $val);
596 596
 				$lang_text = trim($lang_text);
@@ -608,17 +608,17 @@  discard block
 block discarded – undo
608 608
 	function loadLangSelected()
609 609
 	{
610 610
 		static $lang_selected = null;
611
-		if(!$lang_selected)
611
+		if (!$lang_selected)
612 612
 		{
613
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
614
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
615
-			if(!FileHandler::hasContent($selected_lang_file))
613
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
614
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
615
+			if (!FileHandler::hasContent($selected_lang_file))
616 616
 			{
617
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
617
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
618 618
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
619 619
 			}
620 620
 
621
-			if(!FileHandler::hasContent($selected_lang_file))
621
+			if (!FileHandler::hasContent($selected_lang_file))
622 622
 			{
623 623
 				$buff = FileHandler::readFile($orig_lang_file);
624 624
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			else
628 628
 			{
629 629
 				$langs = file($selected_lang_file);
630
-				foreach($langs as $val)
630
+				foreach ($langs as $val)
631 631
 				{
632 632
 					list($lang_prefix, $lang_text) = explode(',', $val);
633 633
 					$lang_text = trim($lang_text);
@@ -646,56 +646,56 @@  discard block
 block discarded – undo
646 646
 	function checkSSO()
647 647
 	{
648 648
 		// pass if it's not GET request or XE is not yet installed
649
-		if($this->db_info->use_sso != 'Y' || isCrawler())
649
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
650 650
 		{
651 651
 			return TRUE;
652 652
 		}
653 653
 		$checkActList = array('rss' => 1, 'atom' => 1);
654
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
654
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
655 655
 		{
656 656
 			return TRUE;
657 657
 		}
658 658
 
659 659
 		// pass if default URL is not set
660 660
 		$default_url = trim($this->db_info->default_url);
661
-		if(!$default_url)
661
+		if (!$default_url)
662 662
 		{
663 663
 			return TRUE;
664 664
 		}
665 665
 
666
-		if(substr_compare($default_url, '/', -1) !== 0)
666
+		if (substr_compare($default_url, '/', -1) !== 0)
667 667
 		{
668 668
 			$default_url .= '/';
669 669
 		}
670 670
 
671 671
 		// for sites recieving SSO valdiation
672
-		if($default_url == self::getRequestUri())
672
+		if ($default_url == self::getRequestUri())
673 673
 		{
674
-			if(self::get('url'))
674
+			if (self::get('url'))
675 675
 			{
676 676
 				$url = base64_decode(self::get('url'));
677 677
 				$url_info = parse_url($url);
678
-				if(!Password::checkSignature($url, self::get('sig')))
678
+				if (!Password::checkSignature($url, self::get('sig')))
679 679
 				{
680 680
 					echo self::get('lang')->msg_invalid_request;
681 681
 					return false;
682 682
 				}
683 683
 
684 684
 				$oModuleModel = getModel('module');
685
-				$domain = $url_info['host'] . $url_info['path'];
686
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				$domain = $url_info['host'].$url_info['path'];
686
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
687 687
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
688 688
 
689
-				if($site_info->site_srl)
689
+				if ($site_info->site_srl)
690 690
 				{
691
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
692
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
691
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
692
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
693 693
 				}
694 694
 				else
695 695
 				{
696 696
 					$redirect_url = $url;
697 697
 				}
698
-				header('location:' . $redirect_url);
698
+				header('location:'.$redirect_url);
699 699
 
700 700
 				return FALSE;
701 701
 			}
@@ -704,9 +704,9 @@  discard block
 block discarded – undo
704 704
 		else
705 705
 		{
706 706
 			// result handling : set session_name()
707
-			if($session_name = self::get('SSOID'))
707
+			if ($session_name = self::get('SSOID'))
708 708
 			{
709
-				if(!Password::checkSignature($session_name, self::get('sig')))
709
+				if (!Password::checkSignature($session_name, self::get('sig')))
710 710
 				{
711 711
 					echo self::get('lang')->msg_invalid_request;
712 712
 					return false;
@@ -715,17 +715,17 @@  discard block
 block discarded – undo
715 715
 				setcookie(session_name(), $session_name);
716 716
 
717 717
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
718
-				header('location:' . $url);
718
+				header('location:'.$url);
719 719
 				return FALSE;
720 720
 				// send SSO request
721 721
 			}
722
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
722
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
723 723
 			{
724 724
 				setcookie('sso', md5(self::getRequestUri()));
725 725
 				$origin_url = self::getRequestUrl();
726 726
 				$origin_sig = Password::createSignature($origin_url);
727 727
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
728
-				header('location:' . $url);
728
+				header('location:'.$url);
729 729
 				return FALSE;
730 730
 			}
731 731
 		}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	{
753 753
 		$self = self::getInstance();
754 754
 
755
-		if(!$self->isFTPRegisted())
755
+		if (!$self->isFTPRegisted())
756 756
 		{
757 757
 			return null;
758 758
 		}
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	function addBrowserTitle($site_title)
772 772
 	{
773
-		if(!$site_title)
773
+		if (!$site_title)
774 774
 		{
775 775
 			return;
776 776
 		}
777 777
 		$self = self::getInstance();
778 778
 
779
-		if($self->site_title)
779
+		if ($self->site_title)
780 780
 		{
781
-			$self->site_title .= ' - ' . $site_title;
781
+			$self->site_title .= ' - '.$site_title;
782 782
 		}
783 783
 		else
784 784
 		{
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 */
795 795
 	function setBrowserTitle($site_title)
796 796
 	{
797
-		if(!$site_title)
797
+		if (!$site_title)
798 798
 		{
799 799
 			return;
800 800
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$oModuleModel = getModel('module');
827 827
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
828 828
 
829
-		if(isset($moduleConfig->siteTitle))
829
+		if (isset($moduleConfig->siteTitle))
830 830
 		{
831 831
 			return $moduleConfig->siteTitle;
832 832
 		}
@@ -853,30 +853,30 @@  discard block
 block discarded – undo
853 853
 		global $lang;
854 854
 
855 855
 		$self = self::getInstance();
856
-		if(!$self->lang_type)
856
+		if (!$self->lang_type)
857 857
 		{
858 858
 			return;
859 859
 		}
860
-		if(!is_object($lang))
860
+		if (!is_object($lang))
861 861
 		{
862 862
 			$lang = new stdClass;
863 863
 		}
864 864
 
865
-		if(!($filename = $self->_loadXmlLang($path)))
865
+		if (!($filename = $self->_loadXmlLang($path)))
866 866
 		{
867 867
 			$filename = $self->_loadPhpLang($path);
868 868
 		}
869 869
 
870
-		if(!is_array($self->loaded_lang_files))
870
+		if (!is_array($self->loaded_lang_files))
871 871
 		{
872 872
 			$self->loaded_lang_files = array();
873 873
 		}
874
-		if(in_array($filename, $self->loaded_lang_files))
874
+		if (in_array($filename, $self->loaded_lang_files))
875 875
 		{
876 876
 			return;
877 877
 		}
878 878
 
879
-		if($filename && is_readable($filename))
879
+		if ($filename && is_readable($filename))
880 880
 		{
881 881
 			$self->loaded_lang_files[] = $filename;
882 882
 			include($filename);
@@ -897,24 +897,24 @@  discard block
 block discarded – undo
897 897
 	{
898 898
 		global $lang;
899 899
 
900
-		if(!$path) return;
900
+		if (!$path) return;
901 901
 
902
-		$_path = 'eval://' . $path;
902
+		$_path = 'eval://'.$path;
903 903
 
904
-		if(in_array($_path, $this->loaded_lang_files))
904
+		if (in_array($_path, $this->loaded_lang_files))
905 905
 		{
906 906
 			return;
907 907
 		}
908 908
 
909
-		if(substr_compare($path, '/', -1) !== 0)
909
+		if (substr_compare($path, '/', -1) !== 0)
910 910
 		{
911 911
 			$path .= '/';
912 912
 		}
913 913
 
914
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
914
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
915 915
 		$content = $oXmlLangParser->getCompileContent();
916 916
 
917
-		if($content)
917
+		if ($content)
918 918
 		{
919 919
 			$this->loaded_lang_files[] = $_path;
920 920
 			eval($content);
@@ -929,9 +929,9 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	function _loadXmlLang($path)
931 931
 	{
932
-		if(!$path) return;
932
+		if (!$path) return;
933 933
 
934
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
934
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
935 935
 		return $oXmlLangParser->compile();
936 936
 	}
937 937
 
@@ -943,22 +943,22 @@  discard block
 block discarded – undo
943 943
 	 */
944 944
 	function _loadPhpLang($path)
945 945
 	{
946
-		if(!$path) return;
946
+		if (!$path) return;
947 947
 
948
-		if(substr_compare($path, '/', -1) !== 0)
948
+		if (substr_compare($path, '/', -1) !== 0)
949 949
 		{
950 950
 			$path .= '/';
951 951
 		}
952
-		$path_tpl = $path . '%s.lang.php';
952
+		$path_tpl = $path.'%s.lang.php';
953 953
 		$file = sprintf($path_tpl, $this->lang_type);
954 954
 
955 955
 		$langs = array('ko', 'en'); // this will be configurable.
956
-		while(!is_readable($file) && $langs[0])
956
+		while (!is_readable($file) && $langs[0])
957 957
 		{
958 958
 			$file = sprintf($path_tpl, array_shift($langs));
959 959
 		}
960 960
 
961
-		if(!is_readable($file))
961
+		if (!is_readable($file))
962 962
 		{
963 963
 			return FALSE;
964 964
 		}
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 	 */
1001 1001
 	function getLang($code)
1002 1002
 	{
1003
-		if(!$code)
1003
+		if (!$code)
1004 1004
 		{
1005 1005
 			return;
1006 1006
 		}
1007
-		if($GLOBALS['lang']->{$code})
1007
+		if ($GLOBALS['lang']->{$code})
1008 1008
 		{
1009 1009
 			return $GLOBALS['lang']->{$code};
1010 1010
 		}
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	 */
1021 1021
 	function setLang($code, $val)
1022 1022
 	{
1023
-		if(!isset($GLOBALS['lang']))
1023
+		if (!isset($GLOBALS['lang']))
1024 1024
 		{
1025 1025
 			$GLOBALS['lang'] = new stdClass();
1026 1026
 		}
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
 		$obj = clone $source_obj;
1047 1047
 
1048
-		foreach($charset_list as $charset)
1048
+		foreach ($charset_list as $charset)
1049 1049
 		{
1050
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1050
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1051 1051
 			$flag = self::checkConvertFlag($flag = TRUE);
1052
-			if($flag)
1052
+			if ($flag)
1053 1053
 			{
1054
-				if($charset == 'UTF-8')
1054
+				if ($charset == 'UTF-8')
1055 1055
 				{
1056 1056
 					return $obj;
1057 1057
 				}
1058
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1058
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1059 1059
 				return $obj;
1060 1060
 			}
1061 1061
 		}
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1075
 	{
1076 1076
 		static $flag = TRUE;
1077
-		if($charset)
1077
+		if ($charset)
1078 1078
 		{
1079
-			if(is_array($val))
1080
-				array_walk($val,'Context::checkConvertFlag',$charset);
1081
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1079
+			if (is_array($val))
1080
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1081
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1082 1082
 			else $flag = FALSE;
1083 1083
 		}
1084 1084
 		else
@@ -1102,9 +1102,9 @@  discard block
 block discarded – undo
1102 1102
 	{
1103 1103
 		if (is_array($val))
1104 1104
 		{
1105
-			array_walk($val,'Context::doConvertEncoding',$charset);
1105
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1106 1106
 		}
1107
-		else $val = iconv($charset,'UTF-8',$val);
1107
+		else $val = iconv($charset, 'UTF-8', $val);
1108 1108
 	}
1109 1109
 
1110 1110
 	/**
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 */
1116 1116
 	function convertEncodingStr($str)
1117 1117
 	{
1118
-        if(!$str) return null;
1118
+        if (!$str) return null;
1119 1119
 		$obj = new stdClass();
1120 1120
 		$obj->str = $str;
1121 1121
 		$obj = self::convertEncoding($obj);
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 	function decodeIdna($domain)
1126 1126
 	{
1127
-		if(strpos($domain, 'xn--') !== FALSE)
1127
+		if (strpos($domain, 'xn--') !== FALSE)
1128 1128
 		{
1129
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1129
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1130 1130
 			$IDN = new idna_convert(array('idn_version' => 2008));
1131 1131
 			$domain = $IDN->decode($domain);
1132 1132
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	{
1158 1158
 		$self = self::getInstance();
1159 1159
 
1160
-		if($self->response_method)
1160
+		if ($self->response_method)
1161 1161
 		{
1162 1162
 			return $self->response_method;
1163 1163
 		}
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1198 1198
 
1199 1199
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1200
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1200
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1201 1201
 		{
1202 1202
 			$this->isSuccessInit = FALSE;
1203 1203
 		}
@@ -1210,30 +1210,30 @@  discard block
 block discarded – undo
1210 1210
 	 */
1211 1211
 	function _setRequestArgument()
1212 1212
 	{
1213
-		if(!count($_REQUEST))
1213
+		if (!count($_REQUEST))
1214 1214
 		{
1215 1215
 			return;
1216 1216
 		}
1217 1217
 
1218 1218
 		$requestMethod = $this->getRequestMethod();
1219
-		foreach($_REQUEST as $key => $val)
1219
+		foreach ($_REQUEST as $key => $val)
1220 1220
 		{
1221
-			if($val === '' || self::get($key))
1221
+			if ($val === '' || self::get($key))
1222 1222
 			{
1223 1223
 				continue;
1224 1224
 			}
1225 1225
 			$key = htmlentities($key);
1226 1226
 			$val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET'));
1227 1227
 
1228
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1228
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1229 1229
 			{
1230 1230
 				$set_to_vars = TRUE;
1231 1231
 			}
1232
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1232
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1233 1233
 			{
1234 1234
 				$set_to_vars = TRUE;
1235 1235
 			}
1236
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1236
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1237 1237
 			{
1238 1238
 				$set_to_vars = TRUE;
1239 1239
 			}
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 				$set_to_vars = FALSE;
1243 1243
 			}
1244 1244
 
1245
-			if($set_to_vars)
1245
+			if ($set_to_vars)
1246 1246
 			{
1247 1247
 				$this->_recursiveCheckVar($val);
1248 1248
 			}
@@ -1253,20 +1253,20 @@  discard block
 block discarded – undo
1253 1253
 
1254 1254
 	function _recursiveCheckVar($val)
1255 1255
 	{
1256
-		if(is_string($val))
1256
+		if (is_string($val))
1257 1257
 		{
1258
-			foreach($this->patterns as $pattern)
1258
+			foreach ($this->patterns as $pattern)
1259 1259
 			{
1260
-				if(preg_match($pattern, $val))
1260
+				if (preg_match($pattern, $val))
1261 1261
 				{
1262 1262
 					$this->isSuccessInit = FALSE;
1263 1263
 					return;
1264 1264
 				}
1265 1265
 			}
1266 1266
 		}
1267
-		else if(is_array($val))
1267
+		else if (is_array($val))
1268 1268
 		{
1269
-			foreach($val as $val2)
1269
+			foreach ($val as $val2)
1270 1270
 			{
1271 1271
 				$this->_recursiveCheckVar($val2);
1272 1272
 			}
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 */
1281 1281
 	function _setJSONRequestArgument()
1282 1282
 	{
1283
-		if($this->getRequestMethod() != 'JSON')
1283
+		if ($this->getRequestMethod() != 'JSON')
1284 1284
 		{
1285 1285
 			return;
1286 1286
 		}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		$params = array();
1289 1289
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1290 1290
 
1291
-		foreach($params as $key => $val)
1291
+		foreach ($params as $key => $val)
1292 1292
 		{
1293 1293
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1294 1294
 		}
@@ -1301,13 +1301,13 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	function _setXmlRpcArgument()
1303 1303
 	{
1304
-		if($this->getRequestMethod() != 'XMLRPC')
1304
+		if ($this->getRequestMethod() != 'XMLRPC')
1305 1305
 		{
1306 1306
 			return;
1307 1307
 		}
1308 1308
 
1309 1309
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1310
-		if(Security::detectingXEE($xml))
1310
+		if (Security::detectingXEE($xml))
1311 1311
 		{
1312 1312
 			header("HTTP/1.0 400 Bad Request");
1313 1313
 			exit;
@@ -1319,12 +1319,12 @@  discard block
 block discarded – undo
1319 1319
 		$params = $xml_obj->methodcall->params;
1320 1320
 		unset($params->node_name, $params->attrs, $params->body);
1321 1321
 
1322
-		if(!count(get_object_vars($params)))
1322
+		if (!count(get_object_vars($params)))
1323 1323
 		{
1324 1324
 			return;
1325 1325
 		}
1326 1326
 
1327
-		foreach($params as $key => $val)
1327
+		foreach ($params as $key => $val)
1328 1328
 		{
1329 1329
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1330 1330
 		}
@@ -1339,10 +1339,10 @@  discard block
 block discarded – undo
1339 1339
 	 */
1340 1340
 	function _filterXmlVars($key, $val)
1341 1341
 	{
1342
-		if(is_array($val))
1342
+		if (is_array($val))
1343 1343
 		{
1344 1344
 			$stack = array();
1345
-			foreach($val as $k => $v)
1345
+			foreach ($val as $k => $v)
1346 1346
 			{
1347 1347
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1348 1348
 			}
@@ -1352,20 +1352,20 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 		$body = $val->body;
1354 1354
 		unset($val->node_name, $val->attrs, $val->body);
1355
-		if(!count(get_object_vars($val)))
1355
+		if (!count(get_object_vars($val)))
1356 1356
 		{
1357 1357
 			return $this->_filterRequestVar($key, $body, 0);
1358 1358
 		}
1359 1359
 
1360 1360
 		$stack = new stdClass();
1361
-		foreach($val as $k => $v)
1361
+		foreach ($val as $k => $v)
1362 1362
 		{
1363 1363
 			$output = $this->_filterXmlVars($k, $v);
1364
-			if(is_object($v) && $v->attrs->type == 'array')
1364
+			if (is_object($v) && $v->attrs->type == 'array')
1365 1365
 			{
1366 1366
 				$output = array($output);
1367 1367
 			}
1368
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1368
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1369 1369
 			{
1370 1370
 				return $output;
1371 1371
 			}
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 			$stack->{$k} = $output;
1374 1374
 		}
1375 1375
 
1376
-		if(!count(get_object_vars($stack)))
1376
+		if (!count(get_object_vars($stack)))
1377 1377
 		{
1378 1378
 			return NULL;
1379 1379
 		}
@@ -1392,16 +1392,16 @@  discard block
 block discarded – undo
1392 1392
 	 */
1393 1393
 	function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = true)
1394 1394
 	{
1395
-		if(!($isArray = is_array($val)))
1395
+		if (!($isArray = is_array($val)))
1396 1396
 		{
1397 1397
 			$val = array($val);
1398 1398
 		}
1399 1399
 
1400 1400
 		$result = array();
1401
-		foreach($val as $k => $v)
1401
+		foreach ($val as $k => $v)
1402 1402
 		{
1403
-			if($remove_hack && !is_array($v)) {
1404
-				if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1403
+			if ($remove_hack && !is_array($v)) {
1404
+				if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1405 1405
 				{
1406 1406
 					$result[$k] = escape($v);
1407 1407
 					continue;
@@ -1409,23 +1409,23 @@  discard block
 block discarded – undo
1409 1409
 			}
1410 1410
 
1411 1411
 			$k = htmlentities($k);
1412
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1412
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1413 1413
 			{
1414 1414
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1415 1415
 			}
1416
-			elseif($key === 'mid' || $key === 'search_keyword')
1416
+			elseif ($key === 'mid' || $key === 'search_keyword')
1417 1417
 			{
1418 1418
 				$result[$k] = escape($v, false);
1419 1419
 			}
1420
-			elseif($key === 'vid')
1420
+			elseif ($key === 'vid')
1421 1421
 			{
1422 1422
 				$result[$k] = urlencode($v);
1423 1423
 			}
1424
-			elseif($key === 'xe_validator_id')
1424
+			elseif ($key === 'xe_validator_id')
1425 1425
 			{
1426 1426
 				$result[$k] = escape($v, false);
1427 1427
 			}
1428
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1428
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1429 1429
 			{
1430 1430
 				unset($result[$k]);
1431 1431
 			}
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 			{
1434 1434
 				$result[$k] = $v;
1435 1435
 
1436
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1436
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1437 1437
 				{
1438 1438
 					if (is_array($result[$k]))
1439 1439
 					{
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 					}
1446 1446
 				}
1447 1447
 
1448
-				if(is_array($result[$k]))
1448
+				if (is_array($result[$k]))
1449 1449
 				{
1450 1450
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1451 1451
 				}
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 					$result[$k] = trim($result[$k]);
1455 1455
 				}
1456 1456
 
1457
-				if($remove_hack)
1457
+				if ($remove_hack)
1458 1458
 				{
1459 1459
 					$result[$k] = escape($result[$k], false);
1460 1460
 				}
@@ -1482,17 +1482,17 @@  discard block
 block discarded – undo
1482 1482
 	 */
1483 1483
 	function _setUploadedArgument()
1484 1484
 	{
1485
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1485
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1486 1486
 		{
1487 1487
 			return;
1488 1488
 		}
1489 1489
 
1490
-		foreach($_FILES as $key => $val)
1490
+		foreach ($_FILES as $key => $val)
1491 1491
 		{
1492 1492
 			$tmp_name = $val['tmp_name'];
1493
-			if(!is_array($tmp_name))
1493
+			if (!is_array($tmp_name))
1494 1494
 			{
1495
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1495
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1496 1496
 				{
1497 1497
 					continue;
1498 1498
 				}
@@ -1505,9 +1505,9 @@  discard block
 block discarded – undo
1505 1505
 				$files = array();
1506 1506
 				$count_files = count($tmp_name);
1507 1507
 
1508
-				for($i = 0; $i < $count_files; $i++)
1508
+				for ($i = 0; $i < $count_files; $i++)
1509 1509
 				{
1510
-					if($val['size'][$i] > 0)
1510
+					if ($val['size'][$i] > 0)
1511 1511
 					{
1512 1512
 						$file = array();
1513 1513
 						$file['name'] = $val['name'][$i];
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 						$files[] = $file;
1519 1519
 					}
1520 1520
 				}
1521
-				if($files) $this->set($key, $files, TRUE);
1521
+				if ($files) $this->set($key, $files, TRUE);
1522 1522
 			}
1523 1523
 		}
1524 1524
 	}
@@ -1540,16 +1540,16 @@  discard block
 block discarded – undo
1540 1540
 	function getRequestUrl()
1541 1541
 	{
1542 1542
 		static $url = null;
1543
-		if(is_null($url))
1543
+		if (is_null($url))
1544 1544
 		{
1545 1545
 			$url = self::getRequestUri();
1546
-			if(count($_GET) > 0)
1546
+			if (count($_GET) > 0)
1547 1547
 			{
1548
-				foreach($_GET as $key => $val)
1548
+				foreach ($_GET as $key => $val)
1549 1549
 				{
1550
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1550
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1551 1551
 				}
1552
-				$url .= '?' . join('&', $vars);
1552
+				$url .= '?'.join('&', $vars);
1553 1553
 			}
1554 1554
 		}
1555 1555
 		return $url;
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 		$self = self::getInstance();
1565 1565
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1566 1566
 
1567
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1567
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1568 1568
 		{
1569 1569
 			unset($js_callback_func);
1570 1570
 			unset($_GET['xe_js_callback']);
@@ -1592,22 +1592,22 @@  discard block
 block discarded – undo
1592 1592
 		$self = self::getInstance();
1593 1593
 
1594 1594
 		// retrieve virtual site information
1595
-		if(is_null($site_module_info))
1595
+		if (is_null($site_module_info))
1596 1596
 		{
1597 1597
 			$site_module_info = self::get('site_module_info');
1598 1598
 		}
1599 1599
 
1600 1600
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1601
-		if($domain && isSiteID($domain))
1601
+		if ($domain && isSiteID($domain))
1602 1602
 		{
1603 1603
 			$vid = $domain;
1604 1604
 			$domain = '';
1605 1605
 		}
1606 1606
 
1607 1607
 		// If $domain, $vid are not set, use current site information
1608
-		if(!$domain && !$vid)
1608
+		if (!$domain && !$vid)
1609 1609
 		{
1610
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1610
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1611 1611
 			{
1612 1612
 				$vid = $site_module_info->domain;
1613 1613
 			}
@@ -1618,21 +1618,21 @@  discard block
 block discarded – undo
1618 1618
 		}
1619 1619
 
1620 1620
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1621
-		if($domain)
1621
+		if ($domain)
1622 1622
 		{
1623 1623
 			$domain_info = parse_url($domain);
1624
-			if(is_null($current_info))
1624
+			if (is_null($current_info))
1625 1625
 			{
1626
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1626
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1627 1627
 			}
1628
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1628
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1629 1629
 			{
1630 1630
 				unset($domain);
1631 1631
 			}
1632 1632
 			else
1633 1633
 			{
1634 1634
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1635
-				if(substr_compare($domain, '/', -1) !== 0)
1635
+				if (substr_compare($domain, '/', -1) !== 0)
1636 1636
 				{
1637 1637
 					$domain .= '/';
1638 1638
 				}
@@ -1642,41 +1642,41 @@  discard block
 block discarded – undo
1642 1642
 		$get_vars = array();
1643 1643
 
1644 1644
 		// If there is no GET variables or first argument is '' to reset variables
1645
-		if(!$self->get_vars || $args_list[0] == '')
1645
+		if (!$self->get_vars || $args_list[0] == '')
1646 1646
 		{
1647 1647
 			// rearrange args_list
1648
-			if(is_array($args_list) && $args_list[0] == '')
1648
+			if (is_array($args_list) && $args_list[0] == '')
1649 1649
 			{
1650 1650
 				array_shift($args_list);
1651 1651
 			}
1652 1652
 		}
1653
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1653
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1654 1654
 		{
1655 1655
 			// Otherwise, make GET variables into array
1656 1656
 			$get_vars = get_object_vars($self->get_vars);
1657 1657
 		}
1658 1658
 		else
1659 1659
 		{
1660
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1666
-			if($get_vars['act'] == 'IS')
1660
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1666
+			if ($get_vars['act'] == 'IS')
1667 1667
 			{
1668
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1668
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1669 1669
 			}
1670 1670
 		}
1671 1671
 
1672 1672
 		// arrange args_list
1673
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1673
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1674 1674
 		{
1675 1675
 			$key = $args_list[$i];
1676 1676
 			$val = trim($args_list[$i + 1]);
1677 1677
 
1678 1678
 			// If value is not set, remove the key
1679
-			if(!isset($val) || !strlen($val))
1679
+			if (!isset($val) || !strlen($val))
1680 1680
 			{
1681 1681
 				unset($get_vars[$key]);
1682 1682
 				continue;
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 		// remove vid, rnd
1689 1689
 		unset($get_vars['rnd']);
1690
-		if($vid)
1690
+		if ($vid)
1691 1691
 		{
1692 1692
 			$get_vars['vid'] = $vid;
1693 1693
 		}
@@ -1704,17 +1704,17 @@  discard block
 block discarded – undo
1704 1704
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1705 1705
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1706 1706
 		);
1707
-		if($act_alias[$act])
1707
+		if ($act_alias[$act])
1708 1708
 		{
1709 1709
 			$get_vars['act'] = $act_alias[$act];
1710 1710
 		}
1711 1711
 
1712 1712
 		// organize URL
1713 1713
 		$query = '';
1714
-		if(count($get_vars) > 0)
1714
+		if (count($get_vars) > 0)
1715 1715
 		{
1716 1716
 			// if using rewrite mod
1717
-			if($self->allow_rewrite)
1717
+			if ($self->allow_rewrite)
1718 1718
 			{
1719 1719
 				$var_keys = array_keys($get_vars);
1720 1720
 				sort($var_keys);
@@ -1734,8 +1734,8 @@  discard block
 block discarded – undo
1734 1734
 					'vid' => $vid,
1735 1735
 					'mid' => $mid,
1736 1736
 					'mid.vid' => "$vid/$mid",
1737
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1738
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1737
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1738
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1739 1739
 					'document_srl' => $srl,
1740 1740
 					'document_srl.mid' => "$mid/$srl",
1741 1741
 					'document_srl.vid' => "$vid/$srl",
@@ -1752,66 +1752,66 @@  discard block
 block discarded – undo
1752 1752
 				$query = $target_map[$target];
1753 1753
 			}
1754 1754
 
1755
-			if(!$query)
1755
+			if (!$query)
1756 1756
 			{
1757 1757
 				$queries = array();
1758
-				foreach($get_vars as $key => $val)
1758
+				foreach ($get_vars as $key => $val)
1759 1759
 				{
1760
-					if(is_array($val) && count($val) > 0)
1760
+					if (is_array($val) && count($val) > 0)
1761 1761
 					{
1762
-						foreach($val as $k => $v)
1762
+						foreach ($val as $k => $v)
1763 1763
 						{
1764
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1764
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1765 1765
 						}
1766 1766
 					}
1767
-					elseif(!is_array($val))
1767
+					elseif (!is_array($val))
1768 1768
 					{
1769
-						$queries[] = $key . '=' . urlencode($val);
1769
+						$queries[] = $key.'='.urlencode($val);
1770 1770
 					}
1771 1771
 				}
1772
-				if(count($queries) > 0)
1772
+				if (count($queries) > 0)
1773 1773
 				{
1774
-					$query = 'index.php?' . join('&', $queries);
1774
+					$query = 'index.php?'.join('&', $queries);
1775 1775
 				}
1776 1776
 			}
1777 1777
 		}
1778 1778
 
1779 1779
 		// If using SSL always
1780 1780
 		$_use_ssl = $self->get('_use_ssl');
1781
-		if($_use_ssl == 'always')
1781
+		if ($_use_ssl == 'always')
1782 1782
 		{
1783
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1783
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1784 1784
 			// optional SSL use
1785 1785
 		}
1786
-		elseif($_use_ssl == 'optional')
1786
+		elseif ($_use_ssl == 'optional')
1787 1787
 		{
1788 1788
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1789
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1789
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1790 1790
 			// no SSL
1791 1791
 		}
1792 1792
 		else
1793 1793
 		{
1794 1794
 			// currently on SSL but target is not based on SSL
1795
-			if($_SERVER['HTTPS'] == 'on')
1795
+			if ($_SERVER['HTTPS'] == 'on')
1796 1796
 			{
1797
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1797
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1798 1798
 			}
1799
-			else if($domain) // if $domain is set
1799
+			else if ($domain) // if $domain is set
1800 1800
 			{
1801
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1801
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1802 1802
 			}
1803 1803
 			else
1804 1804
 			{
1805
-				$query = getScriptPath() . $query;
1805
+				$query = getScriptPath().$query;
1806 1806
 			}
1807 1807
 		}
1808 1808
 
1809
-		if(!$encode)
1809
+		if (!$encode)
1810 1810
 		{
1811 1811
 			return $query;
1812 1812
 		}
1813 1813
 
1814
-		if(!$autoEncode)
1814
+		if (!$autoEncode)
1815 1815
 		{
1816 1816
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1817 1817
 		}
@@ -1820,16 +1820,16 @@  discard block
 block discarded – undo
1820 1820
 		$encode_queries = array();
1821 1821
 		$parsedUrl = parse_url($query);
1822 1822
 		parse_str($parsedUrl['query'], $output);
1823
-		foreach($output as $key => $value)
1823
+		foreach ($output as $key => $value)
1824 1824
 		{
1825
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1825
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1826 1826
 			{
1827 1827
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1828 1828
 			}
1829
-			$encode_queries[] = $key . '=' . $value;
1829
+			$encode_queries[] = $key.'='.$value;
1830 1830
 		}
1831 1831
 
1832
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1832
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1833 1833
 	}
1834 1834
 
1835 1835
 	/**
@@ -1844,17 +1844,17 @@  discard block
 block discarded – undo
1844 1844
 		static $url = array();
1845 1845
 
1846 1846
 		// Check HTTP Request
1847
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1847
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1848 1848
 		{
1849 1849
 			return;
1850 1850
 		}
1851 1851
 
1852
-		if(self::get('_use_ssl') == 'always')
1852
+		if (self::get('_use_ssl') == 'always')
1853 1853
 		{
1854 1854
 			$ssl_mode = ENFORCE_SSL;
1855 1855
 		}
1856 1856
 
1857
-		if($domain)
1857
+		if ($domain)
1858 1858
 		{
1859 1859
 			$domain_key = md5($domain);
1860 1860
 		}
@@ -1863,14 +1863,14 @@  discard block
 block discarded – undo
1863 1863
 			$domain_key = 'default';
1864 1864
 		}
1865 1865
 
1866
-		if(isset($url[$ssl_mode][$domain_key]))
1866
+		if (isset($url[$ssl_mode][$domain_key]))
1867 1867
 		{
1868 1868
 			return $url[$ssl_mode][$domain_key];
1869 1869
 		}
1870 1870
 
1871 1871
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1872 1872
 
1873
-		switch($ssl_mode)
1873
+		switch ($ssl_mode)
1874 1874
 		{
1875 1875
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1876 1876
 				break;
@@ -1880,34 +1880,34 @@  discard block
 block discarded – undo
1880 1880
 				break;
1881 1881
 		}
1882 1882
 
1883
-		if($domain)
1883
+		if ($domain)
1884 1884
 		{
1885 1885
 			$target_url = trim($domain);
1886
-			if(substr_compare($target_url, '/', -1) !== 0)
1886
+			if (substr_compare($target_url, '/', -1) !== 0)
1887 1887
 			{
1888
-				$target_url.= '/';
1888
+				$target_url .= '/';
1889 1889
 			}
1890 1890
 		}
1891 1891
 		else
1892 1892
 		{
1893
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1893
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1894 1894
 		}
1895 1895
 
1896
-		$url_info = parse_url('http://' . $target_url);
1896
+		$url_info = parse_url('http://'.$target_url);
1897 1897
 
1898
-		if($current_use_ssl != $use_ssl)
1898
+		if ($current_use_ssl != $use_ssl)
1899 1899
 		{
1900 1900
 			unset($url_info['port']);
1901 1901
 		}
1902 1902
 
1903
-		if($use_ssl)
1903
+		if ($use_ssl)
1904 1904
 		{
1905 1905
 			$port = self::get('_https_port');
1906
-			if($port && $port != 443)
1906
+			if ($port && $port != 443)
1907 1907
 			{
1908 1908
 				$url_info['port'] = $port;
1909 1909
 			}
1910
-			elseif($url_info['port'] == 443)
1910
+			elseif ($url_info['port'] == 443)
1911 1911
 			{
1912 1912
 				unset($url_info['port']);
1913 1913
 			}
@@ -1915,17 +1915,17 @@  discard block
 block discarded – undo
1915 1915
 		else
1916 1916
 		{
1917 1917
 			$port = self::get('_http_port');
1918
-			if($port && $port != 80)
1918
+			if ($port && $port != 80)
1919 1919
 			{
1920 1920
 				$url_info['port'] = $port;
1921 1921
 			}
1922
-			elseif($url_info['port'] == 80)
1922
+			elseif ($url_info['port'] == 80)
1923 1923
 			{
1924 1924
 				unset($url_info['port']);
1925 1925
 			}
1926 1926
 		}
1927 1927
 
1928
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1928
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1929 1929
 
1930 1930
 		return $url[$ssl_mode][$domain_key];
1931 1931
 	}
@@ -1942,16 +1942,16 @@  discard block
 block discarded – undo
1942 1942
 	{
1943 1943
 		$self = self::getInstance();
1944 1944
 		$self->context->{$key} = $val;
1945
-		if($set_to_get_vars === FALSE)
1945
+		if ($set_to_get_vars === FALSE)
1946 1946
 		{
1947 1947
 			return;
1948 1948
 		}
1949
-		if($val === NULL || $val === '')
1949
+		if ($val === NULL || $val === '')
1950 1950
 		{
1951 1951
 			unset($self->get_vars->{$key});
1952 1952
 			return;
1953 1953
 		}
1954
-		if($set_to_get_vars || $self->get_vars->{$key})
1954
+		if ($set_to_get_vars || $self->get_vars->{$key})
1955 1955
 		{
1956 1956
 			$self->get_vars->{$key} = $val;
1957 1957
 		}
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 	{
1968 1968
 		$self = self::getInstance();
1969 1969
 
1970
-		if(!isset($self->context->{$key}))
1970
+		if (!isset($self->context->{$key}))
1971 1971
 		{
1972 1972
 			return null;
1973 1973
 		}
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 	function gets()
1983 1983
 	{
1984 1984
 		$num_args = func_num_args();
1985
-		if($num_args < 1)
1985
+		if ($num_args < 1)
1986 1986
 		{
1987 1987
 			return;
1988 1988
 		}
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 
1991 1991
 		$args_list = func_get_args();
1992 1992
 		$output = new stdClass();
1993
-		foreach($args_list as $v)
1993
+		foreach ($args_list as $v)
1994 1994
 		{
1995 1995
 			$output->{$v} = $self->get($v);
1996 1996
 		}
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
 	function getRequestVars()
2017 2017
 	{
2018 2018
 		$self = self::getInstance();
2019
-		if($self->get_vars)
2019
+		if ($self->get_vars)
2020 2020
 		{
2021 2021
 			return clone($self->get_vars);
2022 2022
 		}
@@ -2033,13 +2033,13 @@  discard block
 block discarded – undo
2033 2033
 	{
2034 2034
 		$self = self::getInstance();
2035 2035
 
2036
-		if(!is_readable($self->sslActionCacheFile))
2036
+		if (!is_readable($self->sslActionCacheFile))
2037 2037
 		{
2038 2038
 			$buff = '<?php if(!defined("__XE__"))exit;';
2039 2039
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2040 2040
 		}
2041 2041
 
2042
-		if(!isset($self->ssl_actions[$action]))
2042
+		if (!isset($self->ssl_actions[$action]))
2043 2043
 		{
2044 2044
 			$self->ssl_actions[$action] = 1;
2045 2045
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2057,16 +2057,16 @@  discard block
 block discarded – undo
2057 2057
 	{
2058 2058
 		$self = self::getInstance();
2059 2059
 
2060
-		if(!is_readable($self->sslActionCacheFile))
2060
+		if (!is_readable($self->sslActionCacheFile))
2061 2061
 		{
2062 2062
 			unset($self->ssl_actions);
2063 2063
 			$buff = '<?php if(!defined("__XE__"))exit;';
2064 2064
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2065 2065
 		}
2066 2066
 
2067
-		foreach($action_array as $action)
2067
+		foreach ($action_array as $action)
2068 2068
 		{
2069
-			if(!isset($self->ssl_actions[$action]))
2069
+			if (!isset($self->ssl_actions[$action]))
2070 2070
 			{
2071 2071
 				$self->ssl_actions[$action] = 1;
2072 2072
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
 	{
2086 2086
 		$self = self::getInstance();
2087 2087
 
2088
-		if($self->isExistsSSLAction($action))
2088
+		if ($self->isExistsSSLAction($action))
2089 2089
 		{
2090 2090
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2091 2091
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 	function getSSLActions()
2103 2103
 	{
2104 2104
 		$self = self::getInstance();
2105
-		if($self->getSslStatus() == 'optional')
2105
+		if ($self->getSslStatus() == 'optional')
2106 2106
 		{
2107 2107
 			return $self->ssl_actions;
2108 2108
 		}
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	 */
2130 2130
 	function normalizeFilePath($file)
2131 2131
 	{
2132
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2132
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2133 2133
 		{
2134
-			$file = './' . $file;
2134
+			$file = './'.$file;
2135 2135
 		}
2136 2136
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2137
-		while(strpos($file, '/../') !== FALSE)
2137
+		while (strpos($file, '/../') !== FALSE)
2138 2138
 		{
2139 2139
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2140 2140
 		}
@@ -2153,13 +2153,13 @@  discard block
 block discarded – undo
2153 2153
 	{
2154 2154
 		$file = self::normalizeFilePath($file);
2155 2155
 		$script_path = getScriptPath();
2156
-		if(strpos($file, './') === 0)
2156
+		if (strpos($file, './') === 0)
2157 2157
 		{
2158
-			$file = $script_path . substr($file, 2);
2158
+			$file = $script_path.substr($file, 2);
2159 2159
 		}
2160
-		elseif(strpos($file, '../') === 0)
2160
+		elseif (strpos($file, '../') === 0)
2161 2161
 		{
2162
-			$file = self::normalizeFilePath($script_path . $file);
2162
+			$file = self::normalizeFilePath($script_path.$file);
2163 2163
 		}
2164 2164
 
2165 2165
 		return $file;
@@ -2229,12 +2229,12 @@  discard block
 block discarded – undo
2229 2229
 	 */
2230 2230
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2231 2231
 	{
2232
-		if($isRuleset)
2232
+		if ($isRuleset)
2233 2233
 		{
2234
-			if(strpos($file, '#') !== FALSE)
2234
+			if (strpos($file, '#') !== FALSE)
2235 2235
 			{
2236 2236
 				$file = str_replace('#', '', $file);
2237
-				if(!is_readable($file))
2237
+				if (!is_readable($file))
2238 2238
 				{
2239 2239
 					$file = $autoPath;
2240 2240
 				}
@@ -2299,9 +2299,9 @@  discard block
 block discarded – undo
2299 2299
 		ksort($files);
2300 2300
 		$files = array_values($files);
2301 2301
 		$filenames = array();
2302
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2302
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2303 2303
 		{
2304
-			if(in_array($files[$i]['file'], $filenames))
2304
+			if (in_array($files[$i]['file'], $filenames))
2305 2305
 			{
2306 2306
 				unset($files[$i]);
2307 2307
 			}
@@ -2386,14 +2386,14 @@  discard block
 block discarded – undo
2386 2386
 	 */
2387 2387
 	function getJavascriptPluginInfo($pluginName)
2388 2388
 	{
2389
-		if($plugin_name == 'ui.datepicker')
2389
+		if ($plugin_name == 'ui.datepicker')
2390 2390
 		{
2391 2391
 			$plugin_name = 'ui';
2392 2392
 		}
2393 2393
 
2394
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2395
-		$info_file = $plugin_path . 'plugin.load';
2396
-		if(!is_readable($info_file))
2394
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2395
+		$info_file = $plugin_path.'plugin.load';
2396
+		if (!is_readable($info_file))
2397 2397
 		{
2398 2398
 			return;
2399 2399
 		}
@@ -2403,32 +2403,32 @@  discard block
 block discarded – undo
2403 2403
 		$result->jsList = array();
2404 2404
 		$result->cssList = array();
2405 2405
 
2406
-		foreach($list as $filename)
2406
+		foreach ($list as $filename)
2407 2407
 		{
2408 2408
 			$filename = trim($filename);
2409
-			if(!$filename)
2409
+			if (!$filename)
2410 2410
 			{
2411 2411
 				continue;
2412 2412
 			}
2413 2413
 
2414
-			if(strncasecmp('./', $filename, 2) === 0)
2414
+			if (strncasecmp('./', $filename, 2) === 0)
2415 2415
 			{
2416 2416
 				$filename = substr($filename, 2);
2417 2417
 			}
2418 2418
 
2419
-			if(substr_compare($filename, '.js', -3) === 0)
2419
+			if (substr_compare($filename, '.js', -3) === 0)
2420 2420
 			{
2421
-				$result->jsList[] = $plugin_path . $filename;
2421
+				$result->jsList[] = $plugin_path.$filename;
2422 2422
 			}
2423
-			elseif(substr_compare($filename, '.css', -4) === 0)
2423
+			elseif (substr_compare($filename, '.css', -4) === 0)
2424 2424
 			{
2425
-				$result->cssList[] = $plugin_path . $filename;
2425
+				$result->cssList[] = $plugin_path.$filename;
2426 2426
 			}
2427 2427
 		}
2428 2428
 
2429
-		if(is_dir($plugin_path . 'lang'))
2429
+		if (is_dir($plugin_path.'lang'))
2430 2430
 		{
2431
-			$result->langPath = $plugin_path . 'lang';
2431
+			$result->langPath = $plugin_path.'lang';
2432 2432
 		}
2433 2433
 
2434 2434
 		return $result;
@@ -2444,50 +2444,50 @@  discard block
 block discarded – undo
2444 2444
 		static $loaded_plugins = array();
2445 2445
 
2446 2446
 		$self = self::getInstance();
2447
-		if($plugin_name == 'ui.datepicker')
2447
+		if ($plugin_name == 'ui.datepicker')
2448 2448
 		{
2449 2449
 			$plugin_name = 'ui';
2450 2450
 		}
2451 2451
 
2452
-		if($loaded_plugins[$plugin_name])
2452
+		if ($loaded_plugins[$plugin_name])
2453 2453
 		{
2454 2454
 			return;
2455 2455
 		}
2456 2456
 		$loaded_plugins[$plugin_name] = TRUE;
2457 2457
 
2458
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2459
-		$info_file = $plugin_path . 'plugin.load';
2460
-		if(!is_readable($info_file))
2458
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2459
+		$info_file = $plugin_path.'plugin.load';
2460
+		if (!is_readable($info_file))
2461 2461
 		{
2462 2462
 			return;
2463 2463
 		}
2464 2464
 
2465 2465
 		$list = file($info_file);
2466
-		foreach($list as $filename)
2466
+		foreach ($list as $filename)
2467 2467
 		{
2468 2468
 			$filename = trim($filename);
2469
-			if(!$filename)
2469
+			if (!$filename)
2470 2470
 			{
2471 2471
 				continue;
2472 2472
 			}
2473 2473
 
2474
-			if(strncasecmp('./', $filename, 2) === 0)
2474
+			if (strncasecmp('./', $filename, 2) === 0)
2475 2475
 			{
2476 2476
 				$filename = substr($filename, 2);
2477 2477
 			}
2478
-			if(substr_compare($filename, '.js', -3) === 0)
2478
+			if (substr_compare($filename, '.js', -3) === 0)
2479 2479
 			{
2480
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2480
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2481 2481
 			}
2482
-			if(substr_compare($filename, '.css', -4) === 0)
2482
+			if (substr_compare($filename, '.css', -4) === 0)
2483 2483
 			{
2484
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2484
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2485 2485
 			}
2486 2486
 		}
2487 2487
 
2488
-		if(is_dir($plugin_path . 'lang'))
2488
+		if (is_dir($plugin_path.'lang'))
2489 2489
 		{
2490
-			$self->loadLang($plugin_path . 'lang');
2490
+			$self->loadLang($plugin_path.'lang');
2491 2491
 		}
2492 2492
 	}
2493 2493
 
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 	function addHtmlHeader($header)
2501 2501
 	{
2502 2502
 		$self = self::getInstance();
2503
-		$self->html_header .= "\n" . $header;
2503
+		$self->html_header .= "\n".$header;
2504 2504
 	}
2505 2505
 
2506 2506
 	function clearHtmlHeader()
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
 	function addBodyHeader($header)
2553 2553
 	{
2554 2554
 		$self = self::getInstance();
2555
-		$self->body_header .= "\n" . $header;
2555
+		$self->body_header .= "\n".$header;
2556 2556
 	}
2557 2557
 
2558 2558
 	/**
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
 	function addHtmlFooter($footer)
2575 2575
 	{
2576 2576
 		$self = self::getInstance();
2577
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2577
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2578 2578
 	}
2579 2579
 
2580 2580
 	/**
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
 	 */
2596 2596
 	function getConfigFile()
2597 2597
 	{
2598
-		return _XE_PATH_ . 'files/config/db.config.php';
2598
+		return _XE_PATH_.'files/config/db.config.php';
2599 2599
 	}
2600 2600
 
2601 2601
 	/**
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 	 */
2606 2606
 	function getFTPConfigFile()
2607 2607
 	{
2608
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2608
+		return _XE_PATH_.'files/config/ftp.config.php';
2609 2609
 	}
2610 2610
 
2611 2611
 	/**
@@ -2657,14 +2657,14 @@  discard block
 block discarded – undo
2657 2657
 		$_path = explode('/', $path);
2658 2658
 		$_base = explode('/', $base_url);
2659 2659
 
2660
-		if(!$_base[count($_base) - 1])
2660
+		if (!$_base[count($_base) - 1])
2661 2661
 		{
2662 2662
 			array_pop($_base);
2663 2663
 		}
2664 2664
 
2665
-		foreach($_xe as $idx => $dir)
2665
+		foreach ($_xe as $idx => $dir)
2666 2666
 		{
2667
-			if($_path[0] != $dir)
2667
+			if ($_path[0] != $dir)
2668 2668
 			{
2669 2669
 				break;
2670 2670
 			}
@@ -2672,9 +2672,9 @@  discard block
 block discarded – undo
2672 2672
 		}
2673 2673
 
2674 2674
 		$idx = count($_xe) - $idx - 1;
2675
-		while($idx--)
2675
+		while ($idx--)
2676 2676
 		{
2677
-			if(count($_base) > 0)
2677
+			if (count($_base) > 0)
2678 2678
 			{
2679 2679
 				array_shift($_base);
2680 2680
 			}
@@ -2684,13 +2684,13 @@  discard block
 block discarded – undo
2684 2684
 			}
2685 2685
 		}
2686 2686
 
2687
-		if(count($_base) > 0)
2687
+		if (count($_base) > 0)
2688 2688
 		{
2689 2689
 			array_unshift($_path, join('/', $_base));
2690 2690
 		}
2691 2691
 
2692
-		$path = '/' . join('/', $_path);
2693
-		if(substr_compare($path, '/', -1) !== 0)
2692
+		$path = '/'.join('/', $_path);
2693
+		if (substr_compare($path, '/', -1) !== 0)
2694 2694
 		{
2695 2695
 			$path .= '/';
2696 2696
 		}
@@ -2705,13 +2705,13 @@  discard block
 block discarded – undo
2705 2705
 	{
2706 2706
 		$self = self::getInstance();
2707 2707
 
2708
-		if(!is_array($self->meta_tags))
2708
+		if (!is_array($self->meta_tags))
2709 2709
 		{
2710 2710
 			$self->meta_tags = array();
2711 2711
 		}
2712 2712
 
2713 2713
 		$ret = array();
2714
-		foreach($self->meta_tags as $key => $val)
2714
+		foreach ($self->meta_tags as $key => $val)
2715 2715
 		{
2716 2716
 			list($name, $is_http_equiv) = explode("\t", $key);
2717 2717
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2732 2732
 	{
2733 2733
 		$self = self::getInstance();
2734
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2734
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2735 2735
 	}
2736 2736
 
2737 2737
 }
Please login to merge, or discard this patch.
Braces   +115 added lines, -113 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -492,18 +493,22 @@  discard block
 block discarded – undo
492 493
 			$db_info->use_prepared_statements = 'Y';
493 494
 		}
494 495
 
495
-		if(!$db_info->time_zone)
496
-			$db_info->time_zone = date('O');
496
+		if(!$db_info->time_zone) {
497
+					$db_info->time_zone = date('O');
498
+		}
497 499
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 500
 
499
-		if($db_info->qmail_compatibility != 'Y')
500
-			$db_info->qmail_compatibility = 'N';
501
+		if($db_info->qmail_compatibility != 'Y') {
502
+					$db_info->qmail_compatibility = 'N';
503
+		}
501 504
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 505
 
503
-		if(!$db_info->use_db_session)
504
-			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
506
-			$db_info->use_ssl = 'none';
506
+		if(!$db_info->use_db_session) {
507
+					$db_info->use_db_session = 'N';
508
+		}
509
+		if(!$db_info->use_ssl) {
510
+					$db_info->use_ssl = 'none';
511
+		}
507 512
 		$this->set('_use_ssl', $db_info->use_ssl);
508 513
 
509 514
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -514,7 +519,9 @@  discard block
 block discarded – undo
514 519
 		}
515 520
 
516 521
 		// @see https://github.com/xpressengine/xe-core/issues/2301
517
-		if($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
522
+		if($db_info->safeguard !== 'Y') {
523
+			$db_info->safeguard = 'N';
524
+		}
518 525
 
519 526
 		if(is_string($db_info->sitelock_whitelist)) {
520 527
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
@@ -623,8 +630,7 @@  discard block
 block discarded – undo
623 630
 				$buff = FileHandler::readFile($orig_lang_file);
624 631
 				FileHandler::writeFile($selected_lang_file, $buff);
625 632
 				$lang_selected = self::loadLangSupported();
626
-			}
627
-			else
633
+			} else
628 634
 			{
629 635
 				$langs = file($selected_lang_file);
630 636
 				foreach($langs as $val)
@@ -683,15 +689,16 @@  discard block
 block discarded – undo
683 689
 
684 690
 				$oModuleModel = getModel('module');
685 691
 				$domain = $url_info['host'] . $url_info['path'];
686
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
692
+				if(substr_compare($domain, '/', -1) === 0) {
693
+					$domain = substr($domain, 0, -1);
694
+				}
687 695
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
688 696
 
689 697
 				if($site_info->site_srl)
690 698
 				{
691 699
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
692 700
 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
693
-				}
694
-				else
701
+				} else
695 702
 				{
696 703
 					$redirect_url = $url;
697 704
 				}
@@ -700,8 +707,7 @@  discard block
 block discarded – undo
700 707
 				return FALSE;
701 708
 			}
702 709
 			// for sites requesting SSO validation
703
-		}
704
-		else
710
+		} else
705 711
 		{
706 712
 			// result handling : set session_name()
707 713
 			if($session_name = self::get('SSOID'))
@@ -718,8 +724,7 @@  discard block
 block discarded – undo
718 724
 				header('location:' . $url);
719 725
 				return FALSE;
720 726
 				// send SSO request
721
-			}
722
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
727
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
723 728
 			{
724 729
 				setcookie('sso', md5(self::getRequestUri()));
725 730
 				$origin_url = self::getRequestUrl();
@@ -779,8 +784,7 @@  discard block
 block discarded – undo
779 784
 		if($self->site_title)
780 785
 		{
781 786
 			$self->site_title .= ' - ' . $site_title;
782
-		}
783
-		else
787
+		} else
784 788
 		{
785 789
 			$self->site_title = $site_title;
786 790
 		}
@@ -880,8 +884,7 @@  discard block
 block discarded – undo
880 884
 		{
881 885
 			$self->loaded_lang_files[] = $filename;
882 886
 			include($filename);
883
-		}
884
-		else
887
+		} else
885 888
 		{
886 889
 			$self->_evalxmlLang($path);
887 890
 		}
@@ -897,7 +900,9 @@  discard block
 block discarded – undo
897 900
 	{
898 901
 		global $lang;
899 902
 
900
-		if(!$path) return;
903
+		if(!$path) {
904
+			return;
905
+		}
901 906
 
902 907
 		$_path = 'eval://' . $path;
903 908
 
@@ -929,7 +934,9 @@  discard block
 block discarded – undo
929 934
 	 */
930 935
 	function _loadXmlLang($path)
931 936
 	{
932
-		if(!$path) return;
937
+		if(!$path) {
938
+			return;
939
+		}
933 940
 
934 941
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
935 942
 		return $oXmlLangParser->compile();
@@ -943,7 +950,9 @@  discard block
 block discarded – undo
943 950
 	 */
944 951
 	function _loadPhpLang($path)
945 952
 	{
946
-		if(!$path) return;
953
+		if(!$path) {
954
+			return;
955
+		}
947 956
 
948 957
 		if(substr_compare($path, '/', -1) !== 0)
949 958
 		{
@@ -1076,12 +1085,14 @@  discard block
 block discarded – undo
1076 1085
 		static $flag = TRUE;
1077 1086
 		if($charset)
1078 1087
 		{
1079
-			if(is_array($val))
1080
-				array_walk($val,'Context::checkConvertFlag',$charset);
1081
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1082
-			else $flag = FALSE;
1083
-		}
1084
-		else
1088
+			if(is_array($val)) {
1089
+							array_walk($val,'Context::checkConvertFlag',$charset);
1090
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1091
+				$flag = FALSE;
1092
+			} else {
1093
+				$flag = FALSE;
1094
+			}
1095
+		} else
1085 1096
 		{
1086 1097
 			$return = $flag;
1087 1098
 			$flag = TRUE;
@@ -1103,8 +1114,9 @@  discard block
 block discarded – undo
1103 1114
 		if (is_array($val))
1104 1115
 		{
1105 1116
 			array_walk($val,'Context::doConvertEncoding',$charset);
1117
+		} else {
1118
+			$val = iconv($charset,'UTF-8',$val);
1106 1119
 		}
1107
-		else $val = iconv($charset,'UTF-8',$val);
1108 1120
 	}
1109 1121
 
1110 1122
 	/**
@@ -1115,7 +1127,9 @@  discard block
 block discarded – undo
1115 1127
 	 */
1116 1128
 	function convertEncodingStr($str)
1117 1129
 	{
1118
-        if(!$str) return null;
1130
+        if(!$str) {
1131
+        	return null;
1132
+        }
1119 1133
 		$obj = new stdClass();
1120 1134
 		$obj->str = $str;
1121 1135
 		$obj = self::convertEncoding($obj);
@@ -1228,16 +1242,13 @@  discard block
 block discarded – undo
1228 1242
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1229 1243
 			{
1230 1244
 				$set_to_vars = TRUE;
1231
-			}
1232
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1245
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1233 1246
 			{
1234 1247
 				$set_to_vars = TRUE;
1235
-			}
1236
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1248
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1237 1249
 			{
1238 1250
 				$set_to_vars = TRUE;
1239
-			}
1240
-			else
1251
+			} else
1241 1252
 			{
1242 1253
 				$set_to_vars = FALSE;
1243 1254
 			}
@@ -1263,8 +1274,7 @@  discard block
 block discarded – undo
1263 1274
 					return;
1264 1275
 				}
1265 1276
 			}
1266
-		}
1267
-		else if(is_array($val))
1277
+		} else if(is_array($val))
1268 1278
 		{
1269 1279
 			foreach($val as $val2)
1270 1280
 			{
@@ -1412,24 +1422,19 @@  discard block
 block discarded – undo
1412 1422
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1413 1423
 			{
1414 1424
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1415
-			}
1416
-			elseif($key === 'mid' || $key === 'search_keyword')
1425
+			} elseif($key === 'mid' || $key === 'search_keyword')
1417 1426
 			{
1418 1427
 				$result[$k] = escape($v, false);
1419
-			}
1420
-			elseif($key === 'vid')
1428
+			} elseif($key === 'vid')
1421 1429
 			{
1422 1430
 				$result[$k] = urlencode($v);
1423
-			}
1424
-			elseif($key === 'xe_validator_id')
1431
+			} elseif($key === 'xe_validator_id')
1425 1432
 			{
1426 1433
 				$result[$k] = escape($v, false);
1427
-			}
1428
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1434
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1429 1435
 			{
1430 1436
 				unset($result[$k]);
1431
-			}
1432
-			else
1437
+			} else
1433 1438
 			{
1434 1439
 				$result[$k] = $v;
1435 1440
 
@@ -1438,8 +1443,7 @@  discard block
 block discarded – undo
1438 1443
 					if (is_array($result[$k]))
1439 1444
 					{
1440 1445
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1441
-					}
1442
-					else
1446
+					} else
1443 1447
 					{
1444 1448
 						$result[$k] = stripslashes($result[$k]);
1445 1449
 					}
@@ -1448,8 +1452,7 @@  discard block
 block discarded – undo
1448 1452
 				if(is_array($result[$k]))
1449 1453
 				{
1450 1454
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1451
-				}
1452
-				else
1455
+				} else
1453 1456
 				{
1454 1457
 					$result[$k] = trim($result[$k]);
1455 1458
 				}
@@ -1499,8 +1502,7 @@  discard block
 block discarded – undo
1499 1502
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1500 1503
 				$this->set($key, $val, TRUE);
1501 1504
 				$this->is_uploaded = TRUE;
1502
-			}
1503
-			else
1505
+			} else
1504 1506
 			{
1505 1507
 				$files = array();
1506 1508
 				$count_files = count($tmp_name);
@@ -1518,7 +1520,9 @@  discard block
 block discarded – undo
1518 1520
 						$files[] = $file;
1519 1521
 					}
1520 1522
 				}
1521
-				if($files) $this->set($key, $files, TRUE);
1523
+				if($files) {
1524
+					$this->set($key, $files, TRUE);
1525
+				}
1522 1526
 			}
1523 1527
 		}
1524 1528
 	}
@@ -1610,8 +1614,7 @@  discard block
 block discarded – undo
1610 1614
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1611 1615
 			{
1612 1616
 				$vid = $site_module_info->domain;
1613
-			}
1614
-			else
1617
+			} else
1615 1618
 			{
1616 1619
 				$domain = $site_module_info->domain;
1617 1620
 			}
@@ -1628,8 +1631,7 @@  discard block
 block discarded – undo
1628 1631
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1629 1632
 			{
1630 1633
 				unset($domain);
1631
-			}
1632
-			else
1634
+			} else
1633 1635
 			{
1634 1636
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1635 1637
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1649,23 +1651,35 @@  discard block
 block discarded – undo
1649 1651
 			{
1650 1652
 				array_shift($args_list);
1651 1653
 			}
1652
-		}
1653
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1654
+		} elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1654 1655
 		{
1655 1656
 			// Otherwise, make GET variables into array
1656 1657
 			$get_vars = get_object_vars($self->get_vars);
1657
-		}
1658
-		else
1658
+		} else
1659 1659
 		{
1660
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1660
+			if(!!$self->get_vars->module) {
1661
+				$get_vars['module'] = $self->get_vars->module;
1662
+			}
1663
+			if(!!$self->get_vars->mid) {
1664
+				$get_vars['mid'] = $self->get_vars->mid;
1665
+			}
1666
+			if(!!$self->get_vars->act) {
1667
+				$get_vars['act'] = $self->get_vars->act;
1668
+			}
1669
+			if(!!$self->get_vars->page) {
1670
+				$get_vars['page'] = $self->get_vars->page;
1671
+			}
1672
+			if(!!$self->get_vars->search_target) {
1673
+				$get_vars['search_target'] = $self->get_vars->search_target;
1674
+			}
1675
+			if(!!$self->get_vars->search_keyword) {
1676
+				$get_vars['search_keyword'] = $self->get_vars->search_keyword;
1677
+			}
1666 1678
 			if($get_vars['act'] == 'IS')
1667 1679
 			{
1668
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1680
+				if(!!$self->get_vars->is_keyword) {
1681
+					$get_vars['is_keyword'] = $self->get_vars->is_keyword;
1682
+				}
1669 1683
 			}
1670 1684
 		}
1671 1685
 
@@ -1690,8 +1704,7 @@  discard block
 block discarded – undo
1690 1704
 		if($vid)
1691 1705
 		{
1692 1706
 			$get_vars['vid'] = $vid;
1693
-		}
1694
-		else
1707
+		} else
1695 1708
 		{
1696 1709
 			unset($get_vars['vid']);
1697 1710
 		}
@@ -1763,8 +1776,7 @@  discard block
 block discarded – undo
1763 1776
 						{
1764 1777
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1765 1778
 						}
1766
-					}
1767
-					elseif(!is_array($val))
1779
+					} elseif(!is_array($val))
1768 1780
 					{
1769 1781
 						$queries[] = $key . '=' . urlencode($val);
1770 1782
 					}
@@ -1782,25 +1794,23 @@  discard block
 block discarded – undo
1782 1794
 		{
1783 1795
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1784 1796
 			// optional SSL use
1785
-		}
1786
-		elseif($_use_ssl == 'optional')
1797
+		} elseif($_use_ssl == 'optional')
1787 1798
 		{
1788 1799
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1789 1800
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1790 1801
 			// no SSL
1791
-		}
1792
-		else
1802
+		} else
1793 1803
 		{
1794 1804
 			// currently on SSL but target is not based on SSL
1795 1805
 			if($_SERVER['HTTPS'] == 'on')
1796 1806
 			{
1797 1807
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1798
-			}
1799
-			else if($domain) // if $domain is set
1808
+			} else if($domain) {
1809
+				// if $domain is set
1800 1810
 			{
1801 1811
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1802 1812
 			}
1803
-			else
1813
+			} else
1804 1814
 			{
1805 1815
 				$query = getScriptPath() . $query;
1806 1816
 			}
@@ -1857,8 +1867,7 @@  discard block
 block discarded – undo
1857 1867
 		if($domain)
1858 1868
 		{
1859 1869
 			$domain_key = md5($domain);
1860
-		}
1861
-		else
1870
+		} else
1862 1871
 		{
1863 1872
 			$domain_key = 'default';
1864 1873
 		}
@@ -1887,8 +1896,7 @@  discard block
 block discarded – undo
1887 1896
 			{
1888 1897
 				$target_url.= '/';
1889 1898
 			}
1890
-		}
1891
-		else
1899
+		} else
1892 1900
 		{
1893 1901
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1894 1902
 		}
@@ -1906,20 +1914,17 @@  discard block
 block discarded – undo
1906 1914
 			if($port && $port != 443)
1907 1915
 			{
1908 1916
 				$url_info['port'] = $port;
1909
-			}
1910
-			elseif($url_info['port'] == 443)
1917
+			} elseif($url_info['port'] == 443)
1911 1918
 			{
1912 1919
 				unset($url_info['port']);
1913 1920
 			}
1914
-		}
1915
-		else
1921
+		} else
1916 1922
 		{
1917 1923
 			$port = self::get('_http_port');
1918 1924
 			if($port && $port != 80)
1919 1925
 			{
1920 1926
 				$url_info['port'] = $port;
1921
-			}
1922
-			elseif($url_info['port'] == 80)
1927
+			} elseif($url_info['port'] == 80)
1923 1928
 			{
1924 1929
 				unset($url_info['port']);
1925 1930
 			}
@@ -2156,8 +2161,7 @@  discard block
 block discarded – undo
2156 2161
 		if(strpos($file, './') === 0)
2157 2162
 		{
2158 2163
 			$file = $script_path . substr($file, 2);
2159
-		}
2160
-		elseif(strpos($file, '../') === 0)
2164
+		} elseif(strpos($file, '../') === 0)
2161 2165
 		{
2162 2166
 			$file = self::normalizeFilePath($script_path . $file);
2163 2167
 		}
@@ -2419,8 +2423,7 @@  discard block
 block discarded – undo
2419 2423
 			if(substr_compare($filename, '.js', -3) === 0)
2420 2424
 			{
2421 2425
 				$result->jsList[] = $plugin_path . $filename;
2422
-			}
2423
-			elseif(substr_compare($filename, '.css', -4) === 0)
2426
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2424 2427
 			{
2425 2428
 				$result->cssList[] = $plugin_path . $filename;
2426 2429
 			}
@@ -2677,8 +2680,7 @@  discard block
 block discarded – undo
2677 2680
 			if(count($_base) > 0)
2678 2681
 			{
2679 2682
 				array_shift($_base);
2680
-			}
2681
-			else
2683
+			} else
2682 2684
 			{
2683 2685
 				array_unshift($_base, '..');
2684 2686
 			}
Please login to merge, or discard this patch.
config/func.inc.php 3 patches
Doc Comments   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  * @param string $module_name The module name to get a instance
75 75
  * @param string $type disp, proc, controller, class
76 76
  * @param string $kind admin, null
77
- * @return mixed Module instance
77
+ * @return ModuleObject Module instance
78 78
  */
79 79
 function getModule($module_name, $type = 'view', $kind = '')
80 80
 {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * Create a controller instance of the module
86 86
  *
87 87
  * @param string $module_name The module name to get a controller instance
88
- * @return mixed Module controller instance
88
+ * @return ModuleObject Module controller instance
89 89
  */
90 90
 function getController($module_name)
91 91
 {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * Create a admin controller instance of the module
97 97
  *
98 98
  * @param string $module_name The module name to get a admin controller instance
99
- * @return mixed Module admin controller instance
99
+ * @return ModuleObject Module admin controller instance
100 100
  */
101 101
 function getAdminController($module_name)
102 102
 {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * Create a view instance of the module
108 108
  *
109 109
  * @param string $module_name The module name to get a view instance
110
- * @return mixed Module view instance
110
+ * @return ModuleObject Module view instance
111 111
  */
112 112
 function getView($module_name)
113 113
 {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  * Create a mobile instance of the module
119 119
  *
120 120
  * @param string $module_name The module name to get a mobile instance
121
- * @return mixed Module mobile instance
121
+ * @return ModuleObject Module mobile instance
122 122
  */
123 123
 function &getMobile($module_name)
124 124
 {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * Create a admin view instance of the module
130 130
  *
131 131
  * @param string $module_name The module name to get a admin view instance
132
- * @return mixed Module admin view instance
132
+ * @return ModuleObject Module admin view instance
133 133
  */
134 134
 function getAdminView($module_name)
135 135
 {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * Create a model instance of the module
141 141
  *
142 142
  * @param string $module_name The module name to get a model instance
143
- * @return mixed Module model instance
143
+ * @return ModuleObject Module model instance
144 144
  */
145 145
 function getModel($module_name)
146 146
 {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  * Create an admin model instance of the module
152 152
  *
153 153
  * @param string $module_name The module name to get a admin model instance
154
- * @return mixed Module admin model instance
154
+ * @return ModuleObject Module admin model instance
155 155
  */
156 156
 function getAdminModel($module_name)
157 157
 {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  * Create an api instance of the module
163 163
  *
164 164
  * @param string $module_name The module name to get a api instance
165
- * @return mixed Module api class instance
165
+ * @return ModuleObject Module api class instance
166 166
  */
167 167
 function getAPI($module_name)
168 168
 {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * Create a wap instance of the module
174 174
  *
175 175
  * @param string $module_name The module name to get a wap instance
176
- * @return mixed Module wap class instance
176
+ * @return ModuleObject Module wap class instance
177 177
  */
178 178
 function getWAP($module_name)
179 179
 {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
  * Create a class instance of the module
185 185
  *
186 186
  * @param string $module_name The module name to get a class instance
187
- * @return mixed Module class instance
187
+ * @return ModuleObject Module class instance
188 188
  */
189 189
 function getClass($module_name)
190 190
 {
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
  * Return if domain of the virtual site is url type or id type
491 491
  *
492 492
  * @param string $domain
493
- * @return bool
493
+ * @return integer
494 494
  */
495 495
 function isSiteID($domain)
496 496
 {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 /**
560 560
  * Get a time gap between server's timezone and XE's timezone
561 561
  *
562
- * @return int
562
+ * @return double
563 563
  */
564 564
 function zgap()
565 565
 {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
  * Display $buff contents into the file ./files/_debug_message.php.
798 798
  * You can see the file on your prompt by command: tail-f./files/_debug_message.php
799 799
  *
800
- * @param mixed $debug_output Target object to be printed
800
+ * @param string $debug_output Target object to be printed
801 801
  * @param bool $display_option boolean Flag whether to print seperator (default:true)
802 802
  * @param string $file Target file name
803 803
  * @return void
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 /**
905 905
  * @param string $type query, trigger
906 906
  * @param float $elapsed_time
907
- * @param object $obj
907
+ * @param stdClass $obj
908 908
  */
909 909
 function writeSlowlog($type, $elapsed_time, $obj)
910 910
 {
@@ -1685,6 +1685,9 @@  discard block
 block discarded – undo
1685 1685
 	}
1686 1686
 }
1687 1687
 
1688
+/**
1689
+ * @param string $key
1690
+ */
1688 1691
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1689 1692
 {
1690 1693
 	if($requestKey != $dbKey)
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
  *
7 7
  * @author NAVER ([email protected])
8 8
  */
9
-if(!defined('__XE__'))
9
+if (!defined('__XE__'))
10 10
 {
11 11
 	exit();
12 12
 }
13 13
 
14 14
 // define an empty function to avoid errors when iconv function doesn't exist
15
-if(!function_exists('iconv'))
15
+if (!function_exists('iconv'))
16 16
 {
17 17
 	eval('
18 18
 		function iconv($in_charset, $out_charset, $str)
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 {
221 221
 	$oDB = DB::getInstance();
222 222
 	$output = $oDB->executeQuery($query_id, $args, $arg_columns);
223
-	if(!is_array($output->data) && count($output->data) > 0)
223
+	if (!is_array($output->data) && count($output->data) > 0)
224 224
 	{
225 225
 		$output->data = array($output->data);
226 226
 	}
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 function setUserSequence($seq)
251 251
 {
252 252
 	$arr_seq = array();
253
-	if(isset($_SESSION['seq']))
253
+	if (isset($_SESSION['seq']))
254 254
 	{
255
-		if(!is_array($_SESSION['seq'])) {
255
+		if (!is_array($_SESSION['seq'])) {
256 256
 			$_SESSION['seq'] = array($_SESSION['seq']);
257 257
 		}
258 258
 		$arr_seq = $_SESSION['seq'];
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function checkUserSequence($seq)
271 271
 {
272
-	if(!isset($_SESSION['seq']))
272
+	if (!isset($_SESSION['seq']))
273 273
 	{
274 274
 		return false;
275 275
 	}
276
-	if(!in_array($seq, $_SESSION['seq']))
276
+	if (!in_array($seq, $_SESSION['seq']))
277 277
 	{
278 278
 		return false;
279 279
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	$num_args = func_num_args();
300 300
 	$args_list = func_get_args();
301 301
 
302
-	if($num_args)
302
+	if ($num_args)
303 303
 		$url = Context::getUrl($num_args, $args_list);
304 304
 	else
305 305
 		$url = Context::getRequestUri();
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	$num_args = func_num_args();
319 319
 	$args_list = func_get_args();
320 320
 
321
-	if($num_args)
321
+	if ($num_args)
322 322
 	{
323 323
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
324 324
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	$num_args = func_num_args();
342 342
 	$args_list = func_get_args();
343 343
 
344
-	if($num_args)
344
+	if ($num_args)
345 345
 	{
346 346
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
347 347
 	}
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	$num_args = func_num_args();
364 364
 	$args_list = func_get_args();
365 365
 	$request_uri = Context::getRequestUri();
366
-	if(!$num_args)
366
+	if (!$num_args)
367 367
 	{
368 368
 		return $request_uri;
369 369
 	}
370 370
 
371 371
 	$url = Context::getUrl($num_args, $args_list);
372
-	if(strncasecmp('http', $url, 4) !== 0)
372
+	if (strncasecmp('http', $url, 4) !== 0)
373 373
 	{
374 374
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
375
-		return substr($match[0], 0, -1) . $url;
375
+		return substr($match[0], 0, -1).$url;
376 376
 	}
377 377
 	return $url;
378 378
 }
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	$num_args = func_num_args();
388 388
 	$args_list = func_get_args();
389 389
 	$request_uri = Context::getRequestUri();
390
-	if(!$num_args)
390
+	if (!$num_args)
391 391
 	{
392 392
 		return $request_uri;
393 393
 	}
394 394
 
395 395
 	$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
396
-	if(strncasecmp('http', $url, 4) !== 0)
396
+	if (strncasecmp('http', $url, 4) !== 0)
397 397
 	{
398 398
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
399 399
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
400
-		return substr($match[0], 0, -1) . $url;
400
+		return substr($match[0], 0, -1).$url;
401 401
 	}
402 402
 	return $url;
403 403
 }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	$num_args = func_num_args();
414 414
 	$args_list = func_get_args();
415 415
 
416
-	if(!$num_args)
416
+	if (!$num_args)
417 417
 	{
418 418
 		return Context::getRequestUri();
419 419
 	}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	$num_args = func_num_args();
436 436
 	$args_list = func_get_args();
437 437
 
438
-	if(!$num_args)
438
+	if (!$num_args)
439 439
 	{
440 440
 		return Context::getRequestUri();
441 441
 	}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	$args_list = func_get_args();
458 458
 
459 459
 	$request_uri = Context::getRequestUri();
460
-	if(!$num_args)
460
+	if (!$num_args)
461 461
 	{
462 462
 		return $request_uri;
463 463
 	}
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	$num_args = count($args_list);
467 467
 
468 468
 	$url = Context::getUrl($num_args, $args_list, $domain);
469
-	if(strncasecmp('http', $url, 4) !== 0)
469
+	if (strncasecmp('http', $url, 4) !== 0)
470 470
 	{
471 471
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
472
-		return substr($match[0], 0, -1) . $url;
472
+		return substr($match[0], 0, -1).$url;
473 473
 	}
474 474
 	return $url;
475 475
 }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 function getCurrentPageUrl()
483 483
 {
484 484
 	$protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
485
-	$url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
485
+	$url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
486 486
 	return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);
487 487
 }
488 488
 
@@ -507,12 +507,12 @@  discard block
 block discarded – undo
507 507
  */
508 508
 function cut_str($string, $cut_size = 0, $tail = '...')
509 509
 {
510
-	if($cut_size < 1 || !$string)
510
+	if ($cut_size < 1 || !$string)
511 511
 	{
512 512
 		return $string;
513 513
 	}
514 514
 
515
-	if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
515
+	if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
516 516
 	{
517 517
 		$GLOBALS['use_mb_strimwidth'] = TRUE;
518 518
 		return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8');
@@ -526,16 +526,16 @@  discard block
 block discarded – undo
526 526
 	$char_count = 0;
527 527
 
528 528
 	$idx = 0;
529
-	while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
529
+	while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
530 530
 	{
531 531
 		$c = ord(substr($string, $idx, 1));
532 532
 		$char_count++;
533
-		if($c < 128)
533
+		if ($c < 128)
534 534
 		{
535 535
 			$char_width += (int) $chars[$c - 32];
536 536
 			$idx++;
537 537
 		}
538
-		else if(191 < $c && $c < 224)
538
+		else if (191 < $c && $c < 224)
539 539
 		{
540 540
 			$char_width += $chars[4];
541 541
 			$idx += 2;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	}
549 549
 
550 550
 	$output = substr($string, 0, $idx);
551
-	if(strlen($output) < $string_length)
551
+	if (strlen($output) < $string_length)
552 552
 	{
553 553
 		$output .= $tail;
554 554
 	}
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 function zgap()
565 565
 {
566 566
 	$time_zone = $GLOBALS['_time_zone'];
567
-	if($time_zone < 0)
567
+	if ($time_zone < 0)
568 568
 	{
569 569
 		$to = -1;
570 570
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	$t_min = substr($time_zone, 3, 2) * $to;
578 578
 
579 579
 	$server_time_zone = date("O");
580
-	if($server_time_zone < 0)
580
+	if ($server_time_zone < 0)
581 581
 	{
582 582
 		$so = -1;
583 583
 	}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
  */
605 605
 function ztime($str)
606 606
 {
607
-	if(!$str)
607
+	if (!$str)
608 608
 	{
609 609
 		return;
610 610
 	}
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	$year = (int) substr($str, 0, 4);
620 620
 	$month = (int) substr($str, 4, 2);
621 621
 	$day = (int) substr($str, 6, 2);
622
-	if(strlen($str) <= 8)
622
+	if (strlen($str) <= 8)
623 623
 	{
624 624
 		$gap = 0;
625 625
 	}
@@ -643,19 +643,19 @@  discard block
 block discarded – undo
643 643
 	$gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);
644 644
 
645 645
 	$lang_time_gap = Context::getLang('time_gap');
646
-	if($gap < 60)
646
+	if ($gap < 60)
647 647
 	{
648 648
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
649 649
 	}
650
-	elseif($gap < 60 * 60)
650
+	elseif ($gap < 60 * 60)
651 651
 	{
652 652
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
653 653
 	}
654
-	elseif($gap < 60 * 60 * 2)
654
+	elseif ($gap < 60 * 60 * 2)
655 655
 	{
656 656
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
657 657
 	}
658
-	elseif($gap < 60 * 60 * 24)
658
+	elseif ($gap < 60 * 60 * 24)
659 659
 	{
660 660
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
661 661
 	}
@@ -692,40 +692,40 @@  discard block
 block discarded – undo
692 692
 function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
693 693
 {
694 694
 	// return null if no target time is specified
695
-	if(!$str)
695
+	if (!$str)
696 696
 	{
697 697
 		return;
698 698
 	}
699 699
 	// convert the date format according to the language
700
-	if($conversion == TRUE)
700
+	if ($conversion == TRUE)
701 701
 	{
702
-		switch(Context::getLangType())
702
+		switch (Context::getLangType())
703 703
 		{
704 704
 			case 'en' :
705 705
 			case 'es' :
706
-				if($format == 'Y-m-d')
706
+				if ($format == 'Y-m-d')
707 707
 				{
708 708
 					$format = 'M d, Y';
709 709
 				}
710
-				elseif($format == 'Y-m-d H:i:s')
710
+				elseif ($format == 'Y-m-d H:i:s')
711 711
 				{
712 712
 					$format = 'M d, Y H:i:s';
713 713
 				}
714
-				elseif($format == 'Y-m-d H:i')
714
+				elseif ($format == 'Y-m-d H:i')
715 715
 				{
716 716
 					$format = 'M d, Y H:i';
717 717
 				}
718 718
 				break;
719 719
 			case 'vi' :
720
-				if($format == 'Y-m-d')
720
+				if ($format == 'Y-m-d')
721 721
 				{
722 722
 					$format = 'd-m-Y';
723 723
 				}
724
-				elseif($format == 'Y-m-d H:i:s')
724
+				elseif ($format == 'Y-m-d H:i:s')
725 725
 				{
726 726
 					$format = 'H:i:s d-m-Y';
727 727
 				}
728
-				elseif($format == 'Y-m-d H:i')
728
+				elseif ($format == 'Y-m-d H:i')
729 729
 				{
730 730
 					$format = 'H:i d-m-Y';
731 731
 				}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	}
735 735
 
736 736
 	// If year value is less than 1970, handle it separately.
737
-	if((int) substr($str, 0, 4) < 1970)
737
+	if ((int) substr($str, 0, 4) < 1970)
738 738
 	{
739 739
 		$hour = (int) substr($str, 8, 2);
740 740
 		$min = (int) substr($str, 10, 2);
@@ -784,9 +784,9 @@  discard block
 block discarded – undo
784 784
 function getEncodeEmailAddress($email)
785 785
 {
786 786
 	$return = '';
787
-	for($i = 0, $c = strlen($email); $i < $c; $i++)
787
+	for ($i = 0, $c = strlen($email); $i < $c; $i++)
788 788
 	{
789
-		$return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';
789
+		$return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';';
790 790
 	}
791 791
 	return $return;
792 792
 }
@@ -806,25 +806,25 @@  discard block
 block discarded – undo
806 806
 {
807 807
 	static $debug_file;
808 808
 
809
-	if(!(__DEBUG__ & 1))
809
+	if (!(__DEBUG__ & 1))
810 810
 	{
811 811
 		return;
812 812
 	}
813 813
 
814 814
 	static $firephp;
815 815
 	$bt = debug_backtrace();
816
-	if(is_array($bt))
816
+	if (is_array($bt))
817 817
 	{
818 818
 		$bt_debug_print = array_shift($bt);
819 819
 		$bt_called_function = array_shift($bt);
820 820
 	}
821 821
 	$file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);
822 822
 	$line_num = $bt_debug_print['line'];
823
-	$function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];
823
+	$function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];
824 824
 
825
-	if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
825
+	if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
826 826
 	{
827
-		if(!isset($firephp))
827
+		if (!isset($firephp))
828 828
 		{
829 829
 			$firephp = FirePHP::getInstance(TRUE);
830 830
 		}
@@ -833,16 +833,16 @@  discard block
 block discarded – undo
833 833
 		$label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage()));
834 834
 
835 835
 		// Check a FirePHP option
836
-		if($display_option === 'TABLE')
836
+		if ($display_option === 'TABLE')
837 837
 		{
838 838
 			$label = $display_option;
839 839
 		}
840
-		if($display_option === 'ERROR')
840
+		if ($display_option === 'ERROR')
841 841
 		{
842 842
 			$type = $display_option;
843 843
 		}
844 844
 		// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
845
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
845
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
846 846
 		{
847 847
 			$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
848 848
 			$label = NULL;
@@ -852,52 +852,52 @@  discard block
 block discarded – undo
852 852
 	}
853 853
 	else
854 854
 	{
855
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
855
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
856 856
 		{
857 857
 			return;
858 858
 		}
859 859
 
860 860
 		$print = array();
861
-		if(!$debug_file)
861
+		if (!$debug_file)
862 862
 		{
863
-			$debug_file = _XE_PATH_ . 'files/' . $file;
863
+			$debug_file = _XE_PATH_.'files/'.$file;
864 864
 		}
865
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
865
+		if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';
866 866
 
867
-		if($display_option === TRUE || $display_option === 'ERROR')
867
+		if ($display_option === TRUE || $display_option === 'ERROR')
868 868
 		{
869
-			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));;
869
+			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ;
870 870
 			$print[] = str_repeat('=', 80);
871 871
 		}
872 872
 		$type = gettype($debug_output);
873
-		if(!in_array($type, array('array', 'object', 'resource')))
873
+		if (!in_array($type, array('array', 'object', 'resource')))
874 874
 		{
875
-			if($display_option === 'ERROR')
875
+			if ($display_option === 'ERROR')
876 876
 			{
877
-				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
877
+				$print[] = 'ERROR : '.var_export($debug_output, TRUE);
878 878
 			}
879 879
 			else
880 880
 			{
881
-				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
881
+				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')';
882 882
 			}
883 883
 		}
884 884
 		else
885 885
 		{
886
-			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
886
+			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true)));
887 887
 		}
888 888
 		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
889 889
 		$backtrace = debug_backtrace($backtrace_args);
890 890
 
891
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
891
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
892 892
 		{
893 893
 			array_shift($backtrace);
894 894
 		}
895
-		foreach($backtrace as $val)
895
+		foreach ($backtrace as $val)
896 896
 		{
897
-			$print[] = '        - ' . $val['file'] . ' : ' . $val['line'];
897
+			$print[] = '        - '.$val['file'].' : '.$val['line'];
898 898
 		}
899 899
 		$print[] = PHP_EOL;
900
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
900
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
901 901
 	}
902 902
 }
903 903
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
  */
909 909
 function writeSlowlog($type, $elapsed_time, $obj)
910 910
 {
911
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
911
+	if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
912 912
 
913 913
 	static $log_filename = array(
914 914
 		'query' => 'files/_slowlog_query.php',
@@ -918,47 +918,47 @@  discard block
 block discarded – undo
918 918
 	);
919 919
 	$write_file = true;
920 920
 
921
-	$log_file = _XE_PATH_ . $log_filename[$type];
921
+	$log_file = _XE_PATH_.$log_filename[$type];
922 922
 
923 923
 	$buff = array();
924 924
 	$buff[] = '<?php exit(); ?>';
925 925
 	$buff[] = date('c');
926 926
 
927
-	if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
927
+	if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
928 928
 	{
929
-		$buff[] = "\tCaller : " . $obj->caller;
930
-		$buff[] = "\tCalled : " . $obj->called;
929
+		$buff[] = "\tCaller : ".$obj->caller;
930
+		$buff[] = "\tCalled : ".$obj->called;
931 931
 	}
932
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
932
+	else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
933 933
 	{
934
-		$buff[] = "\tAddon : " . $obj->called;
935
-		$buff[] = "\tCalled position : " . $obj->caller;
934
+		$buff[] = "\tAddon : ".$obj->called;
935
+		$buff[] = "\tCalled position : ".$obj->caller;
936 936
 	}
937
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
937
+	else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
938 938
 	{
939
-		$buff[] = "\tWidget : " . $obj->called;
939
+		$buff[] = "\tWidget : ".$obj->called;
940 940
 	}
941
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
941
+	else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
942 942
 	{
943 943
 
944 944
 		$buff[] = $obj->query;
945
-		$buff[] = "\tQuery ID   : " . $obj->query_id;
946
-		$buff[] = "\tCaller     : " . $obj->caller;
947
-		$buff[] = "\tConnection : " . $obj->connection;
945
+		$buff[] = "\tQuery ID   : ".$obj->query_id;
946
+		$buff[] = "\tCaller     : ".$obj->caller;
947
+		$buff[] = "\tConnection : ".$obj->connection;
948 948
 	}
949 949
 	else
950 950
 	{
951 951
 		$write_file = false;
952 952
 	}
953 953
 
954
-	if($write_file)
954
+	if ($write_file)
955 955
 	{
956 956
 		$buff[] = sprintf("\t%0.6f sec", $elapsed_time);
957
-		$buff[] = PHP_EOL . PHP_EOL;
957
+		$buff[] = PHP_EOL.PHP_EOL;
958 958
 		file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
959 959
 	}
960 960
 
961
-	if($type != 'query')
961
+	if ($type != 'query')
962 962
 	{
963 963
 		$trigger_args = $obj;
964 964
 		$trigger_args->_log_type = $type;
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
  */
999 999
 function delObjectVars($target_obj, $del_obj)
1000 1000
 {
1001
-	if(!is_object($target_obj))
1001
+	if (!is_object($target_obj))
1002 1002
 	{
1003 1003
 		return;
1004 1004
 	}
1005
-	if(!is_object($del_obj))
1005
+	if (!is_object($del_obj))
1006 1006
 	{
1007 1007
 		return;
1008 1008
 	}
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 	$target = array_keys($target_vars);
1014 1014
 	$del = array_keys($del_vars);
1015
-	if(!count($target) || !count($del))
1015
+	if (!count($target) || !count($del))
1016 1016
 	{
1017 1017
 		return $target_obj;
1018 1018
 	}
@@ -1020,10 +1020,10 @@  discard block
 block discarded – undo
1020 1020
 	$return_obj = new stdClass();
1021 1021
 
1022 1022
 	$target_count = count($target);
1023
-	for($i = 0; $i < $target_count; $i++)
1023
+	for ($i = 0; $i < $target_count; $i++)
1024 1024
 	{
1025 1025
 		$target_key = $target[$i];
1026
-		if(!in_array($target_key, $del))
1026
+		if (!in_array($target_key, $del))
1027 1027
 		{
1028 1028
 			$return_obj->{$target_key} = $target_obj->{$target_key};
1029 1029
 		}
@@ -1036,10 +1036,10 @@  discard block
 block discarded – undo
1036 1036
 {
1037 1037
 	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id');
1038 1038
 
1039
-	foreach($del_vars as $var)
1039
+	foreach ($del_vars as $var)
1040 1040
 	{
1041
-		if(is_array($vars)) unset($vars[$var]);
1042
-		else if(is_object($vars)) unset($vars->$var);
1041
+		if (is_array($vars)) unset($vars[$var]);
1042
+		else if (is_object($vars)) unset($vars->$var);
1043 1043
 	}
1044 1044
 
1045 1045
 	return $vars;
@@ -1056,12 +1056,12 @@  discard block
 block discarded – undo
1056 1056
  */
1057 1057
 function handleError($errno, $errstr, $file, $line)
1058 1058
 {
1059
-	if(!__DEBUG__)
1059
+	if (!__DEBUG__)
1060 1060
 	{
1061 1061
 		return;
1062 1062
 	}
1063 1063
 	$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
1064
-	if(!in_array($errno, $errors))
1064
+	if (!in_array($errno, $errors))
1065 1065
 	{
1066 1066
 		return;
1067 1067
 	}
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
 function getNumberingPath($no, $size = 3)
1082 1082
 {
1083 1083
 	$mod = pow(10, $size);
1084
-	$output = sprintf('%0' . $size . 'd/', $no % $mod);
1085
-	if($no >= $mod)
1084
+	$output = sprintf('%0'.$size.'d/', $no % $mod);
1085
+	if ($no >= $mod)
1086 1086
 	{
1087 1087
 		$output .= getNumberingPath((int) $no / $mod, $size);
1088 1088
 	}
@@ -1102,12 +1102,12 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 function purifierHtml(&$content)
1104 1104
 {
1105
-	require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');
1105
+	require_once(_XE_PATH_.'classes/security/Purifier.class.php');
1106 1106
 	$oPurifier = Purifier::getInstance();
1107 1107
 
1108 1108
 	// @see https://github.com/xpressengine/xe-core/issues/2278
1109 1109
 	$logged_info = Context::get('logged_info');
1110
-	if($logged_info->is_admin !== 'Y') {
1110
+	if ($logged_info->is_admin !== 'Y') {
1111 1111
 		$oPurifier->setConfig('HTML.Nofollow', true);
1112 1112
 	}
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
  */
1123 1123
 function removeHackTag($content)
1124 1124
 {
1125
-	require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
1125
+	require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
1126 1126
 	$oEmbedFilter = EmbedFilter::getInstance();
1127 1127
 	$oEmbedFilter->check($content);
1128 1128
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
  */
1165 1165
 function checkUploadedFile($file)
1166 1166
 {
1167
-	require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');
1167
+	require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');
1168 1168
 	return UploadFileFilter::check($file);
1169 1169
 }
1170 1170
 
@@ -1178,13 +1178,13 @@  discard block
 block discarded – undo
1178 1178
 {
1179 1179
 	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content);
1180 1180
 
1181
-	if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1181
+	if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1182 1182
 	{
1183
-		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1183
+		if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1184 1184
 		{
1185 1185
 			$content .= '</xmp>';
1186 1186
 		}
1187
-		else if($close_xmp < $start_xmp)
1187
+		else if ($close_xmp < $start_xmp)
1188 1188
 		{
1189 1189
 			$content .= '</xmp>';
1190 1190
 		}
@@ -1204,33 +1204,33 @@  discard block
 block discarded – undo
1204 1204
 	$tag = strtolower($match[2]);
1205 1205
 
1206 1206
 	// xmp tag ?뺣━
1207
-	if($tag == 'xmp')
1207
+	if ($tag == 'xmp')
1208 1208
 	{
1209 1209
 		return "<{$match[1]}xmp>";
1210 1210
 	}
1211
-	if($match[1])
1211
+	if ($match[1])
1212 1212
 	{
1213 1213
 		return $match[0];
1214 1214
 	}
1215
-	if($match[4])
1215
+	if ($match[4])
1216 1216
 	{
1217
-		$match[4] = ' ' . $match[4];
1217
+		$match[4] = ' '.$match[4];
1218 1218
 	}
1219 1219
 
1220 1220
 	$attrs = array();
1221
-	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1221
+	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1222 1222
 	{
1223
-		foreach($m[1] as $idx => $name)
1223
+		foreach ($m[1] as $idx => $name)
1224 1224
 		{
1225
-			if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1225
+			if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1226 1226
 			{
1227 1227
 				continue;
1228 1228
 			}
1229 1229
 
1230
-			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]);
1230
+			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]);
1231 1231
 			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val);
1232 1232
 
1233
-			if(preg_match('/^[a-z]+script:/i', $val))
1233
+			if (preg_match('/^[a-z]+script:/i', $val))
1234 1234
 			{
1235 1235
 				continue;
1236 1236
 			}
@@ -1241,60 +1241,60 @@  discard block
 block discarded – undo
1241 1241
 
1242 1242
 	$filter_arrts = array('style', 'src', 'href');
1243 1243
 
1244
-	if($tag === 'object') array_push($filter_arrts, 'data');
1245
-	if($tag === 'param') array_push($filter_arrts, 'value');
1244
+	if ($tag === 'object') array_push($filter_arrts, 'data');
1245
+	if ($tag === 'param') array_push($filter_arrts, 'value');
1246 1246
 
1247
-	foreach($filter_arrts as $attr)
1247
+	foreach ($filter_arrts as $attr)
1248 1248
 	{
1249
-		if(!isset($attrs[$attr])) continue;
1249
+		if (!isset($attrs[$attr])) continue;
1250 1250
 
1251 1251
 		$attr_value = rawurldecode($attrs[$attr]);
1252 1252
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
1253 1253
 		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value);
1254
-		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1254
+		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1255 1255
 		{
1256 1256
 			unset($attrs[$attr]);
1257 1257
 		}
1258 1258
 	}
1259 1259
 
1260
-	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1260
+	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1261 1261
 	{
1262 1262
 		unset($attrs['style']);
1263 1263
 	}
1264 1264
 
1265 1265
 	$attr = array();
1266
-	foreach($attrs as $name => $val)
1266
+	foreach ($attrs as $name => $val)
1267 1267
 	{
1268
-		if($tag == 'object' || $tag == 'embed' || $tag == 'a')
1268
+		if ($tag == 'object' || $tag == 'embed' || $tag == 'a')
1269 1269
 		{
1270 1270
 			$attribute = strtolower(trim($name));
1271
-			if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1271
+			if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1272 1272
 			{
1273
-				if(stripos($val, 'data:') === 0)
1273
+				if (stripos($val, 'data:') === 0)
1274 1274
 				{
1275 1275
 					continue;
1276 1276
 				}
1277 1277
 			}
1278 1278
 		}
1279 1279
 
1280
-		if($tag == 'img')
1280
+		if ($tag == 'img')
1281 1281
 		{
1282 1282
 			$attribute = strtolower(trim($name));
1283
-			if(stripos($val, 'data:') === 0)
1283
+			if (stripos($val, 'data:') === 0)
1284 1284
 			{
1285 1285
 				continue;
1286 1286
 			}
1287 1287
 		}
1288 1288
 		$val = str_replace('"', '&quot;', $val);
1289
-		$attr[] = $name . "=\"{$val}\"";
1289
+		$attr[] = $name."=\"{$val}\"";
1290 1290
 	}
1291
-	$attr = count($attr) ? ' ' . implode(' ', $attr) : '';
1291
+	$attr = count($attr) ? ' '.implode(' ', $attr) : '';
1292 1292
 
1293 1293
 	return "<{$match[1]}{$tag}{$attr}{$match[4]}>";
1294 1294
 }
1295 1295
 
1296 1296
 // convert hexa value to RGB
1297
-if(!function_exists('hexrgb'))
1297
+if (!function_exists('hexrgb'))
1298 1298
 {
1299 1299
 
1300 1300
 	/**
@@ -1330,9 +1330,9 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 	settype($password, "string");
1332 1332
 
1333
-	for($i = 0; $i < strlen($password); $i++)
1333
+	for ($i = 0; $i < strlen($password); $i++)
1334 1334
 	{
1335
-		if($password[$i] == ' ' || $password[$i] == '\t')
1335
+		if ($password[$i] == ' ' || $password[$i] == '\t')
1336 1336
 		{
1337 1337
 			continue;
1338 1338
 		}
@@ -1344,11 +1344,11 @@  discard block
 block discarded – undo
1344 1344
 	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1));
1345 1345
 	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1));
1346 1346
 
1347
-	if($result1 == '80000000')
1347
+	if ($result1 == '80000000')
1348 1348
 	{
1349 1349
 		$nr += 0x80000000;
1350 1350
 	}
1351
-	if($result2 == '80000000')
1351
+	if ($result2 == '80000000')
1352 1352
 	{
1353 1353
 		$nr2 += 0x80000000;
1354 1354
 	}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 function getScriptPath()
1365 1365
 {
1366 1366
 	static $url = NULL;
1367
-	if($url == NULL)
1367
+	if ($url == NULL)
1368 1368
 	{
1369 1369
 		$script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);
1370 1370
 		$url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path)));
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
 	$decodedStr = '';
1396 1396
 	$pos = 0;
1397 1397
 	$len = strlen($source);
1398
-	while($pos < $len)
1398
+	while ($pos < $len)
1399 1399
 	{
1400 1400
 		$charAt = substr($source, $pos, 1);
1401
-		if($charAt == '%')
1401
+		if ($charAt == '%')
1402 1402
 		{
1403 1403
 			$pos++;
1404 1404
 			$charAt = substr($source, $pos, 1);
1405
-			if($charAt == 'u')
1405
+			if ($charAt == 'u')
1406 1406
 			{
1407 1407
 				// we got a unicode character
1408 1408
 				$pos++;
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function _code2utf($num)
1438 1438
 {
1439
-	if($num < 128)
1439
+	if ($num < 128)
1440 1440
 	{
1441 1441
 		return chr($num);
1442 1442
 	}
1443
-	if($num < 2048)
1443
+	if ($num < 2048)
1444 1444
 	{
1445
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1445
+		return chr(($num >> 6) + 192).chr(($num & 63) + 128);
1446 1446
 	}
1447
-	if($num < 65536)
1447
+	if ($num < 65536)
1448 1448
 	{
1449
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1449
+		return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1450 1450
 	}
1451
-	if($num < 2097152)
1451
+	if ($num < 2097152)
1452 1452
 	{
1453
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1453
+		return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1454 1454
 	}
1455 1455
 	return '';
1456 1456
 }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)
1467 1467
 {
1468
-	if($urldecode)
1468
+	if ($urldecode)
1469 1469
 	{
1470 1470
 		$string = urldecode($string);
1471 1471
 	}
@@ -1473,12 +1473,12 @@  discard block
 block discarded – undo
1473 1473
 	$sample = iconv('utf-8', 'utf-8', $string);
1474 1474
 	$is_utf8 = (md5($sample) === md5($string));
1475 1475
 
1476
-	if(!$urldecode)
1476
+	if (!$urldecode)
1477 1477
 	{
1478 1478
 		$string = urldecode($string);
1479 1479
 	}
1480 1480
 
1481
-	if($return_convert)
1481
+	if ($return_convert)
1482 1482
 	{
1483 1483
 		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string);
1484 1484
 	}
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
  */
1495 1495
 function json_encode2($data)
1496 1496
 {
1497
-	switch(gettype($data))
1497
+	switch (gettype($data))
1498 1498
 	{
1499 1499
 		case 'boolean':
1500 1500
 			return $data ? 'true' : 'false';
@@ -1502,15 +1502,15 @@  discard block
 block discarded – undo
1502 1502
 		case 'double':
1503 1503
 			return $data;
1504 1504
 		case 'string':
1505
-			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"';
1505
+			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"';
1506 1506
 		case 'object':
1507 1507
 			$data = get_object_vars($data);
1508 1508
 		case 'array':
1509 1509
 			$rel = FALSE; // relative array?
1510 1510
 			$key = array_keys($data);
1511
-			foreach($key as $v)
1511
+			foreach ($key as $v)
1512 1512
 			{
1513
-				if(!is_int($v))
1513
+				if (!is_int($v))
1514 1514
 				{
1515 1515
 					$rel = TRUE;
1516 1516
 					break;
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
 			}
1519 1519
 
1520 1520
 			$arr = array();
1521
-			foreach($data as $k => $v)
1521
+			foreach ($data as $k => $v)
1522 1522
 			{
1523
-				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v);
1523
+				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v);
1524 1524
 			}
1525 1525
 
1526
-			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']';
1526
+			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']';
1527 1527
 		default:
1528 1528
 			return '""';
1529 1529
 	}
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
  */
1538 1538
 function isCrawler($agent = NULL)
1539 1539
 {
1540
-	if(!$agent)
1540
+	if (!$agent)
1541 1541
 	{
1542 1542
 		$agent = $_SERVER['HTTP_USER_AGENT'];
1543 1543
 	}
@@ -1547,9 +1547,9 @@  discard block
 block discarded – undo
1547 1547
 		/*'211.245.21.110-211.245.21.119' mixsh is closed */
1548 1548
 	);
1549 1549
 
1550
-	foreach($check_agent as $str)
1550
+	foreach ($check_agent as $str)
1551 1551
 	{
1552
-		if(stristr($agent, $str) != FALSE)
1552
+		if (stristr($agent, $str) != FALSE)
1553 1553
 		{
1554 1554
 			return TRUE;
1555 1555
 		}
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
  */
1568 1568
 function stripEmbedTagForAdmin(&$content, $writer_member_srl)
1569 1569
 {
1570
-	if(!Context::get('is_logged'))
1570
+	if (!Context::get('is_logged'))
1571 1571
 	{
1572 1572
 		return;
1573 1573
 	}
@@ -1575,18 +1575,18 @@  discard block
 block discarded – undo
1575 1575
 	$oModuleModel = getModel('module');
1576 1576
 	$logged_info = Context::get('logged_info');
1577 1577
 
1578
-	if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1578
+	if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1579 1579
 	{
1580
-		if($writer_member_srl)
1580
+		if ($writer_member_srl)
1581 1581
 		{
1582 1582
 			$oMemberModel = getModel('member');
1583 1583
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);
1584
-			if($member_info->is_admin == "Y")
1584
+			if ($member_info->is_admin == "Y")
1585 1585
 			{
1586 1586
 				return;
1587 1587
 			}
1588 1588
 		}
1589
-		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>";
1589
+		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>";
1590 1590
 		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content);
1591 1591
 		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content);
1592 1592
 		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content);
@@ -1603,18 +1603,18 @@  discard block
 block discarded – undo
1603 1603
 function requirePear()
1604 1604
 {
1605 1605
 	static $required = false;
1606
-	if($required)
1606
+	if ($required)
1607 1607
 	{
1608 1608
 		return;
1609 1609
 	}
1610 1610
 
1611
-	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1611
+	if (version_compare(PHP_VERSION, "5.3.0") < 0)
1612 1612
 	{
1613
-		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1613
+		set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());
1614 1614
 	}
1615 1615
 	else
1616 1616
 	{
1617
-		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1617
+		set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());
1618 1618
 	}
1619 1619
 
1620 1620
 	$required = true;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 function checkCSRF()
1624 1624
 {
1625
-	if($_SERVER['REQUEST_METHOD'] != 'POST')
1625
+	if ($_SERVER['REQUEST_METHOD'] != 'POST')
1626 1626
 	{
1627 1627
 		return FALSE;
1628 1628
 	}
@@ -1630,9 +1630,9 @@  discard block
 block discarded – undo
1630 1630
 	$default_url = Context::getDefaultUrl();
1631 1631
 	$referer = $_SERVER["HTTP_REFERER"];
1632 1632
 
1633
-	if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1633
+	if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1634 1634
 	{
1635
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1635
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1636 1636
 		$IDN = new idna_convert(array('idn_version' => 2008));
1637 1637
 		$referer = $IDN->encode($referer);
1638 1638
 	}
@@ -1643,9 +1643,9 @@  discard block
 block discarded – undo
1643 1643
 	$oModuleModel = getModel('module');
1644 1644
 	$siteModuleInfo = $oModuleModel->getDefaultMid();
1645 1645
 
1646
-	if($siteModuleInfo->site_srl == 0)
1646
+	if ($siteModuleInfo->site_srl == 0)
1647 1647
 	{
1648
-		if($default_url['host'] !== $referer['host'])
1648
+		if ($default_url['host'] !== $referer['host'])
1649 1649
 		{
1650 1650
 			return FALSE;
1651 1651
 		}
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 	else
1654 1654
 	{
1655 1655
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1656
-		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1656
+		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1657 1657
 		{
1658 1658
 			return FALSE;
1659 1659
 		}
@@ -1669,15 +1669,15 @@  discard block
 block discarded – undo
1669 1669
  */
1670 1670
 function recurciveExposureCheck(&$menu)
1671 1671
 {
1672
-	if(is_array($menu))
1672
+	if (is_array($menu))
1673 1673
 	{
1674
-		foreach($menu AS $key=>$value)
1674
+		foreach ($menu AS $key=>$value)
1675 1675
 		{
1676
-			if(!$value['isShow'])
1676
+			if (!$value['isShow'])
1677 1677
 			{
1678 1678
 				unset($menu[$key]);
1679 1679
 			}
1680
-			if(is_array($value['list']) && count($value['list']) > 0)
1680
+			if (is_array($value['list']) && count($value['list']) > 0)
1681 1681
 			{
1682 1682
 				recurciveExposureCheck($menu[$key]['list']);
1683 1683
 			}
@@ -1687,14 +1687,14 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1689 1689
 {
1690
-	if($requestKey != $dbKey)
1690
+	if ($requestKey != $dbKey)
1691 1691
 	{
1692 1692
 		$arrayUrl = parse_url(Context::get('success_return_url'));
1693
-		if($arrayUrl['query'])
1693
+		if ($arrayUrl['query'])
1694 1694
 		{
1695 1695
 			parse_str($arrayUrl['query'], $parsedStr);
1696 1696
 
1697
-			if(isset($parsedStr[$key]))
1697
+			if (isset($parsedStr[$key]))
1698 1698
 			{
1699 1699
 				$parsedStr[$key] = $requestKey;
1700 1700
 				$successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);
@@ -1737,14 +1737,14 @@  discard block
 block discarded – undo
1737 1737
  */
1738 1738
 function alertScript($msg)
1739 1739
 {
1740
-	if(!$msg)
1740
+	if (!$msg)
1741 1741
 	{
1742 1742
 		return;
1743 1743
 	}
1744 1744
 
1745 1745
 	echo '<script type="text/javascript">
1746 1746
 //<![CDATA[
1747
-alert("' . $msg . '");
1747
+alert("' . $msg.'");
1748 1748
 //]]>
1749 1749
 </script>';
1750 1750
 }
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
 	echo '<script type="text/javascript">
1777 1777
 //<![CDATA[
1778
-' . $reloadScript . '
1778
+' . $reloadScript.'
1779 1779
 //]]>
1780 1780
 </script>';
1781 1781
 }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 function escape_js($str)
1823 1823
 {
1824 1824
 	$flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE;
1825
-	$str = json_encode((string)$str, $flags);
1825
+	$str = json_encode((string) $str, $flags);
1826 1826
 	return substr($str, 1, strlen($str) - 2);
1827 1827
 }
1828 1828
 
@@ -1874,12 +1874,12 @@  discard block
 block discarded – undo
1874 1874
 {
1875 1875
 	if ($limit < 1) $limit = null;
1876 1876
 	$result = array();
1877
-	$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
1877
+	$split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit);
1878 1878
 	foreach ($split as $piece)
1879 1879
 	{
1880 1880
 		if (trim($piece) !== '')
1881 1881
 		{
1882
-			$result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece));
1882
+			$result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece));
1883 1883
 		}
1884 1884
 	}
1885 1885
 	return $result;
Please login to merge, or discard this patch.
Braces   +56 added lines, -68 removed lines patch added patch discarded remove patch
@@ -299,10 +299,11 @@  discard block
 block discarded – undo
299 299
 	$num_args = func_num_args();
300 300
 	$args_list = func_get_args();
301 301
 
302
-	if($num_args)
303
-		$url = Context::getUrl($num_args, $args_list);
304
-	else
305
-		$url = Context::getRequestUri();
302
+	if($num_args) {
303
+			$url = Context::getUrl($num_args, $args_list);
304
+	} else {
305
+			$url = Context::getRequestUri();
306
+	}
306 307
 
307 308
 	return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url);
308 309
 }
@@ -321,8 +322,7 @@  discard block
 block discarded – undo
321 322
 	if($num_args)
322 323
 	{
323 324
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
324
-	}
325
-	else
325
+	} else
326 326
 	{
327 327
 		$url = Context::getRequestUri();
328 328
 	}
@@ -344,8 +344,7 @@  discard block
 block discarded – undo
344 344
 	if($num_args)
345 345
 	{
346 346
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
347
-	}
348
-	else
347
+	} else
349 348
 	{
350 349
 		$url = Context::getRequestUri();
351 350
 	}
@@ -534,13 +533,11 @@  discard block
 block discarded – undo
534 533
 		{
535 534
 			$char_width += (int) $chars[$c - 32];
536 535
 			$idx++;
537
-		}
538
-		else if(191 < $c && $c < 224)
536
+		} else if(191 < $c && $c < 224)
539 537
 		{
540 538
 			$char_width += $chars[4];
541 539
 			$idx += 2;
542
-		}
543
-		else
540
+		} else
544 541
 		{
545 542
 			$char_width += $chars[0];
546 543
 			$idx += 3;
@@ -567,8 +564,7 @@  discard block
 block discarded – undo
567 564
 	if($time_zone < 0)
568 565
 	{
569 566
 		$to = -1;
570
-	}
571
-	else
567
+	} else
572 568
 	{
573 569
 		$to = 1;
574 570
 	}
@@ -580,8 +576,7 @@  discard block
 block discarded – undo
580 576
 	if($server_time_zone < 0)
581 577
 	{
582 578
 		$so = -1;
583
-	}
584
-	else
579
+	} else
585 580
 	{
586 581
 		$so = 1;
587 582
 	}
@@ -622,8 +617,7 @@  discard block
 block discarded – undo
622 617
 	if(strlen($str) <= 8)
623 618
 	{
624 619
 		$gap = 0;
625
-	}
626
-	else
620
+	} else
627 621
 	{
628 622
 		$gap = zgap();
629 623
 	}
@@ -646,20 +640,16 @@  discard block
 block discarded – undo
646 640
 	if($gap < 60)
647 641
 	{
648 642
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
649
-	}
650
-	elseif($gap < 60 * 60)
643
+	} elseif($gap < 60 * 60)
651 644
 	{
652 645
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
653
-	}
654
-	elseif($gap < 60 * 60 * 2)
646
+	} elseif($gap < 60 * 60 * 2)
655 647
 	{
656 648
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
657
-	}
658
-	elseif($gap < 60 * 60 * 24)
649
+	} elseif($gap < 60 * 60 * 24)
659 650
 	{
660 651
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
661
-	}
662
-	else
652
+	} else
663 653
 	{
664 654
 		$buff = zdate($date, $format);
665 655
 	}
@@ -706,12 +696,10 @@  discard block
 block discarded – undo
706 696
 				if($format == 'Y-m-d')
707 697
 				{
708 698
 					$format = 'M d, Y';
709
-				}
710
-				elseif($format == 'Y-m-d H:i:s')
699
+				} elseif($format == 'Y-m-d H:i:s')
711 700
 				{
712 701
 					$format = 'M d, Y H:i:s';
713
-				}
714
-				elseif($format == 'Y-m-d H:i')
702
+				} elseif($format == 'Y-m-d H:i')
715 703
 				{
716 704
 					$format = 'M d, Y H:i';
717 705
 				}
@@ -720,12 +708,10 @@  discard block
 block discarded – undo
720 708
 				if($format == 'Y-m-d')
721 709
 				{
722 710
 					$format = 'd-m-Y';
723
-				}
724
-				elseif($format == 'Y-m-d H:i:s')
711
+				} elseif($format == 'Y-m-d H:i:s')
725 712
 				{
726 713
 					$format = 'H:i:s d-m-Y';
727
-				}
728
-				elseif($format == 'Y-m-d H:i')
714
+				} elseif($format == 'Y-m-d H:i')
729 715
 				{
730 716
 					$format = 'H:i d-m-Y';
731 717
 				}
@@ -761,8 +747,7 @@  discard block
 block discarded – undo
761 747
 		);
762 748
 
763 749
 		$string = strtr($format, $trans);
764
-	}
765
-	else
750
+	} else
766 751
 	{
767 752
 		// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. 
768 753
 		$string = date($format, ztime($str));
@@ -849,8 +834,7 @@  discard block
 block discarded – undo
849 834
 		}
850 835
 
851 836
 		$firephp->fb($debug_output, $label, $type);
852
-	}
853
-	else
837
+	} else
854 838
 	{
855 839
 		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
856 840
 		{
@@ -862,7 +846,9 @@  discard block
 block discarded – undo
862 846
 		{
863 847
 			$debug_file = _XE_PATH_ . 'files/' . $file;
864 848
 		}
865
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
849
+		if(!file_exists($debug_file)) {
850
+			$print[] = '<?php exit() ?>';
851
+		}
866 852
 
867 853
 		if($display_option === TRUE || $display_option === 'ERROR')
868 854
 		{
@@ -875,13 +861,11 @@  discard block
 block discarded – undo
875 861
 			if($display_option === 'ERROR')
876 862
 			{
877 863
 				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
878
-			}
879
-			else
864
+			} else
880 865
 			{
881 866
 				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
882 867
 			}
883
-		}
884
-		else
868
+		} else
885 869
 		{
886 870
 			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
887 871
 		}
@@ -908,7 +892,9 @@  discard block
 block discarded – undo
908 892
  */
909 893
 function writeSlowlog($type, $elapsed_time, $obj)
910 894
 {
911
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
895
+	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) {
896
+		return;
897
+	}
912 898
 
913 899
 	static $log_filename = array(
914 900
 		'query' => 'files/_slowlog_query.php',
@@ -928,25 +914,21 @@  discard block
 block discarded – undo
928 914
 	{
929 915
 		$buff[] = "\tCaller : " . $obj->caller;
930 916
 		$buff[] = "\tCalled : " . $obj->called;
931
-	}
932
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
917
+	} else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
933 918
 	{
934 919
 		$buff[] = "\tAddon : " . $obj->called;
935 920
 		$buff[] = "\tCalled position : " . $obj->caller;
936
-	}
937
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
921
+	} else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
938 922
 	{
939 923
 		$buff[] = "\tWidget : " . $obj->called;
940
-	}
941
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
924
+	} else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
942 925
 	{
943 926
 
944 927
 		$buff[] = $obj->query;
945 928
 		$buff[] = "\tQuery ID   : " . $obj->query_id;
946 929
 		$buff[] = "\tCaller     : " . $obj->caller;
947 930
 		$buff[] = "\tConnection : " . $obj->connection;
948
-	}
949
-	else
931
+	} else
950 932
 	{
951 933
 		$write_file = false;
952 934
 	}
@@ -1038,8 +1020,11 @@  discard block
 block discarded – undo
1038 1020
 
1039 1021
 	foreach($del_vars as $var)
1040 1022
 	{
1041
-		if(is_array($vars)) unset($vars[$var]);
1042
-		else if(is_object($vars)) unset($vars->$var);
1023
+		if(is_array($vars)) {
1024
+			unset($vars[$var]);
1025
+		} else if(is_object($vars)) {
1026
+			unset($vars->$var);
1027
+		}
1043 1028
 	}
1044 1029
 
1045 1030
 	return $vars;
@@ -1183,8 +1168,7 @@  discard block
 block discarded – undo
1183 1168
 		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1184 1169
 		{
1185 1170
 			$content .= '</xmp>';
1186
-		}
1187
-		else if($close_xmp < $start_xmp)
1171
+		} else if($close_xmp < $start_xmp)
1188 1172
 		{
1189 1173
 			$content .= '</xmp>';
1190 1174
 		}
@@ -1241,12 +1225,18 @@  discard block
 block discarded – undo
1241 1225
 
1242 1226
 	$filter_arrts = array('style', 'src', 'href');
1243 1227
 
1244
-	if($tag === 'object') array_push($filter_arrts, 'data');
1245
-	if($tag === 'param') array_push($filter_arrts, 'value');
1228
+	if($tag === 'object') {
1229
+		array_push($filter_arrts, 'data');
1230
+	}
1231
+	if($tag === 'param') {
1232
+		array_push($filter_arrts, 'value');
1233
+	}
1246 1234
 
1247 1235
 	foreach($filter_arrts as $attr)
1248 1236
 	{
1249
-		if(!isset($attrs[$attr])) continue;
1237
+		if(!isset($attrs[$attr])) {
1238
+			continue;
1239
+		}
1250 1240
 
1251 1241
 		$attr_value = rawurldecode($attrs[$attr]);
1252 1242
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
@@ -1410,16 +1400,14 @@  discard block
 block discarded – undo
1410 1400
 				$unicode = hexdec($unicodeHexVal);
1411 1401
 				$decodedStr .= _code2utf($unicode);
1412 1402
 				$pos += 4;
1413
-			}
1414
-			else
1403
+			} else
1415 1404
 			{
1416 1405
 				// we have an escaped ascii character
1417 1406
 				$hexVal = substr($source, $pos, 2);
1418 1407
 				$decodedStr .= chr(hexdec($hexVal));
1419 1408
 				$pos += 2;
1420 1409
 			}
1421
-		}
1422
-		else
1410
+		} else
1423 1411
 		{
1424 1412
 			$decodedStr .= $charAt;
1425 1413
 			$pos++;
@@ -1611,8 +1599,7 @@  discard block
 block discarded – undo
1611 1599
 	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1612 1600
 	{
1613 1601
 		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1614
-	}
1615
-	else
1602
+	} else
1616 1603
 	{
1617 1604
 		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1618 1605
 	}
@@ -1649,8 +1636,7 @@  discard block
 block discarded – undo
1649 1636
 		{
1650 1637
 			return FALSE;
1651 1638
 		}
1652
-	}
1653
-	else
1639
+	} else
1654 1640
 	{
1655 1641
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1656 1642
 		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
@@ -1872,7 +1858,9 @@  discard block
 block discarded – undo
1872 1858
  */
1873 1859
 function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\')
1874 1860
 {
1875
-	if ($limit < 1) $limit = null;
1861
+	if ($limit < 1) {
1862
+		$limit = null;
1863
+	}
1876 1864
 	$result = array();
1877 1865
 	$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
1878 1866
 	foreach ($split as $piece)
Please login to merge, or discard this patch.
classes/template/TemplateHandler.class.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 				//parse error
463 463
 				if ($error_info['type'] == 4)
464 464
 				{
465
-				    throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
465
+					throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
466 466
 				}
467 467
 			}
468 468
 			else
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			//parse error
479 479
 			if ($error_info['type'] == 4)
480 480
 			{
481
-			    throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
481
+				throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
482 482
 			}
483 483
 		}
484 484
 
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
 	}
1024 1024
 
1025 1025
 	/**
1026
- 	 * Apply escape option to an expression.
1027
- 	 */
1026
+	 * Apply escape option to an expression.
1027
+	 */
1028 1028
  	private function _applyEscapeOption($str, $escape_option = 'noescape')
1029 1029
  	{
1030 1030
  		switch($escape_option)
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 	}
1081 1081
 
1082 1082
 	/**
1083
- 	 * Check if a string seems to contain a variable.
1084
- 	 * 
1085
- 	 * @param string $str
1086
- 	 * @return bool
1087
- 	 */
1083
+	 * Check if a string seems to contain a variable.
1084
+	 * 
1085
+	 * @param string $str
1086
+	 * @return bool
1087
+	 */
1088 1088
  	private static function _isVar($str)
1089 1089
  	{
1090 1090
  		return preg_match('@(?<!::|\\\\|(?<!eval\()\')\$([a-z_][a-z0-9_]*)@i', $str) ? true : false;
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	private $path = NULL; ///< target directory
17 17
 	private $filename = NULL; ///< target filename
18 18
 	private $file = NULL; ///< target file (fullpath)
19
-	private $xe_path = NULL;  ///< XpressEngine base path
19
+	private $xe_path = NULL; ///< XpressEngine base path
20 20
 	private $web_path = NULL; ///< tpl file web path
21 21
 	private $compiled_file = NULL; ///< tpl file web path
22 22
 	private $config = NULL;
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		ini_set('pcre.jit', "0");
35 35
 		$this->xe_path = rtrim(getScriptPath(), '/');
36
-		$this->compiled_path = _XE_PATH_ . $this->compiled_path;
36
+		$this->compiled_path = _XE_PATH_.$this->compiled_path;
37 37
 		$this->config = new stdClass();
38 38
 
39 39
 		$this->ignoreEscape = array(
40
-			'html_content' => function ($m) {
40
+			'html_content' => function($m) {
41 41
 				$list = array(
42 42
 					'$content', // 레이아웃 등
43 43
 					'$editor', // 에디터 출력
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				);
53 53
 				return in_array($m[1], $list);
54 54
 			},
55
-			'url' => function ($m) {
55
+			'url' => function($m) {
56 56
 				$list = array(
57 57
 					'getUrl',
58 58
 					'getNotEncodedUrl',
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 				);
68 68
 				return in_array(array_shift(explode('(', $m[1])), $list);
69 69
 			},
70
-			'methods' => function ($m) {
70
+			'methods' => function($m) {
71 71
 				$list = array(
72 72
 					'getEditor',
73 73
 					'getCommentEditor',
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 					'getSignature', // 회원 서명
77 77
 					'printExtraImages', // new, file 아이콘 등
78 78
 				);
79
-				return preg_match('/\-\>(' . implode('|', $list) . ')\(/', $m[1]);
79
+				return preg_match('/\-\>('.implode('|', $list).')\(/', $m[1]);
80 80
 			},
81
-			'functions' => function ($m) {
81
+			'functions' => function($m) {
82 82
 				$list = array(
83 83
 					'htmlspecialchars',
84 84
 				);
85
-				return preg_match('/^(' . implode('|', $list) . ')\(/', $m[1]);
85
+				return preg_match('/^('.implode('|', $list).')\(/', $m[1]);
86 86
 			},
87
-			'lang' => function ($m) {
87
+			'lang' => function($m) {
88 88
 				// 다국어
89 89
 				return preg_match('/^\$lang\-\>/', trim($m[1]));
90 90
 			}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	{
102 102
 		static $oTemplate = NULL;
103 103
 
104
-		if(__DEBUG__ == 3)
104
+		if (__DEBUG__ == 3)
105 105
 		{
106
-			if(!isset($GLOBALS['__TemplateHandlerCalled__']))
106
+			if (!isset($GLOBALS['__TemplateHandlerCalled__']))
107 107
 			{
108 108
 				$GLOBALS['__TemplateHandlerCalled__'] = 1;
109 109
 			}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			}
114 114
 		}
115 115
 
116
-		if(!$oTemplate)
116
+		if (!$oTemplate)
117 117
 		{
118 118
 			$oTemplate = new TemplateHandler();
119 119
 		}
@@ -131,23 +131,23 @@  discard block
 block discarded – undo
131 131
 	protected function init($tpl_path, $tpl_filename, $tpl_file = '')
132 132
 	{
133 133
 		// verify arguments
134
-		if(substr($tpl_path, -1) != '/')
134
+		if (substr($tpl_path, -1) != '/')
135 135
 		{
136 136
 			$tpl_path .= '/';
137 137
 		}
138
-		if(!is_dir($tpl_path))
138
+		if (!is_dir($tpl_path))
139 139
 		{
140 140
 			return;
141 141
 		}
142
-		if(!file_exists($tpl_path . $tpl_filename) && file_exists($tpl_path . $tpl_filename . '.html'))
142
+		if (!file_exists($tpl_path.$tpl_filename) && file_exists($tpl_path.$tpl_filename.'.html'))
143 143
 		{
144 144
 			$tpl_filename .= '.html';
145 145
 		}
146 146
 
147 147
 		// create tpl_file variable
148
-		if(!$tpl_file)
148
+		if (!$tpl_file)
149 149
 		{
150
-			$tpl_file = $tpl_path . $tpl_filename;
150
+			$tpl_file = $tpl_path.$tpl_filename;
151 151
 		}
152 152
 
153 153
 		// set template file infos.
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		$this->filename = $tpl_filename;
156 156
 		$this->file = $tpl_file;
157 157
 
158
-		$this->web_path = $this->xe_path . '/' . ltrim(preg_replace('@^' . preg_quote(_XE_PATH_, '@') . '|\./@', '', $this->path), '/');
158
+		$this->web_path = $this->xe_path.'/'.ltrim(preg_replace('@^'.preg_quote(_XE_PATH_, '@').'|\./@', '', $this->path), '/');
159 159
 
160 160
 		// get compiled file name
161
-		$hash = md5($this->file . __XE_VERSION__);
161
+		$hash = md5($this->file.__XE_VERSION__);
162 162
 		$this->compiled_file = "{$this->compiled_path}{$hash}.compiled.php";
163 163
 
164 164
 		$this->safeguard = $this->isSafeguard();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		$buff = false;
182 182
 
183 183
 		// store the starting time for debug information
184
-		if(__DEBUG__ == 3)
184
+		if (__DEBUG__ == 3)
185 185
 		{
186 186
 			$start = getMicroTime();
187 187
 		}
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 		$this->init($tpl_path, $tpl_filename, $tpl_file);
191 191
 
192 192
 		// if target file does not exist exit
193
-		if(!$this->file || !file_exists($this->file))
193
+		if (!$this->file || !file_exists($this->file))
194 194
 		{
195 195
 			return "Err : '{$this->file}' template file does not exists.";
196 196
 		}
197 197
 
198 198
 		// for backward compatibility
199
-		if(is_null(self::$rootTpl))
199
+		if (is_null(self::$rootTpl))
200 200
 		{
201 201
 			self::$rootTpl = $this->file;
202 202
 		}
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
 		$oCacheHandler = CacheHandler::getInstance('template');
209 209
 
210 210
 		// get cached buff
211
-		if($oCacheHandler->isSupport())
211
+		if ($oCacheHandler->isSupport())
212 212
 		{
213
-			$cache_key = 'template:' . $this->file;
213
+			$cache_key = 'template:'.$this->file;
214 214
 			$buff = $oCacheHandler->get($cache_key, $latest_mtime);
215 215
 		}
216 216
 		else
217 217
 		{
218
-			if(is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file))
218
+			if (is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file))
219 219
 			{
220
-				$buff = 'file://' . $this->compiled_file;
220
+				$buff = 'file://'.$this->compiled_file;
221 221
 			}
222 222
 		}
223 223
 
224
-		if($buff === FALSE)
224
+		if ($buff === FALSE)
225 225
 		{
226 226
 			$buff = $this->parse();
227
-			if($oCacheHandler->isSupport())
227
+			if ($oCacheHandler->isSupport())
228 228
 			{
229 229
 				$oCacheHandler->put($cache_key, $buff);
230 230
 			}
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$output = $this->_fetch($buff);
238 238
 
239
-		if($__templatehandler_root_tpl == $this->file)
239
+		if ($__templatehandler_root_tpl == $this->file)
240 240
 		{
241 241
 			$__templatehandler_root_tpl = null;
242 242
 		}
243 243
 
244 244
 		// store the ending time for debug information
245
-		if(__DEBUG__ == 3)
245
+		if (__DEBUG__ == 3)
246 246
 		{
247 247
 			$GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
248 248
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		$this->init($tpl_path, $tpl_filename, null);
262 262
 
263 263
 		// if target file does not exist exit
264
-		if(!$this->file || !file_exists($this->file))
264
+		if (!$this->file || !file_exists($this->file))
265 265
 		{
266 266
 			Context::close();
267 267
 			exit("Cannot find the template file: '{$this->file}'");
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	protected function parse($buff = null)
279 279
 	{
280
-		if(is_null($buff))
280
+		if (is_null($buff))
281 281
 		{
282
-			if(!is_readable($this->file))
282
+			if (!is_readable($this->file))
283 283
 			{
284 284
 				return;
285 285
 			}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 
291 291
 		// HTML tags to skip
292
-		if(is_null($this->skipTags))
292
+		if (is_null($this->skipTags))
293 293
 		{
294 294
 			$this->skipTags = array('marquee');
295 295
 		}
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 		$this->config = new stdClass();
300 300
 		$this->config->autoescape = null;
301 301
 
302
-		if(preg_match('/\<config( [^\>\/]+)/', $buff, $config_match))
302
+		if (preg_match('/\<config( [^\>\/]+)/', $buff, $config_match))
303 303
 		{
304
-			if(preg_match_all('@ (?<name>\w+)="(?<value>[^"]+)"@', $config_match[1], $config_matches, PREG_SET_ORDER))
304
+			if (preg_match_all('@ (?<name>\w+)="(?<value>[^"]+)"@', $config_match[1], $config_matches, PREG_SET_ORDER))
305 305
 			{
306
-				foreach($config_matches as $config_match)
306
+				foreach ($config_matches as $config_match)
307 307
 				{
308
-					if($config_match['name'] === 'autoescape')
308
+					if ($config_match['name'] === 'autoescape')
309 309
 					{
310 310
 						$this->config->autoescape = $config_match['value'];
311 311
 					}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			}
314 314
 		}
315 315
 
316
-		if($this->config->autoescape === 'on') $this->safeguard = true;
316
+		if ($this->config->autoescape === 'on') $this->safeguard = true;
317 317
 
318 318
 		// replace comments
319 319
 		$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
 
333 333
 		// form auto generation
334 334
 		$temp = preg_replace_callback('/(<form(?:<\?php.+?\?>|[^<>]+)*?>)(.*?)(<\/form>)/is', array($this, '_compileFormAuthGeneration'), $buff);
335
-		if($temp)
335
+		if ($temp)
336 336
 		{
337 337
 			$buff = $temp;
338 338
 		}
339 339
 
340 340
 		// prevent from calling directly before writing into file
341
-		$buff = '<?php if(!defined("__XE__"))exit;?>' . $buff;
341
+		$buff = '<?php if(!defined("__XE__"))exit;?>'.$buff;
342 342
 
343 343
 		// remove php script reopening
344 344
 		$buff = preg_replace(array('/(\n|\r\n)+/', '/(;)?( )*\?\>\<\?php([\n\t ]+)?/'), array("\n", ";\n"), $buff);
@@ -361,40 +361,40 @@  discard block
 block discarded – undo
361 361
 	private function _compileFormAuthGeneration($matches)
362 362
 	{
363 363
 		// form ruleset attribute move to hidden tag
364
-		if($matches[1])
364
+		if ($matches[1])
365 365
 		{
366 366
 			preg_match('/ruleset="([^"]*?)"/is', $matches[1], $m);
367
-			if($m[0])
367
+			if ($m[0])
368 368
 			{
369
-				$matches[1] = preg_replace('/' . addcslashes($m[0], '?$') . '/i', '', $matches[1]);
369
+				$matches[1] = preg_replace('/'.addcslashes($m[0], '?$').'/i', '', $matches[1]);
370 370
 
371
-				if(strpos($m[1], '@') !== FALSE)
371
+				if (strpos($m[1], '@') !== FALSE)
372 372
 				{
373 373
 					$path = str_replace('@', '', $m[1]);
374
-					$path = './files/ruleset/' . $path . '.xml';
374
+					$path = './files/ruleset/'.$path.'.xml';
375 375
 				}
376
-				else if(strpos($m[1], '#') !== FALSE)
376
+				else if (strpos($m[1], '#') !== FALSE)
377 377
 				{
378 378
 					$fileName = str_replace('#', '', $m[1]);
379 379
 					$fileName = str_replace('<?php echo ', '', $fileName);
380 380
 					$fileName = str_replace(' ?>', '', $fileName);
381
-					$path = '#./files/ruleset/' . $fileName . '.xml';
381
+					$path = '#./files/ruleset/'.$fileName.'.xml';
382 382
 
383 383
 					preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm);
384 384
 					$module_path = $mm[1];
385 385
 					list($rulsetFile) = explode('.', $fileName);
386
-					$autoPath = $module_path . '/ruleset/' . $rulsetFile . '.xml';
386
+					$autoPath = $module_path.'/ruleset/'.$rulsetFile.'.xml';
387 387
 					$m[1] = $rulsetFile;
388 388
 				}
389
-				else if(preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm))
389
+				else if (preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm))
390 390
 				{
391 391
 					$module_path = $mm[1];
392
-					$path = $module_path . '/ruleset/' . $m[1] . '.xml';
392
+					$path = $module_path.'/ruleset/'.$m[1].'.xml';
393 393
 				}
394 394
 
395
-				$matches[2] = '<input type="hidden" name="ruleset" value="' . $m[1] . '" />' . $matches[2];
395
+				$matches[2] = '<input type="hidden" name="ruleset" value="'.$m[1].'" />'.$matches[2];
396 396
 				//assign to addJsFile method for js dynamic recache
397
-				$matches[1] = '<?php Context::addJsFile("' . $path . '", FALSE, "", 0, "body", TRUE, "' . $autoPath . '") ?' . '>' . $matches[1];
397
+				$matches[1] = '<?php Context::addJsFile("'.$path.'", FALSE, "", 0, "body", TRUE, "'.$autoPath.'") ?'.'>'.$matches[1];
398 398
 			}
399 399
 		}
400 400
 
@@ -402,22 +402,22 @@  discard block
 block discarded – undo
402 402
 		preg_match_all('/<input[^>]* name="(act|mid|vid)"/is', $matches[2], $m2);
403 403
 		$checkVar = array('act', 'mid', 'vid');
404 404
 		$resultArray = array_diff($checkVar, $m2[1]);
405
-		if(is_array($resultArray))
405
+		if (is_array($resultArray))
406 406
 		{
407 407
 			$generatedHidden = '';
408
-			foreach($resultArray AS $key => $value)
408
+			foreach ($resultArray AS $key => $value)
409 409
 			{
410
-				$generatedHidden .= '<input type="hidden" name="' . $value . '" value="<?php echo $__Context->' . $value . ' ?>" />';
410
+				$generatedHidden .= '<input type="hidden" name="'.$value.'" value="<?php echo $__Context->'.$value.' ?>" />';
411 411
 			}
412
-			$matches[2] = $generatedHidden . $matches[2];
412
+			$matches[2] = $generatedHidden.$matches[2];
413 413
 		}
414 414
 
415 415
 		// return url generate
416
-		if(!preg_match('/no-error-return-url="true"/i', $matches[1]))
416
+		if (!preg_match('/no-error-return-url="true"/i', $matches[1]))
417 417
 		{
418 418
 			preg_match('/<input[^>]*name="error_return_url"[^>]*>/is', $matches[2], $m3);
419
-			if(!$m3[0])
420
-				$matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />' . $matches[2];
419
+			if (!$m3[0])
420
+				$matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />'.$matches[2];
421 421
 		}
422 422
 		else
423 423
 		{
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	private function _fetch($buff)
437 437
 	{
438
-		if(!$buff)
438
+		if (!$buff)
439 439
 		{
440 440
 			return;
441 441
 		}
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
 		$__Context = &$GLOBALS['__Context__'];
444 444
 		$__Context->tpl_path = $this->path;
445 445
 
446
-		if($_SESSION['is_logged'])
446
+		if ($_SESSION['is_logged'])
447 447
 		{
448 448
 			$__Context->logged_info = Context::get('logged_info');
449 449
 		}
450 450
 
451 451
 		$level = ob_get_level();
452 452
 		ob_start();
453
-		if(substr($buff, 0, 7) == 'file://')
453
+		if (substr($buff, 0, 7) == 'file://')
454 454
 		{
455
-			if(__DEBUG__)
455
+			if (__DEBUG__)
456 456
 			{
457 457
 				//load cache file from disk
458 458
 				$eval_str = FileHandler::readFile(substr($buff, 7));
459
-				$eval_str_buffed = "?>" . $eval_str;
459
+				$eval_str_buffed = "?>".$eval_str;
460 460
 				@eval($eval_str_buffed);
461 461
 				$error_info = error_get_last();
462 462
 				//parse error
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		}
473 473
 		else
474 474
 		{
475
-			$eval_str = "?>" . $buff;
475
+			$eval_str = "?>".$buff;
476 476
 			@eval($eval_str);
477 477
 			$error_info = error_get_last();
478 478
 			//parse error
@@ -501,31 +501,31 @@  discard block
 block discarded – undo
501 501
 	private function _replacePath($match)
502 502
 	{
503 503
 		//return origin conde when src value started '${'.
504
-		if(preg_match('@^\${@', $match[1]))
504
+		if (preg_match('@^\${@', $match[1]))
505 505
 		{
506 506
 			return $match[0];
507 507
 		}
508 508
 
509 509
 		//return origin code when src value include variable.
510
-		if(preg_match('@^[\'|"]\s*\.\s*\$@', $match[1]))
510
+		if (preg_match('@^[\'|"]\s*\.\s*\$@', $match[1]))
511 511
 		{
512 512
 			return $match[0];
513 513
 		}
514 514
 
515 515
 		$src = preg_replace('@^(\./)+@', '', trim($match[1]));
516 516
 
517
-		$src = $this->web_path . $src;
517
+		$src = $this->web_path.$src;
518 518
 		$src = str_replace('/./', '/', $src);
519 519
 
520 520
 		// for backward compatibility
521 521
 		$src = preg_replace('@/((?:[\w-]+/)+)\1@', '/\1', $src);
522 522
 
523
-		while(($tmp = preg_replace('@[^/]+/\.\./@', '', $src, 1)) !== $src)
523
+		while (($tmp = preg_replace('@[^/]+/\.\./@', '', $src, 1)) !== $src)
524 524
 		{
525 525
 			$src = $tmp;
526 526
 		}
527 527
 
528
-		return substr($match[0], 0, -strlen($match[1]) - 6) . "src=\"{$src}\"";
528
+		return substr($match[0], 0, -strlen($match[1]) - 6)."src=\"{$src}\"";
529 529
 	}
530 530
 
531 531
 	/**
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
 	 */
536 536
 	private function _parseInline($buff)
537 537
 	{
538
-		if(!preg_match_all('/<([a-zA-Z]+\d?)(?:\s)/', $buff, $match))
538
+		if (!preg_match_all('/<([a-zA-Z]+\d?)(?:\s)/', $buff, $match))
539 539
 		{
540 540
 			return $buff;
541 541
 		}
542 542
 
543 543
 		$tags = array_diff(array_unique($match[1]), $this->skipTags);
544 544
 
545
-		if(!count($tags))
545
+		if (!count($tags))
546 546
 		{
547 547
 			return $buff;
548 548
 		}
549 549
 
550
-		$tags = '(?:' . implode('|', $tags) . ')';
550
+		$tags = '(?:'.implode('|', $tags).')';
551 551
 		$split_regex = "@(<(?>/?{$tags})(?>[^<>\{\}\"']+|<!--.*?-->|{[^}]+}|\".*?\"|'.*?'|.)*?>)@s";
552 552
 
553 553
 		$nodes = preg_split($split_regex, $buff, -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 		// list of self closing tags
556 556
 		$self_closing = array('area' => 1, 'base' => 1, 'basefont' => 1, 'br' => 1, 'hr' => 1, 'input' => 1, 'img' => 1, 'link' => 1, 'meta' => 1, 'param' => 1, 'frame' => 1, 'col' => 1);
557 557
 
558
-		for($idx = 1, $node_len = count($nodes); $idx < $node_len; $idx+=2)
558
+		for ($idx = 1, $node_len = count($nodes); $idx < $node_len; $idx += 2)
559 559
 		{
560
-			if(!($node = $nodes[$idx]))
560
+			if (!($node = $nodes[$idx]))
561 561
 			{
562 562
 				continue;
563 563
 			}
564 564
 
565
-			if(preg_match_all('@\s(loop|cond)="([^"]+)"@', $node, $matches))
565
+			if (preg_match_all('@\s(loop|cond)="([^"]+)"@', $node, $matches))
566 566
 			{
567 567
 				// this tag
568 568
 				$tag = substr($node, 1, strpos($node, ' ') - 1);
@@ -571,37 +571,37 @@  discard block
 block discarded – undo
571 571
 				$closing = 0;
572 572
 
573 573
 				// process opening tag
574
-				foreach($matches[1] as $n => $stmt)
574
+				foreach ($matches[1] as $n => $stmt)
575 575
 				{
576 576
 					$expr = $matches[2][$n];
577 577
 					$expr = $this->_replaceVar($expr);
578 578
 					$closing++;
579 579
 
580
-					switch($stmt)
580
+					switch ($stmt)
581 581
 					{
582 582
 						case 'cond':
583 583
 							$nodes[$idx - 1] .= "<?php if({$expr}){ ?>";
584 584
 							break;
585 585
 						case 'loop':
586
-							if(!preg_match('@^(?:(.+?)=>(.+?)(?:,(.+?))?|(.*?;.*?;.*?)|(.+?)\s*=\s*(.+?))$@', $expr, $expr_m))
586
+							if (!preg_match('@^(?:(.+?)=>(.+?)(?:,(.+?))?|(.*?;.*?;.*?)|(.+?)\s*=\s*(.+?))$@', $expr, $expr_m))
587 587
 							{
588 588
 								break;
589 589
 							}
590
-							if($expr_m[1])
590
+							if ($expr_m[1])
591 591
 							{
592 592
 								$expr_m[1] = trim($expr_m[1]);
593 593
 								$expr_m[2] = trim($expr_m[2]);
594
-								if($expr_m[3])
594
+								if ($expr_m[3])
595 595
 								{
596
-									$expr_m[2] .= '=>' . trim($expr_m[3]);
596
+									$expr_m[2] .= '=>'.trim($expr_m[3]);
597 597
 								}
598 598
 								$nodes[$idx - 1] .= "<?php if({$expr_m[1]}&&count({$expr_m[1]}))foreach({$expr_m[1]} as {$expr_m[2]}){ ?>";
599 599
 							}
600
-							elseif($expr_m[4])
600
+							elseif ($expr_m[4])
601 601
 							{
602 602
 								$nodes[$idx - 1] .= "<?php for({$expr_m[4]}){ ?>";
603 603
 							}
604
-							elseif($expr_m[5])
604
+							elseif ($expr_m[5])
605 605
 							{
606 606
 								$nodes[$idx - 1] .= "<?php while({$expr_m[5]}={$expr_m[6]}){ ?>";
607 607
 							}
@@ -611,28 +611,28 @@  discard block
 block discarded – undo
611 611
 				$node = preg_replace('@\s(loop|cond)="([^"]+)"@', '', $node);
612 612
 
613 613
 				// find closing tag
614
-				$close_php = '<?php ' . str_repeat('}', $closing) . ' ?>';
614
+				$close_php = '<?php '.str_repeat('}', $closing).' ?>';
615 615
 				//  self closing tag
616
-				if($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag]))
616
+				if ($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag]))
617 617
 				{
618
-					$nodes[$idx + 1] = $close_php . $nodes[$idx + 1];
618
+					$nodes[$idx + 1] = $close_php.$nodes[$idx + 1];
619 619
 				}
620 620
 				else
621 621
 				{
622 622
 					$depth = 1;
623
-					for($i = $idx + 2; $i < $node_len; $i+=2)
623
+					for ($i = $idx + 2; $i < $node_len; $i += 2)
624 624
 					{
625 625
 						$nd = $nodes[$i];
626
-						if(strpos($nd, $tag) === 1)
626
+						if (strpos($nd, $tag) === 1)
627 627
 						{
628 628
 							$depth++;
629 629
 						}
630
-						elseif(strpos($nd, '/' . $tag) === 1)
630
+						elseif (strpos($nd, '/'.$tag) === 1)
631 631
 						{
632 632
 							$depth--;
633
-							if(!$depth)
633
+							if (!$depth)
634 634
 							{
635
-								$nodes[$i - 1] .= $nodes[$i] . $close_php;
635
+								$nodes[$i - 1] .= $nodes[$i].$close_php;
636 636
 								$nodes[$i] = '';
637 637
 								break;
638 638
 							}
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
 				}
642 642
 			}
643 643
 
644
-			if(strpos($node, '|cond="') !== false)
644
+			if (strpos($node, '|cond="') !== false)
645 645
 			{
646 646
 				$node = preg_replace('@(\s[-\w:]+(?:="[^"]+?")?)\|cond="(.+?)"@s', '<?php if($2){ ?>$1<?php } ?>', $node);
647 647
 				$node = $this->_replaceVar($node);
648 648
 			}
649 649
 
650
-			if($nodes[$idx] != $node)
650
+			if ($nodes[$idx] != $node)
651 651
 			{
652 652
 				$nodes[$idx] = $node;
653 653
 			}
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	{
669 669
 		$escape_option = 'noescape';
670 670
 
671
-		if($this->safeguard)
671
+		if ($this->safeguard)
672 672
 		{
673 673
 			$escape_option = 'autoescape';
674 674
 		}
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 		}
680 680
 
681 681
 		// {@ ... } or {$var} or {func(...)}
682
-		if($m[1])
682
+		if ($m[1])
683 683
 		{
684
-			if(preg_match('@^(\w+)\(@', $m[1], $mm) && !function_exists($mm[1]))
684
+			if (preg_match('@^(\w+)\(@', $m[1], $mm) && !function_exists($mm[1]))
685 685
 			{
686 686
 				return $m[0];
687 687
 			}
688 688
 			
689
-			if($m[1]{0} == '@')
689
+			if ($m[1]{0} == '@')
690 690
 			{
691 691
 				$m[1] = $this->_replaceVar(substr($m[1], 1));
692 692
 				return "<?php {$m[1]} ?>";
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 				// Get escape options.
697 697
 				foreach ($this->ignoreEscape as $key => $value)
698 698
 				{
699
-					if($this->ignoreEscape[$key]($m))
699
+					if ($this->ignoreEscape[$key]($m))
700 700
 					{
701 701
 						$escape_option = 'noescape';
702 702
 						break;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 						$filter_option = $matches[2];
728 728
 						if (!self::_isVar($filter_option) && !preg_match("/^'.*'$/", $filter_option) && !preg_match('/^".*"$/', $filter_option))
729 729
 						{
730
-							$filter_option = "'" . escape_sqstr($filter_option) . "'";
730
+							$filter_option = "'".escape_sqstr($filter_option)."'";
731 731
 						}
732 732
 						else
733 733
 						{
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
 				}
827 827
 
828 828
 				// Apply the escape option and return.
829
-				return '<?php echo ' . $this->_applyEscapeOption($var, $escape_option) . ' ?>';
829
+				return '<?php echo '.$this->_applyEscapeOption($var, $escape_option).' ?>';
830 830
 			}
831 831
 		}
832 832
 
833
-		if($m[3])
833
+		if ($m[3])
834 834
 		{
835 835
 			$attr = array();
836
-			if($m[5])
836
+			if ($m[5])
837 837
 			{
838
-				if(preg_match_all('@,(\w+)="([^"]+)"@', $m[6], $mm))
838
+				if (preg_match_all('@,(\w+)="([^"]+)"@', $m[6], $mm))
839 839
 				{
840
-					foreach($mm[1] as $idx => $name)
840
+					foreach ($mm[1] as $idx => $name)
841 841
 					{
842 842
 						$attr[$name] = $mm[2][$idx];
843 843
 					}
@@ -846,21 +846,21 @@  discard block
 block discarded – undo
846 846
 			}
847 847
 			else
848 848
 			{
849
-				if(!preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $mm))
849
+				if (!preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $mm))
850 850
 				{
851 851
 					return $m[0];
852 852
 				}
853
-				foreach($mm[1] as $idx => $name)
853
+				foreach ($mm[1] as $idx => $name)
854 854
 				{
855 855
 					$attr[$name] = $mm[2][$idx];
856 856
 				}
857 857
 			}
858 858
 
859
-			switch($m[3])
859
+			switch ($m[3])
860 860
 			{
861 861
 				// <!--#include--> or <include ..>
862 862
 				case 'include':
863
-					if(!$this->file || !$attr['target'])
863
+					if (!$this->file || !$attr['target'])
864 864
 					{
865 865
 						return '';
866 866
 					}
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 					$pathinfo = pathinfo($attr['target']);
869 869
 					$fileDir = $this->_getRelativeDir($pathinfo['dirname']);
870 870
 
871
-					if(!$fileDir)
871
+					if (!$fileDir)
872 872
 					{
873 873
 						return '';
874 874
 					}
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 				case 'load_js_plugin':
879 879
 					$plugin = $this->_replaceVar($m[5]);
880 880
 					$s = "<!--#JSPLUGIN:{$plugin}-->";
881
-					if(strpos($plugin, '$__Context') === false)
881
+					if (strpos($plugin, '$__Context') === false)
882 882
 					{
883 883
 						$plugin = "'{$plugin}'";
884 884
 					}
@@ -894,13 +894,13 @@  discard block
 block discarded – undo
894 894
 					$doUnload = ($m[3] === 'unload');
895 895
 					$isRemote = !!preg_match('@^(https?:)?//@i', $attr['target']);
896 896
 
897
-					if(!$isRemote)
897
+					if (!$isRemote)
898 898
 					{
899
-						if(!preg_match('@^\.?/@', $attr['target']))
899
+						if (!preg_match('@^\.?/@', $attr['target']))
900 900
 						{
901
-							$attr['target'] = './' . $attr['target'];
901
+							$attr['target'] = './'.$attr['target'];
902 902
 						}
903
-						if(substr($attr['target'], -5) == '/lang')
903
+						if (substr($attr['target'], -5) == '/lang')
904 904
 						{
905 905
 							$pathinfo['dirname'] .= '/lang';
906 906
 							$pathinfo['basename'] = '';
@@ -909,18 +909,18 @@  discard block
 block discarded – undo
909 909
 
910 910
 						$relativeDir = $this->_getRelativeDir($pathinfo['dirname']);
911 911
 
912
-						$attr['target'] = $relativeDir . '/' . $pathinfo['basename'];
912
+						$attr['target'] = $relativeDir.'/'.$pathinfo['basename'];
913 913
 					}
914 914
 
915
-					switch($pathinfo['extension'])
915
+					switch ($pathinfo['extension'])
916 916
 					{
917 917
 						case 'xml':
918
-							if($isRemote || $doUnload)
918
+							if ($isRemote || $doUnload)
919 919
 							{
920 920
 								return '';
921 921
 							}
922 922
 							// language file?
923
-							if($pathinfo['basename'] == 'lang.xml' || substr($pathinfo['dirname'], -5) == '/lang')
923
+							if ($pathinfo['basename'] == 'lang.xml' || substr($pathinfo['dirname'], -5) == '/lang')
924 924
 							{
925 925
 								$result = "Context::loadLang('{$relativeDir}');";
926 926
 							}
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 							}
931 931
 							break;
932 932
 						case 'js':
933
-							if($doUnload)
933
+							if ($doUnload)
934 934
 							{
935 935
 								$result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}');";
936 936
 							}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 							}
942 942
 							break;
943 943
 						case 'css':
944
-							if($doUnload)
944
+							if ($doUnload)
945 945
 							{
946 946
 								$result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}','{$attr['media']}');";
947 947
 							}
@@ -954,20 +954,20 @@  discard block
 block discarded – undo
954 954
 					}
955 955
 
956 956
 					$result = "<?php {$result} ?>";
957
-					if($metafile)
957
+					if ($metafile)
958 958
 					{
959
-						$result = "<!--#Meta:{$metafile}-->" . $result;
959
+						$result = "<!--#Meta:{$metafile}-->".$result;
960 960
 					}
961 961
 
962 962
 					return $result;
963 963
 				// <config ...>
964 964
 				case 'config':
965 965
 					$result = '';
966
-					if(preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $config_matches, PREG_SET_ORDER))
966
+					if (preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $config_matches, PREG_SET_ORDER))
967 967
 					{
968
-						foreach($config_matches as $config_match)
968
+						foreach ($config_matches as $config_match)
969 969
 						{
970
-							$result .= "\$this->config->{$config_match[1]} = '" . trim(strtolower($config_match[2])) . "';";
970
+							$result .= "\$this->config->{$config_match[1]} = '".trim(strtolower($config_match[2]))."';";
971 971
 						}
972 972
 					}
973 973
 					return "<?php {$result} ?>";
@@ -975,45 +975,45 @@  discard block
 block discarded – undo
975 975
 		}
976 976
 
977 977
 		// <[email protected]> such as <!--@if($cond)-->, <!--@else-->, <!--@end-->
978
-		if($m[7])
978
+		if ($m[7])
979 979
 		{
980 980
 			$m[7] = substr($m[7], 1);
981
-			if(!$m[7])
981
+			if (!$m[7])
982 982
 			{
983
-				return '<?php ' . $this->_replaceVar($m[8]) . '{ ?>' . $m[9];
983
+				return '<?php '.$this->_replaceVar($m[8]).'{ ?>'.$m[9];
984 984
 			}
985
-			if(!preg_match('/^(?:((?:end)?(?:if|switch|for(?:each)?|while)|end)|(else(?:if)?)|(break@)?(case|default)|(break))$/', $m[7], $mm))
985
+			if (!preg_match('/^(?:((?:end)?(?:if|switch|for(?:each)?|while)|end)|(else(?:if)?)|(break@)?(case|default)|(break))$/', $m[7], $mm))
986 986
 			{
987 987
 				return '';
988 988
 			}
989
-			if($mm[1])
989
+			if ($mm[1])
990 990
 			{
991
-				if($mm[1]{0} == 'e')
991
+				if ($mm[1]{0} == 'e')
992 992
 				{
993
-					return '<?php } ?>' . $m[9];
993
+					return '<?php } ?>'.$m[9];
994 994
 				}
995 995
 
996 996
 				$precheck = '';
997
-				if($mm[1] == 'switch')
997
+				if ($mm[1] == 'switch')
998 998
 				{
999 999
 					$m[9] = '';
1000 1000
 				}
1001
-				elseif($mm[1] == 'foreach')
1001
+				elseif ($mm[1] == 'foreach')
1002 1002
 				{
1003 1003
 					$var = preg_replace('/^\s*\(\s*(.+?) .*$/', '$1', $m[8]);
1004 1004
 					$precheck = "if({$var}&&count({$var}))";
1005 1005
 				}
1006
-				return '<?php ' . $this->_replaceVar($precheck . $m[7] . $m[8]) . '{ ?>' . $m[9];
1006
+				return '<?php '.$this->_replaceVar($precheck.$m[7].$m[8]).'{ ?>'.$m[9];
1007 1007
 			}
1008
-			if($mm[2])
1008
+			if ($mm[2])
1009 1009
 			{
1010
-				return "<?php }{$m[7]}" . $this->_replaceVar($m[8]) . "{ ?>" . $m[9];
1010
+				return "<?php }{$m[7]}".$this->_replaceVar($m[8])."{ ?>".$m[9];
1011 1011
 			}
1012
-			if($mm[4])
1012
+			if ($mm[4])
1013 1013
 			{
1014
-				return "<?php " . ($mm[3] ? 'break;' : '') . "{$m[7]} " . trim($m[8], '()') . ": ?>" . $m[9];
1014
+				return "<?php ".($mm[3] ? 'break;' : '')."{$m[7]} ".trim($m[8], '()').": ?>".$m[9];
1015 1015
 			}
1016
-			if($mm[5])
1016
+			if ($mm[5])
1017 1017
 			{
1018 1018
 				return "<?php break; ?>";
1019 1019
 			}
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
  	 */
1028 1028
  	private function _applyEscapeOption($str, $escape_option = 'noescape')
1029 1029
  	{
1030
- 		switch($escape_option)
1030
+ 		switch ($escape_option)
1031 1031
  		{
1032 1032
  			case 'escape':
1033 1033
  				return "escape({$str}, true)";
@@ -1051,30 +1051,30 @@  discard block
 block discarded – undo
1051 1051
 		$_path = $path;
1052 1052
 
1053 1053
 		$fileDir = strtr(realpath($this->path), '\\', '/');
1054
-		if($path{0} != '/')
1054
+		if ($path{0} != '/')
1055 1055
 		{
1056
-			$path = strtr(realpath($fileDir . '/' . $path), '\\', '/');
1056
+			$path = strtr(realpath($fileDir.'/'.$path), '\\', '/');
1057 1057
 		}
1058 1058
 
1059 1059
 		// for backward compatibility
1060
-		if(!$path)
1060
+		if (!$path)
1061 1061
 		{
1062 1062
 			$dirs = explode('/', $fileDir);
1063 1063
 			$paths = explode('/', $_path);
1064 1064
 			$idx = array_search($paths[0], $dirs);
1065 1065
 
1066
-			if($idx !== false)
1066
+			if ($idx !== false)
1067 1067
 			{
1068
-				while($dirs[$idx] && $dirs[$idx] === $paths[0])
1068
+				while ($dirs[$idx] && $dirs[$idx] === $paths[0])
1069 1069
 				{
1070 1070
 					array_splice($dirs, $idx, 1);
1071 1071
 					array_shift($paths);
1072 1072
 				}
1073
-				$path = strtr(realpath($fileDir . '/' . implode('/', $paths)), '\\', '/');
1073
+				$path = strtr(realpath($fileDir.'/'.implode('/', $paths)), '\\', '/');
1074 1074
 			}
1075 1075
 		}
1076 1076
 
1077
-		$path = preg_replace('/^' . preg_quote(_XE_PATH_, '/') . '/', '', $path);
1077
+		$path = preg_replace('/^'.preg_quote(_XE_PATH_, '/').'/', '', $path);
1078 1078
 
1079 1079
 		return $path;
1080 1080
 	}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 	 */
1098 1098
 	function _replaceVar($php)
1099 1099
 	{
1100
-		if(!strlen($php))
1100
+		if (!strlen($php))
1101 1101
 		{
1102 1102
 			return '';
1103 1103
 		}
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		$modules = '(addon|admin|adminlogging|autoinstall|board|comment|communication|counter|document|editor|file|importer|install|integration_search|krzip|layout|member|menu|message|module|page|point|poll|rss|seo|session|spamfilter|syndication|tag|trash|widget)';
1113 1113
 
1114 1114
 		// admin, common layout
1115
-		if(preg_match('/^(\.\/)?(modules\/' . $modules . '|common)\/tpl\//', $absPath))
1115
+		if (preg_match('/^(\.\/)?(modules\/'.$modules.'|common)\/tpl\//', $absPath))
1116 1116
 		{
1117 1117
 			return true;
1118 1118
 		}
Please login to merge, or discard this patch.
Braces   +31 added lines, -48 removed lines patch added patch discarded remove patch
@@ -106,8 +106,7 @@  discard block
 block discarded – undo
106 106
 			if(!isset($GLOBALS['__TemplateHandlerCalled__']))
107 107
 			{
108 108
 				$GLOBALS['__TemplateHandlerCalled__'] = 1;
109
-			}
110
-			else
109
+			} else
111 110
 			{
112 111
 				$GLOBALS['__TemplateHandlerCalled__']++;
113 112
 			}
@@ -212,8 +211,7 @@  discard block
 block discarded – undo
212 211
 		{
213 212
 			$cache_key = 'template:' . $this->file;
214 213
 			$buff = $oCacheHandler->get($cache_key, $latest_mtime);
215
-		}
216
-		else
214
+		} else
217 215
 		{
218 216
 			if(is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file))
219 217
 			{
@@ -227,8 +225,7 @@  discard block
 block discarded – undo
227 225
 			if($oCacheHandler->isSupport())
228 226
 			{
229 227
 				$oCacheHandler->put($cache_key, $buff);
230
-			}
231
-			else
228
+			} else
232 229
 			{
233 230
 				FileHandler::writeFile($this->compiled_file, $buff);
234 231
 			}
@@ -313,7 +310,9 @@  discard block
 block discarded – undo
313 310
 			}
314 311
 		}
315 312
 
316
-		if($this->config->autoescape === 'on') $this->safeguard = true;
313
+		if($this->config->autoescape === 'on') {
314
+			$this->safeguard = true;
315
+		}
317 316
 
318 317
 		// replace comments
319 318
 		$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
@@ -372,8 +371,7 @@  discard block
 block discarded – undo
372 371
 				{
373 372
 					$path = str_replace('@', '', $m[1]);
374 373
 					$path = './files/ruleset/' . $path . '.xml';
375
-				}
376
-				else if(strpos($m[1], '#') !== FALSE)
374
+				} else if(strpos($m[1], '#') !== FALSE)
377 375
 				{
378 376
 					$fileName = str_replace('#', '', $m[1]);
379 377
 					$fileName = str_replace('<?php echo ', '', $fileName);
@@ -385,8 +383,7 @@  discard block
 block discarded – undo
385 383
 					list($rulsetFile) = explode('.', $fileName);
386 384
 					$autoPath = $module_path . '/ruleset/' . $rulsetFile . '.xml';
387 385
 					$m[1] = $rulsetFile;
388
-				}
389
-				else if(preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm))
386
+				} else if(preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm))
390 387
 				{
391 388
 					$module_path = $mm[1];
392 389
 					$path = $module_path . '/ruleset/' . $m[1] . '.xml';
@@ -416,10 +413,10 @@  discard block
 block discarded – undo
416 413
 		if(!preg_match('/no-error-return-url="true"/i', $matches[1]))
417 414
 		{
418 415
 			preg_match('/<input[^>]*name="error_return_url"[^>]*>/is', $matches[2], $m3);
419
-			if(!$m3[0])
420
-				$matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />' . $matches[2];
421
-		}
422
-		else
416
+			if(!$m3[0]) {
417
+							$matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />' . $matches[2];
418
+			}
419
+		} else
423 420
 		{
424 421
 			$matches[1] = preg_replace('/no-error-return-url="true"/i', '', $matches[1]);
425 422
 		}
@@ -464,13 +461,11 @@  discard block
 block discarded – undo
464 461
 				{
465 462
 				    throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
466 463
 				}
467
-			}
468
-			else
464
+			} else
469 465
 			{
470 466
 				include(substr($buff, 7));
471 467
 			}
472
-		}
473
-		else
468
+		} else
474 469
 		{
475 470
 			$eval_str = "?>" . $buff;
476 471
 			@eval($eval_str);
@@ -596,12 +591,10 @@  discard block
 block discarded – undo
596 591
 									$expr_m[2] .= '=>' . trim($expr_m[3]);
597 592
 								}
598 593
 								$nodes[$idx - 1] .= "<?php if({$expr_m[1]}&&count({$expr_m[1]}))foreach({$expr_m[1]} as {$expr_m[2]}){ ?>";
599
-							}
600
-							elseif($expr_m[4])
594
+							} elseif($expr_m[4])
601 595
 							{
602 596
 								$nodes[$idx - 1] .= "<?php for({$expr_m[4]}){ ?>";
603
-							}
604
-							elseif($expr_m[5])
597
+							} elseif($expr_m[5])
605 598
 							{
606 599
 								$nodes[$idx - 1] .= "<?php while({$expr_m[5]}={$expr_m[6]}){ ?>";
607 600
 							}
@@ -616,8 +609,7 @@  discard block
 block discarded – undo
616 609
 				if($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag]))
617 610
 				{
618 611
 					$nodes[$idx + 1] = $close_php . $nodes[$idx + 1];
619
-				}
620
-				else
612
+				} else
621 613
 				{
622 614
 					$depth = 1;
623 615
 					for($i = $idx + 2; $i < $node_len; $i+=2)
@@ -626,8 +618,7 @@  discard block
 block discarded – undo
626 618
 						if(strpos($nd, $tag) === 1)
627 619
 						{
628 620
 							$depth++;
629
-						}
630
-						elseif(strpos($nd, '/' . $tag) === 1)
621
+						} elseif(strpos($nd, '/' . $tag) === 1)
631 622
 						{
632 623
 							$depth--;
633 624
 							if(!$depth)
@@ -690,8 +681,7 @@  discard block
 block discarded – undo
690 681
 			{
691 682
 				$m[1] = $this->_replaceVar(substr($m[1], 1));
692 683
 				return "<?php {$m[1]} ?>";
693
-			}
694
-			else
684
+			} else
695 685
 			{
696 686
 				// Get escape options.
697 687
 				foreach ($this->ignoreEscape as $key => $value)
@@ -708,8 +698,7 @@  discard block
 block discarded – undo
708 698
 				{
709 699
 					$m[1] = $mm[1];
710 700
 					$filters = array_map('trim', explode_with_escape('|', substr($mm[2], 1)));
711
-				}
712
-				else
701
+				} else
713 702
 				{
714 703
 					$filters = array();
715 704
 				}
@@ -728,13 +717,11 @@  discard block
 block discarded – undo
728 717
 						if (!self::_isVar($filter_option) && !preg_match("/^'.*'$/", $filter_option) && !preg_match('/^".*"$/', $filter_option))
729 718
 						{
730 719
 							$filter_option = "'" . escape_sqstr($filter_option) . "'";
731
-						}
732
-						else
720
+						} else
733 721
 						{
734 722
 							$filter_option = self::_replaceVar($filter_option);
735 723
 						}
736
-					}
737
-					else
724
+					} else
738 725
 					{
739 726
 						$filter_option = null;
740 727
 					}
@@ -810,8 +797,7 @@  discard block
 block discarded – undo
810 797
 							{
811 798
 								$filter_option = $this->_applyEscapeOption($filter_option, 'autoescape');
812 799
 								$var = "'<a href=\"' . {$filter_option} . '\">' . {$var} . '</a>'";
813
-							}
814
-							else
800
+							} else
815 801
 							{
816 802
 								$var = "'<a href=\"' . {$var} . '\">' . {$var} . '</a>'";
817 803
 							}
@@ -843,8 +829,7 @@  discard block
 block discarded – undo
843 829
 					}
844 830
 				}
845 831
 				$attr['target'] = $m[5];
846
-			}
847
-			else
832
+			} else
848 833
 			{
849 834
 				if(!preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $mm))
850 835
 				{
@@ -923,8 +908,7 @@  discard block
 block discarded – undo
923 908
 							if($pathinfo['basename'] == 'lang.xml' || substr($pathinfo['dirname'], -5) == '/lang')
924 909
 							{
925 910
 								$result = "Context::loadLang('{$relativeDir}');";
926
-							}
927
-							else
911
+							} else
928 912
 							{
929 913
 								$result = "require_once('./classes/xml/XmlJsFilter.class.php');\$__xmlFilter=new XmlJsFilter('{$relativeDir}','{$pathinfo['basename']}');\$__xmlFilter->compile();";
930 914
 							}
@@ -933,8 +917,7 @@  discard block
 block discarded – undo
933 917
 							if($doUnload)
934 918
 							{
935 919
 								$result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}');";
936
-							}
937
-							else
920
+							} else
938 921
 							{
939 922
 								$metafile = $attr['target'];
940 923
 								$result = "\$__tmp=array('{$attr['target']}','{$attr['type']}','{$attr['targetie']}','{$attr['index']}');Context::loadFile(\$__tmp);unset(\$__tmp);";
@@ -944,8 +927,7 @@  discard block
 block discarded – undo
944 927
 							if($doUnload)
945 928
 							{
946 929
 								$result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}','{$attr['media']}');";
947
-							}
948
-							else
930
+							} else
949 931
 							{
950 932
 								$metafile = $attr['target'];
951 933
 								$result = "\$__tmp=array('{$attr['target']}','{$attr['media']}','{$attr['targetie']}','{$attr['index']}');Context::loadFile(\$__tmp);unset(\$__tmp);";
@@ -997,8 +979,7 @@  discard block
 block discarded – undo
997 979
 				if($mm[1] == 'switch')
998 980
 				{
999 981
 					$m[9] = '';
1000
-				}
1001
-				elseif($mm[1] == 'foreach')
982
+				} elseif($mm[1] == 'foreach')
1002 983
 				{
1003 984
 					$var = preg_replace('/^\s*\(\s*(.+?) .*$/', '$1', $m[8]);
1004 985
 					$precheck = "if({$var}&&count({$var}))";
@@ -1106,7 +1087,9 @@  discard block
 block discarded – undo
1106 1087
 
1107 1088
 	function isSafeguard()
1108 1089
 	{
1109
-		if ($this->dbinfo->safeguard === 'Y') return true;
1090
+		if ($this->dbinfo->safeguard === 'Y') {
1091
+			return true;
1092
+		}
1110 1093
 
1111 1094
 		$absPath = str_replace(_XE_PATH_, '', $this->path);
1112 1095
 		$modules = '(addon|admin|adminlogging|autoinstall|board|comment|communication|counter|document|editor|file|importer|install|integration_search|krzip|layout|member|menu|message|module|page|point|poll|rss|seo|session|spamfilter|syndication|tag|trash|widget)';
Please login to merge, or discard this patch.
modules/install/install.controller.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	function init()
18 18
 	{
19 19
 		// Error occurs if already installed
20
-		if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
20
+		if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
21 21
 		{
22 22
 			$this->stop('msg_already_installed');
23 23
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	function _procDBSetting()
87 87
 	{
88 88
 		// Get DB-related variables
89
-		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
89
+		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix');
90 90
 
91 91
 		$db_info = new stdClass();
92 92
 		$db_info->master_db = get_object_vars($con_string);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 		// Check if available to connect to the DB
103 103
 		$oDB = &DB::getInstance();
104 104
 		$output = $oDB->getError();
105
-		if(!$output->toBool()) return $output;
106
-		if(!$oDB->isConnected()) return $oDB->getError();
105
+		if (!$output->toBool()) return $output;
106
+		if (!$oDB->isConnected()) return $oDB->getError();
107 107
 
108 108
 		// Create a db temp config file
109
-		if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
109
+		if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
110 110
 
111
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
111
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
112 112
 		{
113 113
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm');
114 114
 			header('location:'.$returnUrl);
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	function procConfigSetting()
123 123
 	{
124 124
 		// Get variables
125
-		$config_info = Context::gets('use_rewrite','time_zone');
126
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
125
+		$config_info = Context::gets('use_rewrite', 'time_zone');
126
+		if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N';
127 127
 
128 128
 		// Create a db temp config file
129
-		if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
129
+		if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
130 130
 
131
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
131
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
132 132
 		{
133 133
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm');
134 134
 			header('location:'.$returnUrl);
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	function procInstall()
143 143
 	{
144 144
 		// Check if it is already installed
145
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
145
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
146 146
 
147 147
 		Context::loadLang('modules/member/lang');
148 148
 		$oMemberModel = getModel('member');
149 149
 		$vars = Context::getRequestVars();
150 150
 
151
-		if(!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
151
+		if (!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
152 152
 		{
153 153
 			Context::loadLang('modules/member/lang');
154 154
 			$message = Context::getLang('about_password_strength');
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 		Context::set('logged_info', $logged_info);
162 162
 
163 163
 		// check install config
164
-		if(Context::get('install_config'))
164
+		if (Context::get('install_config'))
165 165
 		{
166 166
 			$db_info = $this->_makeDbInfoByInstallConfig();
167 167
 		}
168 168
 		// install by default XE UI
169 169
 		else
170 170
 		{
171
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
172
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
171
+			if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
172
+			if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
173 173
 		}
174 174
 
175 175
 		// Set DB type and information
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
 		// Create DB Instance
178 178
 		$oDB = &DB::getInstance();
179 179
 		// Check if available to connect to the DB
180
-		if(!$oDB->isConnected()) return $oDB->getError();
180
+		if (!$oDB->isConnected()) return $oDB->getError();
181 181
 
182 182
 		// Install all the modules
183 183
 		try {
184 184
 			$oDB->begin();
185 185
 			$this->installDownloadedModule();
186 186
 			$oDB->commit();
187
-		} catch(Exception $e) {
187
+		} catch (Exception $e) {
188 188
 			$oDB->rollback();
189 189
 			return new BaseObject(-1, $e->getMessage());
190 190
 		}
191 191
 
192 192
 		// Create a config file
193
-		if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
193
+		if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
194 194
 
195 195
 		// load script
196
-		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
197
-		if(count($scripts)>0)
196
+		$scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');
197
+		if (count($scripts) > 0)
198 198
 		{
199 199
 			sort($scripts);
200
-			foreach($scripts as $script)
200
+			foreach ($scripts as $script)
201 201
 			{
202 202
 				$script_path = FileHandler::getRealPath('./modules/install/script/');
203
-				$output = include($script_path . $script);
203
+				$output = include($script_path.$script);
204 204
 			}
205 205
 		}
206 206
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 		unset($_SESSION['use_rewrite']);
215 215
 
216
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
216
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
217 217
 		{
218 218
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
219 219
 			header('location:'.$returnUrl);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		$db_info->time_zone = Context::get('time_zone');
245 245
 		$db_info->safeguard = 'Y';
246 246
 
247
-		if($_SERVER['HTTPS'] == 'on')
247
+		if ($_SERVER['HTTPS'] == 'on')
248 248
 		{
249 249
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
250 250
 			$https_port = (!$https_port != 443) ? $https_port : null;
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
255 255
 			$http_port = (!$http_port != 80) ? $http_port : null;
256 256
 		}
257
-		if($http_port) $db_info->http_port = $http_port;
258
-		if($https_port) $db_info->https_port = $https_port;
257
+		if ($http_port) $db_info->http_port = $http_port;
258
+		if ($https_port) $db_info->https_port = $https_port;
259 259
 
260 260
 		return $db_info;
261 261
 	}
@@ -265,57 +265,57 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	function procInstallFTP()
267 267
 	{
268
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
269
-		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
270
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
271
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
272
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
273
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
268
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
269
+		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
270
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
271
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
272
+		if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
273
+		if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
274 274
 
275 275
 		$buff = array('<?php if(!defined("__XE__")) exit();');
276 276
 		$buff[] = "\$ftp_info = new stdClass();";
277
-		foreach($ftp_info as $key => $val)
277
+		foreach ($ftp_info as $key => $val)
278 278
 		{
279
-			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
279
+			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
280 280
 		}
281 281
 
282 282
 		// If safe_mode
283
-		if(ini_get('safe_mode'))
283
+		if (ini_get('safe_mode'))
284 284
 		{
285
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
285
+			if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
286 286
 
287 287
 			require_once(_XE_PATH_.'libs/ftp.class.php');
288 288
 			$oFtp = new ftp();
289
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
289
+			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
290 290
 
291
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
291
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
292 292
 			{
293 293
 				$oFtp->ftp_quit();
294
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
294
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
295 295
 			}
296 296
 
297
-			if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
297
+			if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
298 298
 			{
299 299
 				$oFtp->ftp_quit();
300
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
300
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
301 301
 			}
302 302
 
303
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
303
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
304 304
 			{
305 305
 				$oFtp->ftp_quit();
306
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
306
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
307 307
 			}
308 308
 
309
-			if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
309
+			if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
310 310
 			{
311 311
 				$oFtp->ftp_quit();
312
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
312
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
313 313
 			}
314 314
 
315
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
315
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
316 316
 			{
317 317
 				$oFtp->ftp_quit();
318
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
318
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
319 319
 			}
320 320
 
321 321
 			$oFtp->ftp_quit();
@@ -326,31 +326,31 @@  discard block
 block discarded – undo
326 326
 
327 327
 	function procInstallCheckFtp()
328 328
 	{
329
-		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
330
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
331
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
332
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
329
+		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp');
330
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
331
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
332
+		if (!$ftp_info->sftp) $ftp_info->sftp = 'N';
333 333
 
334
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
334
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
335 335
 
336
-		if($ftp_info->sftp == 'Y')
336
+		if ($ftp_info->sftp == 'Y')
337 337
 		{
338 338
 			$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
339
-			if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
339
+			if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
340 340
 			{
341
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
341
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
342 342
 			}
343 343
 		}
344 344
 		else
345 345
 		{
346 346
 			require_once(_XE_PATH_.'libs/ftp.class.php');
347 347
 			$oFtp = new ftp();
348
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
348
+			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
349 349
 
350
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
350
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
351 351
 			{
352 352
 				$oFtp->ftp_quit();
353
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
353
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
354 354
 			}
355 355
 			$oFtp->ftp_quit();
356 356
 		}
@@ -367,36 +367,36 @@  discard block
 block discarded – undo
367 367
 		$checklist = array();
368 368
 		// 0. check your version of php (5.2.4 or higher)
369 369
 		$checklist['php_version'] = true;
370
-		if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
370
+		if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
371 371
 		{
372 372
 			$checklist['php_version'] = false;
373 373
 		}
374 374
 
375
-		if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
375
+		if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
376 376
 		{
377 377
 			Context::set('phpversion_warning', true);
378 378
 		}
379 379
 
380 380
 		// 1. Check permission
381
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
381
+		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true;
382 382
 		else $checklist['permission'] = false;
383 383
 		// 2. Check if xml_parser_create exists
384
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
384
+		if (function_exists('xml_parser_create')) $checklist['xml'] = true;
385 385
 		else $checklist['xml'] = false;
386 386
 		// 3. Check if ini_get (session.auto_start) == 1
387
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
387
+		if (ini_get('session.auto_start') != 1) $checklist['session'] = true;
388 388
 		else $checklist['session'] = false;
389 389
 		// 4. Check if iconv exists
390
-		if(function_exists('iconv')) $checklist['iconv'] = true;
390
+		if (function_exists('iconv')) $checklist['iconv'] = true;
391 391
 		else $checklist['iconv'] = false;
392 392
 		// 5. Check gd(imagecreatefromgif function)
393
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
393
+		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true;
394 394
 		else $checklist['gd'] = false;
395 395
 		// 6. Check DB
396
-		if(DB::getEnableList()) $checklist['db'] = true;
396
+		if (DB::getEnableList()) $checklist['db'] = true;
397 397
 		else $checklist['db'] = false;
398 398
 
399
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
399
+		if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
400 400
 		else $install_enable = true;
401 401
 
402 402
 		// Save the checked result to the Context
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 
417 417
 		$license_agreement = ($vars->license_agreement == 'Y') ? true : false;
418 418
 
419
-		if($license_agreement)
419
+		if ($license_agreement)
420 420
 		{
421 421
 			$currentTime = $_SERVER['REQUEST_TIME'];
422 422
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			return new BaseObject(-1, 'msg_must_accept_license_agreement');
428 428
 		}
429 429
 
430
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
430
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
431 431
 		{
432 432
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
433 433
 			$this->setRedirectUrl($returnUrl);
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
 		$hostname = $_SERVER['SERVER_NAME'];
451 451
 		$port = $_SERVER['SERVER_PORT'];
452 452
 		$str_port = '';
453
-		if($port)
453
+		if ($port)
454 454
 		{
455
-			$str_port = ':' . $port;
455
+			$str_port = ':'.$port;
456 456
 		}
457 457
 
458 458
 		$tmpPath = $_SERVER['DOCUMENT_ROOT'];
459 459
 
460 460
 		//if DIRECTORY_SEPARATOR is not /(IIS)
461
-		if(DIRECTORY_SEPARATOR !== '/')
461
+		if (DIRECTORY_SEPARATOR !== '/')
462 462
 		{
463 463
 			//change to slash for compare
464 464
 			$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
465 465
 		}
466 466
 
467
-		$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
467
+		$query = "/JUST/CHECK/REWRITE/".$checkFilePath;
468 468
 		$currentPath = str_replace($tmpPath, "", _XE_PATH_);
469
-		if($currentPath != "")
469
+		if ($currentPath != "")
470 470
 		{
471
-			$query = $currentPath . $query;
471
+			$query = $currentPath.$query;
472 472
 		}
473 473
 		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
474 474
 		$requestConfig = array();
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 			'./files/cache/template_compiled',
494 494
 		);
495 495
 
496
-		foreach($directory_list as $dir)
496
+		foreach ($directory_list as $dir)
497 497
 		{
498 498
 			FileHandler::makeDir($dir);
499 499
 		}
@@ -509,57 +509,57 @@  discard block
 block discarded – undo
509 509
 		$oModuleModel = getModel('module');
510 510
 		// Create a table ny finding schemas/*.xml file in each module
511 511
 		$module_list = FileHandler::readDir('./modules/', NULL, false, true);
512
-		foreach($module_list as $module_path)
512
+		foreach ($module_list as $module_path)
513 513
 		{
514 514
 			// Get module name
515
-			$tmp_arr = explode('/',$module_path);
516
-			$module = $tmp_arr[count($tmp_arr)-1];
515
+			$tmp_arr = explode('/', $module_path);
516
+			$module = $tmp_arr[count($tmp_arr) - 1];
517 517
 
518 518
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
519
-			if(!$xml_info) continue;
519
+			if (!$xml_info) continue;
520 520
 			$modules[$xml_info->category][] = $module;
521 521
 		}
522 522
 		// Install "module" module in advance
523
-		$this->installModule('module','./modules/module');
523
+		$this->installModule('module', './modules/module');
524 524
 		$oModule = getClass('module');
525
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
525
+		if ($oModule->checkUpdate()) $oModule->moduleUpdate();
526 526
 		// Determine the order of module installation depending on category
527
-		$install_step = array('system','content','member');
527
+		$install_step = array('system', 'content', 'member');
528 528
 		// Install all the remaining modules
529
-		foreach($install_step as $category)
529
+		foreach ($install_step as $category)
530 530
 		{
531
-			if(count($modules[$category]))
531
+			if (count($modules[$category]))
532 532
 			{
533
-				foreach($modules[$category] as $module)
533
+				foreach ($modules[$category] as $module)
534 534
 				{
535
-					if($module == 'module') continue;
535
+					if ($module == 'module') continue;
536 536
 					$this->installModule($module, sprintf('./modules/%s', $module));
537 537
 
538 538
 					$oModule = getClass($module);
539
-					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
539
+					if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))
540 540
 					{
541
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
541
+						if ($oModule->checkUpdate()) $oModule->moduleUpdate();
542 542
 					}
543 543
 				}
544 544
 				unset($modules[$category]);
545 545
 			}
546 546
 		}
547 547
 		// Install all the remaining modules
548
-		if(count($modules))
548
+		if (count($modules))
549 549
 		{
550
-			foreach($modules as $category => $module_list)
550
+			foreach ($modules as $category => $module_list)
551 551
 			{
552
-				if(count($module_list))
552
+				if (count($module_list))
553 553
 				{
554
-					foreach($module_list as $module)
554
+					foreach ($module_list as $module)
555 555
 					{
556
-						if($module == 'module') continue;
556
+						if ($module == 'module') continue;
557 557
 						$this->installModule($module, sprintf('./modules/%s', $module));
558 558
 
559 559
 						$oModule = getClass($module);
560
-						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
560
+						if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
561 561
 						{
562
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
562
+							if ($oModule->checkUpdate()) $oModule->moduleUpdate();
563 563
 						}
564 564
 					}
565 565
 				}
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 		$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
582 582
 
583 583
 		$file_cnt = count($schema_files);
584
-		for($i=0;$i<$file_cnt;$i++)
584
+		for ($i = 0; $i < $file_cnt; $i++)
585 585
 		{
586 586
 			$file = trim($schema_files[$i]);
587
-			if(!$file || substr($file,-4)!='.xml') continue;
587
+			if (!$file || substr($file, -4) != '.xml') continue;
588 588
 			$output = $oDB->createTableByXmlFile($file);
589
-			if($output === false)
589
+			if ($output === false)
590 590
 				throw new Exception('msg_create_table_failed');
591 591
 		}
592 592
 		// Create a table and module instance and then execute install() method
593 593
 		unset($oModule);
594 594
 		$oModule = getClass($module);
595
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
595
+		if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
596 596
 		return new BaseObject();
597 597
 	}
598 598
 
599 599
 	function _getDBConfigFileContents($db_info)
600 600
 	{
601
-		if(substr($db_info->master_db['db_table_prefix'], -1) != '_')
601
+		if (substr($db_info->master_db['db_table_prefix'], -1) != '_')
602 602
 		{
603 603
 			$db_info->master_db['db_table_prefix'] .= '_';
604 604
 		}
605 605
 
606
-		foreach($db_info->slave_db as &$slave)
606
+		foreach ($db_info->slave_db as &$slave)
607 607
 		{
608
-			if(substr($slave['db_table_prefix'], -1) != '_')
608
+			if (substr($slave['db_table_prefix'], -1) != '_')
609 609
 			{
610 610
 				$slave['db_table_prefix'] .= '_';
611 611
 			}
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 		$buff = array();
615 615
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
616
-		$buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';
616
+		$buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';
617 617
 
618 618
 		return implode(PHP_EOL, $buff);
619 619
 	}
@@ -627,13 +627,13 @@  discard block
 block discarded – undo
627 627
 		$db_tmp_config_file = $this->db_tmp_config_file;
628 628
 
629 629
 		$db_info = Context::getDBInfo();
630
-		if(!$db_info) return;
630
+		if (!$db_info) return;
631 631
 
632 632
 		$buff = $this->_getDBConfigFileContents($db_info);
633 633
 
634 634
 		FileHandler::writeFile($db_tmp_config_file, $buff);
635 635
 
636
-		if(@file_exists($db_tmp_config_file)) return true;
636
+		if (@file_exists($db_tmp_config_file)) return true;
637 637
 		return false;
638 638
 	}
639 639
 
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 		$etc_tmp_config_file = $this->etc_tmp_config_file;
647 647
 
648 648
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n";
649
-		foreach($config_info as $key => $val)
649
+		foreach ($config_info as $key => $val)
650 650
 		{
651
-			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
651
+			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
652 652
 		}
653 653
 
654 654
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
655 655
 
656
-		if(@file_exists($etc_tmp_config_file)) return true;
656
+		if (@file_exists($etc_tmp_config_file)) return true;
657 657
 		return false;
658 658
 	}
659 659
 
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 			//if(file_exists($config_file)) return;
669 669
 
670 670
 			$db_info = Context::getDBInfo();
671
-			if(!$db_info) return;
671
+			if (!$db_info) return;
672 672
 
673 673
 			$buff = $this->_getDBConfigFileContents($db_info);
674 674
 
675 675
 			FileHandler::writeFile($config_file, $buff);
676 676
 
677
-			if(@file_exists($config_file))
677
+			if (@file_exists($config_file))
678 678
 			{
679 679
 				FileHandler::removeFile($this->db_tmp_config_file);
680 680
 				FileHandler::removeFile($this->etc_tmp_config_file);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	function installByConfig($install_config_file)
690 690
 	{
691 691
 		include $install_config_file;
692
-		if(!is_array($auto_config)) return false;
692
+		if (!is_array($auto_config)) return false;
693 693
 
694 694
 		$auto_config['module'] = 'install';
695 695
 		$auto_config['act'] = 'procInstall';
@@ -697,22 +697,22 @@  discard block
 block discarded – undo
697 697
 		$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
698 698
 		$fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
699 699
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
700
-		foreach($auto_config as $k => $v)
700
+		foreach ($auto_config as $k => $v)
701 701
 		{
702
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
702
+			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k);
703 703
 		}
704 704
 		$body .= "</params>\r\n</methodCall>";
705 705
 
706
-		$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
706
+		$header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);
707 707
 		$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
708 708
 
709
-		if($fp)
709
+		if ($fp)
710 710
 		{
711 711
 			fputs($fp, $header);
712
-			while(!feof($fp))
712
+			while (!feof($fp))
713 713
 			{
714 714
 				$line = trim(fgets($fp, 4096));
715
-				if(strncmp('<error>', $line, 7) === 0)
715
+				if (strncmp('<error>', $line, 7) === 0)
716 716
 				{
717 717
 					fclose($fp);
718 718
 					return false;
Please login to merge, or discard this patch.