GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c66acf...0f0c57 )
by gyeong-won
08:35
created
classes/context/Context.class.php 2 patches
Spacing   +297 added lines, -297 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,19 +447,19 @@  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
 		}
454 454
 
455 455
 		$config_file = $self->getConfigFile();
456
-		if(is_readable($config_file))
456
+		if (is_readable($config_file))
457 457
 		{
458 458
 			include($config_file);
459 459
 		}
460 460
 
461 461
 		// If master_db information does not exist, the config file needs to be updated
462
-		if(!isset($db_info->master_db))
462
+		if (!isset($db_info->master_db))
463 463
 		{
464 464
 			$db_info->master_db = array();
465 465
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
478 478
 			unset($db_info->db_table_prefix);
479 479
 
480
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
480
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
481 481
 			{
482 482
 				$db_info->master_db["db_table_prefix"] .= '_';
483 483
 			}
@@ -489,33 +489,33 @@  discard block
 block discarded – undo
489 489
 			$oInstallController->makeConfigFile();
490 490
 		}
491 491
 
492
-		if(!$db_info->use_prepared_statements)
492
+		if (!$db_info->use_prepared_statements)
493 493
 		{
494 494
 			$db_info->use_prepared_statements = 'Y';
495 495
 		}
496 496
 
497
-		if(!$db_info->time_zone)
497
+		if (!$db_info->time_zone)
498 498
 			$db_info->time_zone = date('O');
499 499
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
500 500
 
501
-		if($db_info->qmail_compatibility != 'Y')
501
+		if ($db_info->qmail_compatibility != 'Y')
502 502
 			$db_info->qmail_compatibility = 'N';
503 503
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
504 504
 
505
-		if(!$db_info->use_db_session)
505
+		if (!$db_info->use_db_session)
506 506
 			$db_info->use_db_session = 'N';
507
-		if(!$db_info->use_ssl)
507
+		if (!$db_info->use_ssl)
508 508
 			$db_info->use_ssl = 'none';
509 509
 		$this->set('_use_ssl', $db_info->use_ssl);
510 510
 
511 511
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
512 512
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
513 513
 
514
-		if(!$db_info->sitelock_whitelist) {
514
+		if (!$db_info->sitelock_whitelist) {
515 515
 			$db_info->sitelock_whitelist = '127.0.0.1';
516 516
 		}
517 517
 
518
-		if(is_string($db_info->sitelock_whitelist)) {
518
+		if (is_string($db_info->sitelock_whitelist)) {
519 519
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
520 520
 		}
521 521
 
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 	function loadLangSupported()
587 587
 	{
588 588
 		static $lang_supported = null;
589
-		if(!$lang_supported)
589
+		if (!$lang_supported)
590 590
 		{
591
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
592
-			foreach($langs as $val)
591
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
592
+			foreach ($langs as $val)
593 593
 			{
594 594
 				list($lang_prefix, $lang_text) = explode(',', $val);
595 595
 				$lang_text = trim($lang_text);
@@ -607,17 +607,17 @@  discard block
 block discarded – undo
607 607
 	function loadLangSelected()
608 608
 	{
609 609
 		static $lang_selected = null;
610
-		if(!$lang_selected)
610
+		if (!$lang_selected)
611 611
 		{
612
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
613
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
614
-			if(!FileHandler::hasContent($selected_lang_file))
612
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
613
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
614
+			if (!FileHandler::hasContent($selected_lang_file))
615 615
 			{
616
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
616
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
617 617
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
618 618
 			}
619 619
 
620
-			if(!FileHandler::hasContent($selected_lang_file))
620
+			if (!FileHandler::hasContent($selected_lang_file))
621 621
 			{
622 622
 				$buff = FileHandler::readFile($orig_lang_file);
623 623
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 			else
627 627
 			{
628 628
 				$langs = file($selected_lang_file);
629
-				foreach($langs as $val)
629
+				foreach ($langs as $val)
630 630
 				{
631 631
 					list($lang_prefix, $lang_text) = explode(',', $val);
632 632
 					$lang_text = trim($lang_text);
@@ -645,44 +645,44 @@  discard block
 block discarded – undo
645 645
 	function checkSSO()
646 646
 	{
647 647
 		// pass if it's not GET request or XE is not yet installed
648
-		if($this->db_info->use_sso != 'Y' || isCrawler())
648
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
649 649
 		{
650 650
 			return TRUE;
651 651
 		}
652 652
 		$checkActList = array('rss' => 1, 'atom' => 1);
653
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
653
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
654 654
 		{
655 655
 			return TRUE;
656 656
 		}
657 657
 
658 658
 		// pass if default URL is not set
659 659
 		$default_url = trim($this->db_info->default_url);
660
-		if(!$default_url)
660
+		if (!$default_url)
661 661
 		{
662 662
 			return TRUE;
663 663
 		}
664 664
 
665
-		if(substr_compare($default_url, '/', -1) !== 0)
665
+		if (substr_compare($default_url, '/', -1) !== 0)
666 666
 		{
667 667
 			$default_url .= '/';
668 668
 		}
669 669
 
670 670
 		// for sites recieving SSO valdiation
671
-		if($default_url == self::getRequestUri())
671
+		if ($default_url == self::getRequestUri())
672 672
 		{
673
-			if(self::get('url'))
673
+			if (self::get('url'))
674 674
 			{
675 675
 				$url = base64_decode(self::get('url'));
676 676
 				$url_info = parse_url($url);
677
-				if(!Password::checkSignature($url, self::get('sig')))
677
+				if (!Password::checkSignature($url, self::get('sig')))
678 678
 				{
679 679
 					echo self::get('lang')->msg_invalid_request;
680 680
 					return false;
681 681
 				}
682 682
 
683
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
684
-				$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']);
685
-				header('location:' . $redirect_url);
683
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
684
+				$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']);
685
+				header('location:'.$redirect_url);
686 686
 
687 687
 				return FALSE;
688 688
 			}
@@ -691,9 +691,9 @@  discard block
 block discarded – undo
691 691
 		else
692 692
 		{
693 693
 			// result handling : set session_name()
694
-			if($session_name = self::get('SSOID'))
694
+			if ($session_name = self::get('SSOID'))
695 695
 			{
696
-				if(!Password::checkSignature($session_name, self::get('sig')))
696
+				if (!Password::checkSignature($session_name, self::get('sig')))
697 697
 				{
698 698
 					echo self::get('lang')->msg_invalid_request;
699 699
 					return false;
@@ -702,17 +702,17 @@  discard block
 block discarded – undo
702 702
 				setcookie(session_name(), $session_name);
703 703
 
704 704
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
705
-				header('location:' . $url);
705
+				header('location:'.$url);
706 706
 				return FALSE;
707 707
 				// send SSO request
708 708
 			}
709
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
709
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
710 710
 			{
711 711
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
712 712
 				$origin_url = self::getRequestUrl();
713 713
 				$origin_sig = Password::createSignature($origin_url);
714 714
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
715
-				header('location:' . $url);
715
+				header('location:'.$url);
716 716
 				return FALSE;
717 717
 			}
718 718
 		}
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	{
740 740
 		$self = self::getInstance();
741 741
 
742
-		if(!$self->isFTPRegisted())
742
+		if (!$self->isFTPRegisted())
743 743
 		{
744 744
 			return null;
745 745
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	 */
758 758
 	function addBrowserTitle($site_title)
759 759
 	{
760
-		if(!$site_title)
760
+		if (!$site_title)
761 761
 		{
762 762
 			return;
763 763
 		}
764 764
 		$self = self::getInstance();
765 765
 
766
-		if($self->site_title)
766
+		if ($self->site_title)
767 767
 		{
768
-			$self->site_title .= ' - ' . $site_title;
768
+			$self->site_title .= ' - '.$site_title;
769 769
 		}
770 770
 		else
771 771
 		{
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	function setBrowserTitle($site_title)
783 783
 	{
784
-		if(!$site_title)
784
+		if (!$site_title)
785 785
 		{
786 786
 			return;
787 787
 		}
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		$oModuleModel = getModel('module');
814 814
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
815 815
 
816
-		if(isset($moduleConfig->siteTitle))
816
+		if (isset($moduleConfig->siteTitle))
817 817
 		{
818 818
 			return $moduleConfig->siteTitle;
819 819
 		}
@@ -840,30 +840,30 @@  discard block
 block discarded – undo
840 840
 		global $lang;
841 841
 
842 842
 		$self = self::getInstance();
843
-		if(!$self->lang_type)
843
+		if (!$self->lang_type)
844 844
 		{
845 845
 			return;
846 846
 		}
847
-		if(!is_object($lang))
847
+		if (!is_object($lang))
848 848
 		{
849 849
 			$lang = new stdClass;
850 850
 		}
851 851
 
852
-		if(!($filename = $self->_loadXmlLang($path)))
852
+		if (!($filename = $self->_loadXmlLang($path)))
853 853
 		{
854 854
 			$filename = $self->_loadPhpLang($path);
855 855
 		}
856 856
 
857
-		if(!is_array($self->loaded_lang_files))
857
+		if (!is_array($self->loaded_lang_files))
858 858
 		{
859 859
 			$self->loaded_lang_files = array();
860 860
 		}
861
-		if(in_array($filename, $self->loaded_lang_files))
861
+		if (in_array($filename, $self->loaded_lang_files))
862 862
 		{
863 863
 			return;
864 864
 		}
865 865
 
866
-		if($filename && is_readable($filename))
866
+		if ($filename && is_readable($filename))
867 867
 		{
868 868
 			$self->loaded_lang_files[] = $filename;
869 869
 			include($filename);
@@ -884,24 +884,24 @@  discard block
 block discarded – undo
884 884
 	{
885 885
 		global $lang;
886 886
 
887
-		if(!$path) return;
887
+		if (!$path) return;
888 888
 
889
-		$_path = 'eval://' . $path;
889
+		$_path = 'eval://'.$path;
890 890
 
891
-		if(in_array($_path, $this->loaded_lang_files))
891
+		if (in_array($_path, $this->loaded_lang_files))
892 892
 		{
893 893
 			return;
894 894
 		}
895 895
 
896
-		if(substr_compare($path, '/', -1) !== 0)
896
+		if (substr_compare($path, '/', -1) !== 0)
897 897
 		{
898 898
 			$path .= '/';
899 899
 		}
900 900
 
901
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
901
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
902 902
 		$content = $oXmlLangParser->getCompileContent();
903 903
 
904
-		if($content)
904
+		if ($content)
905 905
 		{
906 906
 			$this->loaded_lang_files[] = $_path;
907 907
 			eval($content);
@@ -916,9 +916,9 @@  discard block
 block discarded – undo
916 916
 	 */
917 917
 	function _loadXmlLang($path)
918 918
 	{
919
-		if(!$path) return;
919
+		if (!$path) return;
920 920
 
921
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
921
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
922 922
 		return $oXmlLangParser->compile();
923 923
 	}
924 924
 
@@ -930,22 +930,22 @@  discard block
 block discarded – undo
930 930
 	 */
931 931
 	function _loadPhpLang($path)
932 932
 	{
933
-		if(!$path) return;
933
+		if (!$path) return;
934 934
 
935
-		if(substr_compare($path, '/', -1) !== 0)
935
+		if (substr_compare($path, '/', -1) !== 0)
936 936
 		{
937 937
 			$path .= '/';
938 938
 		}
939
-		$path_tpl = $path . '%s.lang.php';
939
+		$path_tpl = $path.'%s.lang.php';
940 940
 		$file = sprintf($path_tpl, $this->lang_type);
941 941
 
942 942
 		$langs = array('ko', 'en'); // this will be configurable.
943
-		while(!is_readable($file) && $langs[0])
943
+		while (!is_readable($file) && $langs[0])
944 944
 		{
945 945
 			$file = sprintf($path_tpl, array_shift($langs));
946 946
 		}
947 947
 
948
-		if(!is_readable($file))
948
+		if (!is_readable($file))
949 949
 		{
950 950
 			return FALSE;
951 951
 		}
@@ -987,11 +987,11 @@  discard block
 block discarded – undo
987 987
 	 */
988 988
 	function getLang($code)
989 989
 	{
990
-		if(!$code)
990
+		if (!$code)
991 991
 		{
992 992
 			return;
993 993
 		}
994
-		if($GLOBALS['lang']->{$code})
994
+		if ($GLOBALS['lang']->{$code})
995 995
 		{
996 996
 			return $GLOBALS['lang']->{$code};
997 997
 		}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	 */
1008 1008
 	function setLang($code, $val)
1009 1009
 	{
1010
-		if(!isset($GLOBALS['lang']))
1010
+		if (!isset($GLOBALS['lang']))
1011 1011
 		{
1012 1012
 			$GLOBALS['lang'] = new stdClass();
1013 1013
 		}
@@ -1035,17 +1035,17 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 		$obj = clone $source_obj;
1037 1037
 
1038
-		foreach($charset_list as $charset)
1038
+		foreach ($charset_list as $charset)
1039 1039
 		{
1040
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1040
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1041 1041
 			$flag = self::checkConvertFlag($flag = TRUE);
1042
-			if($flag)
1042
+			if ($flag)
1043 1043
 			{
1044
-				if($charset == 'UTF-8')
1044
+				if ($charset == 'UTF-8')
1045 1045
 				{
1046 1046
 					return $obj;
1047 1047
 				}
1048
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1048
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1049 1049
 				return $obj;
1050 1050
 			}
1051 1051
 		}
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1065 1065
 	{
1066 1066
 		static $flag = TRUE;
1067
-		if($charset)
1067
+		if ($charset)
1068 1068
 		{
1069
-			if(is_array($val))
1070
-				array_walk($val,'Context::checkConvertFlag',$charset);
1071
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1069
+			if (is_array($val))
1070
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1071
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1072 1072
 			else $flag = FALSE;
1073 1073
 		}
1074 1074
 		else
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 	{
1093 1093
 		if (is_array($val))
1094 1094
 		{
1095
-			array_walk($val,'Context::doConvertEncoding',$charset);
1095
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1096 1096
 		}
1097
-		else $val = iconv($charset,'UTF-8',$val);
1097
+		else $val = iconv($charset, 'UTF-8', $val);
1098 1098
 	}
1099 1099
 
1100 1100
 	/**
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function convertEncodingStr($str)
1107 1107
 	{
1108
-        if(!$str) return null;
1108
+        if (!$str) return null;
1109 1109
 		$obj = new stdClass();
1110 1110
 		$obj->str = $str;
1111 1111
 		$obj = self::convertEncoding($obj);
@@ -1114,9 +1114,9 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
 	function decodeIdna($domain)
1116 1116
 	{
1117
-		if(strpos($domain, 'xn--') !== FALSE)
1117
+		if (strpos($domain, 'xn--') !== FALSE)
1118 1118
 		{
1119
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1119
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1120 1120
 			$IDN = new idna_convert(array('idn_version' => 2008));
1121 1121
 			$domain = $IDN->decode($domain);
1122 1122
 		}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	{
1148 1148
 		$self = self::getInstance();
1149 1149
 
1150
-		if($self->response_method)
1150
+		if ($self->response_method)
1151 1151
 		{
1152 1152
 			return $self->response_method;
1153 1153
 		}
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1188 1188
 
1189 1189
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1190
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1190
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1191 1191
 		{
1192 1192
 			$this->isSuccessInit = FALSE;
1193 1193
 		}
@@ -1200,30 +1200,30 @@  discard block
 block discarded – undo
1200 1200
 	 */
1201 1201
 	function _setRequestArgument()
1202 1202
 	{
1203
-		if(!count($_REQUEST))
1203
+		if (!count($_REQUEST))
1204 1204
 		{
1205 1205
 			return;
1206 1206
 		}
1207 1207
 
1208 1208
 		$requestMethod = $this->getRequestMethod();
1209
-		foreach($_REQUEST as $key => $val)
1209
+		foreach ($_REQUEST as $key => $val)
1210 1210
 		{
1211
-			if($val === '' || self::get($key))
1211
+			if ($val === '' || self::get($key))
1212 1212
 			{
1213 1213
 				continue;
1214 1214
 			}
1215 1215
 			$key = htmlentities($key);
1216 1216
 			$val = $this->_filterRequestVar($key, $val);
1217 1217
 
1218
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1218
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1219 1219
 			{
1220 1220
 				$set_to_vars = TRUE;
1221 1221
 			}
1222
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1222
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1223 1223
 			{
1224 1224
 				$set_to_vars = TRUE;
1225 1225
 			}
1226
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1226
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 				$set_to_vars = FALSE;
1233 1233
 			}
1234 1234
 
1235
-			if($set_to_vars)
1235
+			if ($set_to_vars)
1236 1236
 			{
1237 1237
 				$this->_recursiveCheckVar($val);
1238 1238
 			}
@@ -1243,20 +1243,20 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 	function _recursiveCheckVar($val)
1245 1245
 	{
1246
-		if(is_string($val))
1246
+		if (is_string($val))
1247 1247
 		{
1248
-			foreach($this->patterns as $pattern)
1248
+			foreach ($this->patterns as $pattern)
1249 1249
 			{
1250
-				if(preg_match($pattern, $val))
1250
+				if (preg_match($pattern, $val))
1251 1251
 				{
1252 1252
 					$this->isSuccessInit = FALSE;
1253 1253
 					return;
1254 1254
 				}
1255 1255
 			}
1256 1256
 		}
1257
-		else if(is_array($val))
1257
+		else if (is_array($val))
1258 1258
 		{
1259
-			foreach($val as $val2)
1259
+			foreach ($val as $val2)
1260 1260
 			{
1261 1261
 				$this->_recursiveCheckVar($val2);
1262 1262
 			}
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 	 */
1271 1271
 	function _setJSONRequestArgument()
1272 1272
 	{
1273
-		if($this->getRequestMethod() != 'JSON')
1273
+		if ($this->getRequestMethod() != 'JSON')
1274 1274
 		{
1275 1275
 			return;
1276 1276
 		}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 		$params = array();
1279 1279
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1280 1280
 
1281
-		foreach($params as $key => $val)
1281
+		foreach ($params as $key => $val)
1282 1282
 		{
1283 1283
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1284 1284
 		}
@@ -1291,13 +1291,13 @@  discard block
 block discarded – undo
1291 1291
 	 */
1292 1292
 	function _setXmlRpcArgument()
1293 1293
 	{
1294
-		if($this->getRequestMethod() != 'XMLRPC')
1294
+		if ($this->getRequestMethod() != 'XMLRPC')
1295 1295
 		{
1296 1296
 			return;
1297 1297
 		}
1298 1298
 
1299 1299
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1300
-		if(Security::detectingXEE($xml))
1300
+		if (Security::detectingXEE($xml))
1301 1301
 		{
1302 1302
 			header("HTTP/1.0 400 Bad Request");
1303 1303
 			exit;
@@ -1309,12 +1309,12 @@  discard block
 block discarded – undo
1309 1309
 		$params = $xml_obj->methodcall->params;
1310 1310
 		unset($params->node_name, $params->attrs, $params->body);
1311 1311
 
1312
-		if(!count(get_object_vars($params)))
1312
+		if (!count(get_object_vars($params)))
1313 1313
 		{
1314 1314
 			return;
1315 1315
 		}
1316 1316
 
1317
-		foreach($params as $key => $val)
1317
+		foreach ($params as $key => $val)
1318 1318
 		{
1319 1319
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1320 1320
 		}
@@ -1329,10 +1329,10 @@  discard block
 block discarded – undo
1329 1329
 	 */
1330 1330
 	function _filterXmlVars($key, $val)
1331 1331
 	{
1332
-		if(is_array($val))
1332
+		if (is_array($val))
1333 1333
 		{
1334 1334
 			$stack = array();
1335
-			foreach($val as $k => $v)
1335
+			foreach ($val as $k => $v)
1336 1336
 			{
1337 1337
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1338 1338
 			}
@@ -1342,20 +1342,20 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 		$body = $val->body;
1344 1344
 		unset($val->node_name, $val->attrs, $val->body);
1345
-		if(!count(get_object_vars($val)))
1345
+		if (!count(get_object_vars($val)))
1346 1346
 		{
1347 1347
 			return $this->_filterRequestVar($key, $body, 0);
1348 1348
 		}
1349 1349
 
1350 1350
 		$stack = new stdClass();
1351
-		foreach($val as $k => $v)
1351
+		foreach ($val as $k => $v)
1352 1352
 		{
1353 1353
 			$output = $this->_filterXmlVars($k, $v);
1354
-			if(is_object($v) && $v->attrs->type == 'array')
1354
+			if (is_object($v) && $v->attrs->type == 'array')
1355 1355
 			{
1356 1356
 				$output = array($output);
1357 1357
 			}
1358
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1358
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1359 1359
 			{
1360 1360
 				return $output;
1361 1361
 			}
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 			$stack->{$k} = $output;
1364 1364
 		}
1365 1365
 
1366
-		if(!count(get_object_vars($stack)))
1366
+		if (!count(get_object_vars($stack)))
1367 1367
 		{
1368 1368
 			return NULL;
1369 1369
 		}
@@ -1382,28 +1382,28 @@  discard block
 block discarded – undo
1382 1382
 	 */
1383 1383
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1384 1384
 	{
1385
-		if(!($isArray = is_array($val)))
1385
+		if (!($isArray = is_array($val)))
1386 1386
 		{
1387 1387
 			$val = array($val);
1388 1388
 		}
1389 1389
 
1390 1390
 		$result = array();
1391
-		foreach($val as $k => $v)
1391
+		foreach ($val as $k => $v)
1392 1392
 		{
1393 1393
 			$k = htmlentities($k);
1394
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1394
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1395 1395
 			{
1396 1396
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1397 1397
 			}
1398
-			elseif($key === 'mid' || $key === 'search_keyword')
1398
+			elseif ($key === 'mid' || $key === 'search_keyword')
1399 1399
 			{
1400 1400
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1401 1401
 			}
1402
-			elseif($key === 'vid')
1402
+			elseif ($key === 'vid')
1403 1403
 			{
1404 1404
 				$result[$k] = urlencode($v);
1405 1405
 			}
1406
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1406
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1407 1407
 			{
1408 1408
 				unset($result[$k]);
1409 1409
 			}
@@ -1411,12 +1411,12 @@  discard block
 block discarded – undo
1411 1411
 			{
1412 1412
 				$result[$k] = $v;
1413 1413
 
1414
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1414
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1415 1415
 				{
1416 1416
 					$result[$k] = stripslashes($result[$k]);
1417 1417
 				}
1418 1418
 
1419
-				if(!is_array($result[$k]))
1419
+				if (!is_array($result[$k]))
1420 1420
 				{
1421 1421
 					$result[$k] = trim($result[$k]);
1422 1422
 				}
@@ -1444,17 +1444,17 @@  discard block
 block discarded – undo
1444 1444
 	 */
1445 1445
 	function _setUploadedArgument()
1446 1446
 	{
1447
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1447
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1448 1448
 		{
1449 1449
 			return;
1450 1450
 		}
1451 1451
 
1452
-		foreach($_FILES as $key => $val)
1452
+		foreach ($_FILES as $key => $val)
1453 1453
 		{
1454 1454
 			$tmp_name = $val['tmp_name'];
1455
-			if(!is_array($tmp_name))
1455
+			if (!is_array($tmp_name))
1456 1456
 			{
1457
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1457
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1458 1458
 				{
1459 1459
 					continue;
1460 1460
 				}
@@ -1464,9 +1464,9 @@  discard block
 block discarded – undo
1464 1464
 			}
1465 1465
 			else
1466 1466
 			{
1467
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1467
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1468 1468
 				{
1469
-					if($val['size'][$i] > 0)
1469
+					if ($val['size'][$i] > 0)
1470 1470
 					{
1471 1471
 						$file['name'] = $val['name'][$i];
1472 1472
 						$file['type'] = $val['type'][$i];
@@ -1498,16 +1498,16 @@  discard block
 block discarded – undo
1498 1498
 	function getRequestUrl()
1499 1499
 	{
1500 1500
 		static $url = null;
1501
-		if(is_null($url))
1501
+		if (is_null($url))
1502 1502
 		{
1503 1503
 			$url = self::getRequestUri();
1504
-			if(count($_GET) > 0)
1504
+			if (count($_GET) > 0)
1505 1505
 			{
1506
-				foreach($_GET as $key => $val)
1506
+				foreach ($_GET as $key => $val)
1507 1507
 				{
1508
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1508
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1509 1509
 				}
1510
-				$url .= '?' . join('&', $vars);
1510
+				$url .= '?'.join('&', $vars);
1511 1511
 			}
1512 1512
 		}
1513 1513
 		return $url;
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 		$self = self::getInstance();
1523 1523
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1524 1524
 
1525
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1525
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1526 1526
 		{
1527 1527
 			unset($js_callback_func);
1528 1528
 			unset($_GET['xe_js_callback']);
@@ -1550,22 +1550,22 @@  discard block
 block discarded – undo
1550 1550
 		$self = self::getInstance();
1551 1551
 
1552 1552
 		// retrieve virtual site information
1553
-		if(is_null($site_module_info))
1553
+		if (is_null($site_module_info))
1554 1554
 		{
1555 1555
 			$site_module_info = self::get('site_module_info');
1556 1556
 		}
1557 1557
 
1558 1558
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1559
-		if($domain && isSiteID($domain))
1559
+		if ($domain && isSiteID($domain))
1560 1560
 		{
1561 1561
 			$vid = $domain;
1562 1562
 			$domain = '';
1563 1563
 		}
1564 1564
 
1565 1565
 		// If $domain, $vid are not set, use current site information
1566
-		if(!$domain && !$vid)
1566
+		if (!$domain && !$vid)
1567 1567
 		{
1568
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1568
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1569 1569
 			{
1570 1570
 				$vid = $site_module_info->domain;
1571 1571
 			}
@@ -1576,21 +1576,21 @@  discard block
 block discarded – undo
1576 1576
 		}
1577 1577
 
1578 1578
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1579
-		if($domain)
1579
+		if ($domain)
1580 1580
 		{
1581 1581
 			$domain_info = parse_url($domain);
1582
-			if(is_null($current_info))
1582
+			if (is_null($current_info))
1583 1583
 			{
1584
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1584
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1585 1585
 			}
1586
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1586
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1587 1587
 			{
1588 1588
 				unset($domain);
1589 1589
 			}
1590 1590
 			else
1591 1591
 			{
1592 1592
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1593
-				if(substr_compare($domain, '/', -1) !== 0)
1593
+				if (substr_compare($domain, '/', -1) !== 0)
1594 1594
 				{
1595 1595
 					$domain .= '/';
1596 1596
 				}
@@ -1600,10 +1600,10 @@  discard block
 block discarded – undo
1600 1600
 		$get_vars = array();
1601 1601
 
1602 1602
 		// If there is no GET variables or first argument is '' to reset variables
1603
-		if(!$self->get_vars || $args_list[0] == '')
1603
+		if (!$self->get_vars || $args_list[0] == '')
1604 1604
 		{
1605 1605
 			// rearrange args_list
1606
-			if(is_array($args_list) && $args_list[0] == '')
1606
+			if (is_array($args_list) && $args_list[0] == '')
1607 1607
 			{
1608 1608
 				array_shift($args_list);
1609 1609
 			}
@@ -1615,13 +1615,13 @@  discard block
 block discarded – undo
1615 1615
 		}
1616 1616
 
1617 1617
 		// arrange args_list
1618
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1618
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1619 1619
 		{
1620 1620
 			$key = $args_list[$i];
1621 1621
 			$val = trim($args_list[$i + 1]);
1622 1622
 
1623 1623
 			// If value is not set, remove the key
1624
-			if(!isset($val) || !strlen($val))
1624
+			if (!isset($val) || !strlen($val))
1625 1625
 			{
1626 1626
 				unset($get_vars[$key]);
1627 1627
 				continue;
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 
1633 1633
 		// remove vid, rnd
1634 1634
 		unset($get_vars['rnd']);
1635
-		if($vid)
1635
+		if ($vid)
1636 1636
 		{
1637 1637
 			$get_vars['vid'] = $vid;
1638 1638
 		}
@@ -1649,17 +1649,17 @@  discard block
 block discarded – undo
1649 1649
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1650 1650
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1651 1651
 		);
1652
-		if($act_alias[$act])
1652
+		if ($act_alias[$act])
1653 1653
 		{
1654 1654
 			$get_vars['act'] = $act_alias[$act];
1655 1655
 		}
1656 1656
 
1657 1657
 		// organize URL
1658 1658
 		$query = '';
1659
-		if(count($get_vars) > 0)
1659
+		if (count($get_vars) > 0)
1660 1660
 		{
1661 1661
 			// if using rewrite mod
1662
-			if($self->allow_rewrite)
1662
+			if ($self->allow_rewrite)
1663 1663
 			{
1664 1664
 				$var_keys = array_keys($get_vars);
1665 1665
 				sort($var_keys);
@@ -1679,8 +1679,8 @@  discard block
 block discarded – undo
1679 1679
 					'vid' => $vid,
1680 1680
 					'mid' => $mid,
1681 1681
 					'mid.vid' => "$vid/$mid",
1682
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1683
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1682
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1683
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1684 1684
 					'document_srl' => $srl,
1685 1685
 					'document_srl.mid' => "$mid/$srl",
1686 1686
 					'document_srl.vid' => "$vid/$srl",
@@ -1697,66 +1697,66 @@  discard block
 block discarded – undo
1697 1697
 				$query = $target_map[$target];
1698 1698
 			}
1699 1699
 
1700
-			if(!$query)
1700
+			if (!$query)
1701 1701
 			{
1702 1702
 				$queries = array();
1703
-				foreach($get_vars as $key => $val)
1703
+				foreach ($get_vars as $key => $val)
1704 1704
 				{
1705
-					if(is_array($val) && count($val) > 0)
1705
+					if (is_array($val) && count($val) > 0)
1706 1706
 					{
1707
-						foreach($val as $k => $v)
1707
+						foreach ($val as $k => $v)
1708 1708
 						{
1709
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1709
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1710 1710
 						}
1711 1711
 					}
1712
-					elseif(!is_array($val))
1712
+					elseif (!is_array($val))
1713 1713
 					{
1714
-						$queries[] = $key . '=' . urlencode($val);
1714
+						$queries[] = $key.'='.urlencode($val);
1715 1715
 					}
1716 1716
 				}
1717
-				if(count($queries) > 0)
1717
+				if (count($queries) > 0)
1718 1718
 				{
1719
-					$query = 'index.php?' . join('&', $queries);
1719
+					$query = 'index.php?'.join('&', $queries);
1720 1720
 				}
1721 1721
 			}
1722 1722
 		}
1723 1723
 
1724 1724
 		// If using SSL always
1725 1725
 		$_use_ssl = $self->get('_use_ssl');
1726
-		if($_use_ssl == 'always')
1726
+		if ($_use_ssl == 'always')
1727 1727
 		{
1728
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1728
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1729 1729
 			// optional SSL use
1730 1730
 		}
1731
-		elseif($_use_ssl == 'optional')
1731
+		elseif ($_use_ssl == 'optional')
1732 1732
 		{
1733 1733
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1734
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1734
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1735 1735
 			// no SSL
1736 1736
 		}
1737 1737
 		else
1738 1738
 		{
1739 1739
 			// currently on SSL but target is not based on SSL
1740
-			if($_SERVER['HTTPS'] == 'on')
1740
+			if ($_SERVER['HTTPS'] == 'on')
1741 1741
 			{
1742
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1742
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1743 1743
 			}
1744
-			else if($domain) // if $domain is set
1744
+			else if ($domain) // if $domain is set
1745 1745
 			{
1746
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1746
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1747 1747
 			}
1748 1748
 			else
1749 1749
 			{
1750
-				$query = getScriptPath() . $query;
1750
+				$query = getScriptPath().$query;
1751 1751
 			}
1752 1752
 		}
1753 1753
 
1754
-		if(!$encode)
1754
+		if (!$encode)
1755 1755
 		{
1756 1756
 			return $query;
1757 1757
 		}
1758 1758
 
1759
-		if(!$autoEncode)
1759
+		if (!$autoEncode)
1760 1760
 		{
1761 1761
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1762 1762
 		}
@@ -1765,16 +1765,16 @@  discard block
 block discarded – undo
1765 1765
 		$encode_queries = array();
1766 1766
 		$parsedUrl = parse_url($query);
1767 1767
 		parse_str($parsedUrl['query'], $output);
1768
-		foreach($output as $key => $value)
1768
+		foreach ($output as $key => $value)
1769 1769
 		{
1770
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1770
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1771 1771
 			{
1772 1772
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1773 1773
 			}
1774
-			$encode_queries[] = $key . '=' . $value;
1774
+			$encode_queries[] = $key.'='.$value;
1775 1775
 		}
1776 1776
 
1777
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1777
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1778 1778
 	}
1779 1779
 
1780 1780
 	/**
@@ -1789,17 +1789,17 @@  discard block
 block discarded – undo
1789 1789
 		static $url = array();
1790 1790
 
1791 1791
 		// Check HTTP Request
1792
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1792
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1793 1793
 		{
1794 1794
 			return;
1795 1795
 		}
1796 1796
 
1797
-		if(self::get('_use_ssl') == 'always')
1797
+		if (self::get('_use_ssl') == 'always')
1798 1798
 		{
1799 1799
 			$ssl_mode = ENFORCE_SSL;
1800 1800
 		}
1801 1801
 
1802
-		if($domain)
1802
+		if ($domain)
1803 1803
 		{
1804 1804
 			$domain_key = md5($domain);
1805 1805
 		}
@@ -1808,14 +1808,14 @@  discard block
 block discarded – undo
1808 1808
 			$domain_key = 'default';
1809 1809
 		}
1810 1810
 
1811
-		if(isset($url[$ssl_mode][$domain_key]))
1811
+		if (isset($url[$ssl_mode][$domain_key]))
1812 1812
 		{
1813 1813
 			return $url[$ssl_mode][$domain_key];
1814 1814
 		}
1815 1815
 
1816 1816
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1817 1817
 
1818
-		switch($ssl_mode)
1818
+		switch ($ssl_mode)
1819 1819
 		{
1820 1820
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1821 1821
 				break;
@@ -1825,34 +1825,34 @@  discard block
 block discarded – undo
1825 1825
 				break;
1826 1826
 		}
1827 1827
 
1828
-		if($domain)
1828
+		if ($domain)
1829 1829
 		{
1830 1830
 			$target_url = trim($domain);
1831
-			if(substr_compare($target_url, '/', -1) !== 0)
1831
+			if (substr_compare($target_url, '/', -1) !== 0)
1832 1832
 			{
1833
-				$target_url.= '/';
1833
+				$target_url .= '/';
1834 1834
 			}
1835 1835
 		}
1836 1836
 		else
1837 1837
 		{
1838
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1838
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1839 1839
 		}
1840 1840
 
1841
-		$url_info = parse_url('http://' . $target_url);
1841
+		$url_info = parse_url('http://'.$target_url);
1842 1842
 
1843
-		if($current_use_ssl != $use_ssl)
1843
+		if ($current_use_ssl != $use_ssl)
1844 1844
 		{
1845 1845
 			unset($url_info['port']);
1846 1846
 		}
1847 1847
 
1848
-		if($use_ssl)
1848
+		if ($use_ssl)
1849 1849
 		{
1850 1850
 			$port = self::get('_https_port');
1851
-			if($port && $port != 443)
1851
+			if ($port && $port != 443)
1852 1852
 			{
1853 1853
 				$url_info['port'] = $port;
1854 1854
 			}
1855
-			elseif($url_info['port'] == 443)
1855
+			elseif ($url_info['port'] == 443)
1856 1856
 			{
1857 1857
 				unset($url_info['port']);
1858 1858
 			}
@@ -1860,17 +1860,17 @@  discard block
 block discarded – undo
1860 1860
 		else
1861 1861
 		{
1862 1862
 			$port = self::get('_http_port');
1863
-			if($port && $port != 80)
1863
+			if ($port && $port != 80)
1864 1864
 			{
1865 1865
 				$url_info['port'] = $port;
1866 1866
 			}
1867
-			elseif($url_info['port'] == 80)
1867
+			elseif ($url_info['port'] == 80)
1868 1868
 			{
1869 1869
 				unset($url_info['port']);
1870 1870
 			}
1871 1871
 		}
1872 1872
 
1873
-		$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']);
1873
+		$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']);
1874 1874
 
1875 1875
 		return $url[$ssl_mode][$domain_key];
1876 1876
 	}
@@ -1887,16 +1887,16 @@  discard block
 block discarded – undo
1887 1887
 	{
1888 1888
 		$self = self::getInstance();
1889 1889
 		$self->context->{$key} = $val;
1890
-		if($set_to_get_vars === FALSE)
1890
+		if ($set_to_get_vars === FALSE)
1891 1891
 		{
1892 1892
 			return;
1893 1893
 		}
1894
-		if($val === NULL || $val === '')
1894
+		if ($val === NULL || $val === '')
1895 1895
 		{
1896 1896
 			unset($self->get_vars->{$key});
1897 1897
 			return;
1898 1898
 		}
1899
-		if($set_to_get_vars || $self->get_vars->{$key})
1899
+		if ($set_to_get_vars || $self->get_vars->{$key})
1900 1900
 		{
1901 1901
 			$self->get_vars->{$key} = $val;
1902 1902
 		}
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 	{
1913 1913
 		$self = self::getInstance();
1914 1914
 
1915
-		if(!isset($self->context->{$key}))
1915
+		if (!isset($self->context->{$key}))
1916 1916
 		{
1917 1917
 			return null;
1918 1918
 		}
@@ -1927,7 +1927,7 @@  discard block
 block discarded – undo
1927 1927
 	function gets()
1928 1928
 	{
1929 1929
 		$num_args = func_num_args();
1930
-		if($num_args < 1)
1930
+		if ($num_args < 1)
1931 1931
 		{
1932 1932
 			return;
1933 1933
 		}
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 
1936 1936
 		$args_list = func_get_args();
1937 1937
 		$output = new stdClass();
1938
-		foreach($args_list as $v)
1938
+		foreach ($args_list as $v)
1939 1939
 		{
1940 1940
 			$output->{$v} = $self->get($v);
1941 1941
 		}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 	function getRequestVars()
1962 1962
 	{
1963 1963
 		$self = self::getInstance();
1964
-		if($self->get_vars)
1964
+		if ($self->get_vars)
1965 1965
 		{
1966 1966
 			return clone($self->get_vars);
1967 1967
 		}
@@ -1978,13 +1978,13 @@  discard block
 block discarded – undo
1978 1978
 	{
1979 1979
 		$self = self::getInstance();
1980 1980
 
1981
-		if(!is_readable($self->sslActionCacheFile))
1981
+		if (!is_readable($self->sslActionCacheFile))
1982 1982
 		{
1983 1983
 			$buff = '<?php if(!defined("__XE__"))exit;';
1984 1984
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
1985 1985
 		}
1986 1986
 
1987
-		if(!isset($self->ssl_actions[$action]))
1987
+		if (!isset($self->ssl_actions[$action]))
1988 1988
 		{
1989 1989
 			$self->ssl_actions[$action] = 1;
1990 1990
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2002,16 +2002,16 @@  discard block
 block discarded – undo
2002 2002
 	{
2003 2003
 		$self = self::getInstance();
2004 2004
 
2005
-		if(!is_readable($self->sslActionCacheFile))
2005
+		if (!is_readable($self->sslActionCacheFile))
2006 2006
 		{
2007 2007
 			unset($self->ssl_actions);
2008 2008
 			$buff = '<?php if(!defined("__XE__"))exit;';
2009 2009
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2010 2010
 		}
2011 2011
 
2012
-		foreach($action_array as $action)
2012
+		foreach ($action_array as $action)
2013 2013
 		{
2014
-			if(!isset($self->ssl_actions[$action]))
2014
+			if (!isset($self->ssl_actions[$action]))
2015 2015
 			{
2016 2016
 				$self->ssl_actions[$action] = 1;
2017 2017
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 	{
2031 2031
 		$self = self::getInstance();
2032 2032
 
2033
-		if($self->isExistsSSLAction($action))
2033
+		if ($self->isExistsSSLAction($action))
2034 2034
 		{
2035 2035
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2036 2036
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
 	function getSSLActions()
2048 2048
 	{
2049 2049
 		$self = self::getInstance();
2050
-		if($self->getSslStatus() == 'optional')
2050
+		if ($self->getSslStatus() == 'optional')
2051 2051
 		{
2052 2052
 			return $self->ssl_actions;
2053 2053
 		}
@@ -2074,12 +2074,12 @@  discard block
 block discarded – undo
2074 2074
 	 */
2075 2075
 	function normalizeFilePath($file)
2076 2076
 	{
2077
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2077
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2078 2078
 		{
2079
-			$file = './' . $file;
2079
+			$file = './'.$file;
2080 2080
 		}
2081 2081
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2082
-		while(strpos($file, '/../') !== FALSE)
2082
+		while (strpos($file, '/../') !== FALSE)
2083 2083
 		{
2084 2084
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2085 2085
 		}
@@ -2098,13 +2098,13 @@  discard block
 block discarded – undo
2098 2098
 	{
2099 2099
 		$file = self::normalizeFilePath($file);
2100 2100
 		$script_path = getScriptPath();
2101
-		if(strpos($file, './') === 0)
2101
+		if (strpos($file, './') === 0)
2102 2102
 		{
2103
-			$file = $script_path . substr($file, 2);
2103
+			$file = $script_path.substr($file, 2);
2104 2104
 		}
2105
-		elseif(strpos($file, '../') === 0)
2105
+		elseif (strpos($file, '../') === 0)
2106 2106
 		{
2107
-			$file = self::normalizeFilePath($script_path . $file);
2107
+			$file = self::normalizeFilePath($script_path.$file);
2108 2108
 		}
2109 2109
 
2110 2110
 		return $file;
@@ -2174,12 +2174,12 @@  discard block
 block discarded – undo
2174 2174
 	 */
2175 2175
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2176 2176
 	{
2177
-		if($isRuleset)
2177
+		if ($isRuleset)
2178 2178
 		{
2179
-			if(strpos($file, '#') !== FALSE)
2179
+			if (strpos($file, '#') !== FALSE)
2180 2180
 			{
2181 2181
 				$file = str_replace('#', '', $file);
2182
-				if(!is_readable($file))
2182
+				if (!is_readable($file))
2183 2183
 				{
2184 2184
 					$file = $autoPath;
2185 2185
 				}
@@ -2244,9 +2244,9 @@  discard block
 block discarded – undo
2244 2244
 		ksort($files);
2245 2245
 		$files = array_values($files);
2246 2246
 		$filenames = array();
2247
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2247
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2248 2248
 		{
2249
-			if(in_array($files[$i]['file'], $filenames))
2249
+			if (in_array($files[$i]['file'], $filenames))
2250 2250
 			{
2251 2251
 				unset($files[$i]);
2252 2252
 			}
@@ -2331,14 +2331,14 @@  discard block
 block discarded – undo
2331 2331
 	 */
2332 2332
 	function getJavascriptPluginInfo($pluginName)
2333 2333
 	{
2334
-		if($plugin_name == 'ui.datepicker')
2334
+		if ($plugin_name == 'ui.datepicker')
2335 2335
 		{
2336 2336
 			$plugin_name = 'ui';
2337 2337
 		}
2338 2338
 
2339
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2340
-		$info_file = $plugin_path . 'plugin.load';
2341
-		if(!is_readable($info_file))
2339
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2340
+		$info_file = $plugin_path.'plugin.load';
2341
+		if (!is_readable($info_file))
2342 2342
 		{
2343 2343
 			return;
2344 2344
 		}
@@ -2348,32 +2348,32 @@  discard block
 block discarded – undo
2348 2348
 		$result->jsList = array();
2349 2349
 		$result->cssList = array();
2350 2350
 
2351
-		foreach($list as $filename)
2351
+		foreach ($list as $filename)
2352 2352
 		{
2353 2353
 			$filename = trim($filename);
2354
-			if(!$filename)
2354
+			if (!$filename)
2355 2355
 			{
2356 2356
 				continue;
2357 2357
 			}
2358 2358
 
2359
-			if(strncasecmp('./', $filename, 2) === 0)
2359
+			if (strncasecmp('./', $filename, 2) === 0)
2360 2360
 			{
2361 2361
 				$filename = substr($filename, 2);
2362 2362
 			}
2363 2363
 
2364
-			if(substr_compare($filename, '.js', -3) === 0)
2364
+			if (substr_compare($filename, '.js', -3) === 0)
2365 2365
 			{
2366
-				$result->jsList[] = $plugin_path . $filename;
2366
+				$result->jsList[] = $plugin_path.$filename;
2367 2367
 			}
2368
-			elseif(substr_compare($filename, '.css', -4) === 0)
2368
+			elseif (substr_compare($filename, '.css', -4) === 0)
2369 2369
 			{
2370
-				$result->cssList[] = $plugin_path . $filename;
2370
+				$result->cssList[] = $plugin_path.$filename;
2371 2371
 			}
2372 2372
 		}
2373 2373
 
2374
-		if(is_dir($plugin_path . 'lang'))
2374
+		if (is_dir($plugin_path.'lang'))
2375 2375
 		{
2376
-			$result->langPath = $plugin_path . 'lang';
2376
+			$result->langPath = $plugin_path.'lang';
2377 2377
 		}
2378 2378
 
2379 2379
 		return $result;
@@ -2389,50 +2389,50 @@  discard block
 block discarded – undo
2389 2389
 		static $loaded_plugins = array();
2390 2390
 
2391 2391
 		$self = self::getInstance();
2392
-		if($plugin_name == 'ui.datepicker')
2392
+		if ($plugin_name == 'ui.datepicker')
2393 2393
 		{
2394 2394
 			$plugin_name = 'ui';
2395 2395
 		}
2396 2396
 
2397
-		if($loaded_plugins[$plugin_name])
2397
+		if ($loaded_plugins[$plugin_name])
2398 2398
 		{
2399 2399
 			return;
2400 2400
 		}
2401 2401
 		$loaded_plugins[$plugin_name] = TRUE;
2402 2402
 
2403
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2404
-		$info_file = $plugin_path . 'plugin.load';
2405
-		if(!is_readable($info_file))
2403
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2404
+		$info_file = $plugin_path.'plugin.load';
2405
+		if (!is_readable($info_file))
2406 2406
 		{
2407 2407
 			return;
2408 2408
 		}
2409 2409
 
2410 2410
 		$list = file($info_file);
2411
-		foreach($list as $filename)
2411
+		foreach ($list as $filename)
2412 2412
 		{
2413 2413
 			$filename = trim($filename);
2414
-			if(!$filename)
2414
+			if (!$filename)
2415 2415
 			{
2416 2416
 				continue;
2417 2417
 			}
2418 2418
 
2419
-			if(strncasecmp('./', $filename, 2) === 0)
2419
+			if (strncasecmp('./', $filename, 2) === 0)
2420 2420
 			{
2421 2421
 				$filename = substr($filename, 2);
2422 2422
 			}
2423
-			if(substr_compare($filename, '.js', -3) === 0)
2423
+			if (substr_compare($filename, '.js', -3) === 0)
2424 2424
 			{
2425
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2425
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2426 2426
 			}
2427
-			if(substr_compare($filename, '.css', -4) === 0)
2427
+			if (substr_compare($filename, '.css', -4) === 0)
2428 2428
 			{
2429
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2429
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2430 2430
 			}
2431 2431
 		}
2432 2432
 
2433
-		if(is_dir($plugin_path . 'lang'))
2433
+		if (is_dir($plugin_path.'lang'))
2434 2434
 		{
2435
-			$self->loadLang($plugin_path . 'lang');
2435
+			$self->loadLang($plugin_path.'lang');
2436 2436
 		}
2437 2437
 	}
2438 2438
 
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
 	function addHtmlHeader($header)
2446 2446
 	{
2447 2447
 		$self = self::getInstance();
2448
-		$self->html_header .= "\n" . $header;
2448
+		$self->html_header .= "\n".$header;
2449 2449
 	}
2450 2450
 
2451 2451
 	function clearHtmlHeader()
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
 	function addBodyHeader($header)
2498 2498
 	{
2499 2499
 		$self = self::getInstance();
2500
-		$self->body_header .= "\n" . $header;
2500
+		$self->body_header .= "\n".$header;
2501 2501
 	}
2502 2502
 
2503 2503
 	/**
@@ -2519,7 +2519,7 @@  discard block
 block discarded – undo
2519 2519
 	function addHtmlFooter($footer)
2520 2520
 	{
2521 2521
 		$self = self::getInstance();
2522
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2522
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2523 2523
 	}
2524 2524
 
2525 2525
 	/**
@@ -2540,7 +2540,7 @@  discard block
 block discarded – undo
2540 2540
 	 */
2541 2541
 	function getConfigFile()
2542 2542
 	{
2543
-		return _XE_PATH_ . 'files/config/db.config.php';
2543
+		return _XE_PATH_.'files/config/db.config.php';
2544 2544
 	}
2545 2545
 
2546 2546
 	/**
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 	 */
2551 2551
 	function getFTPConfigFile()
2552 2552
 	{
2553
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2553
+		return _XE_PATH_.'files/config/ftp.config.php';
2554 2554
 	}
2555 2555
 
2556 2556
 	/**
@@ -2602,14 +2602,14 @@  discard block
 block discarded – undo
2602 2602
 		$_path = explode('/', $path);
2603 2603
 		$_base = explode('/', $base_url);
2604 2604
 
2605
-		if(!$_base[count($_base) - 1])
2605
+		if (!$_base[count($_base) - 1])
2606 2606
 		{
2607 2607
 			array_pop($_base);
2608 2608
 		}
2609 2609
 
2610
-		foreach($_xe as $idx => $dir)
2610
+		foreach ($_xe as $idx => $dir)
2611 2611
 		{
2612
-			if($_path[0] != $dir)
2612
+			if ($_path[0] != $dir)
2613 2613
 			{
2614 2614
 				break;
2615 2615
 			}
@@ -2617,9 +2617,9 @@  discard block
 block discarded – undo
2617 2617
 		}
2618 2618
 
2619 2619
 		$idx = count($_xe) - $idx - 1;
2620
-		while($idx--)
2620
+		while ($idx--)
2621 2621
 		{
2622
-			if(count($_base) > 0)
2622
+			if (count($_base) > 0)
2623 2623
 			{
2624 2624
 				array_shift($_base);
2625 2625
 			}
@@ -2629,13 +2629,13 @@  discard block
 block discarded – undo
2629 2629
 			}
2630 2630
 		}
2631 2631
 
2632
-		if(count($_base) > 0)
2632
+		if (count($_base) > 0)
2633 2633
 		{
2634 2634
 			array_unshift($_path, join('/', $_base));
2635 2635
 		}
2636 2636
 
2637
-		$path = '/' . join('/', $_path);
2638
-		if(substr_compare($path, '/', -1) !== 0)
2637
+		$path = '/'.join('/', $_path);
2638
+		if (substr_compare($path, '/', -1) !== 0)
2639 2639
 		{
2640 2640
 			$path .= '/';
2641 2641
 		}
@@ -2650,13 +2650,13 @@  discard block
 block discarded – undo
2650 2650
 	{
2651 2651
 		$self = self::getInstance();
2652 2652
 
2653
-		if(!is_array($self->meta_tags))
2653
+		if (!is_array($self->meta_tags))
2654 2654
 		{
2655 2655
 			$self->meta_tags = array();
2656 2656
 		}
2657 2657
 
2658 2658
 		$ret = array();
2659
-		foreach($self->meta_tags as $key => $val)
2659
+		foreach ($self->meta_tags as $key => $val)
2660 2660
 		{
2661 2661
 			list($name, $is_http_equiv) = explode("\t", $key);
2662 2662
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2677 2677
 	{
2678 2678
 		$self = self::getInstance();
2679
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2679
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2680 2680
 	}
2681 2681
 
2682 2682
 }
Please login to merge, or discard this patch.
Braces   +80 added lines, -93 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
 		}
@@ -494,18 +495,22 @@  discard block
 block discarded – undo
494 495
 			$db_info->use_prepared_statements = 'Y';
495 496
 		}
496 497
 
497
-		if(!$db_info->time_zone)
498
-			$db_info->time_zone = date('O');
498
+		if(!$db_info->time_zone) {
499
+					$db_info->time_zone = date('O');
500
+		}
499 501
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
500 502
 
501
-		if($db_info->qmail_compatibility != 'Y')
502
-			$db_info->qmail_compatibility = 'N';
503
+		if($db_info->qmail_compatibility != 'Y') {
504
+					$db_info->qmail_compatibility = 'N';
505
+		}
503 506
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
504 507
 
505
-		if(!$db_info->use_db_session)
506
-			$db_info->use_db_session = 'N';
507
-		if(!$db_info->use_ssl)
508
-			$db_info->use_ssl = 'none';
508
+		if(!$db_info->use_db_session) {
509
+					$db_info->use_db_session = 'N';
510
+		}
511
+		if(!$db_info->use_ssl) {
512
+					$db_info->use_ssl = 'none';
513
+		}
509 514
 		$this->set('_use_ssl', $db_info->use_ssl);
510 515
 
511 516
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -622,8 +627,7 @@  discard block
 block discarded – undo
622 627
 				$buff = FileHandler::readFile($orig_lang_file);
623 628
 				FileHandler::writeFile($selected_lang_file, $buff);
624 629
 				$lang_selected = self::loadLangSupported();
625
-			}
626
-			else
630
+			} else
627 631
 			{
628 632
 				$langs = file($selected_lang_file);
629 633
 				foreach($langs as $val)
@@ -687,8 +691,7 @@  discard block
 block discarded – undo
687 691
 				return FALSE;
688 692
 			}
689 693
 			// for sites requesting SSO validation
690
-		}
691
-		else
694
+		} else
692 695
 		{
693 696
 			// result handling : set session_name()
694 697
 			if($session_name = self::get('SSOID'))
@@ -705,8 +708,7 @@  discard block
 block discarded – undo
705 708
 				header('location:' . $url);
706 709
 				return FALSE;
707 710
 				// send SSO request
708
-			}
709
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
711
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
710 712
 			{
711 713
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
712 714
 				$origin_url = self::getRequestUrl();
@@ -766,8 +768,7 @@  discard block
 block discarded – undo
766 768
 		if($self->site_title)
767 769
 		{
768 770
 			$self->site_title .= ' - ' . $site_title;
769
-		}
770
-		else
771
+		} else
771 772
 		{
772 773
 			$self->site_title = $site_title;
773 774
 		}
@@ -867,8 +868,7 @@  discard block
 block discarded – undo
867 868
 		{
868 869
 			$self->loaded_lang_files[] = $filename;
869 870
 			include($filename);
870
-		}
871
-		else
871
+		} else
872 872
 		{
873 873
 			$self->_evalxmlLang($path);
874 874
 		}
@@ -884,7 +884,9 @@  discard block
 block discarded – undo
884 884
 	{
885 885
 		global $lang;
886 886
 
887
-		if(!$path) return;
887
+		if(!$path) {
888
+			return;
889
+		}
888 890
 
889 891
 		$_path = 'eval://' . $path;
890 892
 
@@ -916,7 +918,9 @@  discard block
 block discarded – undo
916 918
 	 */
917 919
 	function _loadXmlLang($path)
918 920
 	{
919
-		if(!$path) return;
921
+		if(!$path) {
922
+			return;
923
+		}
920 924
 
921 925
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
922 926
 		return $oXmlLangParser->compile();
@@ -930,7 +934,9 @@  discard block
 block discarded – undo
930 934
 	 */
931 935
 	function _loadPhpLang($path)
932 936
 	{
933
-		if(!$path) return;
937
+		if(!$path) {
938
+			return;
939
+		}
934 940
 
935 941
 		if(substr_compare($path, '/', -1) !== 0)
936 942
 		{
@@ -1066,12 +1072,14 @@  discard block
 block discarded – undo
1066 1072
 		static $flag = TRUE;
1067 1073
 		if($charset)
1068 1074
 		{
1069
-			if(is_array($val))
1070
-				array_walk($val,'Context::checkConvertFlag',$charset);
1071
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1072
-			else $flag = FALSE;
1073
-		}
1074
-		else
1075
+			if(is_array($val)) {
1076
+							array_walk($val,'Context::checkConvertFlag',$charset);
1077
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1078
+				$flag = FALSE;
1079
+			} else {
1080
+				$flag = FALSE;
1081
+			}
1082
+		} else
1075 1083
 		{
1076 1084
 			$return = $flag;
1077 1085
 			$flag = TRUE;
@@ -1093,8 +1101,9 @@  discard block
 block discarded – undo
1093 1101
 		if (is_array($val))
1094 1102
 		{
1095 1103
 			array_walk($val,'Context::doConvertEncoding',$charset);
1104
+		} else {
1105
+			$val = iconv($charset,'UTF-8',$val);
1096 1106
 		}
1097
-		else $val = iconv($charset,'UTF-8',$val);
1098 1107
 	}
1099 1108
 
1100 1109
 	/**
@@ -1105,7 +1114,9 @@  discard block
 block discarded – undo
1105 1114
 	 */
1106 1115
 	function convertEncodingStr($str)
1107 1116
 	{
1108
-        if(!$str) return null;
1117
+        if(!$str) {
1118
+        	return null;
1119
+        }
1109 1120
 		$obj = new stdClass();
1110 1121
 		$obj->str = $str;
1111 1122
 		$obj = self::convertEncoding($obj);
@@ -1218,16 +1229,13 @@  discard block
 block discarded – undo
1218 1229
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1219 1230
 			{
1220 1231
 				$set_to_vars = TRUE;
1221
-			}
1222
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1232
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1223 1233
 			{
1224 1234
 				$set_to_vars = TRUE;
1225
-			}
1226
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1227 1236
 			{
1228 1237
 				$set_to_vars = TRUE;
1229
-			}
1230
-			else
1238
+			} else
1231 1239
 			{
1232 1240
 				$set_to_vars = FALSE;
1233 1241
 			}
@@ -1253,8 +1261,7 @@  discard block
 block discarded – undo
1253 1261
 					return;
1254 1262
 				}
1255 1263
 			}
1256
-		}
1257
-		else if(is_array($val))
1264
+		} else if(is_array($val))
1258 1265
 		{
1259 1266
 			foreach($val as $val2)
1260 1267
 			{
@@ -1394,20 +1401,16 @@  discard block
 block discarded – undo
1394 1401
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1395 1402
 			{
1396 1403
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1397
-			}
1398
-			elseif($key === 'mid' || $key === 'search_keyword')
1404
+			} elseif($key === 'mid' || $key === 'search_keyword')
1399 1405
 			{
1400 1406
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1401
-			}
1402
-			elseif($key === 'vid')
1407
+			} elseif($key === 'vid')
1403 1408
 			{
1404 1409
 				$result[$k] = urlencode($v);
1405
-			}
1406
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1410
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1407 1411
 			{
1408 1412
 				unset($result[$k]);
1409
-			}
1410
-			else
1413
+			} else
1411 1414
 			{
1412 1415
 				$result[$k] = $v;
1413 1416
 
@@ -1461,8 +1464,7 @@  discard block
 block discarded – undo
1461 1464
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1462 1465
 				$this->set($key, $val, TRUE);
1463 1466
 				$this->is_uploaded = TRUE;
1464
-			}
1465
-			else
1467
+			} else
1466 1468
 			{
1467 1469
 				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1468 1470
 				{
@@ -1568,8 +1570,7 @@  discard block
 block discarded – undo
1568 1570
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1569 1571
 			{
1570 1572
 				$vid = $site_module_info->domain;
1571
-			}
1572
-			else
1573
+			} else
1573 1574
 			{
1574 1575
 				$domain = $site_module_info->domain;
1575 1576
 			}
@@ -1586,8 +1587,7 @@  discard block
 block discarded – undo
1586 1587
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1587 1588
 			{
1588 1589
 				unset($domain);
1589
-			}
1590
-			else
1590
+			} else
1591 1591
 			{
1592 1592
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1593 1593
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1607,8 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 			{
1608 1608
 				array_shift($args_list);
1609 1609
 			}
1610
-		}
1611
-		else
1610
+		} else
1612 1611
 		{
1613 1612
 			// Otherwise, make GET variables into array
1614 1613
 			$get_vars = get_object_vars($self->get_vars);
@@ -1635,8 +1634,7 @@  discard block
 block discarded – undo
1635 1634
 		if($vid)
1636 1635
 		{
1637 1636
 			$get_vars['vid'] = $vid;
1638
-		}
1639
-		else
1637
+		} else
1640 1638
 		{
1641 1639
 			unset($get_vars['vid']);
1642 1640
 		}
@@ -1708,8 +1706,7 @@  discard block
 block discarded – undo
1708 1706
 						{
1709 1707
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1710 1708
 						}
1711
-					}
1712
-					elseif(!is_array($val))
1709
+					} elseif(!is_array($val))
1713 1710
 					{
1714 1711
 						$queries[] = $key . '=' . urlencode($val);
1715 1712
 					}
@@ -1727,25 +1724,23 @@  discard block
 block discarded – undo
1727 1724
 		{
1728 1725
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1729 1726
 			// optional SSL use
1730
-		}
1731
-		elseif($_use_ssl == 'optional')
1727
+		} elseif($_use_ssl == 'optional')
1732 1728
 		{
1733 1729
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1734 1730
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1735 1731
 			// no SSL
1736
-		}
1737
-		else
1732
+		} else
1738 1733
 		{
1739 1734
 			// currently on SSL but target is not based on SSL
1740 1735
 			if($_SERVER['HTTPS'] == 'on')
1741 1736
 			{
1742 1737
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1743
-			}
1744
-			else if($domain) // if $domain is set
1738
+			} else if($domain) {
1739
+				// if $domain is set
1745 1740
 			{
1746 1741
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1747 1742
 			}
1748
-			else
1743
+			} else
1749 1744
 			{
1750 1745
 				$query = getScriptPath() . $query;
1751 1746
 			}
@@ -1802,8 +1797,7 @@  discard block
 block discarded – undo
1802 1797
 		if($domain)
1803 1798
 		{
1804 1799
 			$domain_key = md5($domain);
1805
-		}
1806
-		else
1800
+		} else
1807 1801
 		{
1808 1802
 			$domain_key = 'default';
1809 1803
 		}
@@ -1832,8 +1826,7 @@  discard block
 block discarded – undo
1832 1826
 			{
1833 1827
 				$target_url.= '/';
1834 1828
 			}
1835
-		}
1836
-		else
1829
+		} else
1837 1830
 		{
1838 1831
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1839 1832
 		}
@@ -1851,20 +1844,17 @@  discard block
 block discarded – undo
1851 1844
 			if($port && $port != 443)
1852 1845
 			{
1853 1846
 				$url_info['port'] = $port;
1854
-			}
1855
-			elseif($url_info['port'] == 443)
1847
+			} elseif($url_info['port'] == 443)
1856 1848
 			{
1857 1849
 				unset($url_info['port']);
1858 1850
 			}
1859
-		}
1860
-		else
1851
+		} else
1861 1852
 		{
1862 1853
 			$port = self::get('_http_port');
1863 1854
 			if($port && $port != 80)
1864 1855
 			{
1865 1856
 				$url_info['port'] = $port;
1866
-			}
1867
-			elseif($url_info['port'] == 80)
1857
+			} elseif($url_info['port'] == 80)
1868 1858
 			{
1869 1859
 				unset($url_info['port']);
1870 1860
 			}
@@ -2101,8 +2091,7 @@  discard block
 block discarded – undo
2101 2091
 		if(strpos($file, './') === 0)
2102 2092
 		{
2103 2093
 			$file = $script_path . substr($file, 2);
2104
-		}
2105
-		elseif(strpos($file, '../') === 0)
2094
+		} elseif(strpos($file, '../') === 0)
2106 2095
 		{
2107 2096
 			$file = self::normalizeFilePath($script_path . $file);
2108 2097
 		}
@@ -2364,8 +2353,7 @@  discard block
 block discarded – undo
2364 2353
 			if(substr_compare($filename, '.js', -3) === 0)
2365 2354
 			{
2366 2355
 				$result->jsList[] = $plugin_path . $filename;
2367
-			}
2368
-			elseif(substr_compare($filename, '.css', -4) === 0)
2356
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2369 2357
 			{
2370 2358
 				$result->cssList[] = $plugin_path . $filename;
2371 2359
 			}
@@ -2622,8 +2610,7 @@  discard block
 block discarded – undo
2622 2610
 			if(count($_base) > 0)
2623 2611
 			{
2624 2612
 				array_shift($_base);
2625
-			}
2626
-			else
2613
+			} else
2627 2614
 			{
2628 2615
 				array_unshift($_base, '..');
2629 2616
 			}
Please login to merge, or discard this patch.
modules/member/member.controller.php 1 patch
Spacing   +442 added lines, -442 removed lines patch added patch discarded remove patch
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	function procMemberLogin($user_id = null, $password = null, $keep_signed = null)
36 36
 	{
37
-		if(!$user_id && !$password && Context::getRequestMethod() == 'GET')
37
+		if (!$user_id && !$password && Context::getRequestMethod() == 'GET')
38 38
 		{
39 39
 			$this->setRedirectUrl(getNotEncodedUrl(''));
40 40
 			return new Object(-1, 'null_user_id');
41 41
 		}
42 42
 
43 43
 		// Variables
44
-		if(!$user_id) $user_id = Context::get('user_id');
44
+		if (!$user_id) $user_id = Context::get('user_id');
45 45
 		$user_id = trim($user_id);
46 46
 
47
-		if(!$password) $password = Context::get('password');
47
+		if (!$password) $password = Context::get('password');
48 48
 		$password = trim($password);
49 49
 
50
-		if(!$keep_signed) $keep_signed = Context::get('keep_signed');
50
+		if (!$keep_signed) $keep_signed = Context::get('keep_signed');
51 51
 		// Return an error when id and password doesn't exist
52
-		if(!$user_id) return new Object(-1,'null_user_id');
53
-		if(!$password) return new Object(-1,'null_password');
52
+		if (!$user_id) return new Object(-1, 'null_user_id');
53
+		if (!$password) return new Object(-1, 'null_password');
54 54
 
55
-		$output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false);
55
+		$output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ? true : false);
56 56
 		if (!$output->toBool()) return $output;
57 57
 
58 58
 		$oModuleModel = getModel('module');
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		$limit_date = $config->change_password_date;
63 63
 
64 64
 		// Check if change_password_date is set
65
-		if($limit_date > 0)
65
+		if ($limit_date > 0)
66 66
 		{
67 67
 			$oMemberModel = getModel('member');
68
-			if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day')))
68
+			if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day')))
69 69
 			{
70 70
 				$msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date);
71
-				return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg));
71
+				return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new Object(-1, $msg));
72 72
 			}
73 73
 		}
74 74
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$args->member_srl = $this->memberInfo->member_srl;
78 78
 		executeQuery('member.deleteAuthMail', $args);
79 79
 
80
-		if(!$config->after_login_url)
80
+		if (!$config->after_login_url)
81 81
 		{
82 82
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
83 83
 		}
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 		// Call a trigger before log-out (before)
99 99
 		$logged_info = Context::get('logged_info');
100 100
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info);
101
-		if(!$trigger_output->toBool()) return $trigger_output;
101
+		if (!$trigger_output->toBool()) return $trigger_output;
102 102
 		// Destroy session information
103 103
 		$this->destroySessionInfo();
104 104
 		// Call a trigger after log-out (after)
105 105
 		$trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info);
106
-		if(!$trigger_output->toBool()) return $trigger_output;
106
+		if (!$trigger_output->toBool()) return $trigger_output;
107 107
 
108 108
 		$output = new Object();
109 109
 
110 110
 		$oModuleModel = getModel('module');
111 111
 		$config = $oModuleModel->getModuleConfig('member');
112
-		if($config->after_logout_url)
112
+		if ($config->after_logout_url)
113 113
 			$output->redirect_url = $config->after_logout_url;
114 114
 
115 115
 		$this->_clearMemberCache($logged_info->member_srl);
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	function procMemberScrapDocument()
126 126
 	{
127 127
 		// Check login information
128
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
128
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
129 129
 		$logged_info = Context::get('logged_info');
130 130
 
131
-		$document_srl = (int)Context::get('document_srl');
132
-		if(!$document_srl) $document_srl = (int)Context::get('target_srl');
133
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
131
+		$document_srl = (int) Context::get('document_srl');
132
+		if (!$document_srl) $document_srl = (int) Context::get('target_srl');
133
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
134 134
 		// Get document
135 135
 		$oDocumentModel = getModel('document');
136 136
 		$oDocument = $oDocumentModel->getDocument($document_srl);
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 		$args->title = $oDocument->get('title');
146 146
 		// Check if already scrapped
147 147
 		$output = executeQuery('member.getScrapDocument', $args);
148
-		if($output->data->count) return new Object(-1, 'msg_alreay_scrapped');
148
+		if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped');
149 149
 		// Insert
150 150
 		$output = executeQuery('member.addScrapDocument', $args);
151
-		if(!$output->toBool()) return $output;
151
+		if (!$output->toBool()) return $output;
152 152
 
153 153
 		$this->setError(-1);
154 154
 		$this->setMessage('success_registed');
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 	function procMemberDeleteScrap()
163 163
 	{
164 164
 		// Check login information
165
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
165
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
166 166
 		$logged_info = Context::get('logged_info');
167 167
 
168
-		$document_srl = (int)Context::get('document_srl');
169
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
168
+		$document_srl = (int) Context::get('document_srl');
169
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
170 170
 		// Variables
171 171
 		$args = new stdClass;
172 172
 		$args->member_srl = $logged_info->member_srl;
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	function procMemberDeleteSavedDocument()
193 193
 	{
194 194
 		// Check login information
195
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
195
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
196 196
 		$logged_info = Context::get('logged_info');
197 197
 
198
-		$document_srl = (int)Context::get('document_srl');
199
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
198
+		$document_srl = (int) Context::get('document_srl');
199
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
200 200
 		// Variables
201 201
 		$oDocumentController = getController('document');
202 202
 		$oDocumentController->deleteDocument($document_srl, true);
@@ -211,37 +211,37 @@  discard block
 block discarded – undo
211 211
 	{
212 212
 		$name = Context::get('name');
213 213
 		$value = Context::get('value');
214
-		if(!$value) return;
214
+		if (!$value) return;
215 215
 
216 216
 		$oMemberModel = getModel('member');
217 217
 		// Check if logged-in
218 218
 		$logged_info = Context::get('logged_info');
219 219
 
220 220
 
221
-		switch($name)
221
+		switch ($name)
222 222
 		{
223 223
 			case 'user_id' :
224 224
 				// Check denied ID
225
-				if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id');
225
+				if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id');
226 226
 				// Check if duplicated
227 227
 				$member_srl = $oMemberModel->getMemberSrlByUserID($value);
228
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id');
228
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id');
229 229
 				break;
230 230
 			case 'nick_name' :
231 231
 				// Check denied ID
232
-				if($oMemberModel->isDeniedNickName($value))
232
+				if ($oMemberModel->isDeniedNickName($value))
233 233
 				{
234
-					return new Object(0,'denied_nick_name');
234
+					return new Object(0, 'denied_nick_name');
235 235
 				}
236 236
 				// Check if duplicated
237 237
 				$member_srl = $oMemberModel->getMemberSrlByNickName($value);
238
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name');
238
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name');
239 239
 
240 240
 				break;
241 241
 			case 'email_address' :
242 242
 				// Check if duplicated
243 243
 				$member_srl = $oMemberModel->getMemberSrlByEmailAddress($value);
244
-				if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address');
244
+				if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address');
245 245
 				break;
246 246
 		}
247 247
 	}
@@ -253,25 +253,25 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	function procMemberInsert()
255 255
 	{
256
-		if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request");
257
-		$oMemberModel = &getModel ('member');
256
+		if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request");
257
+		$oMemberModel = &getModel('member');
258 258
 		$config = $oMemberModel->getMemberConfig();
259 259
 
260 260
 		// call a trigger (before)
261
-		$trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config);
262
-		if(!$trigger_output->toBool ()) return $trigger_output;
261
+		$trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config);
262
+		if (!$trigger_output->toBool()) return $trigger_output;
263 263
 		// Check if an administrator allows a membership
264
-		if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled');
264
+		if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
265 265
 		// Check if the user accept the license terms (only if terms exist)
266
-		if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement');
266
+		if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement');
267 267
 
268 268
 		// Extract the necessary information in advance
269 269
 		$getVars = array();
270
-		if($config->signupForm)
270
+		if ($config->signupForm)
271 271
 		{
272
-			foreach($config->signupForm as $formInfo)
272
+			foreach ($config->signupForm as $formInfo)
273 273
 			{
274
-				if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
274
+				if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
275 275
 				{
276 276
 					$getVars[] = $formInfo->name;
277 277
 				}
@@ -279,22 +279,22 @@  discard block
 block discarded – undo
279 279
 		}
280 280
 
281 281
 		$args = new stdClass;
282
-		foreach($getVars as $val)
282
+		foreach ($getVars as $val)
283 283
 		{
284 284
 			$args->{$val} = Context::get($val);
285
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
285
+			if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
286 286
 		}
287 287
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
288
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
288
+		if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
289 289
 
290 290
 		$args->find_account_answer = Context::get('find_account_answer');
291 291
 		$args->allow_mailing = Context::get('allow_mailing');
292 292
 		$args->allow_message = Context::get('allow_message');
293 293
 
294
-		if($args->password1) $args->password = $args->password1;
294
+		if ($args->password1) $args->password = $args->password1;
295 295
 
296 296
 		// check password strength
297
-		if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
297
+		if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
298 298
 		{
299 299
 			$message = Context::getLang('about_password_strength');
300 300
 			return new Object(-1, $message[$config->password_strength]);
@@ -320,58 +320,58 @@  discard block
 block discarded – undo
320 320
 		unset($all_args->secret_text);
321 321
 
322 322
 		// Set the user state as "denied" when using mail authentication
323
-		if($config->enable_confirm == 'Y') $args->denied = 'Y';
323
+		if ($config->enable_confirm == 'Y') $args->denied = 'Y';
324 324
 		// Add extra vars after excluding necessary information from all the requested arguments
325 325
 		$extra_vars = delObjectVars($all_args, $args);
326 326
 		$args->extra_vars = serialize($extra_vars);
327 327
 
328 328
 		// remove whitespace
329 329
 		$checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address');
330
-		foreach($checkInfos as $val)
330
+		foreach ($checkInfos as $val)
331 331
 		{
332
-			if(isset($args->{$val}))
332
+			if (isset($args->{$val}))
333 333
 			{
334 334
 				$args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val});
335 335
 			}
336 336
 		}
337 337
 		$output = $this->insertMember($args);
338
-		if(!$output->toBool()) return $output;
338
+		if (!$output->toBool()) return $output;
339 339
 
340 340
 		// insert ProfileImage, ImageName, ImageMark
341 341
 		$profile_image = $_FILES['profile_image'];
342
-		if(is_uploaded_file($profile_image['tmp_name']))
342
+		if (is_uploaded_file($profile_image['tmp_name']))
343 343
 		{
344 344
 			$this->insertProfileImage($args->member_srl, $profile_image['tmp_name']);
345 345
 		}
346 346
 
347 347
 		$image_mark = $_FILES['image_mark'];
348
-		if(is_uploaded_file($image_mark['tmp_name']))
348
+		if (is_uploaded_file($image_mark['tmp_name']))
349 349
 		{
350 350
 			$this->insertImageMark($args->member_srl, $image_mark['tmp_name']);
351 351
 		}
352 352
 
353 353
 		$image_name = $_FILES['image_name'];
354
-		if(is_uploaded_file($image_name['tmp_name']))
354
+		if (is_uploaded_file($image_name['tmp_name']))
355 355
 		{
356 356
 			$this->insertImageName($args->member_srl, $image_name['tmp_name']);
357 357
 		}
358 358
 
359 359
 		// If a virtual site, join the site
360 360
 		$site_module_info = Context::get('site_module_info');
361
-		if($site_module_info->site_srl > 0)
361
+		if ($site_module_info->site_srl > 0)
362 362
 		{
363 363
 			$columnList = array('site_srl', 'group_srl');
364 364
 			$default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList);
365
-			if($default_group->group_srl)
365
+			if ($default_group->group_srl)
366 366
 			{
367 367
 				$this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl);
368 368
 			}
369 369
 
370 370
 		}
371 371
 		// Log-in
372
-		if($config->enable_confirm != 'Y')
372
+		if ($config->enable_confirm != 'Y')
373 373
 		{
374
-			if($config->identifier == 'email_address')
374
+			if ($config->identifier == 'email_address')
375 375
 			{
376 376
 				$output = $this->doLogin($args->email_address);
377 377
 			}
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 			{
380 380
 				$output = $this->doLogin($args->user_id);
381 381
 			}
382
-			if(!$output->toBool()) {
383
-				if($output->error == -9)
382
+			if (!$output->toBool()) {
383
+				if ($output->error == -9)
384 384
 					$output->error = -11;
385 385
 				return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output);
386 386
 			}
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 
389 389
 		// Results
390 390
 		$this->add('member_srl', $args->member_srl);
391
-		if($config->redirect_url) $this->add('redirect_url', $config->redirect_url);
392
-		if($config->enable_confirm == 'Y')
391
+		if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url);
392
+		if ($config->enable_confirm == 'Y')
393 393
 		{
394 394
 			$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address);
395 395
 			$this->setMessage($msg);
@@ -398,19 +398,19 @@  discard block
 block discarded – undo
398 398
 		else $this->setMessage('success_registed');
399 399
 		// Call a trigger (after)
400 400
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config);
401
-		if(!$trigger_output->toBool()) return $trigger_output;
401
+		if (!$trigger_output->toBool()) return $trigger_output;
402 402
 
403
-		if($config->redirect_url)
403
+		if ($config->redirect_url)
404 404
 		{
405 405
 			$returnUrl = $config->redirect_url;
406 406
 		}
407 407
 		else
408 408
 		{
409
-			if(Context::get('success_return_url'))
409
+			if (Context::get('success_return_url'))
410 410
 			{
411 411
 				$returnUrl = Context::get('success_return_url');
412 412
 			}
413
-			else if($_COOKIE['XE_REDIRECT_URL'])
413
+			else if ($_COOKIE['XE_REDIRECT_URL'])
414 414
 			{
415 415
 				$returnUrl = $_COOKIE['XE_REDIRECT_URL'];
416 416
 				setcookie("XE_REDIRECT_URL", '', 1);
@@ -424,26 +424,26 @@  discard block
 block discarded – undo
424 424
 
425 425
 	function procMemberModifyInfoBefore()
426 426
 	{
427
-		if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD')
427
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD')
428 428
 		{
429 429
 			return $this->stop('msg_invalid_request');
430 430
 		}
431 431
 
432
-		if(!Context::get('is_logged'))
432
+		if (!Context::get('is_logged'))
433 433
 		{
434 434
 			return $this->stop('msg_not_logged');
435 435
 		}
436 436
 
437 437
 		$password = Context::get('password');
438 438
 
439
-		if(!$password)
439
+		if (!$password)
440 440
 		{
441 441
 			return $this->stop('msg_invalid_request');
442 442
 		}
443 443
 
444 444
 		$oMemberModel = getModel('member');
445 445
 
446
-		if(!$this->memberInfo->password)
446
+		if (!$this->memberInfo->password)
447 447
 		{
448 448
 			// Get information of logged-in user
449 449
 			$logged_info = Context::get('logged_info');
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 			$this->memberInfo->password = $memberInfo->password;
455 455
 		}
456 456
 		// Verify the current password
457
-		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password))
457
+		if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password))
458 458
 		{
459 459
 			return new Object(-1, 'invalid_password');
460 460
 		}
461 461
 
462 462
 		$_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD';
463 463
 
464
-		if(Context::get('success_return_url'))
464
+		if (Context::get('success_return_url'))
465 465
 		{
466 466
 			$redirectUrl = Context::get('success_return_url');
467 467
 		}
@@ -479,26 +479,26 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	function procMemberModifyInfo()
481 481
 	{
482
-		if(!Context::get('is_logged'))
482
+		if (!Context::get('is_logged'))
483 483
 		{
484 484
 			return $this->stop('msg_not_logged');
485 485
 		}
486 486
 
487
-		if($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
487
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
488 488
 		{
489 489
 			return $this->stop('msg_invalid_request');
490 490
 		}
491 491
 		unset($_SESSION['rechecked_password_step']);
492 492
 
493 493
 		// Extract the necessary information in advance
494
-		$oMemberModel = &getModel ('member');
495
-		$config = $oMemberModel->getMemberConfig ();
496
-		$getVars = array('find_account_answer','allow_mailing','allow_message');
497
-		if($config->signupForm)
494
+		$oMemberModel = &getModel('member');
495
+		$config = $oMemberModel->getMemberConfig();
496
+		$getVars = array('find_account_answer', 'allow_mailing', 'allow_message');
497
+		if ($config->signupForm)
498 498
 		{
499
-			foreach($config->signupForm as $formInfo)
499
+			foreach ($config->signupForm as $formInfo)
500 500
 			{
501
-				if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
501
+				if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired))
502 502
 				{
503 503
 					$getVars[] = $formInfo->name;
504 504
 				}
@@ -506,16 +506,16 @@  discard block
 block discarded – undo
506 506
 		}
507 507
 
508 508
 		$args = new stdClass;
509
-		foreach($getVars as $val)
509
+		foreach ($getVars as $val)
510 510
 		{
511 511
 			$args->{$val} = Context::get($val);
512
-			if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
512
+			if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui');
513 513
 		}
514 514
 		// Login Information
515 515
 		$logged_info = Context::get('logged_info');
516 516
 		$args->member_srl = $logged_info->member_srl;
517 517
 		$args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
518
-		if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
518
+		if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>'')));
519 519
 		// Remove some unnecessary variables from all the vars
520 520
 		$all_args = Context::getRequestVars();
521 521
 		unset($all_args->module);
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 
540 540
 		// remove whitespace
541 541
 		$checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address');
542
-		foreach($checkInfos as $val)
542
+		foreach ($checkInfos as $val)
543 543
 		{
544
-			if(isset($args->{$val}))
544
+			if (isset($args->{$val}))
545 545
 			{
546 546
 				$args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val});
547 547
 			}
@@ -549,22 +549,22 @@  discard block
 block discarded – undo
549 549
 
550 550
 		// Execute insert or update depending on the value of member_srl
551 551
 		$output = $this->updateMember($args);
552
-		if(!$output->toBool()) return $output;
552
+		if (!$output->toBool()) return $output;
553 553
 
554 554
 		$profile_image = $_FILES['profile_image'];
555
-		if(is_uploaded_file($profile_image['tmp_name']))
555
+		if (is_uploaded_file($profile_image['tmp_name']))
556 556
 		{
557 557
 			$this->insertProfileImage($args->member_srl, $profile_image['tmp_name']);
558 558
 		}
559 559
 
560 560
 		$image_mark = $_FILES['image_mark'];
561
-		if(is_uploaded_file($image_mark['tmp_name']))
561
+		if (is_uploaded_file($image_mark['tmp_name']))
562 562
 		{
563 563
 			$this->insertImageMark($args->member_srl, $image_mark['tmp_name']);
564 564
 		}
565 565
 
566 566
 		$image_name = $_FILES['image_name'];
567
-		if(is_uploaded_file($image_name['tmp_name']))
567
+		if (is_uploaded_file($image_name['tmp_name']))
568 568
 		{
569 569
 			$this->insertImageName($args->member_srl, $image_name['tmp_name']);
570 570
 		}
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 
580 580
 		// Call a trigger after successfully log-in (after)
581 581
 		$trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo);
582
-		if(!$trigger_output->toBool()) return $trigger_output;
582
+		if (!$trigger_output->toBool()) return $trigger_output;
583 583
 
584 584
 		$this->setSessionInfo();
585 585
 		// Return result
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	function procMemberModifyPassword()
602 602
 	{
603
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
603
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
604 604
 		// Extract the necessary information in advance
605 605
 		$current_password = trim(Context::get('current_password'));
606 606
 		$password = trim(Context::get('password1'));
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
616 616
 		// Verify the cuttent password
617
-		if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password');
617
+		if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password');
618 618
 
619 619
 		// Check if a new password is as same as the previous password
620
-		if($current_password == $password) return new Object(-1, 'invalid_new_password');
620
+		if ($current_password == $password) return new Object(-1, 'invalid_new_password');
621 621
 
622 622
 		// Execute insert or update depending on the value of member_srl
623 623
 		$args = new stdClass;
624 624
 		$args->member_srl = $member_srl;
625 625
 		$args->password = $password;
626 626
 		$output = $this->updateMemberPassword($args);
627
-		if(!$output->toBool()) return $output;
627
+		if (!$output->toBool()) return $output;
628 628
 
629 629
 		$this->add('member_srl', $args->member_srl);
630 630
 		$this->setMessage('success_updated');
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	function procMemberLeave()
642 642
 	{
643
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
643
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
644 644
 		// Extract the necessary information in advance
645 645
 		$password = trim(Context::get('password'));
646 646
 		// Get information of logged-in user
@@ -649,17 +649,17 @@  discard block
 block discarded – undo
649 649
 		// Create a member model object
650 650
 		$oMemberModel = getModel('member');
651 651
 		// Get information of member_srl
652
-		if(!$this->memberInfo->password)
652
+		if (!$this->memberInfo->password)
653 653
 		{
654 654
 			$columnList = array('member_srl', 'password');
655 655
 			$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
656 656
 			$this->memberInfo->password = $memberInfo->password;
657 657
 		}
658 658
 		// Verify the cuttent password
659
-		if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
659
+		if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
660 660
 
661 661
 		$output = $this->deleteMember($member_srl);
662
-		if(!$output->toBool()) return $output;
662
+		if (!$output->toBool()) return $output;
663 663
 		// Destroy all session information
664 664
 		$this->destroySessionInfo();
665 665
 		// Return success message
@@ -678,17 +678,17 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		// Check if the file is successfully uploaded
680 680
 		$file = $_FILES['profile_image'];
681
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image');
681
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image');
682 682
 		// Ignore if member_srl is invalid or doesn't exist.
683 683
 		$member_srl = Context::get('member_srl');
684
-		if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image');
684
+		if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image');
685 685
 
686 686
 		$logged_info = Context::get('logged_info');
687
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image');
687
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image');
688 688
 		// Return if member module is set not to use an image name or the user is not an administrator ;
689 689
 		$oModuleModel = getModel('module');
690 690
 		$config = $oModuleModel->getModuleConfig('member');
691
-		if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image');
691
+		if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image');
692 692
 
693 693
 		$this->insertProfileImage($member_srl, $file['tmp_name']);
694 694
 		// Page refresh
@@ -710,25 +710,25 @@  discard block
 block discarded – undo
710 710
 	{
711 711
 
712 712
 		// Check uploaded file
713
-		if(!checkUploadedFile($target_file)) return;
713
+		if (!checkUploadedFile($target_file)) return;
714 714
 
715 715
 		$oMemberModel = getModel('member');
716 716
 		$config = $oMemberModel->getMemberConfig();
717 717
 
718 718
 		// Get an image size
719 719
 		$max_width = $config->profile_image_max_width;
720
-		if(!$max_width) $max_width = "90";
720
+		if (!$max_width) $max_width = "90";
721 721
 		$max_height = $config->profile_image_max_height;
722
-		if(!$max_height) $max_height = "90";
722
+		if (!$max_height) $max_height = "90";
723 723
 		// Get a target path to save
724 724
 		$target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl));
725 725
 		FileHandler::makeDir($target_path);
726 726
 
727 727
 		// Get file information
728 728
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
729
-		if(IMAGETYPE_PNG == $type) $ext = 'png';
730
-		elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg';
731
-		elseif(IMAGETYPE_GIF == $type) $ext = 'gif';
729
+		if (IMAGETYPE_PNG == $type) $ext = 'png';
730
+		elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg';
731
+		elseif (IMAGETYPE_GIF == $type) $ext = 'gif';
732 732
 		else
733 733
 		{
734 734
 			return;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 		$target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext);
740 740
 		// Convert if the image size is larger than a given size or if the format is not a gif
741
-		if(($width > $max_width || $height > $max_height ) && $type != 1)
741
+		if (($width > $max_width || $height > $max_height) && $type != 1)
742 742
 		{
743 743
 			FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext);
744 744
 		}
@@ -757,17 +757,17 @@  discard block
 block discarded – undo
757 757
 	{
758 758
 		// Check if the file is successfully uploaded
759 759
 		$file = $_FILES['image_name'];
760
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name');
760
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name');
761 761
 		// Ignore if member_srl is invalid or doesn't exist.
762 762
 		$member_srl = Context::get('member_srl');
763
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_name');
763
+		if (!$member_srl) return $this->stop('msg_not_uploaded_image_name');
764 764
 
765 765
 		$logged_info = Context::get('logged_info');
766
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name');
766
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name');
767 767
 		// Return if member module is set not to use an image name or the user is not an administrator ;
768 768
 		$oModuleModel = getModel('module');
769 769
 		$config = $oModuleModel->getModuleConfig('member');
770
-		if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name');
770
+		if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name');
771 771
 
772 772
 		$this->insertImageName($member_srl, $file['tmp_name']);
773 773
 		// Page refresh
@@ -788,15 +788,15 @@  discard block
 block discarded – undo
788 788
 	function insertImageName($member_srl, $target_file)
789 789
 	{
790 790
 		// Check uploaded file
791
-		if(!checkUploadedFile($target_file)) return;
791
+		if (!checkUploadedFile($target_file)) return;
792 792
 
793 793
 		$oModuleModel = getModel('module');
794 794
 		$config = $oModuleModel->getModuleConfig('member');
795 795
 		// Get an image size
796 796
 		$max_width = $config->image_name_max_width;
797
-		if(!$max_width) $max_width = "90";
797
+		if (!$max_width) $max_width = "90";
798 798
 		$max_height = $config->image_name_max_height;
799
-		if(!$max_height) $max_height = "20";
799
+		if (!$max_height) $max_height = "20";
800 800
 		// Get a target path to save
801 801
 		$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl));
802 802
 		FileHandler::makeDir($target_path);
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		// Get file information
806 806
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
807 807
 		// Convert if the image size is larger than a given size or if the format is not a gif
808
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
808
+		if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
809 809
 		else @copy($target_file, $target_filename);
810 810
 	}
811 811
 
@@ -817,20 +817,20 @@  discard block
 block discarded – undo
817 817
 	function procMemberDeleteProfileImage($_memberSrl = 0)
818 818
 	{
819 819
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
820
-		if(!$member_srl)
820
+		if (!$member_srl)
821 821
 		{
822
-			return new Object(0,'success');
822
+			return new Object(0, 'success');
823 823
 		}
824 824
 
825 825
 		$logged_info = Context::get('logged_info');
826 826
 
827
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
827
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
828 828
 		{
829 829
 			$oMemberModel = getModel('member');
830 830
 			$profile_image = $oMemberModel->getProfileImage($member_srl);
831 831
 			FileHandler::removeFile($profile_image->file);
832 832
 		}
833
-		return new Object(0,'success');
833
+		return new Object(0, 'success');
834 834
 	}
835 835
 
836 836
 	/**
@@ -841,20 +841,20 @@  discard block
 block discarded – undo
841 841
 	function procMemberDeleteImageName($_memberSrl = 0)
842 842
 	{
843 843
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
844
-		if(!$member_srl)
844
+		if (!$member_srl)
845 845
 		{
846
-			return new Object(0,'success');
846
+			return new Object(0, 'success');
847 847
 		}
848 848
 
849 849
 		$logged_info = Context::get('logged_info');
850 850
 
851
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
851
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
852 852
 		{
853 853
 			$oMemberModel = getModel('member');
854 854
 			$image_name = $oMemberModel->getImageName($member_srl);
855 855
 			FileHandler::removeFile($image_name->file);
856 856
 		}
857
-		return new Object(0,'success');
857
+		return new Object(0, 'success');
858 858
 	}
859 859
 
860 860
 	/**
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	{
867 867
 		// Check if the file is successfully uploaded
868 868
 		$file = $_FILES['image_mark'];
869
-		if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark');
869
+		if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark');
870 870
 		// Ignore if member_srl is invalid or doesn't exist.
871 871
 		$member_srl = Context::get('member_srl');
872
-		if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark');
872
+		if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark');
873 873
 
874 874
 		$logged_info = Context::get('logged_info');
875
-		if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark');
875
+		if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark');
876 876
 		// Membership in the images mark the module using the ban was set by an administrator or return;
877 877
 		$oModuleModel = getModel('module');
878 878
 		$config = $oModuleModel->getModuleConfig('member');
879
-		if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark');
879
+		if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark');
880 880
 
881 881
 		$this->insertImageMark($member_srl, $file['tmp_name']);
882 882
 		// Page refresh
@@ -897,15 +897,15 @@  discard block
 block discarded – undo
897 897
 	function insertImageMark($member_srl, $target_file)
898 898
 	{
899 899
 		// Check uploaded file
900
-		if(!checkUploadedFile($target_file)) return;
900
+		if (!checkUploadedFile($target_file)) return;
901 901
 
902 902
 		$oModuleModel = getModel('module');
903 903
 		$config = $oModuleModel->getModuleConfig('member');
904 904
 		// Get an image size
905 905
 		$max_width = $config->image_mark_max_width;
906
-		if(!$max_width) $max_width = "20";
906
+		if (!$max_width) $max_width = "20";
907 907
 		$max_height = $config->image_mark_max_height;
908
-		if(!$max_height) $max_height = "20";
908
+		if (!$max_height) $max_height = "20";
909 909
 
910 910
 		$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl));
911 911
 		FileHandler::makeDir($target_path);
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		// Get file information
915 915
 		list($width, $height, $type, $attrs) = @getimagesize($target_file);
916 916
 
917
-		if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
917
+		if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
918 918
 		else @copy($target_file, $target_filename);
919 919
 	}
920 920
 
@@ -926,20 +926,20 @@  discard block
 block discarded – undo
926 926
 	function procMemberDeleteImageMark($_memberSrl = 0)
927 927
 	{
928 928
 		$member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl');
929
-		if(!$member_srl)
929
+		if (!$member_srl)
930 930
 		{
931
-			return new Object(0,'success');
931
+			return new Object(0, 'success');
932 932
 		}
933 933
 
934 934
 		$logged_info = Context::get('logged_info');
935 935
 
936
-		if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
936
+		if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl))
937 937
 		{
938 938
 			$oMemberModel = getModel('member');
939 939
 			$image_mark = $oMemberModel->getImageMark($member_srl);
940 940
 			FileHandler::removeFile($image_mark->file);
941 941
 		}
942
-		return new Object(0,'success');
942
+		return new Object(0, 'success');
943 943
 	}
944 944
 
945 945
 	/**
@@ -950,26 +950,26 @@  discard block
 block discarded – undo
950 950
 	function procMemberFindAccount()
951 951
 	{
952 952
 		$email_address = Context::get('email_address');
953
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
953
+		if (!$email_address) return new Object(-1, 'msg_invalid_request');
954 954
 
955 955
 		$oMemberModel = getModel('member');
956 956
 		$oModuleModel = getModel('module');
957 957
 
958 958
 		// Check if a member having the same email address exists
959 959
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
960
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
960
+		if (!$member_srl) return new Object(-1, 'msg_email_not_exists');
961 961
 
962 962
 		// Get information of the member
963 963
 		$columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name');
964 964
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
965 965
 
966 966
 		// Check if possible to find member's ID and password
967
-		if($member_info->denied == 'Y')
967
+		if ($member_info->denied == 'Y')
968 968
 		{
969 969
 			$chk_args = new stdClass;
970 970
 			$chk_args->member_srl = $member_info->member_srl;
971 971
 			$output = executeQuery('member.chkAuthMail', $chk_args);
972
-			if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed');
972
+			if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed');
973 973
 		}
974 974
 
975 975
 		// Insert data into the authentication DB
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 		$args->is_register = 'N';
983 983
 
984 984
 		$output = executeQuery('member.insertAuthMail', $args);
985
-		if(!$output->toBool()) return $output;
985
+		if (!$output->toBool()) return $output;
986 986
 		// Get content of the email to send a member
987 987
 		Context::set('auth_args', $args);
988 988
 
989 989
 		$member_config = $oModuleModel->getModuleConfig('member');
990 990
 		$memberInfo = array();
991 991
 		global $lang;
992
-		if(is_array($member_config->signupForm))
992
+		if (is_array($member_config->signupForm))
993 993
 		{
994
-			$exceptForm=array('password', 'find_account_question');
995
-			foreach($member_config->signupForm as $form)
994
+			$exceptForm = array('password', 'find_account_question');
995
+			foreach ($member_config->signupForm as $form)
996 996
 			{
997
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
997
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
998 998
 				{
999 999
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1000 1000
 				}
@@ -1009,15 +1009,15 @@  discard block
 block discarded – undo
1009 1009
 		}
1010 1010
 		Context::set('memberInfo', $memberInfo);
1011 1011
 
1012
-		if(!$member_config->skin) $member_config->skin = "default";
1013
-		if(!$member_config->colorset) $member_config->colorset = "white";
1012
+		if (!$member_config->skin) $member_config->skin = "default";
1013
+		if (!$member_config->colorset) $member_config->colorset = "white";
1014 1014
 
1015 1015
 		Context::set('member_config', $member_config);
1016 1016
 
1017 1017
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1018
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1018
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1019 1019
 
1020
-		$find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key);
1020
+		$find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key);
1021 1021
 		Context::set('find_url', $find_url);
1022 1022
 
1023 1023
 		$oTemplate = &TemplateHandler::getInstance();
@@ -1027,19 +1027,19 @@  discard block
 block discarded – undo
1027 1027
 		$member_config = $oModuleModel->getModuleConfig('member');
1028 1028
 		// Send a mail
1029 1029
 		$oMail = new Mail();
1030
-		$oMail->setTitle( Context::getLang('msg_find_account_title') );
1030
+		$oMail->setTitle(Context::getLang('msg_find_account_title'));
1031 1031
 		$oMail->setContent($content);
1032
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1033
-		$oMail->setReceiptor( $member_info->user_name, $member_info->email_address );
1032
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1033
+		$oMail->setReceiptor($member_info->user_name, $member_info->email_address);
1034 1034
 		$oMail->send();
1035 1035
 		// Return message
1036 1036
 		$msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address);
1037
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
1037
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
1038 1038
 		{
1039 1039
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount');
1040 1040
 			$this->setRedirectUrl($returnUrl);
1041 1041
 		}
1042
-		return new Object(0,$msg);
1042
+		return new Object(0, $msg);
1043 1043
 	}
1044 1044
 
1045 1045
 	/**
@@ -1057,28 +1057,28 @@  discard block
 block discarded – undo
1057 1057
 		$find_account_question = trim(Context::get('find_account_question'));
1058 1058
 		$find_account_answer = trim(Context::get('find_account_answer'));
1059 1059
 
1060
-		if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request');
1060
+		if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request');
1061 1061
 
1062 1062
 		$oModuleModel = getModel('module');
1063 1063
 		// Check if a member having the same email address exists
1064 1064
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1065
-		if(!$member_srl) return new Object(-1, 'msg_email_not_exists');
1065
+		if (!$member_srl) return new Object(-1, 'msg_email_not_exists');
1066 1066
 		// Get information of the member
1067 1067
 		$columnList = array('member_srl', 'find_account_question', 'find_account_answer');
1068 1068
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
1069 1069
 
1070 1070
 		// Display a message if no answer is entered
1071
-		if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists');
1071
+		if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists');
1072 1072
 
1073
-		if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches');
1073
+		if (trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches');
1074 1074
 
1075
-		if($config->identifier == 'email_address')
1075
+		if ($config->identifier == 'email_address')
1076 1076
 		{
1077 1077
 			$user_id = $email_address;
1078 1078
 		}
1079 1079
 
1080 1080
 		// Update to a temporary password and set change_password_date to 1
1081
-		$oPassword =  new Password();
1081
+		$oPassword = new Password();
1082 1082
 		$temp_password = $oPassword->createTemporaryPassword(8);
1083 1083
 
1084 1084
 		$args = new stdClass();
@@ -1086,11 +1086,11 @@  discard block
 block discarded – undo
1086 1086
 		$args->password = $temp_password;
1087 1087
 		$args->change_password_date = '1';
1088 1088
 		$output = $this->updateMemberPassword($args);
1089
-		if(!$output->toBool()) return $output;
1089
+		if (!$output->toBool()) return $output;
1090 1090
 
1091
-		$_SESSION['xe_temp_password_' . $user_id] = $temp_password;
1091
+		$_SESSION['xe_temp_password_'.$user_id] = $temp_password;
1092 1092
 
1093
-		$this->add('user_id',$user_id);
1093
+		$this->add('user_id', $user_id);
1094 1094
 
1095 1095
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
1096 1096
 		$this->setRedirectUrl($returnUrl.'&user_id='.$user_id);
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 		$member_srl = Context::get('member_srl');
1111 1111
 		$auth_key = Context::get('auth_key');
1112 1112
 
1113
-		if(!$member_srl || !$auth_key)
1113
+		if (!$member_srl || !$auth_key)
1114 1114
 		{
1115 1115
 			return $this->stop('msg_invalid_request');
1116 1116
 		}
@@ -1121,9 +1121,9 @@  discard block
 block discarded – undo
1121 1121
 		$args->auth_key = $auth_key;
1122 1122
 		$output = executeQuery('member.getAuthMail', $args);
1123 1123
 
1124
-		if(!$output->toBool() || $output->data->auth_key != $auth_key)
1124
+		if (!$output->toBool() || $output->data->auth_key != $auth_key)
1125 1125
 		{
1126
-			if(strlen($output->data->auth_key) !== strlen($auth_key))
1126
+			if (strlen($output->data->auth_key) !== strlen($auth_key))
1127 1127
 			{
1128 1128
 				executeQuery('member.deleteAuthMail', $args);
1129 1129
 			}
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 			return $this->stop('msg_invalid_auth_key');
1132 1132
 		}
1133 1133
 
1134
-		if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400)
1134
+		if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400)
1135 1135
 		{
1136 1136
 			executeQuery('member.deleteAuthMail', $args);
1137 1137
 			return $this->stop('msg_invalid_auth_key');
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		$args->password = $output->data->new_password;
1141 1141
 
1142 1142
 		// If credentials are correct, change the password to a new one
1143
-		if($output->data->is_register == 'Y')
1143
+		if ($output->data->is_register == 'Y')
1144 1144
 		{
1145 1145
 			$args->denied = 'N';
1146 1146
 		}
@@ -1153,13 +1153,13 @@  discard block
 block discarded – undo
1153 1153
 		$is_register = $output->data->is_register;
1154 1154
 
1155 1155
 		$output = executeQuery('member.updateMemberPassword', $args);
1156
-		if(!$output->toBool())
1156
+		if (!$output->toBool())
1157 1157
 		{
1158 1158
 			return $this->stop($output->getMessage());
1159 1159
 		}
1160 1160
 
1161 1161
 		// Remove all values having the member_srl from authentication table
1162
-		executeQuery('member.deleteAuthMail',$args);
1162
+		executeQuery('member.deleteAuthMail', $args);
1163 1163
 
1164 1164
 		$this->_clearMemberCache($args->member_srl);
1165 1165
 
@@ -1178,33 +1178,33 @@  discard block
 block discarded – undo
1178 1178
 	{
1179 1179
 		// Get an email_address
1180 1180
 		$email_address = Context::get('email_address');
1181
-		if(!$email_address) return new Object(-1, 'msg_invalid_request');
1181
+		if (!$email_address) return new Object(-1, 'msg_invalid_request');
1182 1182
 		// Log test by using email_address
1183 1183
 		$oMemberModel = getModel('member');
1184 1184
 
1185 1185
 		$args = new stdClass;
1186 1186
 		$args->email_address = $email_address;
1187 1187
 		$memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address);
1188
-		if(!$memberSrl) return new Object(-1, 'msg_not_exists_member');
1188
+		if (!$memberSrl) return new Object(-1, 'msg_not_exists_member');
1189 1189
 
1190 1190
 		$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address');
1191 1191
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList);
1192 1192
 
1193 1193
 		$oModuleModel = getModel('module');
1194 1194
 		$member_config = $oModuleModel->getModuleConfig('member');
1195
-		if(!$member_config->skin) $member_config->skin = "default";
1196
-		if(!$member_config->colorset) $member_config->colorset = "white";
1195
+		if (!$member_config->skin) $member_config->skin = "default";
1196
+		if (!$member_config->colorset) $member_config->colorset = "white";
1197 1197
 
1198 1198
 		// Check if a authentication mail has been sent previously
1199 1199
 		$chk_args = new stdClass;
1200 1200
 		$chk_args->member_srl = $member_info->member_srl;
1201 1201
 		$output = executeQuery('member.chkAuthMail', $chk_args);
1202
-		if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request');
1202
+		if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request');
1203 1203
 
1204 1204
 		$auth_args = new stdClass;
1205 1205
 		$auth_args->member_srl = $member_info->member_srl;
1206 1206
 		$output = executeQueryArray('member.getAuthMailInfo', $auth_args);
1207
-		if(!$output->data || !$output->data[0]->auth_key)  return new Object(-1, 'msg_invalid_request');
1207
+		if (!$output->data || !$output->data[0]->auth_key)  return new Object(-1, 'msg_invalid_request');
1208 1208
 		$auth_info = $output->data[0];
1209 1209
 
1210 1210
 		// Update the regdate of authmail entry
@@ -1215,12 +1215,12 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 		$memberInfo = array();
1217 1217
 		global $lang;
1218
-		if(is_array($member_config->signupForm))
1218
+		if (is_array($member_config->signupForm))
1219 1219
 		{
1220
-			$exceptForm=array('password', 'find_account_question');
1221
-			foreach($member_config->signupForm as $form)
1220
+			$exceptForm = array('password', 'find_account_question');
1221
+			foreach ($member_config->signupForm as $form)
1222 1222
 			{
1223
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1223
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1224 1224
 				{
1225 1225
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1226 1226
 				}
@@ -1239,19 +1239,19 @@  discard block
 block discarded – undo
1239 1239
 		Context::set('member_config', $member_config);
1240 1240
 
1241 1241
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1242
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1242
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1243 1243
 
1244
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key);
1244
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key);
1245 1245
 		Context::set('auth_url', $auth_url);
1246 1246
 
1247 1247
 		$oTemplate = &TemplateHandler::getInstance();
1248 1248
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
1249 1249
 		// Send a mail
1250 1250
 		$oMail = new Mail();
1251
-		$oMail->setTitle( Context::getLang('msg_confirm_account_title') );
1251
+		$oMail->setTitle(Context::getLang('msg_confirm_account_title'));
1252 1252
 		$oMail->setContent($content);
1253
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1254
-		$oMail->setReceiptor( $args->user_name, $args->email_address );
1253
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1254
+		$oMail->setReceiptor($args->user_name, $args->email_address);
1255 1255
 		$oMail->send();
1256 1256
 
1257 1257
 		$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address);
@@ -1266,23 +1266,23 @@  discard block
 block discarded – undo
1266 1266
 		$memberInfo = $_SESSION['auth_member_info'];
1267 1267
 		unset($_SESSION['auth_member_info']);
1268 1268
 
1269
-		if(!$memberInfo)
1269
+		if (!$memberInfo)
1270 1270
 		{
1271 1271
 			return $this->stop('msg_invalid_request');
1272 1272
 		}
1273 1273
 
1274 1274
 		$newEmail = Context::get('email_address');
1275 1275
 
1276
-		if(!$newEmail)
1276
+		if (!$newEmail)
1277 1277
 		{
1278 1278
 			return $this->stop('msg_invalid_request');
1279 1279
 		}
1280 1280
 
1281 1281
 		$oMemberModel = getModel('member');
1282 1282
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
1283
-		if($member_srl)
1283
+		if ($member_srl)
1284 1284
 		{
1285
-			return new Object(-1,'msg_exists_email_address');
1285
+			return new Object(-1, 'msg_exists_email_address');
1286 1286
 		}
1287 1287
 
1288 1288
 		// remove all key by member_srl
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 		$args->member_srl = $memberInfo->member_srl;
1291 1291
 		$output = executeQuery('member.deleteAuthMail', $args);
1292 1292
 
1293
-		if(!$output->toBool())
1293
+		if (!$output->toBool())
1294 1294
 		{
1295 1295
 			return $output;
1296 1296
 		}
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 		list($args->email_id, $args->email_host) = explode('@', $newEmail);
1301 1301
 
1302 1302
 		$output = executeQuery('member.updateMemberEmailAddress', $args);
1303
-		if(!$output->toBool())
1303
+		if (!$output->toBool())
1304 1304
 		{
1305 1305
 			return $this->stop($output->getMessage());
1306 1306
 		}
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 		$auth_args->is_register = 'Y';
1318 1318
 
1319 1319
 		$output = executeQuery('member.insertAuthMail', $auth_args);
1320
-		if(!$output->toBool()) return $output;
1320
+		if (!$output->toBool()) return $output;
1321 1321
 
1322 1322
 		$memberInfo->email_address = $newEmail;
1323 1323
 
@@ -1341,12 +1341,12 @@  discard block
 block discarded – undo
1341 1341
 		$memberInfo = array();
1342 1342
 
1343 1343
 		global $lang;
1344
-		if(is_array($member_config->signupForm))
1344
+		if (is_array($member_config->signupForm))
1345 1345
 		{
1346
-			$exceptForm=array('password', 'find_account_question');
1347
-			foreach($member_config->signupForm as $form)
1346
+			$exceptForm = array('password', 'find_account_question');
1347
+			foreach ($member_config->signupForm as $form)
1348 1348
 			{
1349
-				if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1349
+				if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired))
1350 1350
 				{
1351 1351
 					$memberInfo[$lang->{$form->name}] = $member_info->{$form->name};
1352 1352
 				}
@@ -1361,25 +1361,25 @@  discard block
 block discarded – undo
1361 1361
 		}
1362 1362
 		Context::set('memberInfo', $memberInfo);
1363 1363
 
1364
-		if(!$member_config->skin) $member_config->skin = "default";
1365
-		if(!$member_config->colorset) $member_config->colorset = "white";
1364
+		if (!$member_config->skin) $member_config->skin = "default";
1365
+		if (!$member_config->colorset) $member_config->colorset = "white";
1366 1366
 
1367 1367
 		Context::set('member_config', $member_config);
1368 1368
 
1369 1369
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
1370
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1370
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
1371 1371
 
1372
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
1372
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
1373 1373
 		Context::set('auth_url', $auth_url);
1374 1374
 
1375 1375
 		$oTemplate = &TemplateHandler::getInstance();
1376 1376
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
1377 1377
 		// Send a mail
1378 1378
 		$oMail = new Mail();
1379
-		$oMail->setTitle( Context::getLang('msg_confirm_account_title') );
1379
+		$oMail->setTitle(Context::getLang('msg_confirm_account_title'));
1380 1380
 		$oMail->setContent($content);
1381
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
1382
-		$oMail->setReceiptor( $member_info->user_name, $member_info->email_address );
1381
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
1382
+		$oMail->setReceiptor($member_info->user_name, $member_info->email_address);
1383 1383
 		$oMail->send();
1384 1384
 	}
1385 1385
 
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 	{
1393 1393
 		$site_module_info = Context::get('site_module_info');
1394 1394
 		$logged_info = Context::get('logged_info');
1395
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1395
+		if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request');
1396 1396
 
1397 1397
 		$oMemberModel = getModel('member');
1398 1398
 		$columnList = array('site_srl', 'group_srl', 'title');
@@ -1411,13 +1411,13 @@  discard block
 block discarded – undo
1411 1411
 	{
1412 1412
 		$site_module_info = Context::get('site_module_info');
1413 1413
 		$logged_info = Context::get('logged_info');
1414
-		if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request');
1414
+		if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request');
1415 1415
 
1416 1416
 		$args = new stdClass;
1417
-		$args->site_srl= $site_module_info->site_srl;
1417
+		$args->site_srl = $site_module_info->site_srl;
1418 1418
 		$args->member_srl = $logged_info->member_srl;
1419 1419
 		$output = executeQuery('member.deleteMembersGroup', $args);
1420
-		if(!$output->toBool()) return $output;
1420
+		if (!$output->toBool()) return $output;
1421 1421
 		$this->setMessage('success_deleted');
1422 1422
 		$this->_clearMemberCache($args->member_srl, $site_module_info->site_srl);
1423 1423
 	}
@@ -1431,25 +1431,25 @@  discard block
 block discarded – undo
1431 1431
 	 */
1432 1432
 	function setMemberConfig($args)
1433 1433
 	{
1434
-		if(!$args->skin) $args->skin = "default";
1435
-		if(!$args->colorset) $args->colorset = "white";
1436
-		if(!$args->editor_skin) $args->editor_skin= "ckeditor";
1437
-		if(!$args->editor_colorset) $args->editor_colorset = "moono";
1438
-		if($args->enable_join!='Y') $args->enable_join = 'N';
1439
-		$args->enable_openid= 'N';
1440
-		if($args->profile_image !='Y') $args->profile_image = 'N';
1441
-		if($args->image_name!='Y') $args->image_name = 'N';
1442
-		if($args->image_mark!='Y') $args->image_mark = 'N';
1443
-		if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
1444
-		if(!trim(strip_tags($args->agreement))) $args->agreement = null;
1445
-		$args->limit_day = (int)$args->limit_day;
1434
+		if (!$args->skin) $args->skin = "default";
1435
+		if (!$args->colorset) $args->colorset = "white";
1436
+		if (!$args->editor_skin) $args->editor_skin = "ckeditor";
1437
+		if (!$args->editor_colorset) $args->editor_colorset = "moono";
1438
+		if ($args->enable_join != 'Y') $args->enable_join = 'N';
1439
+		$args->enable_openid = 'N';
1440
+		if ($args->profile_image != 'Y') $args->profile_image = 'N';
1441
+		if ($args->image_name != 'Y') $args->image_name = 'N';
1442
+		if ($args->image_mark != 'Y') $args->image_mark = 'N';
1443
+		if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N';
1444
+		if (!trim(strip_tags($args->agreement))) $args->agreement = null;
1445
+		$args->limit_day = (int) $args->limit_day;
1446 1446
 
1447 1447
 		$agreement = trim($args->agreement);
1448 1448
 		unset($args->agreement);
1449 1449
 
1450 1450
 		$oModuleController = getController('module');
1451
-		$output = $oModuleController->insertModuleConfig('member',$args);
1452
-		if(!$output->toBool()) return $output;
1451
+		$output = $oModuleController->insertModuleConfig('member', $args);
1452
+		if (!$output->toBool()) return $output;
1453 1453
 
1454 1454
 		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
1455 1455
 		FileHandler::writeFile($agreement_file, $agreement);
@@ -1470,11 +1470,11 @@  discard block
 block discarded – undo
1470 1470
 		$signature = trim(removeHackTag($signature));
1471 1471
 		$signature = preg_replace('/<(\/?)(embed|object|param)/is', '&lt;$1$2', $signature);
1472 1472
 
1473
-		$check_signature = trim(str_replace(array('&nbsp;',"\n","\r"), '', strip_tags($signature, '<img><object>')));
1473
+		$check_signature = trim(str_replace(array('&nbsp;', "\n", "\r"), '', strip_tags($signature, '<img><object>')));
1474 1474
 		$path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl));
1475 1475
 		$filename = sprintf('%s%d.signature.php', $path, $member_srl);
1476 1476
 
1477
-		if(!$check_signature) return FileHandler::removeFile($filename);
1477
+		if (!$check_signature) return FileHandler::removeFile($filename);
1478 1478
 
1479 1479
 		$buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
1480 1480
 		FileHandler::makeDir($path);
@@ -1503,15 +1503,15 @@  discard block
 block discarded – undo
1503 1503
 	 *
1504 1504
 	 * @return Object
1505 1505
 	 */
1506
-	function addMemberToGroup($member_srl, $group_srl, $site_srl=0)
1506
+	function addMemberToGroup($member_srl, $group_srl, $site_srl = 0)
1507 1507
 	{
1508 1508
 		$args = new stdClass();
1509 1509
 		$args->member_srl = $member_srl;
1510 1510
 		$args->group_srl = $group_srl;
1511
-		if($site_srl) $args->site_srl = $site_srl;
1511
+		if ($site_srl) $args->site_srl = $site_srl;
1512 1512
 
1513 1513
 		// Add
1514
-		$output = executeQuery('member.addMemberToGroup',$args);
1514
+		$output = executeQuery('member.addMemberToGroup', $args);
1515 1515
 		$output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args);
1516 1516
 
1517 1517
 		$this->_clearMemberCache($member_srl, $site_srl);
@@ -1531,18 +1531,18 @@  discard block
 block discarded – undo
1531 1531
 	{
1532 1532
 		$obj = new stdClass;
1533 1533
 		$obj->site_srl = $args->site_srl;
1534
-		$obj->member_srl = implode(',',$args->member_srl);
1534
+		$obj->member_srl = implode(',', $args->member_srl);
1535 1535
 
1536 1536
 		$output = executeQueryArray('member.getMembersGroup', $obj);
1537
-		if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1537
+		if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate;
1538 1538
 
1539 1539
 		$output = executeQuery('member.deleteMembersGroup', $obj);
1540
-		if(!$output->toBool()) return $output;
1540
+		if (!$output->toBool()) return $output;
1541 1541
 
1542 1542
 		$inserted_members = array();
1543
-		foreach($args->member_srl as $key => $val)
1543
+		foreach ($args->member_srl as $key => $val)
1544 1544
 		{
1545
-			if($inserted_members[$val]) continue;
1545
+			if ($inserted_members[$val]) continue;
1546 1546
 			$inserted_members[$val] = true;
1547 1547
 
1548 1548
 			unset($obj);
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
 			$obj->site_srl = $args->site_srl;
1553 1553
 			$obj->regdate = $date[$obj->member_srl];
1554 1554
 			$output = executeQuery('member.addMemberToGroup', $obj);
1555
-			if(!$output->toBool()) return $output;
1555
+			if (!$output->toBool()) return $output;
1556 1556
 
1557 1557
 			$this->_clearMemberCache($obj->member_srl, $args->site_srl);
1558 1558
 		}
@@ -1574,9 +1574,9 @@  discard block
 block discarded – undo
1574 1574
 		// Get information of the key
1575 1575
 		$output = executeQuery('member.getAutologin', $args);
1576 1576
 		// If no information exists, delete a cookie
1577
-		if(!$output->toBool() || !$output->data)
1577
+		if (!$output->toBool() || !$output->data)
1578 1578
 		{
1579
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/');
1579
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/');
1580 1580
 			return;
1581 1581
 		}
1582 1582
 
@@ -1586,9 +1586,9 @@  discard block
 block discarded – undo
1586 1586
 		$user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address;
1587 1587
 		$password = $output->data->password;
1588 1588
 
1589
-		if(!$user_id || !$password)
1589
+		if (!$user_id || !$password)
1590 1590
 		{
1591
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/');
1591
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/');
1592 1592
 			return;
1593 1593
 		}
1594 1594
 
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 		$check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT'];
1599 1599
 		$check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32);
1600 1600
 
1601
-		if($check_key === substr($args->autologin_key, 32))
1601
+		if ($check_key === substr($args->autologin_key, 32))
1602 1602
 		{
1603 1603
 			// Check change_password_date
1604 1604
 			$oModuleModel = getModel('module');
@@ -1606,12 +1606,12 @@  discard block
 block discarded – undo
1606 1606
 			$limit_date = $member_config->change_password_date;
1607 1607
 
1608 1608
 			// Check if change_password_date is set
1609
-			if($limit_date > 0)
1609
+			if ($limit_date > 0)
1610 1610
 			{
1611 1611
 				$oMemberModel = getModel('member');
1612 1612
 				$columnList = array('member_srl', 'change_password_date');
1613 1613
 
1614
-				if($config->identifier == 'user_id')
1614
+				if ($config->identifier == 'user_id')
1615 1615
 				{
1616 1616
 					$member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList);
1617 1617
 				}
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 					$member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList);
1621 1621
 				}
1622 1622
 
1623
-				if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){
1623
+				if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) {
1624 1624
 					$do_auto_login = true;
1625 1625
 				}
1626 1626
 
@@ -1631,14 +1631,14 @@  discard block
 block discarded – undo
1631 1631
 			}
1632 1632
 		}
1633 1633
 
1634
-		if($do_auto_login)
1634
+		if ($do_auto_login)
1635 1635
 		{
1636 1636
 			$output = $this->doLogin($user_id);
1637 1637
 		}
1638 1638
 		else
1639 1639
 		{
1640 1640
 			executeQuery('member.deleteAutologin', $args);
1641
-			setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/');
1641
+			setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/');
1642 1642
 		}
1643 1643
 	}
1644 1644
 
@@ -1654,13 +1654,13 @@  discard block
 block discarded – undo
1654 1654
 	function doLogin($user_id, $password = '', $keep_signed = false)
1655 1655
 	{
1656 1656
 		$user_id = strtolower($user_id);
1657
-		if(!$user_id) return new Object(-1, 'null_user_id');
1657
+		if (!$user_id) return new Object(-1, 'null_user_id');
1658 1658
 		// Call a trigger before log-in (before)
1659 1659
 		$trigger_obj = new stdClass();
1660 1660
 		$trigger_obj->user_id = $user_id;
1661 1661
 		$trigger_obj->password = $password;
1662 1662
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj);
1663
-		if(!$trigger_output->toBool()) return $trigger_output;
1663
+		if (!$trigger_output->toBool()) return $trigger_output;
1664 1664
 		// Create a member model object
1665 1665
 		$oMemberModel = getModel('member');
1666 1666
 
@@ -1670,12 +1670,12 @@  discard block
 block discarded – undo
1670 1670
 		$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1671 1671
 
1672 1672
 		// check identifier
1673
-		if($config->identifier == 'email_address')
1673
+		if ($config->identifier == 'email_address')
1674 1674
 		{
1675 1675
 			// Get user_id information
1676 1676
 			$this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id);
1677 1677
 			// Set an invalid user if no value returned
1678
-			if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
1678
+			if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
1679 1679
 
1680 1680
 		}
1681 1681
 		else
@@ -1683,24 +1683,24 @@  discard block
 block discarded – undo
1683 1683
 			// Get user_id information
1684 1684
 			$this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id);
1685 1685
 			// Set an invalid user if no value returned
1686
-			if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
1686
+			if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
1687 1687
 		}
1688 1688
 
1689 1689
 		$output = executeQuery('member.getLoginCountByIp', $args);
1690 1690
 		$errorCount = $output->data->count;
1691
-		if($errorCount >= $config->max_error_count)
1691
+		if ($errorCount >= $config->max_error_count)
1692 1692
 		{
1693 1693
 			$last_update = strtotime($output->data->last_update);
1694
-			$term = intval($_SERVER['REQUEST_TIME']-$last_update);
1695
-			if($term < $config->max_error_count_time)
1694
+			$term = intval($_SERVER['REQUEST_TIME'] - $last_update);
1695
+			if ($term < $config->max_error_count_time)
1696 1696
 			{
1697 1697
 				$term = $config->max_error_count_time - $term;
1698
-				if($term < 60) $term = intval($term).Context::getLang('unit_sec');
1699
-				elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min');
1700
-				elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour');
1701
-				else $term = intval($term/86400).Context::getLang('unit_day');
1698
+				if ($term < 60) $term = intval($term).Context::getLang('unit_sec');
1699
+				elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min');
1700
+				elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour');
1701
+				else $term = intval($term / 86400).Context::getLang('unit_day');
1702 1702
 
1703
-				return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term));
1703
+				return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term));
1704 1704
 			}
1705 1705
 			else
1706 1706
 			{
@@ -1710,13 +1710,13 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 
1712 1712
 		// Password Check
1713
-		if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl))
1713
+		if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl))
1714 1714
 		{
1715
-			return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo);
1715
+			return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo);
1716 1716
 		}
1717 1717
 
1718 1718
 		// If denied == 'Y', notify
1719
-		if($this->memberInfo->denied == 'Y')
1719
+		if ($this->memberInfo->denied == 'Y')
1720 1720
 		{
1721 1721
 			$args->member_srl = $this->memberInfo->member_srl;
1722 1722
 			$output = executeQuery('member.chkAuthMail', $args);
@@ -1724,12 +1724,12 @@  discard block
 block discarded – undo
1724 1724
 			{
1725 1725
 				$_SESSION['auth_member_srl'] = $this->memberInfo->member_srl;
1726 1726
 				$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
1727
-				return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
1727
+				return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed'));
1728 1728
 			}
1729
-			return new Object(-1,'msg_user_denied');
1729
+			return new Object(-1, 'msg_user_denied');
1730 1730
 		}
1731 1731
 		// Notify if denied_date is less than the current time
1732
-		if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));
1732
+		if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new Object(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d")));
1733 1733
 		// Update the latest login time
1734 1734
 		$args->member_srl = $this->memberInfo->member_srl;
1735 1735
 		$output = executeQuery('member.updateLastLogin', $args);
@@ -1739,36 +1739,36 @@  discard block
 block discarded – undo
1739 1739
 
1740 1740
 		// Check if there is recoding table.
1741 1741
 		$oDB = &DB::getInstance();
1742
-		if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N')
1742
+		if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N')
1743 1743
 		{
1744 1744
 			// check if there is login fail records.
1745 1745
 			$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
1746
-			if($output->data && $output->data->content)
1746
+			if ($output->data && $output->data->content)
1747 1747
 			{
1748 1748
 				$title = Context::getLang('login_fail_report');
1749 1749
 				$message = '<ul>';
1750 1750
 				$content = unserialize($output->data->content);
1751
-				if(count($content) > $config->max_error_count)
1751
+				if (count($content) > $config->max_error_count)
1752 1752
 				{
1753
-					foreach($content as $val)
1753
+					foreach ($content as $val)
1754 1754
 					{
1755
-						$message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>';
1755
+						$message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>';
1756 1756
 					}
1757 1757
 					$message .= '</ul>';
1758
-					$content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa'));
1758
+					$content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa'));
1759 1759
 
1760 1760
 					//send message
1761 1761
 					$oCommunicationController = getController('communication');
1762 1762
 					$oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true);
1763 1763
 
1764
-					if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y')
1764
+					if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y')
1765 1765
 					{
1766 1766
 						$view_url = Context::getRequestUri();
1767
-						$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id);
1767
+						$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id);
1768 1768
 						$oMail = new Mail();
1769 1769
 						$oMail->setTitle($title);
1770 1770
 						$oMail->setContent($content);
1771
-						$oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email);
1771
+						$oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email);
1772 1772
 						$oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address);
1773 1773
 						$oMail->send();
1774 1774
 					}
@@ -1778,9 +1778,9 @@  discard block
 block discarded – undo
1778 1778
 		}
1779 1779
 		// Call a trigger after successfully log-in (after)
1780 1780
 		$trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo);
1781
-		if(!$trigger_output->toBool()) return $trigger_output;
1781
+		if (!$trigger_output->toBool()) return $trigger_output;
1782 1782
 		// When user checked to use auto-login
1783
-		if($keep_signed)
1783
+		if ($keep_signed)
1784 1784
 		{
1785 1785
 			// Key generate for auto login
1786 1786
 			$oPassword = new Password();
@@ -1792,12 +1792,12 @@  discard block
 block discarded – undo
1792 1792
 			$autologin_args->member_srl = $this->memberInfo->member_srl;
1793 1793
 			executeQuery('member.deleteAutologin', $autologin_args);
1794 1794
 			$autologin_output = executeQuery('member.insertAutologin', $autologin_args);
1795
-			if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000, '/');
1795
+			if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000, '/');
1796 1796
 		}
1797
-		if($this->memberInfo->is_admin == 'Y')
1797
+		if ($this->memberInfo->is_admin == 'Y')
1798 1798
 		{
1799 1799
 			$oMemberAdminModel = getAdminModel('member');
1800
-			if(!$oMemberAdminModel->getMemberAdminIPCheck())
1800
+			if (!$oMemberAdminModel->getMemberAdminIPCheck())
1801 1801
 			{
1802 1802
 				$_SESSION['denied_admin'] = 'Y';
1803 1803
 			}
@@ -1815,18 +1815,18 @@  discard block
 block discarded – undo
1815 1815
 	{
1816 1816
 		$oMemberModel = getModel('member');
1817 1817
 		// If your information came through the current session information to extract information from the users
1818
-		if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() )
1818
+		if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged())
1819 1819
 		{
1820 1820
 			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']);
1821 1821
 			// If you do not destroy the session Profile
1822
-			if($this->memberInfo->member_srl != $_SESSION['member_srl'])
1822
+			if ($this->memberInfo->member_srl != $_SESSION['member_srl'])
1823 1823
 			{
1824 1824
 				$this->destroySessionInfo();
1825 1825
 				return;
1826 1826
 			}
1827 1827
 		}
1828 1828
 		// Stop using the session id is destroyed
1829
-		if($this->memberInfo->denied=='Y')
1829
+		if ($this->memberInfo->denied == 'Y')
1830 1830
 		{
1831 1831
 			$this->destroySessionInfo();
1832 1832
 			return;
@@ -1856,10 +1856,10 @@  discard block
 block discarded – undo
1856 1856
 		Context::set('logged_info', $this->memberInfo);
1857 1857
 
1858 1858
 		// Only the menu configuration of the user (such as an add-on to the menu can be changed)
1859
-		$this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info');
1860
-		$this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document');
1861
-		$this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document');
1862
-		$this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document');
1859
+		$this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info');
1860
+		$this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document');
1861
+		$this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document');
1862
+		$this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document');
1863 1863
 	}
1864 1864
 
1865 1865
 	/**
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 	function addMemberPopupMenu($url, $str, $icon = '', $target = 'self')
1882 1882
 	{
1883 1883
 		$member_popup_menu_list = Context::get('member_popup_menu_list');
1884
-		if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array();
1884
+		if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array();
1885 1885
 
1886 1886
 		$obj = new stdClass;
1887 1887
 		$obj->url = $url;
@@ -1900,33 +1900,33 @@  discard block
 block discarded – undo
1900 1900
 	{
1901 1901
 		// Call a trigger (before)
1902 1902
 		$output = ModuleHandler::triggerCall('member.insertMember', 'before', $args);
1903
-		if(!$output->toBool()) return $output;
1903
+		if (!$output->toBool()) return $output;
1904 1904
 		// Terms and Conditions portion of the information set up by members reaffirmed
1905 1905
 		$oModuleModel = getModel('module');
1906 1906
 		$config = $oModuleModel->getModuleConfig('member');
1907 1907
 
1908 1908
 		$logged_info = Context::get('logged_info');
1909 1909
 		// If the date of the temporary restrictions limit further information on the date of
1910
-		if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24);
1910
+		if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24);
1911 1911
 
1912 1912
 		$args->member_srl = getNextSequence();
1913 1913
 		$args->list_order = -1 * $args->member_srl;
1914 1914
 
1915 1915
 		// Execute insert or update depending on the value of member_srl
1916
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
1916
+		if (!$args->user_id) $args->user_id = 't'.$args->member_srl;
1917 1917
 		// Enter the user's identity changed to lowercase
1918 1918
 		else $args->user_id = strtolower($args->user_id);
1919
-		if(!$args->user_name) $args->user_name = $args->member_srl;
1920
-		if(!$args->nick_name) $args->nick_name = $args->member_srl;
1919
+		if (!$args->user_name) $args->user_name = $args->member_srl;
1920
+		if (!$args->nick_name) $args->nick_name = $args->member_srl;
1921 1921
 
1922 1922
 		// Control of essential parameters
1923
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
1924
-		if($args->denied!='Y') $args->denied = 'N';
1925
-		$args->allow_message= 'Y';
1923
+		if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N';
1924
+		if ($args->denied != 'Y') $args->denied = 'N';
1925
+		$args->allow_message = 'Y';
1926 1926
 
1927
-		if($logged_info->is_admin == 'Y')
1927
+		if ($logged_info->is_admin == 'Y')
1928 1928
 		{
1929
-			if($args->is_admin!='Y') $args->is_admin = 'N';
1929
+			if ($args->is_admin != 'Y') $args->is_admin = 'N';
1930 1930
 		}
1931 1931
 		else
1932 1932
 		{
@@ -1941,88 +1941,88 @@  discard block
 block discarded – undo
1941 1941
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1942 1942
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1943 1943
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
1944
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
1945
-		if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog;
1944
+		if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage;
1945
+		if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog;
1946 1946
 
1947 1947
 		// Create a model object
1948 1948
 		$oMemberModel = getModel('member');
1949 1949
 
1950 1950
 		// Check password strength
1951
-		if($args->password && !$password_is_hashed)
1951
+		if ($args->password && !$password_is_hashed)
1952 1952
 		{
1953
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
1953
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
1954 1954
 			{
1955 1955
 				$message = Context::getLang('about_password_strength');
1956 1956
 				return new Object(-1, $message[$config->password_strength]);
1957 1957
 			}
1958 1958
 			$args->password = $oMemberModel->hashPassword($args->password);
1959 1959
 		}
1960
-		elseif(!$args->password)
1960
+		elseif (!$args->password)
1961 1961
 		{
1962 1962
 			unset($args->password);
1963 1963
 		}
1964 1964
 
1965 1965
 		// Check if ID is prohibited
1966
-		if($oMemberModel->isDeniedID($args->user_id))
1966
+		if ($oMemberModel->isDeniedID($args->user_id))
1967 1967
 		{
1968
-			return new Object(-1,'denied_user_id');
1968
+			return new Object(-1, 'denied_user_id');
1969 1969
 		}
1970 1970
 
1971 1971
 		// Check if ID is duplicate
1972 1972
 		$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
1973
-		if($member_srl)
1973
+		if ($member_srl)
1974 1974
 		{
1975
-			return new Object(-1,'msg_exists_user_id');
1975
+			return new Object(-1, 'msg_exists_user_id');
1976 1976
 		}
1977 1977
 
1978 1978
 		// Check if nickname is prohibited
1979
-		if($oMemberModel->isDeniedNickName($args->nick_name))
1979
+		if ($oMemberModel->isDeniedNickName($args->nick_name))
1980 1980
 		{
1981
-			return new Object(-1,'denied_nick_name');
1981
+			return new Object(-1, 'denied_nick_name');
1982 1982
 		}
1983 1983
 
1984 1984
 		// Check if nickname is duplicate
1985 1985
 		$member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
1986
-		if($member_srl)
1986
+		if ($member_srl)
1987 1987
 		{
1988
-			return new Object(-1,'msg_exists_nick_name');
1988
+			return new Object(-1, 'msg_exists_nick_name');
1989 1989
 		}
1990 1990
 
1991 1991
 		// Check if email address is duplicate
1992 1992
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
1993
-		if($member_srl)
1993
+		if ($member_srl)
1994 1994
 		{
1995
-			return new Object(-1,'msg_exists_email_address');
1995
+			return new Object(-1, 'msg_exists_email_address');
1996 1996
 		}
1997 1997
 
1998 1998
 		// Insert data into the DB
1999 1999
 		$args->list_order = -1 * $args->member_srl;
2000 2000
 
2001
-		if(!$args->user_id) $args->user_id = 't'.$args->member_srl;
2002
-		if(!$args->user_name) $args->user_name = $args->member_srl;
2001
+		if (!$args->user_id) $args->user_id = 't'.$args->member_srl;
2002
+		if (!$args->user_name) $args->user_name = $args->member_srl;
2003 2003
 
2004 2004
 		$oDB = &DB::getInstance();
2005 2005
 		$oDB->begin();
2006 2006
 
2007 2007
 		$output = executeQuery('member.insertMember', $args);
2008
-		if(!$output->toBool())
2008
+		if (!$output->toBool())
2009 2009
 		{
2010 2010
 			$oDB->rollback();
2011 2011
 			return $output;
2012 2012
 		}
2013 2013
 
2014
-		if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2014
+		if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2015 2015
 		else $group_srl_list = explode('|@|', $args->group_srl_list);
2016 2016
 		// If no value is entered the default group, the value of group registration
2017
-		if(!$args->group_srl_list)
2017
+		if (!$args->group_srl_list)
2018 2018
 		{
2019 2019
 			$columnList = array('site_srl', 'group_srl');
2020 2020
 			$default_group = $oMemberModel->getDefaultGroup(0, $columnList);
2021
-			if($default_group)
2021
+			if ($default_group)
2022 2022
 			{
2023 2023
 				// Add to the default group
2024
-				$output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl);
2025
-				if(!$output->toBool())
2024
+				$output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl);
2025
+				if (!$output->toBool())
2026 2026
 				{
2027 2027
 					$oDB->rollback();
2028 2028
 					return $output;
@@ -2032,11 +2032,11 @@  discard block
 block discarded – undo
2032 2032
 		}
2033 2033
 		else
2034 2034
 		{
2035
-			for($i=0;$i<count($group_srl_list);$i++)
2035
+			for ($i = 0; $i < count($group_srl_list); $i++)
2036 2036
 			{
2037
-				$output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]);
2037
+				$output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
2038 2038
 
2039
-				if(!$output->toBool())
2039
+				if (!$output->toBool())
2040 2040
 				{
2041 2041
 					$oDB->rollback();
2042 2042
 					return $output;
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 
2047 2047
 		$member_config = $oModuleModel->getModuleConfig('member');
2048 2048
 		// When using email authentication mode (when you subscribed members denied a) certified mail sent
2049
-		if($args->denied == 'Y')
2049
+		if ($args->denied == 'Y')
2050 2050
 		{
2051 2051
 			// Insert data into the authentication DB
2052 2052
 			$oPassword = new Password();
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 			$auth_args->is_register = 'Y';
2059 2059
 
2060 2060
 			$output = executeQuery('member.insertAuthMail', $auth_args);
2061
-			if(!$output->toBool())
2061
+			if (!$output->toBool())
2062 2062
 			{
2063 2063
 				$oDB->rollback();
2064 2064
 				return $output;
@@ -2066,10 +2066,10 @@  discard block
 block discarded – undo
2066 2066
 			$this->_sendAuthMail($auth_args, $args);
2067 2067
 		}
2068 2068
 		// Call a trigger (after)
2069
-		if($output->toBool())
2069
+		if ($output->toBool())
2070 2070
 		{
2071 2071
 			$trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args);
2072
-			if(!$trigger_output->toBool())
2072
+			if (!$trigger_output->toBool())
2073 2073
 			{
2074 2074
 				$oDB->rollback();
2075 2075
 				return $trigger_output;
@@ -2091,41 +2091,41 @@  discard block
 block discarded – undo
2091 2091
 	{
2092 2092
 		// Call a trigger (before)
2093 2093
 		$output = ModuleHandler::triggerCall('member.updateMember', 'before', $args);
2094
-		if(!$output->toBool()) return $output;
2094
+		if (!$output->toBool()) return $output;
2095 2095
 		// Create a model object
2096 2096
 		$oMemberModel = getModel('member');
2097 2097
 
2098 2098
 		$logged_info = Context::get('logged_info');
2099 2099
 		// Get what you want to modify the original information
2100
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2100
+		if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2101 2101
 		// Control of essential parameters
2102
-		if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
2103
-		if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
2102
+		if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N';
2103
+		if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y';
2104 2104
 
2105
-		if($logged_info->is_admin == 'Y')
2105
+		if ($logged_info->is_admin == 'Y')
2106 2106
 		{
2107
-			if($args->denied!='Y') $args->denied = 'N';
2108
-			if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N';
2107
+			if ($args->denied != 'Y') $args->denied = 'N';
2108
+			if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N';
2109 2109
 		}
2110 2110
 		else
2111 2111
 		{
2112 2112
 			unset($args->is_admin);
2113
-			if($is_admin == false)
2113
+			if ($is_admin == false)
2114 2114
 				unset($args->denied);
2115
-			if($logged_info->member_srl != $args->member_srl && $is_admin == false)
2115
+			if ($logged_info->member_srl != $args->member_srl && $is_admin == false)
2116 2116
 			{
2117 2117
 				return $this->stop('msg_invalid_request');
2118 2118
 			}
2119 2119
 		}
2120 2120
 
2121 2121
 		// Sanitize user ID, username, nickname, homepage, blog
2122
-		if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2122
+		if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2123 2123
 		$args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2124 2124
 		$args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2125 2125
 		$args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2126 2126
 		$args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2127
-		if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage;
2128
-		if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog;
2127
+		if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage;
2128
+		if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog;
2129 2129
 
2130 2130
 		// check member identifier form
2131 2131
 		$config = $oMemberModel->getMemberConfig();
@@ -2134,56 +2134,56 @@  discard block
 block discarded – undo
2134 2134
 		$orgMemberInfo = $output->data;
2135 2135
 
2136 2136
 		// Check if email address or user ID is duplicate
2137
-		if($config->identifier == 'email_address')
2137
+		if ($config->identifier == 'email_address')
2138 2138
 		{
2139 2139
 			$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
2140
-			if($member_srl && $args->member_srl != $member_srl)
2140
+			if ($member_srl && $args->member_srl != $member_srl)
2141 2141
 			{
2142
-				return new Object(-1,'msg_exists_email_address');
2142
+				return new Object(-1, 'msg_exists_email_address');
2143 2143
 			}
2144 2144
 			$args->email_address = $orgMemberInfo->email_address;
2145 2145
 		}
2146 2146
 		else
2147 2147
 		{
2148 2148
 			$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
2149
-			if($member_srl && $args->member_srl != $member_srl)
2149
+			if ($member_srl && $args->member_srl != $member_srl)
2150 2150
 			{
2151
-				return new Object(-1,'msg_exists_user_id');
2151
+				return new Object(-1, 'msg_exists_user_id');
2152 2152
 			}
2153 2153
 
2154 2154
 			$args->user_id = $orgMemberInfo->user_id;
2155 2155
 		}
2156 2156
 
2157
-		if($logged_info->is_admin !== 'Y')
2157
+		if ($logged_info->is_admin !== 'Y')
2158 2158
 		{
2159 2159
 			// Check if ID is prohibited
2160
-			if($args->user_id && $oMemberModel->isDeniedID($args->user_id))
2160
+			if ($args->user_id && $oMemberModel->isDeniedID($args->user_id))
2161 2161
 			{
2162
-				return new Object(-1,'denied_user_id');
2162
+				return new Object(-1, 'denied_user_id');
2163 2163
 			}
2164 2164
 
2165 2165
 			// Check if nickname is prohibited
2166
-			if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name))
2166
+			if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name))
2167 2167
 			{
2168 2168
 				return new Object(-1, 'denied_nick_name');
2169 2169
 			}
2170 2170
 		}
2171 2171
 
2172 2172
 		// Check if ID is duplicate
2173
-		if($args->user_id)
2173
+		if ($args->user_id)
2174 2174
 		{
2175 2175
 			$member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
2176
-			if($member_srl && $args->member_srl != $member_srl)
2176
+			if ($member_srl && $args->member_srl != $member_srl)
2177 2177
 			{
2178
-				return new Object(-1,'msg_exists_user_id');
2178
+				return new Object(-1, 'msg_exists_user_id');
2179 2179
 			}
2180 2180
 		}
2181 2181
 
2182 2182
 		// Check if nickname is duplicate
2183 2183
 		$member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
2184
- 		if($member_srl && $args->member_srl != $member_srl)
2184
+ 		if ($member_srl && $args->member_srl != $member_srl)
2185 2185
  		{
2186
- 			return new Object(-1,'msg_exists_nick_name');
2186
+ 			return new Object(-1, 'msg_exists_nick_name');
2187 2187
  		}
2188 2188
 
2189 2189
 		list($args->email_id, $args->email_host) = explode('@', $args->email_address);
@@ -2192,9 +2192,9 @@  discard block
 block discarded – undo
2192 2192
 		$oDB->begin();
2193 2193
 
2194 2194
 		// Check password strength
2195
-		if($args->password)
2195
+		if ($args->password)
2196 2196
 		{
2197
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2197
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2198 2198
 			{
2199 2199
 				$message = Context::getLang('about_password_strength');
2200 2200
 				return new Object(-1, $message[$config->password_strength]);
@@ -2206,40 +2206,40 @@  discard block
 block discarded – undo
2206 2206
 			$args->password = $orgMemberInfo->password;
2207 2207
 		}
2208 2208
 		
2209
-		if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name;
2210
-		if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id;
2211
-		if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name;
2212
-		if(!$args->description) $args->description = '';
2213
-		if(!$args->birthday) $args->birthday = '';
2209
+		if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name;
2210
+		if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id;
2211
+		if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name;
2212
+		if (!$args->description) $args->description = '';
2213
+		if (!$args->birthday) $args->birthday = '';
2214 2214
 
2215 2215
 		$output = executeQuery('member.updateMember', $args);
2216 2216
 
2217
-		if(!$output->toBool())
2217
+		if (!$output->toBool())
2218 2218
 		{
2219 2219
 			$oDB->rollback();
2220 2220
 			return $output;
2221 2221
 		}
2222 2222
 
2223
-		if($args->group_srl_list)
2223
+		if ($args->group_srl_list)
2224 2224
 		{
2225
-			if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2225
+			if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list;
2226 2226
 			else $group_srl_list = explode('|@|', $args->group_srl_list);
2227 2227
 			// If the group information, group information changes
2228
-			if(count($group_srl_list) > 0)
2228
+			if (count($group_srl_list) > 0)
2229 2229
 			{
2230 2230
 				$args->site_srl = 0;
2231 2231
 				// One of its members to delete all the group
2232 2232
 				$output = executeQuery('member.deleteMemberGroupMember', $args);
2233
-				if(!$output->toBool())
2233
+				if (!$output->toBool())
2234 2234
 				{
2235 2235
 					$oDB->rollback();
2236 2236
 					return $output;
2237 2237
 				}
2238 2238
 				// Enter one of the loop a
2239
-				for($i=0;$i<count($group_srl_list);$i++)
2239
+				for ($i = 0; $i < count($group_srl_list); $i++)
2240 2240
 				{
2241
-					$output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]);
2242
-					if(!$output->toBool())
2241
+					$output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
2242
+					if (!$output->toBool())
2243 2243
 					{
2244 2244
 						$oDB->rollback();
2245 2245
 						return $output;
@@ -2251,9 +2251,9 @@  discard block
 block discarded – undo
2251 2251
 			}
2252 2252
 		}
2253 2253
 		// Call a trigger (after)
2254
-		if($output->toBool()) {
2254
+		if ($output->toBool()) {
2255 2255
 			$trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args);
2256
-			if(!$trigger_output->toBool())
2256
+			if (!$trigger_output->toBool())
2257 2257
 			{
2258 2258
 				$oDB->rollback();
2259 2259
 				return $trigger_output;
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
 		$this->_clearMemberCache($args->member_srl, $args->site_srl);
2267 2267
 
2268 2268
 		// Save Session
2269
-		if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2269
+		if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
2270 2270
 		$logged_info = Context::get('logged_info');
2271 2271
 
2272 2272
 		$output->add('member_srl', $args->member_srl);
@@ -2278,14 +2278,14 @@  discard block
 block discarded – undo
2278 2278
 	 */
2279 2279
 	function updateMemberPassword($args)
2280 2280
 	{
2281
-		if($args->password)
2281
+		if ($args->password)
2282 2282
 		{
2283 2283
 
2284 2284
 			// check password strength
2285 2285
 			$oMemberModel = getModel('member');
2286 2286
 			$config = $oMemberModel->getMemberConfig();
2287 2287
 
2288
-			if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2288
+			if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength))
2289 2289
 			{
2290 2290
 				$message = Context::getLang('about_password_strength');
2291 2291
 				return new Object(-1, $message[$config->password_strength]);
@@ -2293,13 +2293,13 @@  discard block
 block discarded – undo
2293 2293
 
2294 2294
 			$args->password = $oMemberModel->hashPassword($args->password);
2295 2295
 		}
2296
-		else if($args->hashed_password)
2296
+		else if ($args->hashed_password)
2297 2297
 		{
2298 2298
 			$args->password = $args->hashed_password;
2299 2299
 		}
2300 2300
 
2301 2301
 		$output = executeQuery('member.updateMemberPassword', $args);
2302
-		if($output->toBool())
2302
+		if ($output->toBool())
2303 2303
 		{
2304 2304
 			$result = executeQuery('member.updateChangePasswordDate', $args);
2305 2305
 		}
@@ -2318,18 +2318,18 @@  discard block
 block discarded – undo
2318 2318
 		$trigger_obj = new stdClass();
2319 2319
 		$trigger_obj->member_srl = $member_srl;
2320 2320
 		$output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj);
2321
-		if(!$output->toBool()) return $output;
2321
+		if (!$output->toBool()) return $output;
2322 2322
 		// Create a model object
2323 2323
 		$oMemberModel = getModel('member');
2324 2324
 		// Bringing the user's information
2325
-		if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin))
2325
+		if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin))
2326 2326
 		{
2327 2327
 			$columnList = array('member_srl', 'is_admin');
2328 2328
 			$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
2329 2329
 		}
2330
-		if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
2330
+		if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
2331 2331
 		// If managers can not be deleted
2332
-		if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
2332
+		if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
2333 2333
 
2334 2334
 		$oDB = &DB::getInstance();
2335 2335
 		$oDB->begin();
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 		$args->member_srl = $member_srl;
2339 2339
 		// Delete the entries in member_auth_mail
2340 2340
 		$output = executeQuery('member.deleteAuthMail', $args);
2341
-		if(!$output->toBool())
2341
+		if (!$output->toBool())
2342 2342
 		{
2343 2343
 			$oDB->rollback();
2344 2344
 			return $output;
@@ -2353,23 +2353,23 @@  discard block
 block discarded – undo
2353 2353
 		 */
2354 2354
 		// Delete the entries in member_group_member
2355 2355
 		$output = executeQuery('member.deleteMemberGroupMember', $args);
2356
-		if(!$output->toBool())
2356
+		if (!$output->toBool())
2357 2357
 		{
2358 2358
 			$oDB->rollback();
2359 2359
 			return $output;
2360 2360
 		}
2361 2361
 		// member removed from the table
2362 2362
 		$output = executeQuery('member.deleteMember', $args);
2363
-		if(!$output->toBool())
2363
+		if (!$output->toBool())
2364 2364
 		{
2365 2365
 			$oDB->rollback();
2366 2366
 			return $output;
2367 2367
 		}
2368 2368
 		// Call a trigger (after)
2369
-		if($output->toBool())
2369
+		if ($output->toBool())
2370 2370
 		{
2371 2371
 			$trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj);
2372
-			if(!$trigger_output->toBool())
2372
+			if (!$trigger_output->toBool())
2373 2373
 			{
2374 2374
 				$oDB->rollback();
2375 2375
 				return $trigger_output;
@@ -2393,23 +2393,23 @@  discard block
 block discarded – undo
2393 2393
 	 */
2394 2394
 	function destroySessionInfo()
2395 2395
 	{
2396
-		if(!$_SESSION || !is_array($_SESSION)) return;
2396
+		if (!$_SESSION || !is_array($_SESSION)) return;
2397 2397
 
2398 2398
 		$memberInfo = Context::get('logged_info');
2399 2399
 		$memberSrl = $memberInfo->member_srl;
2400 2400
 
2401
-		foreach($_SESSION as $key => $val)
2401
+		foreach ($_SESSION as $key => $val)
2402 2402
 		{
2403 2403
 			$_SESSION[$key] = '';
2404 2404
 		}
2405 2405
 
2406 2406
 		session_destroy();
2407
-		setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000, '/');
2408
-		setcookie('sso','',$_SERVER['REQUEST_TIME']-42000, '/');
2409
-		setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000, '/');
2407
+		setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000, '/');
2408
+		setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000, '/');
2409
+		setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000, '/');
2410 2410
 		setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000, '/');
2411 2411
 
2412
-		if($memberSrl || $_COOKIE['xeak'])
2412
+		if ($memberSrl || $_COOKIE['xeak'])
2413 2413
 		{
2414 2414
 			$args = new stdClass();
2415 2415
 			$args->member_srl = $memberSrl;
@@ -2425,22 +2425,22 @@  discard block
 block discarded – undo
2425 2425
 		$pointGroup = $pointModuleConfig->point_group;
2426 2426
 
2427 2427
 		$levelGroup = array();
2428
-		if(is_array($pointGroup) && count($pointGroup)>0)
2428
+		if (is_array($pointGroup) && count($pointGroup) > 0)
2429 2429
 		{
2430 2430
 			$levelGroup = array_flip($pointGroup);
2431 2431
 			ksort($levelGroup);
2432 2432
 		}
2433 2433
 		$maxLevel = 0;
2434 2434
 		$resultGroup = array_intersect($levelGroup, $groupSrlList);
2435
-		if(count($resultGroup) > 0)
2435
+		if (count($resultGroup) > 0)
2436 2436
 			$maxLevel = max(array_flip($resultGroup));
2437 2437
 
2438
-		if($maxLevel > 0)
2438
+		if ($maxLevel > 0)
2439 2439
 		{
2440 2440
 			$oPointModel = getModel('point');
2441 2441
 			$originPoint = $oPointModel->getPoint($memberSrl);
2442 2442
 
2443
-			if($pointModuleConfig->level_step[$maxLevel] > $originPoint)
2443
+			if ($pointModuleConfig->level_step[$maxLevel] > $originPoint)
2444 2444
 			{
2445 2445
 				$oPointController = getController('point');
2446 2446
 				$oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update');
@@ -2450,18 +2450,18 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
 	function procMemberModifyEmailAddress()
2452 2452
 	{
2453
-		if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
2453
+		if (!Context::get('is_logged')) return $this->stop('msg_not_logged');
2454 2454
 
2455 2455
 		$member_info = Context::get('logged_info');
2456 2456
 		$newEmail = Context::get('email_address');
2457 2457
 
2458
-		if(!$newEmail) return $this->stop('msg_invalid_request');
2458
+		if (!$newEmail) return $this->stop('msg_invalid_request');
2459 2459
 
2460 2460
 		$oMemberModel = getModel('member');
2461 2461
 		$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
2462
-		if($member_srl) return new Object(-1,'msg_exists_email_address');
2462
+		if ($member_srl) return new Object(-1, 'msg_exists_email_address');
2463 2463
 
2464
-		if($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
2464
+		if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA')
2465 2465
 		{
2466 2466
 			return $this->stop('msg_invalid_request');
2467 2467
 		}
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
 		$oDB = &DB::getInstance();
2478 2478
 		$oDB->begin();
2479 2479
 		$output = executeQuery('member.insertAuthMail', $auth_args);
2480
-		if(!$output->toBool())
2480
+		if (!$output->toBool())
2481 2481
 		{
2482 2482
 			$oDB->rollback();
2483 2483
 			return $output;
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
 		$member_config = $oModuleModel->getModuleConfig('member');
2488 2488
 
2489 2489
 		$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
2490
-		if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2490
+		if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
2491 2491
 
2492 2492
 		global $lang;
2493 2493
 
@@ -2499,17 +2499,17 @@  discard block
 block discarded – undo
2499 2499
 
2500 2500
 		Context::set('newEmail', $newEmail);
2501 2501
 
2502
-		$auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
2502
+		$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
2503 2503
 		Context::set('auth_url', $auth_url);
2504 2504
 
2505 2505
 		$oTemplate = &TemplateHandler::getInstance();
2506 2506
 		$content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
2507 2507
 
2508 2508
 		$oMail = new Mail();
2509
-		$oMail->setTitle( Context::getLang('title_modify_email_address') );
2509
+		$oMail->setTitle(Context::getLang('title_modify_email_address'));
2510 2510
 		$oMail->setContent($content);
2511
-		$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
2512
-		$oMail->setReceiptor( $member_info->nick_name, $newEmail );
2511
+		$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
2512
+		$oMail->setReceiptor($member_info->nick_name, $newEmail);
2513 2513
 		$result = $oMail->send();
2514 2514
 
2515 2515
 		$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail);
@@ -2523,16 +2523,16 @@  discard block
 block discarded – undo
2523 2523
 	{
2524 2524
 		$member_srl = Context::get('member_srl');
2525 2525
 		$auth_key = Context::get('auth_key');
2526
-		if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
2526
+		if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
2527 2527
 
2528 2528
 		// Test logs for finding password by user_id and authkey
2529 2529
 		$args = new stdClass;
2530 2530
 		$args->member_srl = $member_srl;
2531 2531
 		$args->auth_key = $auth_key;
2532 2532
 		$output = executeQuery('member.getAuthMail', $args);
2533
-		if(!$output->toBool() || $output->data->auth_key != $auth_key)
2533
+		if (!$output->toBool() || $output->data->auth_key != $auth_key)
2534 2534
 		{
2535
-			if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args);
2535
+			if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args);
2536 2536
 			return $this->stop('msg_invalid_modify_email_auth_key');
2537 2537
 		}
2538 2538
 
@@ -2541,10 +2541,10 @@  discard block
 block discarded – undo
2541 2541
 		list($args->email_id, $args->email_host) = explode('@', $newEmail);
2542 2542
 
2543 2543
 		$output = executeQuery('member.updateMemberEmailAddress', $args);
2544
-		if(!$output->toBool()) return $this->stop($output->getMessage());
2544
+		if (!$output->toBool()) return $this->stop($output->getMessage());
2545 2545
 
2546 2546
 		// Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table
2547
-		executeQuery('member.deleteAuthChangeEmailAddress',$args);
2547
+		executeQuery('member.deleteAuthChangeEmailAddress', $args);
2548 2548
 
2549 2549
 		$this->_clearMemberCache($args->member_srl);
2550 2550
 
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
 	**/
2563 2563
 	function triggerGetDocumentMenu(&$menu_list)
2564 2564
 	{
2565
-		if(!Context::get('is_logged')) return new Object();
2565
+		if (!Context::get('is_logged')) return new Object();
2566 2566
 
2567 2567
 		$logged_info = Context::get('logged_info');
2568 2568
 		$document_srl = Context::get('target_srl');
@@ -2573,12 +2573,12 @@  discard block
 block discarded – undo
2573 2573
 		$member_srl = $oDocument->get('member_srl');
2574 2574
 		$module_srl = $oDocument->get('module_srl');
2575 2575
 
2576
-		if(!$member_srl) return new Object();
2577
-		if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2576
+		if (!$member_srl) return new Object();
2577
+		if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object();
2578 2578
 
2579 2579
 		$oDocumentController = getController('document');
2580
-		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
2581
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup');
2580
+		$url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl);
2581
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup');
2582 2582
 
2583 2583
 		return new Object();
2584 2584
 	}
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 	**/
2593 2593
 	function triggerGetCommentMenu(&$menu_list)
2594 2594
 	{
2595
-		if(!Context::get('is_logged')) return new Object();
2595
+		if (!Context::get('is_logged')) return new Object();
2596 2596
 
2597 2597
 		$logged_info = Context::get('logged_info');
2598 2598
 		$comment_srl = Context::get('target_srl');
@@ -2603,12 +2603,12 @@  discard block
 block discarded – undo
2603 2603
 		$module_srl = $oComment->get('module_srl');
2604 2604
 		$member_srl = $oComment->get('member_srl');
2605 2605
 
2606
-		if(!$member_srl) return new Object();
2607
-		if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object();
2606
+		if (!$member_srl) return new Object();
2607
+		if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object();
2608 2608
 
2609 2609
 		$oCommentController = getController('comment');
2610
-		$url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl);
2611
-		$oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup');
2610
+		$url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl);
2611
+		$oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup');
2612 2612
 
2613 2613
 		return new Object();
2614 2614
 	}
@@ -2620,7 +2620,7 @@  discard block
 block discarded – undo
2620 2620
 	**/
2621 2621
 	function procMemberSpammerManage()
2622 2622
 	{
2623
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2623
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2624 2624
 
2625 2625
 		$logged_info = Context::get('logged_info');
2626 2626
 		$member_srl = Context::get('member_srl');
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
 		$cnt_loop = Context::get('cnt_loop');
2629 2629
 		$proc_type = Context::get('proc_type');
2630 2630
 		$isMoveToTrash = true;
2631
-		if($proc_type == "delete")
2631
+		if ($proc_type == "delete")
2632 2632
 			$isMoveToTrash = false;
2633 2633
 
2634 2634
 		// check grant
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
2638 2638
 		$grant = $oModuleModel->getGrant($module_info, $logged_info);
2639 2639
 
2640
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2640
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
2641 2641
 
2642 2642
 		$proc_msg = "";
2643 2643
 
@@ -2646,10 +2646,10 @@  discard block
 block discarded – undo
2646 2646
 
2647 2647
 		// delete or trash destination
2648 2648
 		// proc member
2649
-		if($cnt_loop == 1)
2649
+		if ($cnt_loop == 1)
2650 2650
 			$this->_spammerMember($member_srl);
2651 2651
 		// proc document and comment
2652
-		elseif($cnt_loop>1)
2652
+		elseif ($cnt_loop > 1)
2653 2653
 			$this->_spammerDocuments($member_srl, $isMoveToTrash);
2654 2654
 
2655 2655
 		// get destination count
@@ -2658,11 +2658,11 @@  discard block
 block discarded – undo
2658 2658
 
2659 2659
 		$total_count = Context::get('total_count');
2660 2660
 		$remain_count = $cnt_document + $cnt_comment;
2661
-		if($cnt_loop == 1) $total_count = $remain_count;
2661
+		if ($cnt_loop == 1) $total_count = $remain_count;
2662 2662
 
2663 2663
 		// get progress percent
2664
-		if($total_count > 0)
2665
-			$progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 );
2664
+		if ($total_count > 0)
2665
+			$progress = intval((($total_count - $remain_count) / $total_count) * 100);
2666 2666
 		else
2667 2667
 			$progress = 100;
2668 2668
 
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
 	**/
2687 2687
 	private function _spammerMember($member_srl) {
2688 2688
 		$logged_info = Context::get('logged_info');
2689
-		$spam_description = trim( Context::get('spam_description') );
2689
+		$spam_description = trim(Context::get('spam_description'));
2690 2690
 
2691 2691
 		$oMemberModel = getModel('member');
2692 2692
 		$columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description');
@@ -2705,10 +2705,10 @@  discard block
 block discarded – undo
2705 2705
 		$args->user_id = $member_info->user_id;
2706 2706
 		$args->nick_name = $member_info->nick_name;
2707 2707
 		$args->denied = "Y";
2708
-		$args->description = trim( $member_info->description );
2709
-		if( $args->description != "" ) $args->description .= "\n";	// add new line
2708
+		$args->description = trim($member_info->description);
2709
+		if ($args->description != "") $args->description .= "\n"; // add new line
2710 2710
 
2711
-		$args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]";
2711
+		$args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]";
2712 2712
 
2713 2713
 		$output = $this->updateMember($args, true);
2714 2714
 
@@ -2737,21 +2737,21 @@  discard block
 block discarded – undo
2737 2737
 		// 1. proc comment, 2. proc document
2738 2738
 		$cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl);
2739 2739
 		$cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl);
2740
-		if($cnt_comment > 0)
2740
+		if ($cnt_comment > 0)
2741 2741
 		{
2742 2742
 			$columnList = array();
2743 2743
 			$commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount);
2744
-			if($commentList) {
2745
-				foreach($commentList as $v) {
2744
+			if ($commentList) {
2745
+				foreach ($commentList as $v) {
2746 2746
 					$oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash);
2747 2747
 				}
2748 2748
 			}
2749
-		} elseif($cnt_document > 0) {
2749
+		} elseif ($cnt_document > 0) {
2750 2750
 			$columnList = array();
2751 2751
 			$documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount);
2752
-			if($documentList) {
2753
-				foreach($documentList as $v) {
2754
-					if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v);
2752
+			if ($documentList) {
2753
+				foreach ($documentList as $v) {
2754
+					if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v);
2755 2755
 					else $oDocumentController->deleteDocument($v->document_srl);
2756 2756
 				}
2757 2757
 			}
@@ -2763,24 +2763,24 @@  discard block
 block discarded – undo
2763 2763
 	function _clearMemberCache($member_srl, $site_srl = 0)
2764 2764
 	{
2765 2765
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
2766
-		if($oCacheHandler->isSupport())
2766
+		if ($oCacheHandler->isSupport())
2767 2767
 		{
2768
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl;
2768
+			$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl;
2769 2769
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2770 2770
 			$oCacheHandler->delete($cache_key);
2771 2771
 
2772
-			if($site_srl !== 0)
2772
+			if ($site_srl !== 0)
2773 2773
 			{
2774
-				$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
2774
+				$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0';
2775 2775
 				$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2776 2776
 				$oCacheHandler->delete($cache_key);
2777 2777
 			}
2778 2778
 		}
2779 2779
 
2780 2780
 		$oCacheHandler = CacheHandler::getInstance('object');
2781
-		if($oCacheHandler->isSupport())
2781
+		if ($oCacheHandler->isSupport())
2782 2782
 		{
2783
-			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
2783
+			$object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl;
2784 2784
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
2785 2785
 			$oCacheHandler->delete($cache_key);
2786 2786
 		}
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 1 patch
Spacing   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	function __construct() {
59
-		$this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile;
59
+		$this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile;
60 60
 	}
61 61
 
62 62
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new Object(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new Object(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new Object(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new Object(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368 368
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new Object(0,'success_deleted');
378
+		return new Object(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new Object(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new Object(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new Object($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -465,27 +465,27 @@  discard block
 block discarded – undo
465 465
 			$args->is_shortcut = $request->is_shortcut;
466 466
 			$args->url = $request->shortcut_target;
467 467
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
468
+			if (!$args->open_window) $args->open_window = 'N';
469
+			if (!$args->expand) $args->expand = 'N';
470
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
471 471
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
473 473
 			else $args->name = $request->menu_name;
474 474
 		}
475 475
 		// type is module short cut
476
-		else if(is_numeric($request->shortcut_target))
476
+		else if (is_numeric($request->shortcut_target))
477 477
 		{
478 478
 			// Get original information
479 479
 			$oMenuAdminModel = getAdminModel('menu');
480 480
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
481
-			if(!$itemInfo->menu_item_srl)
481
+			if (!$itemInfo->menu_item_srl)
482 482
 			{
483 483
 				return new Object(-1, 'msg_invalid_request');
484 484
 			}
485 485
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
486 486
 
487 487
 			$args = $itemInfo;
488
-			if(count($args->group_srls) == 0)
488
+			if (count($args->group_srls) == 0)
489 489
 			{
490 490
 				unset($args->group_srls);
491 491
 			}
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 			$args->url = '#';
506 506
 		}
507 507
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
509 509
 		else $args->desc = '';
510 510
 
511 511
 		$args->menu_item_srl = getNextSequence();
512
-		$args->listorder = -1*$args->menu_item_srl;
512
+		$args->listorder = -1 * $args->menu_item_srl;
513 513
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
514
+		if (!$output->toBool()) return $output;
515 515
 
516 516
 		$oDB->commit();
517 517
 
@@ -533,46 +533,46 @@  discard block
 block discarded – undo
533 533
 		$args->expand = $request->menu_expand;
534 534
 		$args->is_shortcut = $request->is_shortcut;
535 535
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
536
+		if (!$args->open_window) $args->open_window = 'N';
537
+		if (!$args->expand) $args->expand = 'N';
538
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
539 539
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
541 541
 		else $args->name = $request->menu_name;
542 542
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
544 544
 		else $args->desc = '';
545 545
 
546
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 547
 		{
548 548
 			return new Object(-1, 'msg_invalid_request');
549 549
 		}
550 550
 
551 551
 		// when menu copy, module already copied
552
-		if($isProc)
552
+		if ($isProc)
553 553
 		{
554 554
 			$result = $this->_insertModule($request, $args);
555
-			if(!$result->toBool())
555
+			if (!$result->toBool())
556 556
 			{
557 557
 				return new Object(-1, $result->message);
558 558
 			}
559 559
 		}
560 560
 
561 561
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
562
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
565 565
 
566
-		if(!$request->module_id)
566
+		if (!$request->module_id)
567 567
 		{
568 568
 			return new Object(-1, 'msg_invalid_request');
569 569
 		}
570 570
 
571 571
 		$args->url = $request->module_id;
572 572
 		$args->menu_item_srl = getNextSequence();
573
-		$args->listorder = -1*$args->menu_item_srl;
573
+		$args->listorder = -1 * $args->menu_item_srl;
574 574
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
575
+		if (!$output->toBool()) return $output;
576 576
 
577 577
 		$oDB->commit();
578 578
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		//module create
606 606
 		$site_module_info = Context::get('site_module_info');
607
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
607
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
608 608
 		$cmArgs->browser_title = $args->name;
609 609
 		$cmArgs->menu_srl = $request->menu_srl;
610 610
 		$cmArgs->layout_srl = -1;
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
 		$cmArgs->is_skin_fix = 'N';
613 613
 		$cmArgs->is_mskin_fix = 'N';
614 614
 
615
-		if(Mobile::isMobileEnabled() === true)
615
+		if (Mobile::isMobileEnabled() === true)
616 616
 		{
617 617
 			$cmArgs->use_mobile = 'Y';
618 618
 		}
619 619
 
620 620
 		// if mid is empty, auto create mid
621
-		if(!$request->module_id)
621
+		if (!$request->module_id)
622 622
 		{
623 623
 			$randomMid = $this->_makeRandomMid();
624 624
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 		// check already created module instance
629 629
 		$oModuleModel = getModel('module');
630 630
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
631
-		if($output->module_srl)
631
+		if ($output->module_srl)
632 632
 		{
633 633
 			return new Object(-1, 'msg_module_name_exists');
634 634
 		}
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 	{
648 648
 		$request = Context::getRequestVars();
649 649
 
650
-		if(!$request->menu_item_srl || !$request->menu_name)
650
+		if (!$request->menu_item_srl || !$request->menu_name)
651 651
 		{
652 652
 			return new Object(-1, 'msg_invalid_request');
653 653
 		}
654 654
 
655 655
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
656
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
658 658
 
659 659
 		// Get original information
660 660
 		$oMenuAdminModel = getAdminModel('menu');
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		$args = $itemInfo;
663 663
 
664 664
 		// if menu type is module, check exists module and update
665
-		if($itemInfo->is_shortcut == 'Y')
665
+		if ($itemInfo->is_shortcut == 'Y')
666 666
 		{
667 667
 			// type is url
668
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
669 669
 			{
670 670
 				$args->url = $request->shortcut_target;
671 671
 			}
672 672
 			// type is module short cut
673
-			else if(is_numeric($request->shortcut_target))
673
+			else if (is_numeric($request->shortcut_target))
674 674
 			{
675 675
 				// Get new original information
676 676
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
677
-				if(!$newItemInfo->menu_item_srl)
677
+				if (!$newItemInfo->menu_item_srl)
678 678
 				{
679 679
 					return new Object(-1, 'msg_invalid_request');
680 680
 				}
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
 		{
692 692
 			// check already created module instance
693 693
 			$oModuleModel = getModel('module');
694
-			if($request->module_id != $itemInfo->url)
694
+			if ($request->module_id != $itemInfo->url)
695 695
 			{
696 696
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
697
-				if($output->module_srl)
697
+				if ($output->module_srl)
698 698
 				{
699 699
 					return new Object(-1, 'msg_module_name_exists');
700 700
 				}
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
 
703 703
 			// if not exist module, return error
704 704
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
705
-			if(!$moduleInfo)
705
+			if (!$moduleInfo)
706 706
 			{
707 707
 				return new Object(-1, 'msg_invalid_request');
708 708
 			}
709 709
 
710 710
 			$moduleInfo->mid = $request->module_id;
711
-			if($request->browser_title)
711
+			if ($request->browser_title)
712 712
 			{
713 713
 				$moduleInfo->browser_title = $request->browser_title;
714 714
 			}
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			$args->url = $request->module_id;
718 718
 		}
719 719
 
720
-		if($request->menu_name_key)
720
+		if ($request->menu_name_key)
721 721
 		{
722 722
 			$args->name = $request->menu_name_key;
723 723
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			$args->name = $request->menu_name;
727 727
 		}
728 728
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
730 730
 		else $args->desc = '';
731 731
 
732 732
 		unset($args->group_srls);
@@ -754,38 +754,38 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$btnOutput = $this->_uploadButton($args);
756 756
 
757
-		if($btnOutput['normal_btn'])
757
+		if ($btnOutput['normal_btn'])
758 758
 		{
759 759
 			$this->add('normal_btn', $btnOutput['normal_btn']);
760 760
 			$item_info->normal_btn = $btnOutput['normal_btn'];
761 761
 		}
762
-		if($btnOutput['hover_btn'])
762
+		if ($btnOutput['hover_btn'])
763 763
 		{
764 764
 			$this->add('hover_btn', $btnOutput['hover_btn']);
765 765
 			$item_info->hover_btn = $btnOutput['hover_btn'];
766 766
 		}
767
-		if($btnOutput['active_btn'])
767
+		if ($btnOutput['active_btn'])
768 768
 		{
769 769
 			$this->add('active_btn', $btnOutput['active_btn']);
770 770
 			$item_info->active_btn = $btnOutput['active_btn'];
771 771
 		}
772 772
 
773 773
 		// group_srls check
774
-		if(count($item_info->group_srls) == 0)
774
+		if (count($item_info->group_srls) == 0)
775 775
 		{
776 776
 			unset($item_info->group_srls);
777 777
 		}
778 778
 
779 779
 		// Button delete check
780
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
781 781
 		{
782 782
 			$item_info->normal_btn = '';
783 783
 		}
784
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
785 785
 		{
786 786
 			$item_info->hover_btn = '';
787 787
 		}
788
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
789 789
 		{
790 790
 			$item_info->active_btn = '';
791 791
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$args->is_force = Context::get('is_force');
826 826
 
827 827
 		$returnObj = $this->deleteItem($args);
828
-		if(is_object($returnObj))
828
+		if (is_object($returnObj))
829 829
 		{
830 830
 			$this->setError($returnObj->error);
831 831
 			$this->setMessage($returnObj->message);
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
 		$args->menu_srl = $itemInfo->menu_srl;
855 855
 
856 856
 		// Display an error that the category cannot be deleted if it has a child node	603
857
-		if($args->is_force != 'Y')
857
+		if ($args->is_force != 'Y')
858 858
 		{
859 859
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
861
-			if($output->data->count > 0)
860
+			if (!$output->toBool()) return $output;
861
+			if ($output->data->count > 0)
862 862
 			{
863 863
 				return new Object(-1001, 'msg_cannot_delete_for_child');
864 864
 			}
@@ -870,22 +870,22 @@  discard block
 block discarded – undo
870 870
 
871 871
 		// check admin menu delete
872 872
 		$oAdmin = getClass('admin');
873
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
874 874
 		{
875 875
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 876
 		}
877 877
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
879 879
 
880 880
 		// get menu properies with child menu
881 881
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
882 882
 		$originMenu = NULL;
883 883
 
884
-		if(is_readable(FileHandler::getRealPath($phpFile)))
884
+		if (is_readable(FileHandler::getRealPath($phpFile)))
885 885
 		{
886 886
 			include(FileHandler::getRealPath($phpFile));
887 887
 
888
-			if(is_array($menu->list))
888
+			if (is_array($menu->list))
889 889
 			{
890 890
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
891 891
 			}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
896 896
 		$isStartmenuInclude = false;
897 897
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
898
-		if($isStartmenuInclude)
898
+		if ($isStartmenuInclude)
899 899
 		{
900 900
 			return new Object(-1, 'msg_cannot_delete_homemenu');
901 901
 		}
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 
920 920
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
921 921
 	{
922
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
923 923
 		{
924 924
 			$isStartmenuInclude = true;
925 925
 		}
926 926
 
927
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
927
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
928 928
 		{
929
-			foreach($originMenu['list'] AS $key=>$value)
929
+			foreach ($originMenu['list'] AS $key=>$value)
930 930
 			{
931 931
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
932 932
 			}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		$args->menu_srl = $menuSrl;
941 941
 		$args->menu_item_srl = $node['node_srl'];
942 942
 		$output = executeQuery("menu.deleteMenuItem", $args);
943
-		if(!$output->toBool())
943
+		if (!$output->toBool())
944 944
 		{
945 945
 			$oDB->rollback();
946 946
 			return $output;
@@ -949,12 +949,12 @@  discard block
 block discarded – undo
949 949
 		// Update the xml file and get its location
950 950
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 951
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
952
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
955 955
 
956 956
 		// Delete module
957
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
958 958
 		{
959 959
 			$oModuleController = getController('module');
960 960
 			$oModuleModel = getModel('module');
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 			$args->site_srl = $menuInfo->site_srl;
965 965
 			$args->is_shortcut = 'Y';
966 966
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
967
-			if($output->data->menu_item_srl)
967
+			if ($output->data->menu_item_srl)
968 968
 			{
969 969
 				$output->data->url = '';
970 970
 				$referenceItem = $output->data;
971 971
 				$output = $this->_updateMenuItem($referenceItem);
972
-				if(!$output->toBool())
972
+				if (!$output->toBool())
973 973
 				{
974 974
 					$oDB->rollback();
975 975
 					return $output;
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 			}
978 978
 
979 979
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
980
-			if($moduleInfo->module_srl)
980
+			if ($moduleInfo->module_srl)
981 981
 			{
982 982
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
983
-				if(!$output->toBool())
983
+				if (!$output->toBool())
984 984
 				{
985 985
 					$oDB->rollback();
986 986
 					return $output;
@@ -993,14 +993,14 @@  discard block
 block discarded – undo
993 993
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 994
 	{
995 995
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
996
-		if(!$output->toBool())
996
+		if (!$output->toBool())
997 997
 		{
998 998
 			return new Object(-1, $output->message);
999 999
 		}
1000 1000
 
1001
-		if(is_array($node['list']))
1001
+		if (is_array($node['list']))
1002 1002
 		{
1003
-			foreach($node['list'] AS $key=>$value)
1003
+			foreach ($node['list'] AS $key=>$value)
1004 1004
 			{
1005 1005
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1006 1006
 			}
@@ -1013,31 +1013,31 @@  discard block
 block discarded – undo
1013 1013
 	 */
1014 1014
 	function procMenuAdminMoveItem()
1015 1015
 	{
1016
-		$mode = Context::get('mode');	//move
1017
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1018
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1016
+		$mode = Context::get('mode'); //move
1017
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1018
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1019
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1020 1020
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1021
+		if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request');
1022 1022
 
1023 1023
 		$oMenuAdminModel = getAdminModel('menu');
1024 1024
 
1025 1025
 		// get original menu item info for cache file recreate
1026 1026
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1027
-		if(!$originalItemInfo->menu_item_srl)
1027
+		if (!$originalItemInfo->menu_item_srl)
1028 1028
 		{
1029 1029
 			return new Object(-1, 'msg_empty_menu_item');
1030 1030
 		}
1031 1031
 
1032 1032
 		// get menu properies with child menu
1033
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1034 1034
 		$originMenu = NULL;
1035 1035
 
1036
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1036
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1037 1037
 		{
1038 1038
 			include(FileHandler::getRealPath($phpFile));
1039 1039
 
1040
-			if(is_array($menu->list))
1040
+			if (is_array($menu->list))
1041 1041
 			{
1042 1042
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1043 1043
 			}
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 		// get target menu info for move
1047 1047
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1048 1048
 		// if move in same sitemap
1049
-		if($targetMenuItemInfo->menu_item_srl)
1049
+		if ($targetMenuItemInfo->menu_item_srl)
1050 1050
 		{
1051 1051
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1052 1052
 		}
@@ -1058,20 +1058,20 @@  discard block
 block discarded – undo
1058 1058
 			$parent_srl = 0;
1059 1059
 		}
1060 1060
 
1061
-		if(!$this->homeModuleMid)
1061
+		if (!$this->homeModuleMid)
1062 1062
 		{
1063 1063
 			$oModuleModel = getModel('module');
1064 1064
 			$oMenuAdminController = getAdminController('menu');
1065 1065
 			$columnList = array('modules.mid',);
1066 1066
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1067
-			if($output->mid)
1067
+			if ($output->mid)
1068 1068
 			{
1069 1069
 				$this->homeModuleMid = $output->mid;
1070 1070
 			}
1071 1071
 		}
1072 1072
 
1073 1073
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1074
-		if(count($originMenu['list']) > 0)
1074
+		if (count($originMenu['list']) > 0)
1075 1075
 		{
1076 1076
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1077 1077
 		}
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1087 1087
 	{
1088
-		if(is_array($node))
1088
+		if (is_array($node))
1089 1089
 		{
1090
-			foreach($node AS $key=>$node)
1090
+			foreach ($node AS $key=>$node)
1091 1091
 			{
1092 1092
 				$args = new stdClass();
1093 1093
 				$args->menu_srl = $menu_srl;
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 				$output = $this->_updateMenuItem($args);
1096 1096
 
1097 1097
 				//module's menu_srl move also
1098
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1098
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1099 1099
 				{
1100 1100
 					$oModuleModel = getModel('module');
1101 1101
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1102
-					if($menu_srl != $moduleInfo->menu_srl)
1102
+					if ($menu_srl != $moduleInfo->menu_srl)
1103 1103
 					{
1104 1104
 						$moduleInfo->menu_srl = $menu_srl;
1105 1105
 						$oModuleController = getController('module');
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 					}
1108 1108
 				}
1109 1109
 
1110
-				if(count($node['list']) > 0)
1110
+				if (count($node['list']) > 0)
1111 1111
 				{
1112 1112
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1113 1113
 				}
@@ -1129,21 +1129,21 @@  discard block
 block discarded – undo
1129 1129
 		$menuSrl = $itemInfo->menu_srl;
1130 1130
 
1131 1131
 		// get menu properies with child menu
1132
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1132
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1133 1133
 		$originMenu = NULL;
1134 1134
 
1135
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1135
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1136 1136
 		{
1137 1137
 			include(FileHandler::getRealPath($phpFile));
1138 1138
 
1139
-			if(is_array($menu->list))
1139
+			if (is_array($menu->list))
1140 1140
 			{
1141 1141
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		// copy the menu item with recursively
1146
-		if(is_array($originMenu))
1146
+		if (is_array($originMenu))
1147 1147
 		{
1148 1148
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1149 1149
 		}
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1161 1161
 	{
1162
-		if(array_key_exists($menuItemSrl, $menuList))
1162
+		if (array_key_exists($menuItemSrl, $menuList))
1163 1163
 		{
1164 1164
 			$originMenu = $menuList[$menuItemSrl];
1165 1165
 			return;
1166 1166
 		}
1167 1167
 
1168
-		foreach($menuList AS $key=>$value)
1168
+		foreach ($menuList AS $key=>$value)
1169 1169
 		{
1170
-			if(count($value['list']) > 0)
1170
+			if (count($value['list']) > 0)
1171 1171
 			{
1172 1172
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1173 1173
 			}
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		// default argument setting
1183 1183
 		$args = new stdClass();
1184 1184
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1186 1186
 		else $args->parent_srl = $parentSrl;
1187 1187
 		$args->menu_name_key = $originMenu['text'];
1188 1188
 		$args->menu_name = $originMenu['text'];
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$isModuleCopySuccess = false;
1197 1197
 		// if menu have a reference of module instance
1198
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1198
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1199 1199
 		{
1200 1200
 			$oModuleModel = getModel('module');
1201 1201
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1215,22 +1215,22 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 			$args->module_srl = $copiedModuleSrl;
1217 1217
 
1218
-			if($copiedModuleSrl)
1218
+			if ($copiedModuleSrl)
1219 1219
 			{
1220 1220
 				$isModuleCopySuccess = true;
1221 1221
 			}
1222 1222
 		}
1223 1223
 		// if menu type is shortcut
1224
-		else if($menuItemInfo->is_shortcut == 'Y')
1224
+		else if ($menuItemInfo->is_shortcut == 'Y')
1225 1225
 		{
1226 1226
 			$args->shortcut_target = $originMenu['url'];
1227 1227
 			$isModuleCopySuccess = true;
1228 1228
 		}
1229 1229
 
1230
-		if($isModuleCopySuccess)
1230
+		if ($isModuleCopySuccess)
1231 1231
 		{
1232 1232
 			// if have a group permission
1233
-			if($menuItemInfo->group_srls)
1233
+			if ($menuItemInfo->group_srls)
1234 1234
 			{
1235 1235
 				$args->group_srls = $menuItemInfo->group_srls;
1236 1236
 			}
@@ -1244,12 +1244,12 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 			// if have a button, copy a button image also
1246 1246
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1247
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1248 1248
 			{
1249 1249
 				// copy & upate
1250 1250
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1251
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1252
-				if(count($update_item_info->group_srls) == 0)
1251
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1252
+				if (count($update_item_info->group_srls) == 0)
1253 1253
 				{
1254 1254
 					unset($update_item_info->group_srls);
1255 1255
 				}
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 		// if have a child menu, copy child menu also
1265 1265
 		$childMenu = array_shift($originMenu['list']);
1266
-		if(count($childMenu) > 0)
1266
+		if (count($childMenu) > 0)
1267 1267
 		{
1268 1268
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1269 1269
 		}
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 	{
1274 1274
 		$time = $_SERVER['REQUEST_TIME'];
1275 1275
 		$randomString = "";
1276
-		for($i=0;$i<4;$i++)
1276
+		for ($i = 0; $i < 4; $i++)
1277 1277
 		{
1278 1278
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1279
+			if ($case) $doc = rand(65, 90);
1280 1280
 			else $doc = rand(97, 122);
1281 1281
 
1282 1282
 			$randomString .= chr($doc);
@@ -1300,32 +1300,32 @@  discard block
 block discarded – undo
1300 1300
 		// menu name update
1301 1301
 		$args->menu_srl = $this->menuSrl;
1302 1302
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1303
+		if (!$output->toBool()) return $output;
1304 1304
 
1305 1305
 		$this->map = array();
1306
-		if(is_array($parentKeyList))
1306
+		if (is_array($parentKeyList))
1307 1307
 		{
1308
-			foreach($parentKeyList as $no=>$srl)
1308
+			foreach ($parentKeyList as $no=>$srl)
1309 1309
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1310
+				if ($srl === 0) continue;
1311
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1312 1312
 				$this->map[$srl][] = $no;
1313 1313
 			}
1314 1314
 		}
1315 1315
 
1316 1316
 		$result = array();
1317
-		if(is_array($this->itemKeyList))
1317
+		if (is_array($this->itemKeyList))
1318 1318
 		{
1319
-			foreach($this->itemKeyList as $srl)
1319
+			foreach ($this->itemKeyList as $srl)
1320 1320
 			{
1321
-				if(!$this->checked[$srl])
1321
+				if (!$this->checked[$srl])
1322 1322
 				{
1323 1323
 					$target = new stdClass();
1324 1324
 					$this->checked[$srl] = 1;
1325 1325
 					$target->node = $srl;
1326
-					$target->child= array();
1326
+					$target->child = array();
1327 1327
 
1328
-					while(count($this->map[$srl]))
1328
+					while (count($this->map[$srl]))
1329 1329
 					{
1330 1330
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1331 1331
 					}
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
 			}
1335 1335
 		}
1336 1336
 
1337
-		if(is_array($result))
1337
+		if (is_array($result))
1338 1338
 		{
1339 1339
 			$i = 0;
1340
-			foreach($result AS $key=>$node)
1340
+			foreach ($result AS $key=>$node)
1341 1341
 			{
1342
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1343
-				$this->_recursiveMoveMenuItem($node);	//move child node
1342
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1343
+				$this->_recursiveMoveMenuItem($node); //move child node
1344 1344
 				$i = $node->node;
1345 1345
 			}
1346 1346
 		}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 		$child_node->child = array();
1370 1370
 		$target->child[] = $child_node;
1371 1371
 
1372
-		while(count($this->map[$child_srl]))
1372
+		while (count($this->map[$child_srl]))
1373 1373
 		{
1374 1374
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1375 1375
 		}
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 	function _recursiveMoveMenuItem($result)
1385 1385
 	{
1386 1386
 		$i = 0;
1387
-		while(count($result->child))
1387
+		while (count($result->child))
1388 1388
 		{
1389 1389
 			unset($node);
1390 1390
 			$node = array_shift($result->child);
@@ -1404,48 +1404,48 @@  discard block
 block discarded – undo
1404 1404
 	 * @param string $mode 'move' or 'insert'
1405 1405
 	 * @return void
1406 1406
 	 */
1407
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1407
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1408 1408
 	{
1409 1409
 		// Get the original menus
1410 1410
 		$oMenuAdminModel = getAdminModel('menu');
1411 1411
 
1412 1412
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1413
+		if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request');
1414 1414
 		// Move the menu location(change the order menu appears)
1415
-		if($mode == 'move')
1415
+		if ($mode == 'move')
1416 1416
 		{
1417 1417
 			$args = new stdClass();
1418 1418
 			$args->parent_srl = $parent_srl;
1419 1419
 			$args->menu_srl = $menu_srl;
1420 1420
 
1421
-			if($source_srl)
1421
+			if ($source_srl)
1422 1422
 			{
1423 1423
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1425
-				$args->listorder = $source_item->listorder-1;
1424
+				if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request');
1425
+				$args->listorder = $source_item->listorder - 1;
1426 1426
 			}
1427 1427
 			else
1428 1428
 			{
1429 1429
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1431
-				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1430
+				if (!$output->toBool()) return $output;
1431
+				$args->listorder = (int) $output->data->listorder;
1432
+				if (!$args->listorder) $args->listorder = 0;
1433 1433
 			}
1434 1434
 			$args->parent_srl = $parent_srl;
1435 1435
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1436
+			if (!$output->toBool()) return $output;
1437 1437
 
1438 1438
 			$args->parent_srl = $parent_srl;
1439 1439
 			$args->menu_item_srl = $target_srl;
1440 1440
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1441
+			if (!$output->toBool()) return $output;
1442 1442
 
1443 1443
 			//module's menu_srl move also
1444
-			if($isShortcut == 'N' && !empty($url))
1444
+			if ($isShortcut == 'N' && !empty($url))
1445 1445
 			{
1446 1446
 				$oModuleModel = getModel('module');
1447 1447
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1448
-				if($menu_srl != $moduleInfo->menu_srl)
1448
+				if ($menu_srl != $moduleInfo->menu_srl)
1449 1449
 				{
1450 1450
 					$moduleInfo->menu_srl = $menu_srl;
1451 1451
 					$oModuleController = getController('module');
@@ -1453,13 +1453,13 @@  discard block
 block discarded – undo
1453 1453
 				}
1454 1454
 
1455 1455
 				// change home menu cache file
1456
-				if($url == $this->homeModuleMid)
1456
+				if ($url == $this->homeModuleMid)
1457 1457
 				{
1458
-					if(file_exists($this->homeMenuCacheFile))
1458
+					if (file_exists($this->homeMenuCacheFile))
1459 1459
 					{
1460 1460
 						include($this->homeMenuCacheFile);
1461 1461
 					}
1462
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1463 1463
 					{
1464 1464
 						$this->makeHomemenuCacheFile($menu_srl);
1465 1465
 					}
@@ -1467,13 +1467,13 @@  discard block
 block discarded – undo
1467 1467
 			}
1468 1468
 			// Add a child
1469 1469
 		}
1470
-		elseif($mode == 'insert')
1470
+		elseif ($mode == 'insert')
1471 1471
 		{
1472 1472
 			$args->menu_item_srl = $target_srl;
1473 1473
 			$args->parent_srl = $parent_srl;
1474
-			$args->listorder = -1*getNextSequence();
1474
+			$args->listorder = -1 * getNextSequence();
1475 1475
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1476
+			if (!$output->toBool()) return $output;
1477 1477
 		}
1478 1478
 
1479 1479
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
 		// Re-generate the xml file
1499 1499
 		$xml_file = $this->makeXmlFile($menu_srl);
1500 1500
 		// Set return value
1501
-		$this->add('menu_title',$menu_title);
1502
-		$this->add('xml_file',$xml_file);
1501
+		$this->add('menu_title', $menu_title);
1502
+		$this->add('xml_file', $xml_file);
1503 1503
 	}
1504 1504
 
1505 1505
 	/**
@@ -1513,12 +1513,12 @@  discard block
 block discarded – undo
1513 1513
 		$target = Context::get('target');
1514 1514
 		$target_file = Context::get($target);
1515 1515
 		// Error occurs when the target is neither a uploaded file nor a valid file
1516
-		if(!$menu_srl || !$menu_item_srl)
1516
+		if (!$menu_srl || !$menu_item_srl)
1517 1517
 		{
1518 1518
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1519
 
1520 1520
 		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1522 1522
 		{
1523 1523
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1524
 		}
@@ -1526,13 +1526,13 @@  discard block
 block discarded – undo
1526 1526
 		// Move the file to a specific director if the uploaded file meets requirement
1527 1527
 		else
1528 1528
 		{
1529
-			$tmp_arr = explode('.',$target_file['name']);
1530
-			$ext = $tmp_arr[count($tmp_arr)-1];
1529
+			$tmp_arr = explode('.', $target_file['name']);
1530
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1531 1531
 
1532 1532
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1533
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1534
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1535
+			if (!is_dir($path)) FileHandler::makeDir($path);
1536 1536
 
1537 1537
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1538
 			Context::set('filename', $filename);
@@ -1565,14 +1565,14 @@  discard block
 block discarded – undo
1565 1565
 	{
1566 1566
 		$oModuleModel = getModel('module');
1567 1567
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1568
-		if(is_array($installed_module_list))
1568
+		if (is_array($installed_module_list))
1569 1569
 		{
1570 1570
 			$currentLang = Context::getLangType();
1571 1571
 			$menuList = array();
1572
-			foreach($installed_module_list AS $key=>$value)
1572
+			foreach ($installed_module_list AS $key=>$value)
1573 1573
 			{
1574 1574
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1575
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1576 1576
 				unset($info->menu);
1577 1577
 			}
1578 1578
 		}
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1605
 
1606 1606
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1609 1609
 		$dbInfo = Context::getDBInfo();
1610 1610
 
1611 1611
 		$args = new stdClass();
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		$args->menu_srl = $requestArgs->menu_srl;
1615 1615
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1616 1616
 		//if now page is https...
1617
-		if(strpos($url, 'https') !== false)
1617
+		if (strpos($url, 'https') !== false)
1618 1618
 		{
1619 1619
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620 1620
 		}
@@ -1628,23 +1628,23 @@  discard block
 block discarded – undo
1628 1628
 		$args->hover_btn = '';
1629 1629
 		$args->active_btn = '';
1630 1630
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1631
-		$args->listorder = -1*$args->menu_item_srl;
1631
+		$args->listorder = -1 * $args->menu_item_srl;
1632 1632
 
1633 1633
 		// Check if already exists
1634 1634
 		$oMenuModel = getAdminModel('menu');
1635 1635
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1636 1636
 		// Update if exists
1637
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1637
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1638 1638
 		{
1639 1639
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1640
+			if (!$output->toBool()) return $output;
1641 1641
 		}
1642 1642
 		// Insert if not exist
1643 1643
 		else
1644 1644
 		{
1645
-			$args->listorder = -1*$args->menu_item_srl;
1645
+			$args->listorder = -1 * $args->menu_item_srl;
1646 1646
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1647
+			if (!$output->toBool()) return $output;
1648 1648
 		}
1649 1649
 		// Get information of the menu
1650 1650
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1672,23 +1672,23 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 		// Menu Exposure update
1674 1674
 		// if exposure target is only login user...
1675
-		if(!$exposure)
1675
+		if (!$exposure)
1676 1676
 		{
1677 1677
 			$args->group_srls = '';
1678 1678
 		}
1679 1679
 		else
1680 1680
 		{
1681 1681
 			$exposure = explode(',', $exposure);
1682
-			if(in_array($exposure, array('-1','-3')))
1682
+			if (in_array($exposure, array('-1', '-3')))
1683 1683
 			{
1684 1684
 				$args->group_srls = $exposure;
1685 1685
 			}
1686 1686
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1687
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1688 1688
 		}
1689 1689
 
1690 1690
 		$output = $this->_updateMenuItem($args);
1691
-		if(!$output->toBool())
1691
+		if (!$output->toBool())
1692 1692
 		{
1693 1693
 			return $output;
1694 1694
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1705
 
1706 1706
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1707
+		if (!$grantList) $grantList = new stdClass;
1708 1708
 
1709 1709
 		$grantList->access = new stdClass();
1710 1710
 		$grantList->access->default = 'guest';
@@ -1712,9 +1712,9 @@  discard block
 block discarded – undo
1712 1712
 		$grantList->manager->default = 'manager';
1713 1713
 
1714 1714
 		$grant = new stdClass;
1715
-		foreach($grantList AS $grantName=>$grantInfo)
1715
+		foreach ($grantList AS $grantName=>$grantInfo)
1716 1716
 		{
1717
-			if(!$htPerm[$grantName])
1717
+			if (!$htPerm[$grantName])
1718 1718
 			{
1719 1719
 				continue;
1720 1720
 			}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 			$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1723 1723
 
1724 1724
 			// users in a particular group
1725
-			if(is_array($htPerm[$grantName]))
1725
+			if (is_array($htPerm[$grantName]))
1726 1726
 			{
1727 1727
 				$grant->{$grantName} = $htPerm[$grantName];
1728 1728
 				continue;
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 			$grant->{$group_srls} = array();
1737 1737
 		}
1738 1738
 
1739
-		if(count($grant))
1739
+		if (count($grant))
1740 1740
 		{
1741 1741
 			$oModuleController = getController('module');
1742 1742
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
 	function makeXmlFile($menu_srl)
1755 1755
 	{
1756 1756
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1757
+		if (!$menu_srl) return;
1758 1758
 		// Get menu informaton
1759 1759
 		$args = new stdClass();
1760 1760
 		$args->menu_srl = $menu_srl;
1761 1761
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1763
-		$site_srl = (int)$output->data->site_srl;
1762
+		if (!$output->toBool() || !$output->data) return $output;
1763
+		$site_srl = (int) $output->data->site_srl;
1764 1764
 
1765
-		if($site_srl)
1765
+		if ($site_srl)
1766 1766
 		{
1767 1767
 			$oModuleModel = getModel('module');
1768 1768
 			$columnList = array('sites.domain');
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 		$args->menu_srl = $menu_srl;
1774 1774
 		$args->sort_index = 'listorder';
1775 1775
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1776
+		if (!$output->toBool()) return;
1777 1777
 		// Specify the name of the cache file
1778
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1778
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1779
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1780 1780
 		// If no data found, generate an XML file without node data
1781 1781
 		$list = $output->data;
1782
-		if(!$list)
1782
+		if (!$list)
1783 1783
 		{
1784 1784
 			$xml_buff = "<root />";
1785 1785
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1787,10 +1787,10 @@  discard block
 block discarded – undo
1787 1787
 			return $xml_file;
1788 1788
 		}
1789 1789
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1790
+		if (!is_array($list)) $list = array($list);
1791 1791
 		// Create a tree for loop
1792 1792
 		$list_count = count($list);
1793
-		for($i=0;$i<$list_count;$i++)
1793
+		for ($i = 0; $i < $list_count; $i++)
1794 1794
 		{
1795 1795
 			$node = $list[$i];
1796 1796
 			$menu_item_srl = $node->menu_item_srl;
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 		$php_buff = sprintf(
1847 1847
 			'<?php '.
1848 1848
 			'if(!defined("__XE__")) exit(); '.
1849
-			'$menu = new stdClass();' .
1849
+			'$menu = new stdClass();'.
1850 1850
 			'%s; '.
1851 1851
 			'%s; '.
1852 1852
 			'$menu->list = array(%s); '.
@@ -1875,26 +1875,26 @@  discard block
 block discarded – undo
1875 1875
 	 */
1876 1876
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1877
 	{
1878
-		if(!$source_node) return;
1878
+		if (!$source_node) return;
1879 1879
 
1880 1880
 		$oMenuAdminModel = getAdminModel('menu');
1881 1881
 
1882
-		foreach($source_node as $menu_item_srl => $node)
1882
+		foreach ($source_node as $menu_item_srl => $node)
1883 1883
 		{
1884 1884
 			$child_buff = "";
1885 1885
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1886
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1887 1887
 			// List variables
1888 1888
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889
-			foreach($names as $key => $val)
1889
+			foreach ($names as $key => $val)
1890 1890
 			{
1891
-				$name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1891
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1892 1892
 			}
1893 1893
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1894 1894
 
1895
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1896
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1897
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1895
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1896
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1897
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 1898
 			{
1899 1899
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1900 1900
 			}
@@ -1904,21 +1904,21 @@  discard block
 block discarded – undo
1904 1904
 			$expand = $node->expand;
1905 1905
 
1906 1906
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1907
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1908 1908
 			else $normal_btn = '';
1909 1909
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1910
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1911 1911
 			else $hover_btn = '';
1912 1912
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1913
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1914 1914
 			else $active_btn = '';
1915 1915
 
1916 1916
 			$group_srls = $node->group_srls;
1917 1917
 
1918
-			if($normal_btn)
1918
+			if ($normal_btn)
1919 1919
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1920
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1922 1922
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923 1923
 			}
1924 1924
 			else
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 1927
 			}
1928 1928
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1929
+			if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1930 1930
 			else $group_check_code = "true";
1931 1931
 			$attribute = sprintf(
1932 1932
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 				$link
1951 1951
 			);
1952 1952
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
1953
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
+			else $buff .= sprintf('<node %s />', $attribute);
1955 1955
 		}
1956 1956
 		return $buff;
1957 1957
 	}
@@ -1970,77 +1970,77 @@  discard block
 block discarded – undo
1970 1970
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 1971
 	{
1972 1972
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
1973
+		if (!$source_node) return $output;
1974 1974
 
1975 1975
 		$oMenuAdminModel = getAdminModel('menu');
1976 1976
 
1977
-		foreach($source_node as $menu_item_srl => $node)
1977
+		foreach ($source_node as $menu_item_srl => $node)
1978 1978
 		{
1979 1979
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1980
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981 1981
 			else $child_output = array("buff"=>"", "url_list"=>array());
1982 1982
 
1983 1983
 			// List variables
1984 1984
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1985 1985
 			unset($name_arr_str);
1986
-			foreach($names as $key => $val)
1986
+			foreach ($names as $key => $val)
1987 1987
 			{
1988
-				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), strip_tags($val)));
1988
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), strip_tags($val)));
1989 1989
 			}
1990 1990
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1991 1991
 
1992 1992
 			// If url value is not empty in the current node, put the value into an array url_list
1993
-			if($node->url) $child_output['url_list'][] = $node->url;
1993
+			if ($node->url) $child_output['url_list'][] = $node->url;
1994 1994
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
1995 1995
 			// If node->group_srls value exists
1996
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
1996
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
1997 1997
 			else $group_check_code = "true";
1998 1998
 
1999 1999
 			// List variables
2000
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2001
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2002
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2003
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2000
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2001
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2002
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2003
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2004 2004
 			{
2005 2005
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2006 2006
 			}
2007 2007
 			else $href = sprintf('"%s"', $url);
2008 2008
 			$is_shortcut = $node->is_shortcut;
2009 2009
 			$open_window = $node->open_window;
2010
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2011
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2012
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2010
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2011
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2012
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2013 2013
 
2014
-			foreach($child_output['url_list'] as $key =>$val)
2014
+			foreach ($child_output['url_list'] as $key =>$val)
2015 2015
 			{
2016 2016
 				$child_output['url_list'][$key] = addslashes($val);
2017 2017
 			}
2018 2018
 
2019
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2019
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2020 2020
 			$child_buff = $child_output['buff'];
2021 2021
 			$expand = $node->expand;
2022 2022
 
2023 2023
 			$normal_btn = $node->normal_btn;
2024
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2024
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2025 2025
 			else $normal_btn = '';
2026 2026
 
2027 2027
 			$hover_btn = $node->hover_btn;
2028
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2028
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2029 2029
 			else $hover_btn = '';
2030 2030
 
2031 2031
 			$active_btn = $node->active_btn;
2032
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2032
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2033 2033
 			else $active_btn = '';
2034 2034
 
2035 2035
 
2036 2036
 			$group_srls = $node->group_srls;
2037 2037
 
2038
-			if($normal_btn)
2038
+			if ($normal_btn)
2039 2039
 			{
2040
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2041
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2040
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2041
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2042 2042
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2043
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2043
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2044 2044
 				else $link_active = $link;
2045 2045
 			}
2046 2046
 			else
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 			);
2079 2079
 
2080 2080
 			// Generate buff data
2081
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2081
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2082 2082
 			$output['name'] .= $name_str;
2083 2083
 		}
2084 2084
 		return $output;
@@ -2092,19 +2092,19 @@  discard block
 block discarded – undo
2092 2092
 	 */
2093 2093
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2094 2094
 	{
2095
-		if(!count($menu_srl_list)) return;
2095
+		if (!count($menu_srl_list)) return;
2096 2096
 		// Delete the value of menu_srls
2097
-		$args->menu_srls = implode(',',$menu_srl_list);
2097
+		$args->menu_srls = implode(',', $menu_srl_list);
2098 2098
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2099
-		if(!$output->toBool()) return $output;
2099
+		if (!$output->toBool()) return $output;
2100 2100
 
2101 2101
 		$args->layout_srl = $layout_srl;
2102 2102
 		// Mapping menu_srls, layout_srl
2103
-		for($i=0;$i<count($menu_srl_list);$i++)
2103
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2104 2104
 		{
2105 2105
 			$args->menu_srl = $menu_srl_list[$i];
2106 2106
 			$output = executeQuery('menu.insertMenuLayout', $args);
2107
-			if(!$output->toBool()) return $output;
2107
+			if (!$output->toBool()) return $output;
2108 2108
 		}
2109 2109
 	}
2110 2110
 
@@ -2117,47 +2117,47 @@  discard block
 block discarded – undo
2117 2117
 	{
2118 2118
 		// path setting
2119 2119
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2120
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2120
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2121 2121
 		{
2122 2122
 			FileHandler::makeDir($path);
2123 2123
 		}
2124 2124
 
2125
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2125
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2126 2126
 		{
2127 2127
 			$oMenuModel = getAdminModel('menu');
2128 2128
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2129 2129
 
2130
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2131
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2132
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2130
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2131
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2132
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2133 2133
 		}
2134 2134
 
2135 2135
 		$returnArray = array();
2136 2136
 		$date = date('YmdHis');
2137 2137
 		// normal button
2138
-		if($args->menu_normal_btn)
2138
+		if ($args->menu_normal_btn)
2139 2139
 		{
2140
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2141
-			$ext = $tmp_arr[count($tmp_arr)-1];
2140
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2141
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2142 2142
 
2143 2143
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2144 2144
 
2145
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2145
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2146 2146
 			{
2147
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2147
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2148 2148
 				$returnArray ['normal_btn'] = $filename;
2149 2149
 			}
2150 2150
 		}
2151 2151
 
2152 2152
 		// hover button
2153
-		if($args->menu_hover_btn)
2153
+		if ($args->menu_hover_btn)
2154 2154
 		{
2155
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2156
-			$ext = $tmp_arr[count($tmp_arr)-1];
2155
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2156
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2157 2157
 
2158 2158
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2159 2159
 
2160
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2160
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2161 2161
 			{
2162 2162
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2163 2163
 				$returnArray['hover_btn'] = $filename;
@@ -2165,14 +2165,14 @@  discard block
 block discarded – undo
2165 2165
 		}
2166 2166
 
2167 2167
 		// active button
2168
-		if($args->menu_active_btn)
2168
+		if ($args->menu_active_btn)
2169 2169
 		{
2170
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2171
-			$ext = $tmp_arr[count($tmp_arr)-1];
2170
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2171
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2172 2172
 
2173 2173
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2174 2174
 
2175
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2175
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2176 2176
 			{
2177 2177
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2178 2178
 				$returnArray['active_btn'] = $filename;
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
 			"active_btn"=>"",
2195 2195
 		);
2196 2196
 		//normal_btn
2197
-		if($menuItemInfo->normal_btn)
2197
+		if ($menuItemInfo->normal_btn)
2198 2198
 		{
2199 2199
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2200 2200
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2204,7 +2204,7 @@  discard block
 block discarded – undo
2204 2204
 		}
2205 2205
 
2206 2206
 		//hover_btn
2207
-		if($menuItemInfo->hover_btn)
2207
+		if ($menuItemInfo->hover_btn)
2208 2208
 		{
2209 2209
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2210 2210
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 		}
2215 2215
 
2216 2216
 		//active_btn
2217
-		if($menuItemInfo->active_btn)
2217
+		if ($menuItemInfo->active_btn)
2218 2218
 		{
2219 2219
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2220 2220
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2229,9 +2229,9 @@  discard block
 block discarded – undo
2229 2229
 	{
2230 2230
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2231 2231
 		$tmp_arr = explode('.', $buttonPath);
2232
-		$ext = $tmp_arr[count($tmp_arr)-1];
2232
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2233 2233
 		$date = date("YmdHis");
2234
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2234
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2235 2235
 	}
2236 2236
 
2237 2237
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.