@@ -162,7 +162,7 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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 |  				saveCookie('lang_type', $this->lang_type, false, $_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  | 
                                                    ||
| 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,8 +341,8 @@ discard block  | 
                                                    ||
| 341 | 341 | );  | 
                                                        
| 342 | 342 | }  | 
                                                        
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess);  | 
                                                        |
| 345 | - if($this->db_info->disable_cookie_secure !== 'Y')  | 
                                                        |
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess);  | 
                                                        |
| 345 | + if ($this->db_info->disable_cookie_secure !== 'Y')  | 
                                                        |
| 346 | 346 |  		{ | 
                                                        
| 347 | 347 |  			ini_set('session.cookie_httponly', true); | 
                                                        
| 348 | 348 |  			ini_set('session.cookie_secure', Context::getSslStatus() === 'always'); | 
                                                        
@@ -350,11 +350,11 @@ discard block  | 
                                                    ||
| 350 | 350 | session_start();  | 
                                                        
| 351 | 351 | |
| 352 | 352 | // set authentication information in Context and session  | 
                                                        
| 353 | - if(self::isInstalled())  | 
                                                        |
| 353 | + if (self::isInstalled())  | 
                                                        |
| 354 | 354 |  		{ | 
                                                        
| 355 | - if($this->db_info->disable_csrf_token !== 'Y')  | 
                                                        |
| 355 | + if ($this->db_info->disable_csrf_token !== 'Y')  | 
                                                        |
| 356 | 356 |  			{ | 
                                                        
| 357 | - if(!$_SESSION['csrf_token'])  | 
                                                        |
| 357 | + if (!$_SESSION['csrf_token'])  | 
                                                        |
| 358 | 358 |  				{ | 
                                                        
| 359 | 359 | $_SESSION['csrf_token'] = Password::createSecureSalt(40);  | 
                                                        
| 360 | 360 | }  | 
                                                        
@@ -366,15 +366,15 @@ discard block  | 
                                                    ||
| 366 | 366 |  			$oMemberModel = getModel('member'); | 
                                                        
| 367 | 367 |  			$oMemberController = getController('member'); | 
                                                        
| 368 | 368 | |
| 369 | - if($oMemberController && $oMemberModel)  | 
                                                        |
| 369 | + if ($oMemberController && $oMemberModel)  | 
                                                        |
| 370 | 370 |  			{ | 
                                                        
| 371 | 371 | // if signed in, validate it.  | 
                                                        
| 372 | - if($oMemberModel->isLogged())  | 
                                                        |
| 372 | + if ($oMemberModel->isLogged())  | 
                                                        |
| 373 | 373 |  				{ | 
                                                        
| 374 | 374 | $oMemberController->setSessionInfo();  | 
                                                        
| 375 | 375 | }  | 
                                                        
| 376 | 376 | // check auto sign-in  | 
                                                        
| 377 | - elseif($_COOKIE['xeak'])  | 
                                                        |
| 377 | + elseif ($_COOKIE['xeak'])  | 
                                                        |
| 378 | 378 |  				{ | 
                                                        
| 379 | 379 | $oMemberController->doAutologin();  | 
                                                        
| 380 | 380 | }  | 
                                                        
@@ -386,7 +386,7 @@ discard block  | 
                                                    ||
| 386 | 386 | |
| 387 | 387 | // load common language file  | 
                                                        
| 388 | 388 | $this->lang = &$GLOBALS['lang'];  | 
                                                        
| 389 | - $this->loadLang(_XE_PATH_ . 'common/lang/');  | 
                                                        |
| 389 | + $this->loadLang(_XE_PATH_.'common/lang/');  | 
                                                        |
| 390 | 390 | |
| 391 | 391 | // check if using rewrite module  | 
                                                        
| 392 | 392 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);  | 
                                                        
@@ -394,28 +394,28 @@ discard block  | 
                                                    ||
| 394 | 394 | // set locations for javascript use  | 
                                                        
| 395 | 395 | $url = array();  | 
                                                        
| 396 | 396 | $current_url = self::getRequestUri();  | 
                                                        
| 397 | - if($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 397 | + if ($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 398 | 398 |  		{ | 
                                                        
| 399 | - if($this->get_vars)  | 
                                                        |
| 399 | + if ($this->get_vars)  | 
                                                        |
| 400 | 400 |  			{ | 
                                                        
| 401 | 401 | $url = array();  | 
                                                        
| 402 | - foreach($this->get_vars as $key => $val)  | 
                                                        |
| 402 | + foreach ($this->get_vars as $key => $val)  | 
                                                        |
| 403 | 403 |  				{ | 
                                                        
| 404 | - if(is_array($val) && count($val) > 0)  | 
                                                        |
| 404 | + if (is_array($val) && count($val) > 0)  | 
                                                        |
| 405 | 405 |  					{ | 
                                                        
| 406 | - foreach($val as $k => $v)  | 
                                                        |
| 406 | + foreach ($val as $k => $v)  | 
                                                        |
| 407 | 407 |  						{ | 
                                                        
| 408 | - $url[] = $key . '[' . $k . ']=' . urlencode($v);  | 
                                                        |
| 408 | + $url[] = $key.'['.$k.']='.urlencode($v);  | 
                                                        |
| 409 | 409 | }  | 
                                                        
| 410 | 410 | }  | 
                                                        
| 411 | - elseif($val)  | 
                                                        |
| 411 | + elseif ($val)  | 
                                                        |
| 412 | 412 |  					{ | 
                                                        
| 413 | - $url[] = $key . '=' . urlencode($val);  | 
                                                        |
| 413 | + $url[] = $key.'='.urlencode($val);  | 
                                                        |
| 414 | 414 | }  | 
                                                        
| 415 | 415 | }  | 
                                                        
| 416 | 416 | |
| 417 | 417 | $current_url = self::getRequestUri();  | 
                                                        
| 418 | -				if($url) $current_url .= '?' . join('&', $url); | 
                                                        |
| 418 | +				if ($url) $current_url .= '?'.join('&', $url); | 
                                                        |
| 419 | 419 | }  | 
                                                        
| 420 | 420 | else  | 
                                                        
| 421 | 421 |  			{ | 
                                                        
@@ -430,12 +430,12 @@ discard block  | 
                                                    ||
| 430 | 430 |  		$this->set('current_url', $current_url); | 
                                                        
| 431 | 431 |  		$this->set('request_uri', self::getRequestUri()); | 
                                                        
| 432 | 432 | |
| 433 | - if(strpos($current_url, 'xn--') !== FALSE)  | 
                                                        |
| 433 | + if (strpos($current_url, 'xn--') !== FALSE)  | 
                                                        |
| 434 | 434 |  		{ | 
                                                        
| 435 | 435 |  			$this->set('current_url', self::decodeIdna($current_url)); | 
                                                        
| 436 | 436 | }  | 
                                                        
| 437 | 437 | |
| 438 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE)  | 
                                                        |
| 438 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE)  | 
                                                        |
| 439 | 439 |  		{ | 
                                                        
| 440 | 440 |  			$this->set('request_uri', self::decodeIdna(self::getRequestUri())); | 
                                                        
| 441 | 441 | }  | 
                                                        
@@ -460,7 +460,7 @@ discard block  | 
                                                    ||
| 460 | 460 |  	{ | 
                                                        
| 461 | 461 | $self = self::getInstance();  | 
                                                        
| 462 | 462 | |
| 463 | - if(!$self->isInstalled())  | 
                                                        |
| 463 | + if (!$self->isInstalled())  | 
                                                        |
| 464 | 464 |  		{ | 
                                                        
| 465 | 465 | return;  | 
                                                        
| 466 | 466 | }  | 
                                                        
@@ -470,7 +470,7 @@ discard block  | 
                                                    ||
| 470 | 470 | ob_end_clean();  | 
                                                        
| 471 | 471 | |
| 472 | 472 | // If master_db information does not exist, the config file needs to be updated  | 
                                                        
| 473 | - if(!isset($db_info->master_db))  | 
                                                        |
| 473 | + if (!isset($db_info->master_db))  | 
                                                        |
| 474 | 474 |  		{ | 
                                                        
| 475 | 475 | $db_info->master_db = array();  | 
                                                        
| 476 | 476 | $db_info->master_db["db_type"] = $db_info->db_type;  | 
                                                        
@@ -488,7 +488,7 @@ discard block  | 
                                                    ||
| 488 | 488 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;  | 
                                                        
| 489 | 489 | unset($db_info->db_table_prefix);  | 
                                                        
| 490 | 490 | |
| 491 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)  | 
                                                        |
| 491 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)  | 
                                                        |
| 492 | 492 |  			{ | 
                                                        
| 493 | 493 | $db_info->master_db["db_table_prefix"] .= '_';  | 
                                                        
| 494 | 494 | }  | 
                                                        
@@ -500,42 +500,42 @@ discard block  | 
                                                    ||
| 500 | 500 | $oInstallController->makeConfigFile();  | 
                                                        
| 501 | 501 | }  | 
                                                        
| 502 | 502 | |
| 503 | - if(!$db_info->use_prepared_statements)  | 
                                                        |
| 503 | + if (!$db_info->use_prepared_statements)  | 
                                                        |
| 504 | 504 |  		{ | 
                                                        
| 505 | 505 | $db_info->use_prepared_statements = 'Y';  | 
                                                        
| 506 | 506 | }  | 
                                                        
| 507 | 507 | |
| 508 | - if(!$db_info->time_zone)  | 
                                                        |
| 508 | + if (!$db_info->time_zone)  | 
                                                        |
| 509 | 509 |  			$db_info->time_zone = date('O'); | 
                                                        
| 510 | 510 | $GLOBALS['_time_zone'] = $db_info->time_zone;  | 
                                                        
| 511 | 511 | |
| 512 | - if($db_info->qmail_compatibility != 'Y')  | 
                                                        |
| 512 | + if ($db_info->qmail_compatibility != 'Y')  | 
                                                        |
| 513 | 513 | $db_info->qmail_compatibility = 'N';  | 
                                                        
| 514 | 514 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;  | 
                                                        
| 515 | 515 | |
| 516 | - if(!$db_info->use_db_session)  | 
                                                        |
| 516 | + if (!$db_info->use_db_session)  | 
                                                        |
| 517 | 517 | $db_info->use_db_session = 'N';  | 
                                                        
| 518 | - if(!$db_info->use_ssl)  | 
                                                        |
| 518 | + if (!$db_info->use_ssl)  | 
                                                        |
| 519 | 519 | $db_info->use_ssl = 'none';  | 
                                                        
| 520 | 520 |  		$this->set('_use_ssl', $db_info->use_ssl); | 
                                                        
| 521 | 521 | |
| 522 | 522 |  		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); | 
                                                        
| 523 | 523 |  		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); | 
                                                        
| 524 | 524 | |
| 525 | -		if(!$db_info->sitelock_whitelist) { | 
                                                        |
| 525 | +		if (!$db_info->sitelock_whitelist) { | 
                                                        |
| 526 | 526 | $db_info->sitelock_whitelist = '127.0.0.1';  | 
                                                        
| 527 | 527 | }  | 
                                                        
| 528 | 528 | |
| 529 | -		if(is_string($db_info->sitelock_whitelist)) { | 
                                                        |
| 529 | +		if (is_string($db_info->sitelock_whitelist)) { | 
                                                        |
| 530 | 530 |  			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); | 
                                                        
| 531 | 531 | }  | 
                                                        
| 532 | 532 | |
| 533 | - if(!$db_info->disable_cookie_secure)  | 
                                                        |
| 533 | + if (!$db_info->disable_cookie_secure)  | 
                                                        |
| 534 | 534 |  		{ | 
                                                        
| 535 | 535 | $db_info->disable_cookie_secure = 'Y';  | 
                                                        
| 536 | 536 | }  | 
                                                        
| 537 | 537 | |
| 538 | - if(!$db_info->disable_csrf_token)  | 
                                                        |
| 538 | + if (!$db_info->disable_csrf_token)  | 
                                                        |
| 539 | 539 |  		{ | 
                                                        
| 540 | 540 | $db_info->disable_csrf_token = 'Y';  | 
                                                        
| 541 | 541 | }  | 
                                                        
@@ -607,10 +607,10 @@ discard block  | 
                                                    ||
| 607 | 607 | function loadLangSupported()  | 
                                                        
| 608 | 608 |  	{ | 
                                                        
| 609 | 609 | static $lang_supported = null;  | 
                                                        
| 610 | - if(!$lang_supported)  | 
                                                        |
| 610 | + if (!$lang_supported)  | 
                                                        |
| 611 | 611 |  		{ | 
                                                        
| 612 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info');  | 
                                                        |
| 613 | - foreach($langs as $val)  | 
                                                        |
| 612 | + $langs = file(_XE_PATH_.'common/lang/lang.info');  | 
                                                        |
| 613 | + foreach ($langs as $val)  | 
                                                        |
| 614 | 614 |  			{ | 
                                                        
| 615 | 615 |  				list($lang_prefix, $lang_text) = explode(',', $val); | 
                                                        
| 616 | 616 | $lang_text = trim($lang_text);  | 
                                                        
@@ -628,17 +628,17 @@ discard block  | 
                                                    ||
| 628 | 628 | function loadLangSelected()  | 
                                                        
| 629 | 629 |  	{ | 
                                                        
| 630 | 630 | static $lang_selected = null;  | 
                                                        
| 631 | - if(!$lang_selected)  | 
                                                        |
| 631 | + if (!$lang_selected)  | 
                                                        |
| 632 | 632 |  		{ | 
                                                        
| 633 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';  | 
                                                        |
| 634 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';  | 
                                                        |
| 635 | - if(!FileHandler::hasContent($selected_lang_file))  | 
                                                        |
| 633 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info';  | 
                                                        |
| 634 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';  | 
                                                        |
| 635 | + if (!FileHandler::hasContent($selected_lang_file))  | 
                                                        |
| 636 | 636 |  			{ | 
                                                        
| 637 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';  | 
                                                        |
| 637 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';  | 
                                                        |
| 638 | 638 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);  | 
                                                        
| 639 | 639 | }  | 
                                                        
| 640 | 640 | |
| 641 | - if(!FileHandler::hasContent($selected_lang_file))  | 
                                                        |
| 641 | + if (!FileHandler::hasContent($selected_lang_file))  | 
                                                        |
| 642 | 642 |  			{ | 
                                                        
| 643 | 643 | $buff = FileHandler::readFile($orig_lang_file);  | 
                                                        
| 644 | 644 | FileHandler::writeFile($selected_lang_file, $buff);  | 
                                                        
@@ -647,7 +647,7 @@ discard block  | 
                                                    ||
| 647 | 647 | else  | 
                                                        
| 648 | 648 |  			{ | 
                                                        
| 649 | 649 | $langs = file($selected_lang_file);  | 
                                                        
| 650 | - foreach($langs as $val)  | 
                                                        |
| 650 | + foreach ($langs as $val)  | 
                                                        |
| 651 | 651 |  				{ | 
                                                        
| 652 | 652 |  					list($lang_prefix, $lang_text) = explode(',', $val); | 
                                                        
| 653 | 653 | $lang_text = trim($lang_text);  | 
                                                        
@@ -666,56 +666,56 @@ discard block  | 
                                                    ||
| 666 | 666 | function checkSSO()  | 
                                                        
| 667 | 667 |  	{ | 
                                                        
| 668 | 668 | // pass if it's not GET request or XE is not yet installed  | 
                                                        
| 669 | - if($this->db_info->use_sso != 'Y' || isCrawler())  | 
                                                        |
| 669 | + if ($this->db_info->use_sso != 'Y' || isCrawler())  | 
                                                        |
| 670 | 670 |  		{ | 
                                                        
| 671 | 671 | return TRUE;  | 
                                                        
| 672 | 672 | }  | 
                                                        
| 673 | 673 |  		$checkActList = array('rss' => 1, 'atom' => 1); | 
                                                        
| 674 | -		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) | 
                                                        |
| 674 | +		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) | 
                                                        |
| 675 | 675 |  		{ | 
                                                        
| 676 | 676 | return TRUE;  | 
                                                        
| 677 | 677 | }  | 
                                                        
| 678 | 678 | |
| 679 | 679 | // pass if default URL is not set  | 
                                                        
| 680 | 680 | $default_url = trim($this->db_info->default_url);  | 
                                                        
| 681 | - if(!$default_url)  | 
                                                        |
| 681 | + if (!$default_url)  | 
                                                        |
| 682 | 682 |  		{ | 
                                                        
| 683 | 683 | return TRUE;  | 
                                                        
| 684 | 684 | }  | 
                                                        
| 685 | 685 | |
| 686 | - if(substr_compare($default_url, '/', -1) !== 0)  | 
                                                        |
| 686 | + if (substr_compare($default_url, '/', -1) !== 0)  | 
                                                        |
| 687 | 687 |  		{ | 
                                                        
| 688 | 688 | $default_url .= '/';  | 
                                                        
| 689 | 689 | }  | 
                                                        
| 690 | 690 | |
| 691 | 691 | // for sites recieving SSO valdiation  | 
                                                        
| 692 | - if($default_url == self::getRequestUri())  | 
                                                        |
| 692 | + if ($default_url == self::getRequestUri())  | 
                                                        |
| 693 | 693 |  		{ | 
                                                        
| 694 | -			if(self::get('url')) | 
                                                        |
| 694 | +			if (self::get('url')) | 
                                                        |
| 695 | 695 |  			{ | 
                                                        
| 696 | 696 |  				$url = base64_decode(self::get('url')); | 
                                                        
| 697 | 697 | $url_info = parse_url($url);  | 
                                                        
| 698 | -				if(!Password::checkSignature($url, self::get('sig'))) | 
                                                        |
| 698 | +				if (!Password::checkSignature($url, self::get('sig'))) | 
                                                        |
| 699 | 699 |  				{ | 
                                                        
| 700 | 700 |  					echo self::get('lang')->msg_invalid_request; | 
                                                        
| 701 | 701 | return false;  | 
                                                        
| 702 | 702 | }  | 
                                                        
| 703 | 703 | |
| 704 | 704 |  				$oModuleModel = getModel('module'); | 
                                                        
| 705 | - $domain = $url_info['host'] . $url_info['path'];  | 
                                                        |
| 706 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);  | 
                                                        |
| 705 | + $domain = $url_info['host'].$url_info['path'];  | 
                                                        |
| 706 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);  | 
                                                        |
| 707 | 707 | $site_info = $oModuleModel->getSiteInfoByDomain($domain);  | 
                                                        
| 708 | 708 | |
| 709 | - if($site_info->site_srl)  | 
                                                        |
| 709 | + if ($site_info->site_srl)  | 
                                                        |
| 710 | 710 |  				{ | 
                                                        
| 711 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));  | 
                                                        |
| 712 | -				$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']); | 
                                                        |
| 711 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));  | 
                                                        |
| 712 | +				$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']); | 
                                                        |
| 713 | 713 | }  | 
                                                        
| 714 | 714 | else  | 
                                                        
| 715 | 715 |  				{ | 
                                                        
| 716 | 716 | $redirect_url = $url;  | 
                                                        
| 717 | 717 | }  | 
                                                        
| 718 | -				header('location:' . $redirect_url); | 
                                                        |
| 718 | +				header('location:'.$redirect_url); | 
                                                        |
| 719 | 719 | |
| 720 | 720 | return FALSE;  | 
                                                        
| 721 | 721 | }  | 
                                                        
@@ -724,9 +724,9 @@ discard block  | 
                                                    ||
| 724 | 724 | else  | 
                                                        
| 725 | 725 |  		{ | 
                                                        
| 726 | 726 | // result handling : set session_name()  | 
                                                        
| 727 | -			if($session_name = self::get('SSOID')) | 
                                                        |
| 727 | +			if ($session_name = self::get('SSOID')) | 
                                                        |
| 728 | 728 |  			{ | 
                                                        
| 729 | -				if(!Password::checkSignature($session_name, self::get('sig'))) | 
                                                        |
| 729 | +				if (!Password::checkSignature($session_name, self::get('sig'))) | 
                                                        |
| 730 | 730 |  				{ | 
                                                        
| 731 | 731 |  					echo self::get('lang')->msg_invalid_request; | 
                                                        
| 732 | 732 | return false;  | 
                                                        
@@ -735,17 +735,17 @@ discard block  | 
                                                    ||
| 735 | 735 | saveCookie(session_name(), $session_name, true);  | 
                                                        
| 736 | 736 | |
| 737 | 737 |  				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); | 
                                                        
| 738 | -				header('location:' . $url); | 
                                                        |
| 738 | +				header('location:'.$url); | 
                                                        |
| 739 | 739 | return FALSE;  | 
                                                        
| 740 | 740 | // send SSO request  | 
                                                        
| 741 | 741 | }  | 
                                                        
| 742 | -			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | 
                                                        |
| 742 | +			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | 
                                                        |
| 743 | 743 |  			{ | 
                                                        
| 744 | 744 |  				saveCookie('sso', md5(self::getRequestUri()), true); | 
                                                        
| 745 | 745 | $origin_url = self::getRequestUrl();  | 
                                                        
| 746 | 746 | $origin_sig = Password::createSignature($origin_url);  | 
                                                        
| 747 | 747 |  				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); | 
                                                        
| 748 | -				header('location:' . $url); | 
                                                        |
| 748 | +				header('location:'.$url); | 
                                                        |
| 749 | 749 | return FALSE;  | 
                                                        
| 750 | 750 | }  | 
                                                        
| 751 | 751 | }  | 
                                                        
@@ -772,7 +772,7 @@ discard block  | 
                                                    ||
| 772 | 772 |  	{ | 
                                                        
| 773 | 773 | $self = self::getInstance();  | 
                                                        
| 774 | 774 | |
| 775 | - if(!$self->isFTPRegisted())  | 
                                                        |
| 775 | + if (!$self->isFTPRegisted())  | 
                                                        |
| 776 | 776 |  		{ | 
                                                        
| 777 | 777 | return null;  | 
                                                        
| 778 | 778 | }  | 
                                                        
@@ -790,15 +790,15 @@ discard block  | 
                                                    ||
| 790 | 790 | */  | 
                                                        
| 791 | 791 | function addBrowserTitle($site_title)  | 
                                                        
| 792 | 792 |  	{ | 
                                                        
| 793 | - if(!$site_title)  | 
                                                        |
| 793 | + if (!$site_title)  | 
                                                        |
| 794 | 794 |  		{ | 
                                                        
| 795 | 795 | return;  | 
                                                        
| 796 | 796 | }  | 
                                                        
| 797 | 797 | $self = self::getInstance();  | 
                                                        
| 798 | 798 | |
| 799 | - if($self->site_title)  | 
                                                        |
| 799 | + if ($self->site_title)  | 
                                                        |
| 800 | 800 |  		{ | 
                                                        
| 801 | - $self->site_title .= ' - ' . $site_title;  | 
                                                        |
| 801 | + $self->site_title .= ' - '.$site_title;  | 
                                                        |
| 802 | 802 | }  | 
                                                        
| 803 | 803 | else  | 
                                                        
| 804 | 804 |  		{ | 
                                                        
@@ -814,7 +814,7 @@ discard block  | 
                                                    ||
| 814 | 814 | */  | 
                                                        
| 815 | 815 | function setBrowserTitle($site_title)  | 
                                                        
| 816 | 816 |  	{ | 
                                                        
| 817 | - if(!$site_title)  | 
                                                        |
| 817 | + if (!$site_title)  | 
                                                        |
| 818 | 818 |  		{ | 
                                                        
| 819 | 819 | return;  | 
                                                        
| 820 | 820 | }  | 
                                                        
@@ -846,7 +846,7 @@ discard block  | 
                                                    ||
| 846 | 846 |  		$oModuleModel = getModel('module'); | 
                                                        
| 847 | 847 |  		$moduleConfig = $oModuleModel->getModuleConfig('module'); | 
                                                        
| 848 | 848 | |
| 849 | - if(isset($moduleConfig->siteTitle))  | 
                                                        |
| 849 | + if (isset($moduleConfig->siteTitle))  | 
                                                        |
| 850 | 850 |  		{ | 
                                                        
| 851 | 851 | return $moduleConfig->siteTitle;  | 
                                                        
| 852 | 852 | }  | 
                                                        
@@ -873,30 +873,30 @@ discard block  | 
                                                    ||
| 873 | 873 | global $lang;  | 
                                                        
| 874 | 874 | |
| 875 | 875 | $self = self::getInstance();  | 
                                                        
| 876 | - if(!$self->lang_type)  | 
                                                        |
| 876 | + if (!$self->lang_type)  | 
                                                        |
| 877 | 877 |  		{ | 
                                                        
| 878 | 878 | return;  | 
                                                        
| 879 | 879 | }  | 
                                                        
| 880 | - if(!is_object($lang))  | 
                                                        |
| 880 | + if (!is_object($lang))  | 
                                                        |
| 881 | 881 |  		{ | 
                                                        
| 882 | 882 | $lang = new stdClass;  | 
                                                        
| 883 | 883 | }  | 
                                                        
| 884 | 884 | |
| 885 | - if(!($filename = $self->_loadXmlLang($path)))  | 
                                                        |
| 885 | + if (!($filename = $self->_loadXmlLang($path)))  | 
                                                        |
| 886 | 886 |  		{ | 
                                                        
| 887 | 887 | $filename = $self->_loadPhpLang($path);  | 
                                                        
| 888 | 888 | }  | 
                                                        
| 889 | 889 | |
| 890 | - if(!is_array($self->loaded_lang_files))  | 
                                                        |
| 890 | + if (!is_array($self->loaded_lang_files))  | 
                                                        |
| 891 | 891 |  		{ | 
                                                        
| 892 | 892 | $self->loaded_lang_files = array();  | 
                                                        
| 893 | 893 | }  | 
                                                        
| 894 | - if(in_array($filename, $self->loaded_lang_files))  | 
                                                        |
| 894 | + if (in_array($filename, $self->loaded_lang_files))  | 
                                                        |
| 895 | 895 |  		{ | 
                                                        
| 896 | 896 | return;  | 
                                                        
| 897 | 897 | }  | 
                                                        
| 898 | 898 | |
| 899 | - if($filename && is_readable($filename))  | 
                                                        |
| 899 | + if ($filename && is_readable($filename))  | 
                                                        |
| 900 | 900 |  		{ | 
                                                        
| 901 | 901 | $self->loaded_lang_files[] = $filename;  | 
                                                        
| 902 | 902 | include($filename);  | 
                                                        
@@ -917,24 +917,24 @@ discard block  | 
                                                    ||
| 917 | 917 |  	{ | 
                                                        
| 918 | 918 | global $lang;  | 
                                                        
| 919 | 919 | |
| 920 | - if(!$path) return;  | 
                                                        |
| 920 | + if (!$path) return;  | 
                                                        |
| 921 | 921 | |
| 922 | - $_path = 'eval://' . $path;  | 
                                                        |
| 922 | + $_path = 'eval://'.$path;  | 
                                                        |
| 923 | 923 | |
| 924 | - if(in_array($_path, $this->loaded_lang_files))  | 
                                                        |
| 924 | + if (in_array($_path, $this->loaded_lang_files))  | 
                                                        |
| 925 | 925 |  		{ | 
                                                        
| 926 | 926 | return;  | 
                                                        
| 927 | 927 | }  | 
                                                        
| 928 | 928 | |
| 929 | - if(substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 929 | + if (substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 930 | 930 |  		{ | 
                                                        
| 931 | 931 | $path .= '/';  | 
                                                        
| 932 | 932 | }  | 
                                                        
| 933 | 933 | |
| 934 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);  | 
                                                        |
| 934 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);  | 
                                                        |
| 935 | 935 | $content = $oXmlLangParser->getCompileContent();  | 
                                                        
| 936 | 936 | |
| 937 | - if($content)  | 
                                                        |
| 937 | + if ($content)  | 
                                                        |
| 938 | 938 |  		{ | 
                                                        
| 939 | 939 | $this->loaded_lang_files[] = $_path;  | 
                                                        
| 940 | 940 | eval($content);  | 
                                                        
@@ -949,9 +949,9 @@ discard block  | 
                                                    ||
| 949 | 949 | */  | 
                                                        
| 950 | 950 | function _loadXmlLang($path)  | 
                                                        
| 951 | 951 |  	{ | 
                                                        
| 952 | - if(!$path) return;  | 
                                                        |
| 952 | + if (!$path) return;  | 
                                                        |
| 953 | 953 | |
| 954 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);  | 
                                                        |
| 954 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);  | 
                                                        |
| 955 | 955 | return $oXmlLangParser->compile();  | 
                                                        
| 956 | 956 | }  | 
                                                        
| 957 | 957 | |
@@ -963,22 +963,22 @@ discard block  | 
                                                    ||
| 963 | 963 | */  | 
                                                        
| 964 | 964 | function _loadPhpLang($path)  | 
                                                        
| 965 | 965 |  	{ | 
                                                        
| 966 | - if(!$path) return;  | 
                                                        |
| 966 | + if (!$path) return;  | 
                                                        |
| 967 | 967 | |
| 968 | - if(substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 968 | + if (substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 969 | 969 |  		{ | 
                                                        
| 970 | 970 | $path .= '/';  | 
                                                        
| 971 | 971 | }  | 
                                                        
| 972 | - $path_tpl = $path . '%s.lang.php';  | 
                                                        |
| 972 | + $path_tpl = $path.'%s.lang.php';  | 
                                                        |
| 973 | 973 | $file = sprintf($path_tpl, $this->lang_type);  | 
                                                        
| 974 | 974 | |
| 975 | 975 |  		$langs = array('ko', 'en'); // this will be configurable. | 
                                                        
| 976 | - while(!is_readable($file) && $langs[0])  | 
                                                        |
| 976 | + while (!is_readable($file) && $langs[0])  | 
                                                        |
| 977 | 977 |  		{ | 
                                                        
| 978 | 978 | $file = sprintf($path_tpl, array_shift($langs));  | 
                                                        
| 979 | 979 | }  | 
                                                        
| 980 | 980 | |
| 981 | - if(!is_readable($file))  | 
                                                        |
| 981 | + if (!is_readable($file))  | 
                                                        |
| 982 | 982 |  		{ | 
                                                        
| 983 | 983 | return FALSE;  | 
                                                        
| 984 | 984 | }  | 
                                                        
@@ -1020,11 +1020,11 @@ discard block  | 
                                                    ||
| 1020 | 1020 | */  | 
                                                        
| 1021 | 1021 | function getLang($code)  | 
                                                        
| 1022 | 1022 |  	{ | 
                                                        
| 1023 | - if(!$code)  | 
                                                        |
| 1023 | + if (!$code)  | 
                                                        |
| 1024 | 1024 |  		{ | 
                                                        
| 1025 | 1025 | return;  | 
                                                        
| 1026 | 1026 | }  | 
                                                        
| 1027 | -		if($GLOBALS['lang']->{$code}) | 
                                                        |
| 1027 | +		if ($GLOBALS['lang']->{$code}) | 
                                                        |
| 1028 | 1028 |  		{ | 
                                                        
| 1029 | 1029 |  			return $GLOBALS['lang']->{$code}; | 
                                                        
| 1030 | 1030 | }  | 
                                                        
@@ -1040,7 +1040,7 @@ discard block  | 
                                                    ||
| 1040 | 1040 | */  | 
                                                        
| 1041 | 1041 | function setLang($code, $val)  | 
                                                        
| 1042 | 1042 |  	{ | 
                                                        
| 1043 | - if(!isset($GLOBALS['lang']))  | 
                                                        |
| 1043 | + if (!isset($GLOBALS['lang']))  | 
                                                        |
| 1044 | 1044 |  		{ | 
                                                        
| 1045 | 1045 | $GLOBALS['lang'] = new stdClass();  | 
                                                        
| 1046 | 1046 | }  | 
                                                        
@@ -1065,17 +1065,17 @@ discard block  | 
                                                    ||
| 1065 | 1065 | |
| 1066 | 1066 | $obj = clone $source_obj;  | 
                                                        
| 1067 | 1067 | |
| 1068 | - foreach($charset_list as $charset)  | 
                                                        |
| 1068 | + foreach ($charset_list as $charset)  | 
                                                        |
| 1069 | 1069 |  		{ | 
                                                        
| 1070 | - array_walk($obj,'Context::checkConvertFlag',$charset);  | 
                                                        |
| 1070 | + array_walk($obj, 'Context::checkConvertFlag', $charset);  | 
                                                        |
| 1071 | 1071 | $flag = self::checkConvertFlag($flag = TRUE);  | 
                                                        
| 1072 | - if($flag)  | 
                                                        |
| 1072 | + if ($flag)  | 
                                                        |
| 1073 | 1073 |  			{ | 
                                                        
| 1074 | - if($charset == 'UTF-8')  | 
                                                        |
| 1074 | + if ($charset == 'UTF-8')  | 
                                                        |
| 1075 | 1075 |  				{ | 
                                                        
| 1076 | 1076 | return $obj;  | 
                                                        
| 1077 | 1077 | }  | 
                                                        
| 1078 | - array_walk($obj,'Context::doConvertEncoding',$charset);  | 
                                                        |
| 1078 | + array_walk($obj, 'Context::doConvertEncoding', $charset);  | 
                                                        |
| 1079 | 1079 | return $obj;  | 
                                                        
| 1080 | 1080 | }  | 
                                                        
| 1081 | 1081 | }  | 
                                                        
@@ -1094,11 +1094,11 @@ discard block  | 
                                                    ||
| 1094 | 1094 | function checkConvertFlag(&$val, $key = null, $charset = null)  | 
                                                        
| 1095 | 1095 |  	{ | 
                                                        
| 1096 | 1096 | static $flag = TRUE;  | 
                                                        
| 1097 | - if($charset)  | 
                                                        |
| 1097 | + if ($charset)  | 
                                                        |
| 1098 | 1098 |  		{ | 
                                                        
| 1099 | - if(is_array($val))  | 
                                                        |
| 1100 | - array_walk($val,'Context::checkConvertFlag',$charset);  | 
                                                        |
| 1101 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;  | 
                                                        |
| 1099 | + if (is_array($val))  | 
                                                        |
| 1100 | + array_walk($val, 'Context::checkConvertFlag', $charset);  | 
                                                        |
| 1101 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;  | 
                                                        |
| 1102 | 1102 | else $flag = FALSE;  | 
                                                        
| 1103 | 1103 | }  | 
                                                        
| 1104 | 1104 | else  | 
                                                        
@@ -1122,9 +1122,9 @@ discard block  | 
                                                    ||
| 1122 | 1122 |  	{ | 
                                                        
| 1123 | 1123 | if (is_array($val))  | 
                                                        
| 1124 | 1124 |  		{ | 
                                                        
| 1125 | - array_walk($val,'Context::doConvertEncoding',$charset);  | 
                                                        |
| 1125 | + array_walk($val, 'Context::doConvertEncoding', $charset);  | 
                                                        |
| 1126 | 1126 | }  | 
                                                        
| 1127 | - else $val = iconv($charset,'UTF-8',$val);  | 
                                                        |
| 1127 | + else $val = iconv($charset, 'UTF-8', $val);  | 
                                                        |
| 1128 | 1128 | }  | 
                                                        
| 1129 | 1129 | |
| 1130 | 1130 | /**  | 
                                                        
@@ -1135,7 +1135,7 @@ discard block  | 
                                                    ||
| 1135 | 1135 | */  | 
                                                        
| 1136 | 1136 | function convertEncodingStr($str)  | 
                                                        
| 1137 | 1137 |  	{ | 
                                                        
| 1138 | - if(!$str) return null;  | 
                                                        |
| 1138 | + if (!$str) return null;  | 
                                                        |
| 1139 | 1139 | $obj = new stdClass();  | 
                                                        
| 1140 | 1140 | $obj->str = $str;  | 
                                                        
| 1141 | 1141 | $obj = self::convertEncoding($obj);  | 
                                                        
@@ -1144,9 +1144,9 @@ discard block  | 
                                                    ||
| 1144 | 1144 | |
| 1145 | 1145 | function decodeIdna($domain)  | 
                                                        
| 1146 | 1146 |  	{ | 
                                                        
| 1147 | - if(strpos($domain, 'xn--') !== FALSE)  | 
                                                        |
| 1147 | + if (strpos($domain, 'xn--') !== FALSE)  | 
                                                        |
| 1148 | 1148 |  		{ | 
                                                        
| 1149 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1149 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1150 | 1150 |  			$IDN = new idna_convert(array('idn_version' => 2008)); | 
                                                        
| 1151 | 1151 | $domain = $IDN->decode($domain);  | 
                                                        
| 1152 | 1152 | }  | 
                                                        
@@ -1177,7 +1177,7 @@ discard block  | 
                                                    ||
| 1177 | 1177 |  	{ | 
                                                        
| 1178 | 1178 | $self = self::getInstance();  | 
                                                        
| 1179 | 1179 | |
| 1180 | - if($self->response_method)  | 
                                                        |
| 1180 | + if ($self->response_method)  | 
                                                        |
| 1181 | 1181 |  		{ | 
                                                        
| 1182 | 1182 | return $self->response_method;  | 
                                                        
| 1183 | 1183 | }  | 
                                                        
@@ -1217,7 +1217,7 @@ discard block  | 
                                                    ||
| 1217 | 1217 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']);  | 
                                                        
| 1218 | 1218 | |
| 1219 | 1219 |  		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; | 
                                                        
| 1220 | - if(preg_match($pattern, $_SERVER['HTTP_HOST']))  | 
                                                        |
| 1220 | + if (preg_match($pattern, $_SERVER['HTTP_HOST']))  | 
                                                        |
| 1221 | 1221 |  		{ | 
                                                        
| 1222 | 1222 | $this->isSuccessInit = FALSE;  | 
                                                        
| 1223 | 1223 | }  | 
                                                        
@@ -1230,30 +1230,30 @@ discard block  | 
                                                    ||
| 1230 | 1230 | */  | 
                                                        
| 1231 | 1231 | function _setRequestArgument()  | 
                                                        
| 1232 | 1232 |  	{ | 
                                                        
| 1233 | - if(!count($_REQUEST))  | 
                                                        |
| 1233 | + if (!count($_REQUEST))  | 
                                                        |
| 1234 | 1234 |  		{ | 
                                                        
| 1235 | 1235 | return;  | 
                                                        
| 1236 | 1236 | }  | 
                                                        
| 1237 | 1237 | |
| 1238 | 1238 | $requestMethod = $this->getRequestMethod();  | 
                                                        
| 1239 | - foreach($_REQUEST as $key => $val)  | 
                                                        |
| 1239 | + foreach ($_REQUEST as $key => $val)  | 
                                                        |
| 1240 | 1240 |  		{ | 
                                                        
| 1241 | - if($val === '' || self::get($key))  | 
                                                        |
| 1241 | + if ($val === '' || self::get($key))  | 
                                                        |
| 1242 | 1242 |  			{ | 
                                                        
| 1243 | 1243 | continue;  | 
                                                        
| 1244 | 1244 | }  | 
                                                        
| 1245 | 1245 | $key = htmlentities($key);  | 
                                                        
| 1246 | 1246 | $val = $this->_filterRequestVar($key, $val);  | 
                                                        
| 1247 | 1247 | |
| 1248 | - if($requestMethod == 'GET' && isset($_GET[$key]))  | 
                                                        |
| 1248 | + if ($requestMethod == 'GET' && isset($_GET[$key]))  | 
                                                        |
| 1249 | 1249 |  			{ | 
                                                        
| 1250 | 1250 | $set_to_vars = TRUE;  | 
                                                        
| 1251 | 1251 | }  | 
                                                        
| 1252 | - elseif($requestMethod == 'POST' && isset($_POST[$key]))  | 
                                                        |
| 1252 | + elseif ($requestMethod == 'POST' && isset($_POST[$key]))  | 
                                                        |
| 1253 | 1253 |  			{ | 
                                                        
| 1254 | 1254 | $set_to_vars = TRUE;  | 
                                                        
| 1255 | 1255 | }  | 
                                                        
| 1256 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))  | 
                                                        |
| 1256 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))  | 
                                                        |
| 1257 | 1257 |  			{ | 
                                                        
| 1258 | 1258 | $set_to_vars = TRUE;  | 
                                                        
| 1259 | 1259 | }  | 
                                                        
@@ -1262,7 +1262,7 @@ discard block  | 
                                                    ||
| 1262 | 1262 | $set_to_vars = FALSE;  | 
                                                        
| 1263 | 1263 | }  | 
                                                        
| 1264 | 1264 | |
| 1265 | - if($set_to_vars)  | 
                                                        |
| 1265 | + if ($set_to_vars)  | 
                                                        |
| 1266 | 1266 |  			{ | 
                                                        
| 1267 | 1267 | $this->_recursiveCheckVar($val);  | 
                                                        
| 1268 | 1268 | }  | 
                                                        
@@ -1273,20 +1273,20 @@ discard block  | 
                                                    ||
| 1273 | 1273 | |
| 1274 | 1274 | function _recursiveCheckVar($val)  | 
                                                        
| 1275 | 1275 |  	{ | 
                                                        
| 1276 | - if(is_string($val))  | 
                                                        |
| 1276 | + if (is_string($val))  | 
                                                        |
| 1277 | 1277 |  		{ | 
                                                        
| 1278 | - foreach($this->patterns as $pattern)  | 
                                                        |
| 1278 | + foreach ($this->patterns as $pattern)  | 
                                                        |
| 1279 | 1279 |  			{ | 
                                                        
| 1280 | - if(preg_match($pattern, $val))  | 
                                                        |
| 1280 | + if (preg_match($pattern, $val))  | 
                                                        |
| 1281 | 1281 |  				{ | 
                                                        
| 1282 | 1282 | $this->isSuccessInit = FALSE;  | 
                                                        
| 1283 | 1283 | return;  | 
                                                        
| 1284 | 1284 | }  | 
                                                        
| 1285 | 1285 | }  | 
                                                        
| 1286 | 1286 | }  | 
                                                        
| 1287 | - else if(is_array($val))  | 
                                                        |
| 1287 | + else if (is_array($val))  | 
                                                        |
| 1288 | 1288 |  		{ | 
                                                        
| 1289 | - foreach($val as $val2)  | 
                                                        |
| 1289 | + foreach ($val as $val2)  | 
                                                        |
| 1290 | 1290 |  			{ | 
                                                        
| 1291 | 1291 | $this->_recursiveCheckVar($val2);  | 
                                                        
| 1292 | 1292 | }  | 
                                                        
@@ -1300,7 +1300,7 @@ discard block  | 
                                                    ||
| 1300 | 1300 | */  | 
                                                        
| 1301 | 1301 | function _setJSONRequestArgument()  | 
                                                        
| 1302 | 1302 |  	{ | 
                                                        
| 1303 | - if($this->getRequestMethod() != 'JSON')  | 
                                                        |
| 1303 | + if ($this->getRequestMethod() != 'JSON')  | 
                                                        |
| 1304 | 1304 |  		{ | 
                                                        
| 1305 | 1305 | return;  | 
                                                        
| 1306 | 1306 | }  | 
                                                        
@@ -1308,7 +1308,7 @@ discard block  | 
                                                    ||
| 1308 | 1308 | $params = array();  | 
                                                        
| 1309 | 1309 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);  | 
                                                        
| 1310 | 1310 | |
| 1311 | - foreach($params as $key => $val)  | 
                                                        |
| 1311 | + foreach ($params as $key => $val)  | 
                                                        |
| 1312 | 1312 |  		{ | 
                                                        
| 1313 | 1313 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);  | 
                                                        
| 1314 | 1314 | }  | 
                                                        
@@ -1321,13 +1321,13 @@ discard block  | 
                                                    ||
| 1321 | 1321 | */  | 
                                                        
| 1322 | 1322 | function _setXmlRpcArgument()  | 
                                                        
| 1323 | 1323 |  	{ | 
                                                        
| 1324 | - if($this->getRequestMethod() != 'XMLRPC')  | 
                                                        |
| 1324 | + if ($this->getRequestMethod() != 'XMLRPC')  | 
                                                        |
| 1325 | 1325 |  		{ | 
                                                        
| 1326 | 1326 | return;  | 
                                                        
| 1327 | 1327 | }  | 
                                                        
| 1328 | 1328 | |
| 1329 | 1329 | $xml = $GLOBALS['HTTP_RAW_POST_DATA'];  | 
                                                        
| 1330 | - if(Security::detectingXEE($xml))  | 
                                                        |
| 1330 | + if (Security::detectingXEE($xml))  | 
                                                        |
| 1331 | 1331 |  		{ | 
                                                        
| 1332 | 1332 |  			header("HTTP/1.0 400 Bad Request"); | 
                                                        
| 1333 | 1333 | exit;  | 
                                                        
@@ -1339,12 +1339,12 @@ discard block  | 
                                                    ||
| 1339 | 1339 | $params = $xml_obj->methodcall->params;  | 
                                                        
| 1340 | 1340 | unset($params->node_name, $params->attrs, $params->body);  | 
                                                        
| 1341 | 1341 | |
| 1342 | - if(!count(get_object_vars($params)))  | 
                                                        |
| 1342 | + if (!count(get_object_vars($params)))  | 
                                                        |
| 1343 | 1343 |  		{ | 
                                                        
| 1344 | 1344 | return;  | 
                                                        
| 1345 | 1345 | }  | 
                                                        
| 1346 | 1346 | |
| 1347 | - foreach($params as $key => $val)  | 
                                                        |
| 1347 | + foreach ($params as $key => $val)  | 
                                                        |
| 1348 | 1348 |  		{ | 
                                                        
| 1349 | 1349 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE);  | 
                                                        
| 1350 | 1350 | }  | 
                                                        
@@ -1359,10 +1359,10 @@ discard block  | 
                                                    ||
| 1359 | 1359 | */  | 
                                                        
| 1360 | 1360 | function _filterXmlVars($key, $val)  | 
                                                        
| 1361 | 1361 |  	{ | 
                                                        
| 1362 | - if(is_array($val))  | 
                                                        |
| 1362 | + if (is_array($val))  | 
                                                        |
| 1363 | 1363 |  		{ | 
                                                        
| 1364 | 1364 | $stack = array();  | 
                                                        
| 1365 | - foreach($val as $k => $v)  | 
                                                        |
| 1365 | + foreach ($val as $k => $v)  | 
                                                        |
| 1366 | 1366 |  			{ | 
                                                        
| 1367 | 1367 | $stack[$k] = $this->_filterXmlVars($k, $v);  | 
                                                        
| 1368 | 1368 | }  | 
                                                        
@@ -1372,20 +1372,20 @@ discard block  | 
                                                    ||
| 1372 | 1372 | |
| 1373 | 1373 | $body = $val->body;  | 
                                                        
| 1374 | 1374 | unset($val->node_name, $val->attrs, $val->body);  | 
                                                        
| 1375 | - if(!count(get_object_vars($val)))  | 
                                                        |
| 1375 | + if (!count(get_object_vars($val)))  | 
                                                        |
| 1376 | 1376 |  		{ | 
                                                        
| 1377 | 1377 | return $this->_filterRequestVar($key, $body, 0);  | 
                                                        
| 1378 | 1378 | }  | 
                                                        
| 1379 | 1379 | |
| 1380 | 1380 | $stack = new stdClass();  | 
                                                        
| 1381 | - foreach($val as $k => $v)  | 
                                                        |
| 1381 | + foreach ($val as $k => $v)  | 
                                                        |
| 1382 | 1382 |  		{ | 
                                                        
| 1383 | 1383 | $output = $this->_filterXmlVars($k, $v);  | 
                                                        
| 1384 | - if(is_object($v) && $v->attrs->type == 'array')  | 
                                                        |
| 1384 | + if (is_object($v) && $v->attrs->type == 'array')  | 
                                                        |
| 1385 | 1385 |  			{ | 
                                                        
| 1386 | 1386 | $output = array($output);  | 
                                                        
| 1387 | 1387 | }  | 
                                                        
| 1388 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))  | 
                                                        |
| 1388 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))  | 
                                                        |
| 1389 | 1389 |  			{ | 
                                                        
| 1390 | 1390 | return $output;  | 
                                                        
| 1391 | 1391 | }  | 
                                                        
@@ -1393,7 +1393,7 @@ discard block  | 
                                                    ||
| 1393 | 1393 |  			$stack->{$k} = $output; | 
                                                        
| 1394 | 1394 | }  | 
                                                        
| 1395 | 1395 | |
| 1396 | - if(!count(get_object_vars($stack)))  | 
                                                        |
| 1396 | + if (!count(get_object_vars($stack)))  | 
                                                        |
| 1397 | 1397 |  		{ | 
                                                        
| 1398 | 1398 | return NULL;  | 
                                                        
| 1399 | 1399 | }  | 
                                                        
@@ -1412,32 +1412,32 @@ discard block  | 
                                                    ||
| 1412 | 1412 | */  | 
                                                        
| 1413 | 1413 | function _filterRequestVar($key, $val, $do_stripslashes = 1)  | 
                                                        
| 1414 | 1414 |  	{ | 
                                                        
| 1415 | - if(!($isArray = is_array($val)))  | 
                                                        |
| 1415 | + if (!($isArray = is_array($val)))  | 
                                                        |
| 1416 | 1416 |  		{ | 
                                                        
| 1417 | 1417 | $val = array($val);  | 
                                                        
| 1418 | 1418 | }  | 
                                                        
| 1419 | 1419 | |
| 1420 | 1420 | $result = array();  | 
                                                        
| 1421 | - foreach($val as $k => $v)  | 
                                                        |
| 1421 | + foreach ($val as $k => $v)  | 
                                                        |
| 1422 | 1422 |  		{ | 
                                                        
| 1423 | 1423 | $k = htmlentities($k);  | 
                                                        
| 1424 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)  | 
                                                        |
| 1424 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)  | 
                                                        |
| 1425 | 1425 |  			{ | 
                                                        
| 1426 | 1426 |  				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; | 
                                                        
| 1427 | 1427 | }  | 
                                                        
| 1428 | - elseif($key === 'mid' || $key === 'search_keyword')  | 
                                                        |
| 1428 | + elseif ($key === 'mid' || $key === 'search_keyword')  | 
                                                        |
| 1429 | 1429 |  			{ | 
                                                        
| 1430 | 1430 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1431 | 1431 | }  | 
                                                        
| 1432 | - elseif($key === 'vid')  | 
                                                        |
| 1432 | + elseif ($key === 'vid')  | 
                                                        |
| 1433 | 1433 |  			{ | 
                                                        
| 1434 | 1434 | $result[$k] = urlencode($v);  | 
                                                        
| 1435 | 1435 | }  | 
                                                        
| 1436 | - elseif($key === 'xe_validator_id')  | 
                                                        |
| 1436 | + elseif ($key === 'xe_validator_id')  | 
                                                        |
| 1437 | 1437 |  			{ | 
                                                        
| 1438 | 1438 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1439 | 1439 | }  | 
                                                        
| 1440 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)  | 
                                                        |
| 1440 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)  | 
                                                        |
| 1441 | 1441 |  			{ | 
                                                        
| 1442 | 1442 | unset($result[$k]);  | 
                                                        
| 1443 | 1443 | }  | 
                                                        
@@ -1445,7 +1445,7 @@ discard block  | 
                                                    ||
| 1445 | 1445 |  			{ | 
                                                        
| 1446 | 1446 | $result[$k] = $v;  | 
                                                        
| 1447 | 1447 | |
| 1448 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())  | 
                                                        |
| 1448 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())  | 
                                                        |
| 1449 | 1449 |  				{ | 
                                                        
| 1450 | 1450 | if (is_array($result[$k]))  | 
                                                        
| 1451 | 1451 |  					{ | 
                                                        
@@ -1457,7 +1457,7 @@ discard block  | 
                                                    ||
| 1457 | 1457 | }  | 
                                                        
| 1458 | 1458 | }  | 
                                                        
| 1459 | 1459 | |
| 1460 | - if(is_array($result[$k]))  | 
                                                        |
| 1460 | + if (is_array($result[$k]))  | 
                                                        |
| 1461 | 1461 |  				{ | 
                                                        
| 1462 | 1462 |  					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); | 
                                                        
| 1463 | 1463 | }  | 
                                                        
@@ -1489,17 +1489,17 @@ discard block  | 
                                                    ||
| 1489 | 1489 | */  | 
                                                        
| 1490 | 1490 | function _setUploadedArgument()  | 
                                                        
| 1491 | 1491 |  	{ | 
                                                        
| 1492 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))  | 
                                                        |
| 1492 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))  | 
                                                        |
| 1493 | 1493 |  		{ | 
                                                        
| 1494 | 1494 | return;  | 
                                                        
| 1495 | 1495 | }  | 
                                                        
| 1496 | 1496 | |
| 1497 | - foreach($_FILES as $key => $val)  | 
                                                        |
| 1497 | + foreach ($_FILES as $key => $val)  | 
                                                        |
| 1498 | 1498 |  		{ | 
                                                        
| 1499 | 1499 | $tmp_name = $val['tmp_name'];  | 
                                                        
| 1500 | - if(!is_array($tmp_name))  | 
                                                        |
| 1500 | + if (!is_array($tmp_name))  | 
                                                        |
| 1501 | 1501 |  			{ | 
                                                        
| 1502 | - if(!$tmp_name || !is_uploaded_file($tmp_name))  | 
                                                        |
| 1502 | + if (!$tmp_name || !is_uploaded_file($tmp_name))  | 
                                                        |
| 1503 | 1503 |  				{ | 
                                                        
| 1504 | 1504 | continue;  | 
                                                        
| 1505 | 1505 | }  | 
                                                        
@@ -1512,9 +1512,9 @@ discard block  | 
                                                    ||
| 1512 | 1512 | $files = array();  | 
                                                        
| 1513 | 1513 | $count_files = count($tmp_name);  | 
                                                        
| 1514 | 1514 | |
| 1515 | - for($i = 0; $i < $count_files; $i++)  | 
                                                        |
| 1515 | + for ($i = 0; $i < $count_files; $i++)  | 
                                                        |
| 1516 | 1516 |  				{ | 
                                                        
| 1517 | - if($val['size'][$i] > 0)  | 
                                                        |
| 1517 | + if ($val['size'][$i] > 0)  | 
                                                        |
| 1518 | 1518 |  					{ | 
                                                        
| 1519 | 1519 | $file = array();  | 
                                                        
| 1520 | 1520 | $file['name'] = $val['name'][$i];  | 
                                                        
@@ -1525,7 +1525,7 @@ discard block  | 
                                                    ||
| 1525 | 1525 | $files[] = $file;  | 
                                                        
| 1526 | 1526 | }  | 
                                                        
| 1527 | 1527 | }  | 
                                                        
| 1528 | - if($files) $this->set($key, $files, TRUE);  | 
                                                        |
| 1528 | + if ($files) $this->set($key, $files, TRUE);  | 
                                                        |
| 1529 | 1529 | }  | 
                                                        
| 1530 | 1530 | }  | 
                                                        
| 1531 | 1531 | }  | 
                                                        
@@ -1547,16 +1547,16 @@ discard block  | 
                                                    ||
| 1547 | 1547 | function getRequestUrl()  | 
                                                        
| 1548 | 1548 |  	{ | 
                                                        
| 1549 | 1549 | static $url = null;  | 
                                                        
| 1550 | - if(is_null($url))  | 
                                                        |
| 1550 | + if (is_null($url))  | 
                                                        |
| 1551 | 1551 |  		{ | 
                                                        
| 1552 | 1552 | $url = self::getRequestUri();  | 
                                                        
| 1553 | - if(count($_GET) > 0)  | 
                                                        |
| 1553 | + if (count($_GET) > 0)  | 
                                                        |
| 1554 | 1554 |  			{ | 
                                                        
| 1555 | - foreach($_GET as $key => $val)  | 
                                                        |
| 1555 | + foreach ($_GET as $key => $val)  | 
                                                        |
| 1556 | 1556 |  				{ | 
                                                        
| 1557 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');  | 
                                                        |
| 1557 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');  | 
                                                        |
| 1558 | 1558 | }  | 
                                                        
| 1559 | -				$url .= '?' . join('&', $vars); | 
                                                        |
| 1559 | +				$url .= '?'.join('&', $vars); | 
                                                        |
| 1560 | 1560 | }  | 
                                                        
| 1561 | 1561 | }  | 
                                                        
| 1562 | 1562 | return $url;  | 
                                                        
@@ -1571,7 +1571,7 @@ discard block  | 
                                                    ||
| 1571 | 1571 | $self = self::getInstance();  | 
                                                        
| 1572 | 1572 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];  | 
                                                        
| 1573 | 1573 | |
| 1574 | -		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) | 
                                                        |
| 1574 | +		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) | 
                                                        |
| 1575 | 1575 |  		{ | 
                                                        
| 1576 | 1576 | unset($js_callback_func);  | 
                                                        
| 1577 | 1577 | unset($_GET['xe_js_callback']);  | 
                                                        
@@ -1599,22 +1599,22 @@ discard block  | 
                                                    ||
| 1599 | 1599 | $self = self::getInstance();  | 
                                                        
| 1600 | 1600 | |
| 1601 | 1601 | // retrieve virtual site information  | 
                                                        
| 1602 | - if(is_null($site_module_info))  | 
                                                        |
| 1602 | + if (is_null($site_module_info))  | 
                                                        |
| 1603 | 1603 |  		{ | 
                                                        
| 1604 | 1604 |  			$site_module_info = self::get('site_module_info'); | 
                                                        
| 1605 | 1605 | }  | 
                                                        
| 1606 | 1606 | |
| 1607 | 1607 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)  | 
                                                        
| 1608 | - if($domain && isSiteID($domain))  | 
                                                        |
| 1608 | + if ($domain && isSiteID($domain))  | 
                                                        |
| 1609 | 1609 |  		{ | 
                                                        
| 1610 | 1610 | $vid = $domain;  | 
                                                        
| 1611 | 1611 | $domain = '';  | 
                                                        
| 1612 | 1612 | }  | 
                                                        
| 1613 | 1613 | |
| 1614 | 1614 | // If $domain, $vid are not set, use current site information  | 
                                                        
| 1615 | - if(!$domain && !$vid)  | 
                                                        |
| 1615 | + if (!$domain && !$vid)  | 
                                                        |
| 1616 | 1616 |  		{ | 
                                                        
| 1617 | - if($site_module_info->domain && isSiteID($site_module_info->domain))  | 
                                                        |
| 1617 | + if ($site_module_info->domain && isSiteID($site_module_info->domain))  | 
                                                        |
| 1618 | 1618 |  			{ | 
                                                        
| 1619 | 1619 | $vid = $site_module_info->domain;  | 
                                                        
| 1620 | 1620 | }  | 
                                                        
@@ -1625,21 +1625,21 @@ discard block  | 
                                                    ||
| 1625 | 1625 | }  | 
                                                        
| 1626 | 1626 | |
| 1627 | 1627 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.  | 
                                                        
| 1628 | - if($domain)  | 
                                                        |
| 1628 | + if ($domain)  | 
                                                        |
| 1629 | 1629 |  		{ | 
                                                        
| 1630 | 1630 | $domain_info = parse_url($domain);  | 
                                                        
| 1631 | - if(is_null($current_info))  | 
                                                        |
| 1631 | + if (is_null($current_info))  | 
                                                        |
| 1632 | 1632 |  			{ | 
                                                        
| 1633 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());  | 
                                                        |
| 1633 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());  | 
                                                        |
| 1634 | 1634 | }  | 
                                                        
| 1635 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])  | 
                                                        |
| 1635 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])  | 
                                                        |
| 1636 | 1636 |  			{ | 
                                                        
| 1637 | 1637 | unset($domain);  | 
                                                        
| 1638 | 1638 | }  | 
                                                        
| 1639 | 1639 | else  | 
                                                        
| 1640 | 1640 |  			{ | 
                                                        
| 1641 | 1641 |  				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); | 
                                                        
| 1642 | - if(substr_compare($domain, '/', -1) !== 0)  | 
                                                        |
| 1642 | + if (substr_compare($domain, '/', -1) !== 0)  | 
                                                        |
| 1643 | 1643 |  				{ | 
                                                        
| 1644 | 1644 | $domain .= '/';  | 
                                                        
| 1645 | 1645 | }  | 
                                                        
@@ -1649,41 +1649,41 @@ discard block  | 
                                                    ||
| 1649 | 1649 | $get_vars = array();  | 
                                                        
| 1650 | 1650 | |
| 1651 | 1651 | // If there is no GET variables or first argument is '' to reset variables  | 
                                                        
| 1652 | - if(!$self->get_vars || $args_list[0] == '')  | 
                                                        |
| 1652 | + if (!$self->get_vars || $args_list[0] == '')  | 
                                                        |
| 1653 | 1653 |  		{ | 
                                                        
| 1654 | 1654 | // rearrange args_list  | 
                                                        
| 1655 | - if(is_array($args_list) && $args_list[0] == '')  | 
                                                        |
| 1655 | + if (is_array($args_list) && $args_list[0] == '')  | 
                                                        |
| 1656 | 1656 |  			{ | 
                                                        
| 1657 | 1657 | array_shift($args_list);  | 
                                                        
| 1658 | 1658 | }  | 
                                                        
| 1659 | 1659 | }  | 
                                                        
| 1660 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 1660 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 1661 | 1661 |  		{ | 
                                                        
| 1662 | 1662 | // Otherwise, make GET variables into array  | 
                                                        
| 1663 | 1663 | $get_vars = get_object_vars($self->get_vars);  | 
                                                        
| 1664 | 1664 | }  | 
                                                        
| 1665 | 1665 | else  | 
                                                        
| 1666 | 1666 |  		{ | 
                                                        
| 1667 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;  | 
                                                        |
| 1668 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;  | 
                                                        |
| 1669 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;  | 
                                                        |
| 1670 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;  | 
                                                        |
| 1671 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;  | 
                                                        |
| 1672 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;  | 
                                                        |
| 1673 | - if($get_vars['act'] == 'IS')  | 
                                                        |
| 1667 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;  | 
                                                        |
| 1668 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;  | 
                                                        |
| 1669 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;  | 
                                                        |
| 1670 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;  | 
                                                        |
| 1671 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;  | 
                                                        |
| 1672 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;  | 
                                                        |
| 1673 | + if ($get_vars['act'] == 'IS')  | 
                                                        |
| 1674 | 1674 |  			{ | 
                                                        
| 1675 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;  | 
                                                        |
| 1675 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;  | 
                                                        |
| 1676 | 1676 | }  | 
                                                        
| 1677 | 1677 | }  | 
                                                        
| 1678 | 1678 | |
| 1679 | 1679 | // arrange args_list  | 
                                                        
| 1680 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2)  | 
                                                        |
| 1680 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2)  | 
                                                        |
| 1681 | 1681 |  		{ | 
                                                        
| 1682 | 1682 | $key = $args_list[$i];  | 
                                                        
| 1683 | 1683 | $val = trim($args_list[$i + 1]);  | 
                                                        
| 1684 | 1684 | |
| 1685 | 1685 | // If value is not set, remove the key  | 
                                                        
| 1686 | - if(!isset($val) || !strlen($val))  | 
                                                        |
| 1686 | + if (!isset($val) || !strlen($val))  | 
                                                        |
| 1687 | 1687 |  			{ | 
                                                        
| 1688 | 1688 | unset($get_vars[$key]);  | 
                                                        
| 1689 | 1689 | continue;  | 
                                                        
@@ -1694,7 +1694,7 @@ discard block  | 
                                                    ||
| 1694 | 1694 | |
| 1695 | 1695 | // remove vid, rnd  | 
                                                        
| 1696 | 1696 | unset($get_vars['rnd']);  | 
                                                        
| 1697 | - if($vid)  | 
                                                        |
| 1697 | + if ($vid)  | 
                                                        |
| 1698 | 1698 |  		{ | 
                                                        
| 1699 | 1699 | $get_vars['vid'] = $vid;  | 
                                                        
| 1700 | 1700 | }  | 
                                                        
@@ -1711,17 +1711,17 @@ discard block  | 
                                                    ||
| 1711 | 1711 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',  | 
                                                        
| 1712 | 1712 | 'dispModuleAdminSelectList' => 'dispModuleSelectList'  | 
                                                        
| 1713 | 1713 | );  | 
                                                        
| 1714 | - if($act_alias[$act])  | 
                                                        |
| 1714 | + if ($act_alias[$act])  | 
                                                        |
| 1715 | 1715 |  		{ | 
                                                        
| 1716 | 1716 | $get_vars['act'] = $act_alias[$act];  | 
                                                        
| 1717 | 1717 | }  | 
                                                        
| 1718 | 1718 | |
| 1719 | 1719 | // organize URL  | 
                                                        
| 1720 | 1720 | $query = '';  | 
                                                        
| 1721 | - if(count($get_vars) > 0)  | 
                                                        |
| 1721 | + if (count($get_vars) > 0)  | 
                                                        |
| 1722 | 1722 |  		{ | 
                                                        
| 1723 | 1723 | // if using rewrite mod  | 
                                                        
| 1724 | - if($self->allow_rewrite)  | 
                                                        |
| 1724 | + if ($self->allow_rewrite)  | 
                                                        |
| 1725 | 1725 |  			{ | 
                                                        
| 1726 | 1726 | $var_keys = array_keys($get_vars);  | 
                                                        
| 1727 | 1727 | sort($var_keys);  | 
                                                        
@@ -1741,8 +1741,8 @@ discard block  | 
                                                    ||
| 1741 | 1741 | 'vid' => $vid,  | 
                                                        
| 1742 | 1742 | 'mid' => $mid,  | 
                                                        
| 1743 | 1743 | 'mid.vid' => "$vid/$mid",  | 
                                                        
| 1744 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'],  | 
                                                        |
| 1745 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],  | 
                                                        |
| 1744 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'],  | 
                                                        |
| 1745 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],  | 
                                                        |
| 1746 | 1746 | 'document_srl' => $srl,  | 
                                                        
| 1747 | 1747 | 'document_srl.mid' => "$mid/$srl",  | 
                                                        
| 1748 | 1748 | 'document_srl.vid' => "$vid/$srl",  | 
                                                        
@@ -1759,66 +1759,66 @@ discard block  | 
                                                    ||
| 1759 | 1759 | $query = $target_map[$target];  | 
                                                        
| 1760 | 1760 | }  | 
                                                        
| 1761 | 1761 | |
| 1762 | - if(!$query)  | 
                                                        |
| 1762 | + if (!$query)  | 
                                                        |
| 1763 | 1763 |  			{ | 
                                                        
| 1764 | 1764 | $queries = array();  | 
                                                        
| 1765 | - foreach($get_vars as $key => $val)  | 
                                                        |
| 1765 | + foreach ($get_vars as $key => $val)  | 
                                                        |
| 1766 | 1766 |  				{ | 
                                                        
| 1767 | - if(is_array($val) && count($val) > 0)  | 
                                                        |
| 1767 | + if (is_array($val) && count($val) > 0)  | 
                                                        |
| 1768 | 1768 |  					{ | 
                                                        
| 1769 | - foreach($val as $k => $v)  | 
                                                        |
| 1769 | + foreach ($val as $k => $v)  | 
                                                        |
| 1770 | 1770 |  						{ | 
                                                        
| 1771 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v);  | 
                                                        |
| 1771 | + $queries[] = $key.'['.$k.']='.urlencode($v);  | 
                                                        |
| 1772 | 1772 | }  | 
                                                        
| 1773 | 1773 | }  | 
                                                        
| 1774 | - elseif(!is_array($val))  | 
                                                        |
| 1774 | + elseif (!is_array($val))  | 
                                                        |
| 1775 | 1775 |  					{ | 
                                                        
| 1776 | - $queries[] = $key . '=' . urlencode($val);  | 
                                                        |
| 1776 | + $queries[] = $key.'='.urlencode($val);  | 
                                                        |
| 1777 | 1777 | }  | 
                                                        
| 1778 | 1778 | }  | 
                                                        
| 1779 | - if(count($queries) > 0)  | 
                                                        |
| 1779 | + if (count($queries) > 0)  | 
                                                        |
| 1780 | 1780 |  				{ | 
                                                        
| 1781 | -					$query = 'index.php?' . join('&', $queries); | 
                                                        |
| 1781 | +					$query = 'index.php?'.join('&', $queries); | 
                                                        |
| 1782 | 1782 | }  | 
                                                        
| 1783 | 1783 | }  | 
                                                        
| 1784 | 1784 | }  | 
                                                        
| 1785 | 1785 | |
| 1786 | 1786 | // If using SSL always  | 
                                                        
| 1787 | 1787 |  		$_use_ssl = $self->get('_use_ssl'); | 
                                                        
| 1788 | - if($_use_ssl == 'always')  | 
                                                        |
| 1788 | + if ($_use_ssl == 'always')  | 
                                                        |
| 1789 | 1789 |  		{ | 
                                                        
| 1790 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;  | 
                                                        |
| 1790 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;  | 
                                                        |
| 1791 | 1791 | // optional SSL use  | 
                                                        
| 1792 | 1792 | }  | 
                                                        
| 1793 | - elseif($_use_ssl == 'optional')  | 
                                                        |
| 1793 | + elseif ($_use_ssl == 'optional')  | 
                                                        |
| 1794 | 1794 |  		{ | 
                                                        
| 1795 | 1795 |  			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; | 
                                                        
| 1796 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query;  | 
                                                        |
| 1796 | + $query = $self->getRequestUri($ssl_mode, $domain).$query;  | 
                                                        |
| 1797 | 1797 | // no SSL  | 
                                                        
| 1798 | 1798 | }  | 
                                                        
| 1799 | 1799 | else  | 
                                                        
| 1800 | 1800 |  		{ | 
                                                        
| 1801 | 1801 | // currently on SSL but target is not based on SSL  | 
                                                        
| 1802 | - if($_SERVER['HTTPS'] == 'on')  | 
                                                        |
| 1802 | + if ($_SERVER['HTTPS'] == 'on')  | 
                                                        |
| 1803 | 1803 |  			{ | 
                                                        
| 1804 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;  | 
                                                        |
| 1804 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;  | 
                                                        |
| 1805 | 1805 | }  | 
                                                        
| 1806 | - else if($domain) // if $domain is set  | 
                                                        |
| 1806 | + else if ($domain) // if $domain is set  | 
                                                        |
| 1807 | 1807 |  			{ | 
                                                        
| 1808 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;  | 
                                                        |
| 1808 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;  | 
                                                        |
| 1809 | 1809 | }  | 
                                                        
| 1810 | 1810 | else  | 
                                                        
| 1811 | 1811 |  			{ | 
                                                        
| 1812 | - $query = getScriptPath() . $query;  | 
                                                        |
| 1812 | + $query = getScriptPath().$query;  | 
                                                        |
| 1813 | 1813 | }  | 
                                                        
| 1814 | 1814 | }  | 
                                                        
| 1815 | 1815 | |
| 1816 | - if(!$encode)  | 
                                                        |
| 1816 | + if (!$encode)  | 
                                                        |
| 1817 | 1817 |  		{ | 
                                                        
| 1818 | 1818 | return $query;  | 
                                                        
| 1819 | 1819 | }  | 
                                                        
| 1820 | 1820 | |
| 1821 | - if(!$autoEncode)  | 
                                                        |
| 1821 | + if (!$autoEncode)  | 
                                                        |
| 1822 | 1822 |  		{ | 
                                                        
| 1823 | 1823 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1824 | 1824 | }  | 
                                                        
@@ -1827,16 +1827,16 @@ discard block  | 
                                                    ||
| 1827 | 1827 | $encode_queries = array();  | 
                                                        
| 1828 | 1828 | $parsedUrl = parse_url($query);  | 
                                                        
| 1829 | 1829 | parse_str($parsedUrl['query'], $output);  | 
                                                        
| 1830 | - foreach($output as $key => $value)  | 
                                                        |
| 1830 | + foreach ($output as $key => $value)  | 
                                                        |
| 1831 | 1831 |  		{ | 
                                                        
| 1832 | -			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) | 
                                                        |
| 1832 | +			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) | 
                                                        |
| 1833 | 1833 |  			{ | 
                                                        
| 1834 | 1834 | $value = urlencode(htmlspecialchars_decode(urldecode($value)));  | 
                                                        
| 1835 | 1835 | }  | 
                                                        
| 1836 | - $encode_queries[] = $key . '=' . $value;  | 
                                                        |
| 1836 | + $encode_queries[] = $key.'='.$value;  | 
                                                        |
| 1837 | 1837 | }  | 
                                                        
| 1838 | 1838 | |
| 1839 | -		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
                                                        |
| 1839 | +		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
                                                        |
| 1840 | 1840 | }  | 
                                                        
| 1841 | 1841 | |
| 1842 | 1842 | /**  | 
                                                        
@@ -1851,17 +1851,17 @@ discard block  | 
                                                    ||
| 1851 | 1851 | static $url = array();  | 
                                                        
| 1852 | 1852 | |
| 1853 | 1853 | // Check HTTP Request  | 
                                                        
| 1854 | - if(!isset($_SERVER['SERVER_PROTOCOL']))  | 
                                                        |
| 1854 | + if (!isset($_SERVER['SERVER_PROTOCOL']))  | 
                                                        |
| 1855 | 1855 |  		{ | 
                                                        
| 1856 | 1856 | return;  | 
                                                        
| 1857 | 1857 | }  | 
                                                        
| 1858 | 1858 | |
| 1859 | -		if(self::get('_use_ssl') == 'always') | 
                                                        |
| 1859 | +		if (self::get('_use_ssl') == 'always') | 
                                                        |
| 1860 | 1860 |  		{ | 
                                                        
| 1861 | 1861 | $ssl_mode = ENFORCE_SSL;  | 
                                                        
| 1862 | 1862 | }  | 
                                                        
| 1863 | 1863 | |
| 1864 | - if($domain)  | 
                                                        |
| 1864 | + if ($domain)  | 
                                                        |
| 1865 | 1865 |  		{ | 
                                                        
| 1866 | 1866 | $domain_key = md5($domain);  | 
                                                        
| 1867 | 1867 | }  | 
                                                        
@@ -1870,14 +1870,14 @@ discard block  | 
                                                    ||
| 1870 | 1870 | $domain_key = 'default';  | 
                                                        
| 1871 | 1871 | }  | 
                                                        
| 1872 | 1872 | |
| 1873 | - if(isset($url[$ssl_mode][$domain_key]))  | 
                                                        |
| 1873 | + if (isset($url[$ssl_mode][$domain_key]))  | 
                                                        |
| 1874 | 1874 |  		{ | 
                                                        
| 1875 | 1875 | return $url[$ssl_mode][$domain_key];  | 
                                                        
| 1876 | 1876 | }  | 
                                                        
| 1877 | 1877 | |
| 1878 | 1878 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on');  | 
                                                        
| 1879 | 1879 | |
| 1880 | - switch($ssl_mode)  | 
                                                        |
| 1880 | + switch ($ssl_mode)  | 
                                                        |
| 1881 | 1881 |  		{ | 
                                                        
| 1882 | 1882 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;  | 
                                                        
| 1883 | 1883 | break;  | 
                                                        
@@ -1887,34 +1887,34 @@ discard block  | 
                                                    ||
| 1887 | 1887 | break;  | 
                                                        
| 1888 | 1888 | }  | 
                                                        
| 1889 | 1889 | |
| 1890 | - if($domain)  | 
                                                        |
| 1890 | + if ($domain)  | 
                                                        |
| 1891 | 1891 |  		{ | 
                                                        
| 1892 | 1892 | $target_url = trim($domain);  | 
                                                        
| 1893 | - if(substr_compare($target_url, '/', -1) !== 0)  | 
                                                        |
| 1893 | + if (substr_compare($target_url, '/', -1) !== 0)  | 
                                                        |
| 1894 | 1894 |  			{ | 
                                                        
| 1895 | - $target_url.= '/';  | 
                                                        |
| 1895 | + $target_url .= '/';  | 
                                                        |
| 1896 | 1896 | }  | 
                                                        
| 1897 | 1897 | }  | 
                                                        
| 1898 | 1898 | else  | 
                                                        
| 1899 | 1899 |  		{ | 
                                                        
| 1900 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath();  | 
                                                        |
| 1900 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath();  | 
                                                        |
| 1901 | 1901 | }  | 
                                                        
| 1902 | 1902 | |
| 1903 | -		$url_info = parse_url('http://' . $target_url); | 
                                                        |
| 1903 | +		$url_info = parse_url('http://'.$target_url); | 
                                                        |
| 1904 | 1904 | |
| 1905 | - if($current_use_ssl != $use_ssl)  | 
                                                        |
| 1905 | + if ($current_use_ssl != $use_ssl)  | 
                                                        |
| 1906 | 1906 |  		{ | 
                                                        
| 1907 | 1907 | unset($url_info['port']);  | 
                                                        
| 1908 | 1908 | }  | 
                                                        
| 1909 | 1909 | |
| 1910 | - if($use_ssl)  | 
                                                        |
| 1910 | + if ($use_ssl)  | 
                                                        |
| 1911 | 1911 |  		{ | 
                                                        
| 1912 | 1912 |  			$port = self::get('_https_port'); | 
                                                        
| 1913 | - if($port && $port != 443)  | 
                                                        |
| 1913 | + if ($port && $port != 443)  | 
                                                        |
| 1914 | 1914 |  			{ | 
                                                        
| 1915 | 1915 | $url_info['port'] = $port;  | 
                                                        
| 1916 | 1916 | }  | 
                                                        
| 1917 | - elseif($url_info['port'] == 443)  | 
                                                        |
| 1917 | + elseif ($url_info['port'] == 443)  | 
                                                        |
| 1918 | 1918 |  			{ | 
                                                        
| 1919 | 1919 | unset($url_info['port']);  | 
                                                        
| 1920 | 1920 | }  | 
                                                        
@@ -1922,17 +1922,17 @@ discard block  | 
                                                    ||
| 1922 | 1922 | else  | 
                                                        
| 1923 | 1923 |  		{ | 
                                                        
| 1924 | 1924 |  			$port = self::get('_http_port'); | 
                                                        
| 1925 | - if($port && $port != 80)  | 
                                                        |
| 1925 | + if ($port && $port != 80)  | 
                                                        |
| 1926 | 1926 |  			{ | 
                                                        
| 1927 | 1927 | $url_info['port'] = $port;  | 
                                                        
| 1928 | 1928 | }  | 
                                                        
| 1929 | - elseif($url_info['port'] == 80)  | 
                                                        |
| 1929 | + elseif ($url_info['port'] == 80)  | 
                                                        |
| 1930 | 1930 |  			{ | 
                                                        
| 1931 | 1931 | unset($url_info['port']);  | 
                                                        
| 1932 | 1932 | }  | 
                                                        
| 1933 | 1933 | }  | 
                                                        
| 1934 | 1934 | |
| 1935 | -		$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']); | 
                                                        |
| 1935 | +		$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']); | 
                                                        |
| 1936 | 1936 | |
| 1937 | 1937 | return $url[$ssl_mode][$domain_key];  | 
                                                        
| 1938 | 1938 | }  | 
                                                        
@@ -1949,16 +1949,16 @@ discard block  | 
                                                    ||
| 1949 | 1949 |  	{ | 
                                                        
| 1950 | 1950 | $self = self::getInstance();  | 
                                                        
| 1951 | 1951 |  		$self->context->{$key} = $val; | 
                                                        
| 1952 | - if($set_to_get_vars === FALSE)  | 
                                                        |
| 1952 | + if ($set_to_get_vars === FALSE)  | 
                                                        |
| 1953 | 1953 |  		{ | 
                                                        
| 1954 | 1954 | return;  | 
                                                        
| 1955 | 1955 | }  | 
                                                        
| 1956 | - if($val === NULL || $val === '')  | 
                                                        |
| 1956 | + if ($val === NULL || $val === '')  | 
                                                        |
| 1957 | 1957 |  		{ | 
                                                        
| 1958 | 1958 |  			unset($self->get_vars->{$key}); | 
                                                        
| 1959 | 1959 | return;  | 
                                                        
| 1960 | 1960 | }  | 
                                                        
| 1961 | -		if($set_to_get_vars || $self->get_vars->{$key}) | 
                                                        |
| 1961 | +		if ($set_to_get_vars || $self->get_vars->{$key}) | 
                                                        |
| 1962 | 1962 |  		{ | 
                                                        
| 1963 | 1963 |  			$self->get_vars->{$key} = $val; | 
                                                        
| 1964 | 1964 | }  | 
                                                        
@@ -1974,7 +1974,7 @@ discard block  | 
                                                    ||
| 1974 | 1974 |  	{ | 
                                                        
| 1975 | 1975 | $self = self::getInstance();  | 
                                                        
| 1976 | 1976 | |
| 1977 | -		if(!isset($self->context->{$key})) | 
                                                        |
| 1977 | +		if (!isset($self->context->{$key})) | 
                                                        |
| 1978 | 1978 |  		{ | 
                                                        
| 1979 | 1979 | return null;  | 
                                                        
| 1980 | 1980 | }  | 
                                                        
@@ -1989,7 +1989,7 @@ discard block  | 
                                                    ||
| 1989 | 1989 | function gets()  | 
                                                        
| 1990 | 1990 |  	{ | 
                                                        
| 1991 | 1991 | $num_args = func_num_args();  | 
                                                        
| 1992 | - if($num_args < 1)  | 
                                                        |
| 1992 | + if ($num_args < 1)  | 
                                                        |
| 1993 | 1993 |  		{ | 
                                                        
| 1994 | 1994 | return;  | 
                                                        
| 1995 | 1995 | }  | 
                                                        
@@ -1997,7 +1997,7 @@ discard block  | 
                                                    ||
| 1997 | 1997 | |
| 1998 | 1998 | $args_list = func_get_args();  | 
                                                        
| 1999 | 1999 | $output = new stdClass();  | 
                                                        
| 2000 | - foreach($args_list as $v)  | 
                                                        |
| 2000 | + foreach ($args_list as $v)  | 
                                                        |
| 2001 | 2001 |  		{ | 
                                                        
| 2002 | 2002 |  			$output->{$v} = $self->get($v); | 
                                                        
| 2003 | 2003 | }  | 
                                                        
@@ -2023,7 +2023,7 @@ discard block  | 
                                                    ||
| 2023 | 2023 | function getRequestVars()  | 
                                                        
| 2024 | 2024 |  	{ | 
                                                        
| 2025 | 2025 | $self = self::getInstance();  | 
                                                        
| 2026 | - if($self->get_vars)  | 
                                                        |
| 2026 | + if ($self->get_vars)  | 
                                                        |
| 2027 | 2027 |  		{ | 
                                                        
| 2028 | 2028 | return clone($self->get_vars);  | 
                                                        
| 2029 | 2029 | }  | 
                                                        
@@ -2040,13 +2040,13 @@ discard block  | 
                                                    ||
| 2040 | 2040 |  	{ | 
                                                        
| 2041 | 2041 | $self = self::getInstance();  | 
                                                        
| 2042 | 2042 | |
| 2043 | - if(!is_readable($self->sslActionCacheFile))  | 
                                                        |
| 2043 | + if (!is_readable($self->sslActionCacheFile))  | 
                                                        |
| 2044 | 2044 |  		{ | 
                                                        
| 2045 | 2045 |  			$buff = '<?php if(!defined("__XE__"))exit;'; | 
                                                        
| 2046 | 2046 | FileHandler::writeFile($self->sslActionCacheFile, $buff);  | 
                                                        
| 2047 | 2047 | }  | 
                                                        
| 2048 | 2048 | |
| 2049 | - if(!isset($self->ssl_actions[$action]))  | 
                                                        |
| 2049 | + if (!isset($self->ssl_actions[$action]))  | 
                                                        |
| 2050 | 2050 |  		{ | 
                                                        
| 2051 | 2051 | $self->ssl_actions[$action] = 1;  | 
                                                        
| 2052 | 2052 |  			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
                                                        
@@ -2064,16 +2064,16 @@ discard block  | 
                                                    ||
| 2064 | 2064 |  	{ | 
                                                        
| 2065 | 2065 | $self = self::getInstance();  | 
                                                        
| 2066 | 2066 | |
| 2067 | - if(!is_readable($self->sslActionCacheFile))  | 
                                                        |
| 2067 | + if (!is_readable($self->sslActionCacheFile))  | 
                                                        |
| 2068 | 2068 |  		{ | 
                                                        
| 2069 | 2069 | unset($self->ssl_actions);  | 
                                                        
| 2070 | 2070 |  			$buff = '<?php if(!defined("__XE__"))exit;'; | 
                                                        
| 2071 | 2071 | FileHandler::writeFile($self->sslActionCacheFile, $buff);  | 
                                                        
| 2072 | 2072 | }  | 
                                                        
| 2073 | 2073 | |
| 2074 | - foreach($action_array as $action)  | 
                                                        |
| 2074 | + foreach ($action_array as $action)  | 
                                                        |
| 2075 | 2075 |  		{ | 
                                                        
| 2076 | - if(!isset($self->ssl_actions[$action]))  | 
                                                        |
| 2076 | + if (!isset($self->ssl_actions[$action]))  | 
                                                        |
| 2077 | 2077 |  			{ | 
                                                        
| 2078 | 2078 | $self->ssl_actions[$action] = 1;  | 
                                                        
| 2079 | 2079 |  				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
                                                        
@@ -2092,7 +2092,7 @@ discard block  | 
                                                    ||
| 2092 | 2092 |  	{ | 
                                                        
| 2093 | 2093 | $self = self::getInstance();  | 
                                                        
| 2094 | 2094 | |
| 2095 | - if($self->isExistsSSLAction($action))  | 
                                                        |
| 2095 | + if ($self->isExistsSSLAction($action))  | 
                                                        |
| 2096 | 2096 |  		{ | 
                                                        
| 2097 | 2097 |  			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
                                                        
| 2098 | 2098 | $buff = FileHandler::readFile($self->sslActionCacheFile);  | 
                                                        
@@ -2109,7 +2109,7 @@ discard block  | 
                                                    ||
| 2109 | 2109 | function getSSLActions()  | 
                                                        
| 2110 | 2110 |  	{ | 
                                                        
| 2111 | 2111 | $self = self::getInstance();  | 
                                                        
| 2112 | - if($self->getSslStatus() == 'optional')  | 
                                                        |
| 2112 | + if ($self->getSslStatus() == 'optional')  | 
                                                        |
| 2113 | 2113 |  		{ | 
                                                        
| 2114 | 2114 | return $self->ssl_actions;  | 
                                                        
| 2115 | 2115 | }  | 
                                                        
@@ -2136,12 +2136,12 @@ discard block  | 
                                                    ||
| 2136 | 2136 | */  | 
                                                        
| 2137 | 2137 | function normalizeFilePath($file)  | 
                                                        
| 2138 | 2138 |  	{ | 
                                                        
| 2139 | -		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) | 
                                                        |
| 2139 | +		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) | 
                                                        |
| 2140 | 2140 |  		{ | 
                                                        
| 2141 | - $file = './' . $file;  | 
                                                        |
| 2141 | + $file = './'.$file;  | 
                                                        |
| 2142 | 2142 | }  | 
                                                        
| 2143 | 2143 |  		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); | 
                                                        
| 2144 | - while(strpos($file, '/../') !== FALSE)  | 
                                                        |
| 2144 | + while (strpos($file, '/../') !== FALSE)  | 
                                                        |
| 2145 | 2145 |  		{ | 
                                                        
| 2146 | 2146 |  			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); | 
                                                        
| 2147 | 2147 | }  | 
                                                        
@@ -2160,13 +2160,13 @@ discard block  | 
                                                    ||
| 2160 | 2160 |  	{ | 
                                                        
| 2161 | 2161 | $file = self::normalizeFilePath($file);  | 
                                                        
| 2162 | 2162 | $script_path = getScriptPath();  | 
                                                        
| 2163 | - if(strpos($file, './') === 0)  | 
                                                        |
| 2163 | + if (strpos($file, './') === 0)  | 
                                                        |
| 2164 | 2164 |  		{ | 
                                                        
| 2165 | - $file = $script_path . substr($file, 2);  | 
                                                        |
| 2165 | + $file = $script_path.substr($file, 2);  | 
                                                        |
| 2166 | 2166 | }  | 
                                                        
| 2167 | - elseif(strpos($file, '../') === 0)  | 
                                                        |
| 2167 | + elseif (strpos($file, '../') === 0)  | 
                                                        |
| 2168 | 2168 |  		{ | 
                                                        
| 2169 | - $file = self::normalizeFilePath($script_path . $file);  | 
                                                        |
| 2169 | + $file = self::normalizeFilePath($script_path.$file);  | 
                                                        |
| 2170 | 2170 | }  | 
                                                        
| 2171 | 2171 | |
| 2172 | 2172 | return $file;  | 
                                                        
@@ -2236,12 +2236,12 @@ discard block  | 
                                                    ||
| 2236 | 2236 | */  | 
                                                        
| 2237 | 2237 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)  | 
                                                        
| 2238 | 2238 |  	{ | 
                                                        
| 2239 | - if($isRuleset)  | 
                                                        |
| 2239 | + if ($isRuleset)  | 
                                                        |
| 2240 | 2240 |  		{ | 
                                                        
| 2241 | - if(strpos($file, '#') !== FALSE)  | 
                                                        |
| 2241 | + if (strpos($file, '#') !== FALSE)  | 
                                                        |
| 2242 | 2242 |  			{ | 
                                                        
| 2243 | 2243 |  				$file = str_replace('#', '', $file); | 
                                                        
| 2244 | - if(!is_readable($file))  | 
                                                        |
| 2244 | + if (!is_readable($file))  | 
                                                        |
| 2245 | 2245 |  				{ | 
                                                        
| 2246 | 2246 | $file = $autoPath;  | 
                                                        
| 2247 | 2247 | }  | 
                                                        
@@ -2306,9 +2306,9 @@ discard block  | 
                                                    ||
| 2306 | 2306 | ksort($files);  | 
                                                        
| 2307 | 2307 | $files = array_values($files);  | 
                                                        
| 2308 | 2308 | $filenames = array();  | 
                                                        
| 2309 | - for($i = 0, $c = count($files); $i < $c; ++$i)  | 
                                                        |
| 2309 | + for ($i = 0, $c = count($files); $i < $c; ++$i)  | 
                                                        |
| 2310 | 2310 |  		{ | 
                                                        
| 2311 | - if(in_array($files[$i]['file'], $filenames))  | 
                                                        |
| 2311 | + if (in_array($files[$i]['file'], $filenames))  | 
                                                        |
| 2312 | 2312 |  			{ | 
                                                        
| 2313 | 2313 | unset($files[$i]);  | 
                                                        
| 2314 | 2314 | }  | 
                                                        
@@ -2393,14 +2393,14 @@ discard block  | 
                                                    ||
| 2393 | 2393 | */  | 
                                                        
| 2394 | 2394 | function getJavascriptPluginInfo($pluginName)  | 
                                                        
| 2395 | 2395 |  	{ | 
                                                        
| 2396 | - if($plugin_name == 'ui.datepicker')  | 
                                                        |
| 2396 | + if ($plugin_name == 'ui.datepicker')  | 
                                                        |
| 2397 | 2397 |  		{ | 
                                                        
| 2398 | 2398 | $plugin_name = 'ui';  | 
                                                        
| 2399 | 2399 | }  | 
                                                        
| 2400 | 2400 | |
| 2401 | - $plugin_path = './common/js/plugins/' . $pluginName . '/';  | 
                                                        |
| 2402 | - $info_file = $plugin_path . 'plugin.load';  | 
                                                        |
| 2403 | - if(!is_readable($info_file))  | 
                                                        |
| 2401 | + $plugin_path = './common/js/plugins/'.$pluginName.'/';  | 
                                                        |
| 2402 | + $info_file = $plugin_path.'plugin.load';  | 
                                                        |
| 2403 | + if (!is_readable($info_file))  | 
                                                        |
| 2404 | 2404 |  		{ | 
                                                        
| 2405 | 2405 | return;  | 
                                                        
| 2406 | 2406 | }  | 
                                                        
@@ -2410,32 +2410,32 @@ discard block  | 
                                                    ||
| 2410 | 2410 | $result->jsList = array();  | 
                                                        
| 2411 | 2411 | $result->cssList = array();  | 
                                                        
| 2412 | 2412 | |
| 2413 | - foreach($list as $filename)  | 
                                                        |
| 2413 | + foreach ($list as $filename)  | 
                                                        |
| 2414 | 2414 |  		{ | 
                                                        
| 2415 | 2415 | $filename = trim($filename);  | 
                                                        
| 2416 | - if(!$filename)  | 
                                                        |
| 2416 | + if (!$filename)  | 
                                                        |
| 2417 | 2417 |  			{ | 
                                                        
| 2418 | 2418 | continue;  | 
                                                        
| 2419 | 2419 | }  | 
                                                        
| 2420 | 2420 | |
| 2421 | -			if(strncasecmp('./', $filename, 2) === 0) | 
                                                        |
| 2421 | +			if (strncasecmp('./', $filename, 2) === 0) | 
                                                        |
| 2422 | 2422 |  			{ | 
                                                        
| 2423 | 2423 | $filename = substr($filename, 2);  | 
                                                        
| 2424 | 2424 | }  | 
                                                        
| 2425 | 2425 | |
| 2426 | - if(substr_compare($filename, '.js', -3) === 0)  | 
                                                        |
| 2426 | + if (substr_compare($filename, '.js', -3) === 0)  | 
                                                        |
| 2427 | 2427 |  			{ | 
                                                        
| 2428 | - $result->jsList[] = $plugin_path . $filename;  | 
                                                        |
| 2428 | + $result->jsList[] = $plugin_path.$filename;  | 
                                                        |
| 2429 | 2429 | }  | 
                                                        
| 2430 | - elseif(substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2430 | + elseif (substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2431 | 2431 |  			{ | 
                                                        
| 2432 | - $result->cssList[] = $plugin_path . $filename;  | 
                                                        |
| 2432 | + $result->cssList[] = $plugin_path.$filename;  | 
                                                        |
| 2433 | 2433 | }  | 
                                                        
| 2434 | 2434 | }  | 
                                                        
| 2435 | 2435 | |
| 2436 | - if(is_dir($plugin_path . 'lang'))  | 
                                                        |
| 2436 | + if (is_dir($plugin_path.'lang'))  | 
                                                        |
| 2437 | 2437 |  		{ | 
                                                        
| 2438 | - $result->langPath = $plugin_path . 'lang';  | 
                                                        |
| 2438 | + $result->langPath = $plugin_path.'lang';  | 
                                                        |
| 2439 | 2439 | }  | 
                                                        
| 2440 | 2440 | |
| 2441 | 2441 | return $result;  | 
                                                        
@@ -2451,50 +2451,50 @@ discard block  | 
                                                    ||
| 2451 | 2451 | static $loaded_plugins = array();  | 
                                                        
| 2452 | 2452 | |
| 2453 | 2453 | $self = self::getInstance();  | 
                                                        
| 2454 | - if($plugin_name == 'ui.datepicker')  | 
                                                        |
| 2454 | + if ($plugin_name == 'ui.datepicker')  | 
                                                        |
| 2455 | 2455 |  		{ | 
                                                        
| 2456 | 2456 | $plugin_name = 'ui';  | 
                                                        
| 2457 | 2457 | }  | 
                                                        
| 2458 | 2458 | |
| 2459 | - if($loaded_plugins[$plugin_name])  | 
                                                        |
| 2459 | + if ($loaded_plugins[$plugin_name])  | 
                                                        |
| 2460 | 2460 |  		{ | 
                                                        
| 2461 | 2461 | return;  | 
                                                        
| 2462 | 2462 | }  | 
                                                        
| 2463 | 2463 | $loaded_plugins[$plugin_name] = TRUE;  | 
                                                        
| 2464 | 2464 | |
| 2465 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/';  | 
                                                        |
| 2466 | - $info_file = $plugin_path . 'plugin.load';  | 
                                                        |
| 2467 | - if(!is_readable($info_file))  | 
                                                        |
| 2465 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/';  | 
                                                        |
| 2466 | + $info_file = $plugin_path.'plugin.load';  | 
                                                        |
| 2467 | + if (!is_readable($info_file))  | 
                                                        |
| 2468 | 2468 |  		{ | 
                                                        
| 2469 | 2469 | return;  | 
                                                        
| 2470 | 2470 | }  | 
                                                        
| 2471 | 2471 | |
| 2472 | 2472 | $list = file($info_file);  | 
                                                        
| 2473 | - foreach($list as $filename)  | 
                                                        |
| 2473 | + foreach ($list as $filename)  | 
                                                        |
| 2474 | 2474 |  		{ | 
                                                        
| 2475 | 2475 | $filename = trim($filename);  | 
                                                        
| 2476 | - if(!$filename)  | 
                                                        |
| 2476 | + if (!$filename)  | 
                                                        |
| 2477 | 2477 |  			{ | 
                                                        
| 2478 | 2478 | continue;  | 
                                                        
| 2479 | 2479 | }  | 
                                                        
| 2480 | 2480 | |
| 2481 | -			if(strncasecmp('./', $filename, 2) === 0) | 
                                                        |
| 2481 | +			if (strncasecmp('./', $filename, 2) === 0) | 
                                                        |
| 2482 | 2482 |  			{ | 
                                                        
| 2483 | 2483 | $filename = substr($filename, 2);  | 
                                                        
| 2484 | 2484 | }  | 
                                                        
| 2485 | - if(substr_compare($filename, '.js', -3) === 0)  | 
                                                        |
| 2485 | + if (substr_compare($filename, '.js', -3) === 0)  | 
                                                        |
| 2486 | 2486 |  			{ | 
                                                        
| 2487 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);  | 
                                                        |
| 2487 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);  | 
                                                        |
| 2488 | 2488 | }  | 
                                                        
| 2489 | - if(substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2489 | + if (substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2490 | 2490 |  			{ | 
                                                        
| 2491 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);  | 
                                                        |
| 2491 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);  | 
                                                        |
| 2492 | 2492 | }  | 
                                                        
| 2493 | 2493 | }  | 
                                                        
| 2494 | 2494 | |
| 2495 | - if(is_dir($plugin_path . 'lang'))  | 
                                                        |
| 2495 | + if (is_dir($plugin_path.'lang'))  | 
                                                        |
| 2496 | 2496 |  		{ | 
                                                        
| 2497 | - $self->loadLang($plugin_path . 'lang');  | 
                                                        |
| 2497 | + $self->loadLang($plugin_path.'lang');  | 
                                                        |
| 2498 | 2498 | }  | 
                                                        
| 2499 | 2499 | }  | 
                                                        
| 2500 | 2500 | |
@@ -2507,7 +2507,7 @@ discard block  | 
                                                    ||
| 2507 | 2507 | function addHtmlHeader($header)  | 
                                                        
| 2508 | 2508 |  	{ | 
                                                        
| 2509 | 2509 | $self = self::getInstance();  | 
                                                        
| 2510 | - $self->html_header .= "\n" . $header;  | 
                                                        |
| 2510 | + $self->html_header .= "\n".$header;  | 
                                                        |
| 2511 | 2511 | }  | 
                                                        
| 2512 | 2512 | |
| 2513 | 2513 | function clearHtmlHeader()  | 
                                                        
@@ -2559,7 +2559,7 @@ discard block  | 
                                                    ||
| 2559 | 2559 | function addBodyHeader($header)  | 
                                                        
| 2560 | 2560 |  	{ | 
                                                        
| 2561 | 2561 | $self = self::getInstance();  | 
                                                        
| 2562 | - $self->body_header .= "\n" . $header;  | 
                                                        |
| 2562 | + $self->body_header .= "\n".$header;  | 
                                                        |
| 2563 | 2563 | }  | 
                                                        
| 2564 | 2564 | |
| 2565 | 2565 | /**  | 
                                                        
@@ -2581,7 +2581,7 @@ discard block  | 
                                                    ||
| 2581 | 2581 | function addHtmlFooter($footer)  | 
                                                        
| 2582 | 2582 |  	{ | 
                                                        
| 2583 | 2583 | $self = self::getInstance();  | 
                                                        
| 2584 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;  | 
                                                        |
| 2584 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;  | 
                                                        |
| 2585 | 2585 | }  | 
                                                        
| 2586 | 2586 | |
| 2587 | 2587 | /**  | 
                                                        
@@ -2602,7 +2602,7 @@ discard block  | 
                                                    ||
| 2602 | 2602 | */  | 
                                                        
| 2603 | 2603 | function getConfigFile()  | 
                                                        
| 2604 | 2604 |  	{ | 
                                                        
| 2605 | - return _XE_PATH_ . 'files/config/db.config.php';  | 
                                                        |
| 2605 | + return _XE_PATH_.'files/config/db.config.php';  | 
                                                        |
| 2606 | 2606 | }  | 
                                                        
| 2607 | 2607 | |
| 2608 | 2608 | /**  | 
                                                        
@@ -2612,7 +2612,7 @@ discard block  | 
                                                    ||
| 2612 | 2612 | */  | 
                                                        
| 2613 | 2613 | function getFTPConfigFile()  | 
                                                        
| 2614 | 2614 |  	{ | 
                                                        
| 2615 | - return _XE_PATH_ . 'files/config/ftp.config.php';  | 
                                                        |
| 2615 | + return _XE_PATH_.'files/config/ftp.config.php';  | 
                                                        |
| 2616 | 2616 | }  | 
                                                        
| 2617 | 2617 | |
| 2618 | 2618 | /**  | 
                                                        
@@ -2664,14 +2664,14 @@ discard block  | 
                                                    ||
| 2664 | 2664 |  		$_path = explode('/', $path); | 
                                                        
| 2665 | 2665 |  		$_base = explode('/', $base_url); | 
                                                        
| 2666 | 2666 | |
| 2667 | - if(!$_base[count($_base) - 1])  | 
                                                        |
| 2667 | + if (!$_base[count($_base) - 1])  | 
                                                        |
| 2668 | 2668 |  		{ | 
                                                        
| 2669 | 2669 | array_pop($_base);  | 
                                                        
| 2670 | 2670 | }  | 
                                                        
| 2671 | 2671 | |
| 2672 | - foreach($_xe as $idx => $dir)  | 
                                                        |
| 2672 | + foreach ($_xe as $idx => $dir)  | 
                                                        |
| 2673 | 2673 |  		{ | 
                                                        
| 2674 | - if($_path[0] != $dir)  | 
                                                        |
| 2674 | + if ($_path[0] != $dir)  | 
                                                        |
| 2675 | 2675 |  			{ | 
                                                        
| 2676 | 2676 | break;  | 
                                                        
| 2677 | 2677 | }  | 
                                                        
@@ -2679,9 +2679,9 @@ discard block  | 
                                                    ||
| 2679 | 2679 | }  | 
                                                        
| 2680 | 2680 | |
| 2681 | 2681 | $idx = count($_xe) - $idx - 1;  | 
                                                        
| 2682 | - while($idx--)  | 
                                                        |
| 2682 | + while ($idx--)  | 
                                                        |
| 2683 | 2683 |  		{ | 
                                                        
| 2684 | - if(count($_base) > 0)  | 
                                                        |
| 2684 | + if (count($_base) > 0)  | 
                                                        |
| 2685 | 2685 |  			{ | 
                                                        
| 2686 | 2686 | array_shift($_base);  | 
                                                        
| 2687 | 2687 | }  | 
                                                        
@@ -2691,13 +2691,13 @@ discard block  | 
                                                    ||
| 2691 | 2691 | }  | 
                                                        
| 2692 | 2692 | }  | 
                                                        
| 2693 | 2693 | |
| 2694 | - if(count($_base) > 0)  | 
                                                        |
| 2694 | + if (count($_base) > 0)  | 
                                                        |
| 2695 | 2695 |  		{ | 
                                                        
| 2696 | 2696 |  			array_unshift($_path, join('/', $_base)); | 
                                                        
| 2697 | 2697 | }  | 
                                                        
| 2698 | 2698 | |
| 2699 | -		$path = '/' . join('/', $_path); | 
                                                        |
| 2700 | - if(substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 2699 | +		$path = '/'.join('/', $_path); | 
                                                        |
| 2700 | + if (substr_compare($path, '/', -1) !== 0)  | 
                                                        |
| 2701 | 2701 |  		{ | 
                                                        
| 2702 | 2702 | $path .= '/';  | 
                                                        
| 2703 | 2703 | }  | 
                                                        
@@ -2712,13 +2712,13 @@ discard block  | 
                                                    ||
| 2712 | 2712 |  	{ | 
                                                        
| 2713 | 2713 | $self = self::getInstance();  | 
                                                        
| 2714 | 2714 | |
| 2715 | - if(!is_array($self->meta_tags))  | 
                                                        |
| 2715 | + if (!is_array($self->meta_tags))  | 
                                                        |
| 2716 | 2716 |  		{ | 
                                                        
| 2717 | 2717 | $self->meta_tags = array();  | 
                                                        
| 2718 | 2718 | }  | 
                                                        
| 2719 | 2719 | |
| 2720 | 2720 | $ret = array();  | 
                                                        
| 2721 | - foreach($self->meta_tags as $key => $val)  | 
                                                        |
| 2721 | + foreach ($self->meta_tags as $key => $val)  | 
                                                        |
| 2722 | 2722 |  		{ | 
                                                        
| 2723 | 2723 |  			list($name, $is_http_equiv) = explode("\t", $key); | 
                                                        
| 2724 | 2724 |  			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); | 
                                                        
@@ -2738,7 +2738,7 @@ discard block  | 
                                                    ||
| 2738 | 2738 | function addMetaTag($name, $content, $is_http_equiv = FALSE)  | 
                                                        
| 2739 | 2739 |  	{ | 
                                                        
| 2740 | 2740 | $self = self::getInstance();  | 
                                                        
| 2741 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;  | 
                                                        |
| 2741 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;  | 
                                                        |
| 2742 | 2742 | }  | 
                                                        
| 2743 | 2743 | |
| 2744 | 2744 | }  | 
                                                        
@@ -230,7 +230,9 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 303 | 304 |  			{ | 
                                                        
| 304 | 305 |  				saveCookie('lang_type', $this->lang_type, false, $_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  | 
                                                    ||
| 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 | if($this->db_info->disable_cookie_secure !== 'Y')  | 
                                                        
| 346 | 348 |  		{ | 
                                                        
| 347 | 349 |  			ini_set('session.cookie_httponly', true); | 
                                                        
@@ -407,22 +409,21 @@ discard block  | 
                                                    ||
| 407 | 409 |  						{ | 
                                                        
| 408 | 410 | $url[] = $key . '[' . $k . ']=' . urlencode($v);  | 
                                                        
| 409 | 411 | }  | 
                                                        
| 410 | - }  | 
                                                        |
| 411 | - elseif($val)  | 
                                                        |
| 412 | + } elseif($val)  | 
                                                        |
| 412 | 413 |  					{ | 
                                                        
| 413 | 414 | $url[] = $key . '=' . urlencode($val);  | 
                                                        
| 414 | 415 | }  | 
                                                        
| 415 | 416 | }  | 
                                                        
| 416 | 417 | |
| 417 | 418 | $current_url = self::getRequestUri();  | 
                                                        
| 418 | -				if($url) $current_url .= '?' . join('&', $url); | 
                                                        |
| 419 | - }  | 
                                                        |
| 420 | - else  | 
                                                        |
| 419 | +				if($url) { | 
                                                        |
| 420 | +					$current_url .= '?' . join('&', $url); | 
                                                        |
| 421 | + }  | 
                                                        |
| 422 | + } else  | 
                                                        |
| 421 | 423 |  			{ | 
                                                        
| 422 | 424 | $current_url = $this->getUrl();  | 
                                                        
| 423 | 425 | }  | 
                                                        
| 424 | - }  | 
                                                        |
| 425 | - else  | 
                                                        |
| 426 | + } else  | 
                                                        |
| 426 | 427 |  		{ | 
                                                        
| 427 | 428 | $current_url = self::getRequestUri();  | 
                                                        
| 428 | 429 | }  | 
                                                        
@@ -505,18 +506,22 @@ discard block  | 
                                                    ||
| 505 | 506 | $db_info->use_prepared_statements = 'Y';  | 
                                                        
| 506 | 507 | }  | 
                                                        
| 507 | 508 | |
| 508 | - if(!$db_info->time_zone)  | 
                                                        |
| 509 | -			$db_info->time_zone = date('O'); | 
                                                        |
| 509 | +		if(!$db_info->time_zone) { | 
                                                        |
| 510 | +					$db_info->time_zone = date('O'); | 
                                                        |
| 511 | + }  | 
                                                        |
| 510 | 512 | $GLOBALS['_time_zone'] = $db_info->time_zone;  | 
                                                        
| 511 | 513 | |
| 512 | - if($db_info->qmail_compatibility != 'Y')  | 
                                                        |
| 513 | - $db_info->qmail_compatibility = 'N';  | 
                                                        |
| 514 | +		if($db_info->qmail_compatibility != 'Y') { | 
                                                        |
| 515 | + $db_info->qmail_compatibility = 'N';  | 
                                                        |
| 516 | + }  | 
                                                        |
| 514 | 517 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;  | 
                                                        
| 515 | 518 | |
| 516 | - if(!$db_info->use_db_session)  | 
                                                        |
| 517 | - $db_info->use_db_session = 'N';  | 
                                                        |
| 518 | - if(!$db_info->use_ssl)  | 
                                                        |
| 519 | - $db_info->use_ssl = 'none';  | 
                                                        |
| 519 | +		if(!$db_info->use_db_session) { | 
                                                        |
| 520 | + $db_info->use_db_session = 'N';  | 
                                                        |
| 521 | + }  | 
                                                        |
| 522 | +		if(!$db_info->use_ssl) { | 
                                                        |
| 523 | + $db_info->use_ssl = 'none';  | 
                                                        |
| 524 | + }  | 
                                                        |
| 520 | 525 |  		$this->set('_use_ssl', $db_info->use_ssl); | 
                                                        
| 521 | 526 | |
| 522 | 527 |  		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); | 
                                                        
@@ -643,8 +648,7 @@ discard block  | 
                                                    ||
| 643 | 648 | $buff = FileHandler::readFile($orig_lang_file);  | 
                                                        
| 644 | 649 | FileHandler::writeFile($selected_lang_file, $buff);  | 
                                                        
| 645 | 650 | $lang_selected = self::loadLangSupported();  | 
                                                        
| 646 | - }  | 
                                                        |
| 647 | - else  | 
                                                        |
| 651 | + } else  | 
                                                        |
| 648 | 652 |  			{ | 
                                                        
| 649 | 653 | $langs = file($selected_lang_file);  | 
                                                        
| 650 | 654 | foreach($langs as $val)  | 
                                                        
@@ -703,15 +707,16 @@ discard block  | 
                                                    ||
| 703 | 707 | |
| 704 | 708 |  				$oModuleModel = getModel('module'); | 
                                                        
| 705 | 709 | $domain = $url_info['host'] . $url_info['path'];  | 
                                                        
| 706 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);  | 
                                                        |
| 710 | +				if(substr_compare($domain, '/', -1) === 0) { | 
                                                        |
| 711 | + $domain = substr($domain, 0, -1);  | 
                                                        |
| 712 | + }  | 
                                                        |
| 707 | 713 | $site_info = $oModuleModel->getSiteInfoByDomain($domain);  | 
                                                        
| 708 | 714 | |
| 709 | 715 | if($site_info->site_srl)  | 
                                                        
| 710 | 716 |  				{ | 
                                                        
| 711 | 717 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));  | 
                                                        
| 712 | 718 |  				$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']); | 
                                                        
| 713 | - }  | 
                                                        |
| 714 | - else  | 
                                                        |
| 719 | + } else  | 
                                                        |
| 715 | 720 |  				{ | 
                                                        
| 716 | 721 | $redirect_url = $url;  | 
                                                        
| 717 | 722 | }  | 
                                                        
@@ -720,8 +725,7 @@ discard block  | 
                                                    ||
| 720 | 725 | return FALSE;  | 
                                                        
| 721 | 726 | }  | 
                                                        
| 722 | 727 | // for sites requesting SSO validation  | 
                                                        
| 723 | - }  | 
                                                        |
| 724 | - else  | 
                                                        |
| 728 | + } else  | 
                                                        |
| 725 | 729 |  		{ | 
                                                        
| 726 | 730 | // result handling : set session_name()  | 
                                                        
| 727 | 731 |  			if($session_name = self::get('SSOID')) | 
                                                        
@@ -738,8 +742,7 @@ discard block  | 
                                                    ||
| 738 | 742 |  				header('location:' . $url); | 
                                                        
| 739 | 743 | return FALSE;  | 
                                                        
| 740 | 744 | // send SSO request  | 
                                                        
| 741 | - }  | 
                                                        |
| 742 | -			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | 
                                                        |
| 745 | +			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | 
                                                        |
| 743 | 746 |  			{ | 
                                                        
| 744 | 747 |  				saveCookie('sso', md5(self::getRequestUri()), true); | 
                                                        
| 745 | 748 | $origin_url = self::getRequestUrl();  | 
                                                        
@@ -799,8 +802,7 @@ discard block  | 
                                                    ||
| 799 | 802 | if($self->site_title)  | 
                                                        
| 800 | 803 |  		{ | 
                                                        
| 801 | 804 | $self->site_title .= ' - ' . $site_title;  | 
                                                        
| 802 | - }  | 
                                                        |
| 803 | - else  | 
                                                        |
| 805 | + } else  | 
                                                        |
| 804 | 806 |  		{ | 
                                                        
| 805 | 807 | $self->site_title = $site_title;  | 
                                                        
| 806 | 808 | }  | 
                                                        
@@ -900,8 +902,7 @@ discard block  | 
                                                    ||
| 900 | 902 |  		{ | 
                                                        
| 901 | 903 | $self->loaded_lang_files[] = $filename;  | 
                                                        
| 902 | 904 | include($filename);  | 
                                                        
| 903 | - }  | 
                                                        |
| 904 | - else  | 
                                                        |
| 905 | + } else  | 
                                                        |
| 905 | 906 |  		{ | 
                                                        
| 906 | 907 | $self->_evalxmlLang($path);  | 
                                                        
| 907 | 908 | }  | 
                                                        
@@ -917,7 +918,9 @@ discard block  | 
                                                    ||
| 917 | 918 |  	{ | 
                                                        
| 918 | 919 | global $lang;  | 
                                                        
| 919 | 920 | |
| 920 | - if(!$path) return;  | 
                                                        |
| 921 | +		if(!$path) { | 
                                                        |
| 922 | + return;  | 
                                                        |
| 923 | + }  | 
                                                        |
| 921 | 924 | |
| 922 | 925 | $_path = 'eval://' . $path;  | 
                                                        
| 923 | 926 | |
@@ -949,7 +952,9 @@ discard block  | 
                                                    ||
| 949 | 952 | */  | 
                                                        
| 950 | 953 | function _loadXmlLang($path)  | 
                                                        
| 951 | 954 |  	{ | 
                                                        
| 952 | - if(!$path) return;  | 
                                                        |
| 955 | +		if(!$path) { | 
                                                        |
| 956 | + return;  | 
                                                        |
| 957 | + }  | 
                                                        |
| 953 | 958 | |
| 954 | 959 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);  | 
                                                        
| 955 | 960 | return $oXmlLangParser->compile();  | 
                                                        
@@ -963,7 +968,9 @@ discard block  | 
                                                    ||
| 963 | 968 | */  | 
                                                        
| 964 | 969 | function _loadPhpLang($path)  | 
                                                        
| 965 | 970 |  	{ | 
                                                        
| 966 | - if(!$path) return;  | 
                                                        |
| 971 | +		if(!$path) { | 
                                                        |
| 972 | + return;  | 
                                                        |
| 973 | + }  | 
                                                        |
| 967 | 974 | |
| 968 | 975 | if(substr_compare($path, '/', -1) !== 0)  | 
                                                        
| 969 | 976 |  		{ | 
                                                        
@@ -1096,12 +1103,14 @@ discard block  | 
                                                    ||
| 1096 | 1103 | static $flag = TRUE;  | 
                                                        
| 1097 | 1104 | if($charset)  | 
                                                        
| 1098 | 1105 |  		{ | 
                                                        
| 1099 | - if(is_array($val))  | 
                                                        |
| 1100 | - array_walk($val,'Context::checkConvertFlag',$charset);  | 
                                                        |
| 1101 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;  | 
                                                        |
| 1102 | - else $flag = FALSE;  | 
                                                        |
| 1103 | - }  | 
                                                        |
| 1104 | - else  | 
                                                        |
| 1106 | +			if(is_array($val)) { | 
                                                        |
| 1107 | + array_walk($val,'Context::checkConvertFlag',$charset);  | 
                                                        |
| 1108 | +			} else if($val && iconv($charset,$charset,$val)!=$val) { | 
                                                        |
| 1109 | + $flag = FALSE;  | 
                                                        |
| 1110 | +			} else { | 
                                                        |
| 1111 | + $flag = FALSE;  | 
                                                        |
| 1112 | + }  | 
                                                        |
| 1113 | + } else  | 
                                                        |
| 1105 | 1114 |  		{ | 
                                                        
| 1106 | 1115 | $return = $flag;  | 
                                                        
| 1107 | 1116 | $flag = TRUE;  | 
                                                        
@@ -1123,8 +1132,9 @@ discard block  | 
                                                    ||
| 1123 | 1132 | if (is_array($val))  | 
                                                        
| 1124 | 1133 |  		{ | 
                                                        
| 1125 | 1134 | array_walk($val,'Context::doConvertEncoding',$charset);  | 
                                                        
| 1135 | +		} else { | 
                                                        |
| 1136 | + $val = iconv($charset,'UTF-8',$val);  | 
                                                        |
| 1126 | 1137 | }  | 
                                                        
| 1127 | - else $val = iconv($charset,'UTF-8',$val);  | 
                                                        |
| 1128 | 1138 | }  | 
                                                        
| 1129 | 1139 | |
| 1130 | 1140 | /**  | 
                                                        
@@ -1135,7 +1145,9 @@ discard block  | 
                                                    ||
| 1135 | 1145 | */  | 
                                                        
| 1136 | 1146 | function convertEncodingStr($str)  | 
                                                        
| 1137 | 1147 |  	{ | 
                                                        
| 1138 | - if(!$str) return null;  | 
                                                        |
| 1148 | +        if(!$str) { | 
                                                        |
| 1149 | + return null;  | 
                                                        |
| 1150 | + }  | 
                                                        |
| 1139 | 1151 | $obj = new stdClass();  | 
                                                        
| 1140 | 1152 | $obj->str = $str;  | 
                                                        
| 1141 | 1153 | $obj = self::convertEncoding($obj);  | 
                                                        
@@ -1248,16 +1260,13 @@ discard block  | 
                                                    ||
| 1248 | 1260 | if($requestMethod == 'GET' && isset($_GET[$key]))  | 
                                                        
| 1249 | 1261 |  			{ | 
                                                        
| 1250 | 1262 | $set_to_vars = TRUE;  | 
                                                        
| 1251 | - }  | 
                                                        |
| 1252 | - elseif($requestMethod == 'POST' && isset($_POST[$key]))  | 
                                                        |
| 1263 | + } elseif($requestMethod == 'POST' && isset($_POST[$key]))  | 
                                                        |
| 1253 | 1264 |  			{ | 
                                                        
| 1254 | 1265 | $set_to_vars = TRUE;  | 
                                                        
| 1255 | - }  | 
                                                        |
| 1256 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))  | 
                                                        |
| 1266 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))  | 
                                                        |
| 1257 | 1267 |  			{ | 
                                                        
| 1258 | 1268 | $set_to_vars = TRUE;  | 
                                                        
| 1259 | - }  | 
                                                        |
| 1260 | - else  | 
                                                        |
| 1269 | + } else  | 
                                                        |
| 1261 | 1270 |  			{ | 
                                                        
| 1262 | 1271 | $set_to_vars = FALSE;  | 
                                                        
| 1263 | 1272 | }  | 
                                                        
@@ -1283,8 +1292,7 @@ discard block  | 
                                                    ||
| 1283 | 1292 | return;  | 
                                                        
| 1284 | 1293 | }  | 
                                                        
| 1285 | 1294 | }  | 
                                                        
| 1286 | - }  | 
                                                        |
| 1287 | - else if(is_array($val))  | 
                                                        |
| 1295 | + } else if(is_array($val))  | 
                                                        |
| 1288 | 1296 |  		{ | 
                                                        
| 1289 | 1297 | foreach($val as $val2)  | 
                                                        
| 1290 | 1298 |  			{ | 
                                                        
@@ -1424,24 +1432,19 @@ discard block  | 
                                                    ||
| 1424 | 1432 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)  | 
                                                        
| 1425 | 1433 |  			{ | 
                                                        
| 1426 | 1434 |  				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; | 
                                                        
| 1427 | - }  | 
                                                        |
| 1428 | - elseif($key === 'mid' || $key === 'search_keyword')  | 
                                                        |
| 1435 | + } elseif($key === 'mid' || $key === 'search_keyword')  | 
                                                        |
| 1429 | 1436 |  			{ | 
                                                        
| 1430 | 1437 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1431 | - }  | 
                                                        |
| 1432 | - elseif($key === 'vid')  | 
                                                        |
| 1438 | + } elseif($key === 'vid')  | 
                                                        |
| 1433 | 1439 |  			{ | 
                                                        
| 1434 | 1440 | $result[$k] = urlencode($v);  | 
                                                        
| 1435 | - }  | 
                                                        |
| 1436 | - elseif($key === 'xe_validator_id')  | 
                                                        |
| 1441 | + } elseif($key === 'xe_validator_id')  | 
                                                        |
| 1437 | 1442 |  			{ | 
                                                        
| 1438 | 1443 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1439 | - }  | 
                                                        |
| 1440 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)  | 
                                                        |
| 1444 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)  | 
                                                        |
| 1441 | 1445 |  			{ | 
                                                        
| 1442 | 1446 | unset($result[$k]);  | 
                                                        
| 1443 | - }  | 
                                                        |
| 1444 | - else  | 
                                                        |
| 1447 | + } else  | 
                                                        |
| 1445 | 1448 |  			{ | 
                                                        
| 1446 | 1449 | $result[$k] = $v;  | 
                                                        
| 1447 | 1450 | |
@@ -1450,8 +1453,7 @@ discard block  | 
                                                    ||
| 1450 | 1453 | if (is_array($result[$k]))  | 
                                                        
| 1451 | 1454 |  					{ | 
                                                        
| 1452 | 1455 |  						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); | 
                                                        
| 1453 | - }  | 
                                                        |
| 1454 | - else  | 
                                                        |
| 1456 | + } else  | 
                                                        |
| 1455 | 1457 |  					{ | 
                                                        
| 1456 | 1458 | $result[$k] = stripslashes($result[$k]);  | 
                                                        
| 1457 | 1459 | }  | 
                                                        
@@ -1460,8 +1462,7 @@ discard block  | 
                                                    ||
| 1460 | 1462 | if(is_array($result[$k]))  | 
                                                        
| 1461 | 1463 |  				{ | 
                                                        
| 1462 | 1464 |  					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); | 
                                                        
| 1463 | - }  | 
                                                        |
| 1464 | - else  | 
                                                        |
| 1465 | + } else  | 
                                                        |
| 1465 | 1466 |  				{ | 
                                                        
| 1466 | 1467 | $result[$k] = trim($result[$k]);  | 
                                                        
| 1467 | 1468 | }  | 
                                                        
@@ -1506,8 +1507,7 @@ discard block  | 
                                                    ||
| 1506 | 1507 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);  | 
                                                        
| 1507 | 1508 | $this->set($key, $val, TRUE);  | 
                                                        
| 1508 | 1509 | $this->is_uploaded = TRUE;  | 
                                                        
| 1509 | - }  | 
                                                        |
| 1510 | - else  | 
                                                        |
| 1510 | + } else  | 
                                                        |
| 1511 | 1511 |  			{ | 
                                                        
| 1512 | 1512 | $files = array();  | 
                                                        
| 1513 | 1513 | $count_files = count($tmp_name);  | 
                                                        
@@ -1525,7 +1525,9 @@ discard block  | 
                                                    ||
| 1525 | 1525 | $files[] = $file;  | 
                                                        
| 1526 | 1526 | }  | 
                                                        
| 1527 | 1527 | }  | 
                                                        
| 1528 | - if($files) $this->set($key, $files, TRUE);  | 
                                                        |
| 1528 | +				if($files) { | 
                                                        |
| 1529 | + $this->set($key, $files, TRUE);  | 
                                                        |
| 1530 | + }  | 
                                                        |
| 1529 | 1531 | }  | 
                                                        
| 1530 | 1532 | }  | 
                                                        
| 1531 | 1533 | }  | 
                                                        
@@ -1617,8 +1619,7 @@ discard block  | 
                                                    ||
| 1617 | 1619 | if($site_module_info->domain && isSiteID($site_module_info->domain))  | 
                                                        
| 1618 | 1620 |  			{ | 
                                                        
| 1619 | 1621 | $vid = $site_module_info->domain;  | 
                                                        
| 1620 | - }  | 
                                                        |
| 1621 | - else  | 
                                                        |
| 1622 | + } else  | 
                                                        |
| 1622 | 1623 |  			{ | 
                                                        
| 1623 | 1624 | $domain = $site_module_info->domain;  | 
                                                        
| 1624 | 1625 | }  | 
                                                        
@@ -1635,8 +1636,7 @@ discard block  | 
                                                    ||
| 1635 | 1636 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])  | 
                                                        
| 1636 | 1637 |  			{ | 
                                                        
| 1637 | 1638 | unset($domain);  | 
                                                        
| 1638 | - }  | 
                                                        |
| 1639 | - else  | 
                                                        |
| 1639 | + } else  | 
                                                        |
| 1640 | 1640 |  			{ | 
                                                        
| 1641 | 1641 |  				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); | 
                                                        
| 1642 | 1642 | if(substr_compare($domain, '/', -1) !== 0)  | 
                                                        
@@ -1656,23 +1656,35 @@ discard block  | 
                                                    ||
| 1656 | 1656 |  			{ | 
                                                        
| 1657 | 1657 | array_shift($args_list);  | 
                                                        
| 1658 | 1658 | }  | 
                                                        
| 1659 | - }  | 
                                                        |
| 1660 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 1659 | + } elseif($_SERVER['REQUEST_METHOD'] == 'GET')  | 
                                                        |
| 1661 | 1660 |  		{ | 
                                                        
| 1662 | 1661 | // Otherwise, make GET variables into array  | 
                                                        
| 1663 | 1662 | $get_vars = get_object_vars($self->get_vars);  | 
                                                        
| 1664 | - }  | 
                                                        |
| 1665 | - else  | 
                                                        |
| 1663 | + } else  | 
                                                        |
| 1666 | 1664 |  		{ | 
                                                        
| 1667 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;  | 
                                                        |
| 1668 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;  | 
                                                        |
| 1669 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;  | 
                                                        |
| 1670 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;  | 
                                                        |
| 1671 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;  | 
                                                        |
| 1672 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;  | 
                                                        |
| 1665 | +			if(!!$self->get_vars->module) { | 
                                                        |
| 1666 | + $get_vars['module'] = $self->get_vars->module;  | 
                                                        |
| 1667 | + }  | 
                                                        |
| 1668 | +			if(!!$self->get_vars->mid) { | 
                                                        |
| 1669 | + $get_vars['mid'] = $self->get_vars->mid;  | 
                                                        |
| 1670 | + }  | 
                                                        |
| 1671 | +			if(!!$self->get_vars->act) { | 
                                                        |
| 1672 | + $get_vars['act'] = $self->get_vars->act;  | 
                                                        |
| 1673 | + }  | 
                                                        |
| 1674 | +			if(!!$self->get_vars->page) { | 
                                                        |
| 1675 | + $get_vars['page'] = $self->get_vars->page;  | 
                                                        |
| 1676 | + }  | 
                                                        |
| 1677 | +			if(!!$self->get_vars->search_target) { | 
                                                        |
| 1678 | + $get_vars['search_target'] = $self->get_vars->search_target;  | 
                                                        |
| 1679 | + }  | 
                                                        |
| 1680 | +			if(!!$self->get_vars->search_keyword) { | 
                                                        |
| 1681 | + $get_vars['search_keyword'] = $self->get_vars->search_keyword;  | 
                                                        |
| 1682 | + }  | 
                                                        |
| 1673 | 1683 | if($get_vars['act'] == 'IS')  | 
                                                        
| 1674 | 1684 |  			{ | 
                                                        
| 1675 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;  | 
                                                        |
| 1685 | +				if(!!$self->get_vars->is_keyword) { | 
                                                        |
| 1686 | + $get_vars['is_keyword'] = $self->get_vars->is_keyword;  | 
                                                        |
| 1687 | + }  | 
                                                        |
| 1676 | 1688 | }  | 
                                                        
| 1677 | 1689 | }  | 
                                                        
| 1678 | 1690 | |
@@ -1697,8 +1709,7 @@ discard block  | 
                                                    ||
| 1697 | 1709 | if($vid)  | 
                                                        
| 1698 | 1710 |  		{ | 
                                                        
| 1699 | 1711 | $get_vars['vid'] = $vid;  | 
                                                        
| 1700 | - }  | 
                                                        |
| 1701 | - else  | 
                                                        |
| 1712 | + } else  | 
                                                        |
| 1702 | 1713 |  		{ | 
                                                        
| 1703 | 1714 | unset($get_vars['vid']);  | 
                                                        
| 1704 | 1715 | }  | 
                                                        
@@ -1770,8 +1781,7 @@ discard block  | 
                                                    ||
| 1770 | 1781 |  						{ | 
                                                        
| 1771 | 1782 | $queries[] = $key . '[' . $k . ']=' . urlencode($v);  | 
                                                        
| 1772 | 1783 | }  | 
                                                        
| 1773 | - }  | 
                                                        |
| 1774 | - elseif(!is_array($val))  | 
                                                        |
| 1784 | + } elseif(!is_array($val))  | 
                                                        |
| 1775 | 1785 |  					{ | 
                                                        
| 1776 | 1786 | $queries[] = $key . '=' . urlencode($val);  | 
                                                        
| 1777 | 1787 | }  | 
                                                        
@@ -1789,25 +1799,23 @@ discard block  | 
                                                    ||
| 1789 | 1799 |  		{ | 
                                                        
| 1790 | 1800 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;  | 
                                                        
| 1791 | 1801 | // optional SSL use  | 
                                                        
| 1792 | - }  | 
                                                        |
| 1793 | - elseif($_use_ssl == 'optional')  | 
                                                        |
| 1802 | + } elseif($_use_ssl == 'optional')  | 
                                                        |
| 1794 | 1803 |  		{ | 
                                                        
| 1795 | 1804 |  			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; | 
                                                        
| 1796 | 1805 | $query = $self->getRequestUri($ssl_mode, $domain) . $query;  | 
                                                        
| 1797 | 1806 | // no SSL  | 
                                                        
| 1798 | - }  | 
                                                        |
| 1799 | - else  | 
                                                        |
| 1807 | + } else  | 
                                                        |
| 1800 | 1808 |  		{ | 
                                                        
| 1801 | 1809 | // currently on SSL but target is not based on SSL  | 
                                                        
| 1802 | 1810 | if($_SERVER['HTTPS'] == 'on')  | 
                                                        
| 1803 | 1811 |  			{ | 
                                                        
| 1804 | 1812 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;  | 
                                                        
| 1805 | - }  | 
                                                        |
| 1806 | - else if($domain) // if $domain is set  | 
                                                        |
| 1813 | +			} else if($domain) { | 
                                                        |
| 1814 | + // if $domain is set  | 
                                                        |
| 1807 | 1815 |  			{ | 
                                                        
| 1808 | 1816 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;  | 
                                                        
| 1809 | 1817 | }  | 
                                                        
| 1810 | - else  | 
                                                        |
| 1818 | + } else  | 
                                                        |
| 1811 | 1819 |  			{ | 
                                                        
| 1812 | 1820 | $query = getScriptPath() . $query;  | 
                                                        
| 1813 | 1821 | }  | 
                                                        
@@ -1864,8 +1872,7 @@ discard block  | 
                                                    ||
| 1864 | 1872 | if($domain)  | 
                                                        
| 1865 | 1873 |  		{ | 
                                                        
| 1866 | 1874 | $domain_key = md5($domain);  | 
                                                        
| 1867 | - }  | 
                                                        |
| 1868 | - else  | 
                                                        |
| 1875 | + } else  | 
                                                        |
| 1869 | 1876 |  		{ | 
                                                        
| 1870 | 1877 | $domain_key = 'default';  | 
                                                        
| 1871 | 1878 | }  | 
                                                        
@@ -1894,8 +1901,7 @@ discard block  | 
                                                    ||
| 1894 | 1901 |  			{ | 
                                                        
| 1895 | 1902 | $target_url.= '/';  | 
                                                        
| 1896 | 1903 | }  | 
                                                        
| 1897 | - }  | 
                                                        |
| 1898 | - else  | 
                                                        |
| 1904 | + } else  | 
                                                        |
| 1899 | 1905 |  		{ | 
                                                        
| 1900 | 1906 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath();  | 
                                                        
| 1901 | 1907 | }  | 
                                                        
@@ -1913,20 +1919,17 @@ discard block  | 
                                                    ||
| 1913 | 1919 | if($port && $port != 443)  | 
                                                        
| 1914 | 1920 |  			{ | 
                                                        
| 1915 | 1921 | $url_info['port'] = $port;  | 
                                                        
| 1916 | - }  | 
                                                        |
| 1917 | - elseif($url_info['port'] == 443)  | 
                                                        |
| 1922 | + } elseif($url_info['port'] == 443)  | 
                                                        |
| 1918 | 1923 |  			{ | 
                                                        
| 1919 | 1924 | unset($url_info['port']);  | 
                                                        
| 1920 | 1925 | }  | 
                                                        
| 1921 | - }  | 
                                                        |
| 1922 | - else  | 
                                                        |
| 1926 | + } else  | 
                                                        |
| 1923 | 1927 |  		{ | 
                                                        
| 1924 | 1928 |  			$port = self::get('_http_port'); | 
                                                        
| 1925 | 1929 | if($port && $port != 80)  | 
                                                        
| 1926 | 1930 |  			{ | 
                                                        
| 1927 | 1931 | $url_info['port'] = $port;  | 
                                                        
| 1928 | - }  | 
                                                        |
| 1929 | - elseif($url_info['port'] == 80)  | 
                                                        |
| 1932 | + } elseif($url_info['port'] == 80)  | 
                                                        |
| 1930 | 1933 |  			{ | 
                                                        
| 1931 | 1934 | unset($url_info['port']);  | 
                                                        
| 1932 | 1935 | }  | 
                                                        
@@ -2163,8 +2166,7 @@ discard block  | 
                                                    ||
| 2163 | 2166 | if(strpos($file, './') === 0)  | 
                                                        
| 2164 | 2167 |  		{ | 
                                                        
| 2165 | 2168 | $file = $script_path . substr($file, 2);  | 
                                                        
| 2166 | - }  | 
                                                        |
| 2167 | - elseif(strpos($file, '../') === 0)  | 
                                                        |
| 2169 | + } elseif(strpos($file, '../') === 0)  | 
                                                        |
| 2168 | 2170 |  		{ | 
                                                        
| 2169 | 2171 | $file = self::normalizeFilePath($script_path . $file);  | 
                                                        
| 2170 | 2172 | }  | 
                                                        
@@ -2426,8 +2428,7 @@ discard block  | 
                                                    ||
| 2426 | 2428 | if(substr_compare($filename, '.js', -3) === 0)  | 
                                                        
| 2427 | 2429 |  			{ | 
                                                        
| 2428 | 2430 | $result->jsList[] = $plugin_path . $filename;  | 
                                                        
| 2429 | - }  | 
                                                        |
| 2430 | - elseif(substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2431 | + } elseif(substr_compare($filename, '.css', -4) === 0)  | 
                                                        |
| 2431 | 2432 |  			{ | 
                                                        
| 2432 | 2433 | $result->cssList[] = $plugin_path . $filename;  | 
                                                        
| 2433 | 2434 | }  | 
                                                        
@@ -2684,8 +2685,7 @@ discard block  | 
                                                    ||
| 2684 | 2685 | if(count($_base) > 0)  | 
                                                        
| 2685 | 2686 |  			{ | 
                                                        
| 2686 | 2687 | array_shift($_base);  | 
                                                        
| 2687 | - }  | 
                                                        |
| 2688 | - else  | 
                                                        |
| 2688 | + } else  | 
                                                        |
| 2689 | 2689 |  			{ | 
                                                        
| 2690 | 2690 | array_unshift($_base, '..');  | 
                                                        
| 2691 | 2691 | }  | 
                                                        
@@ -28,7 +28,7 @@ discard block  | 
                                                    ||
| 28 | 28 |  	{ | 
                                                        
| 29 | 29 | $db_info = Context::getDBInfo();  | 
                                                        
| 30 | 30 | |
| 31 | - if(strpos($db_info->default_url, 'xn--') !== FALSE)  | 
                                                        |
| 31 | + if (strpos($db_info->default_url, 'xn--') !== FALSE)  | 
                                                        |
| 32 | 32 |  		{ | 
                                                        
| 33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url);  | 
                                                        
| 34 | 34 | }  | 
                                                        
@@ -48,13 +48,13 @@ discard block  | 
                                                    ||
| 48 | 48 | // forbit access if the user is not an administrator  | 
                                                        
| 49 | 49 |  		$oMemberModel = getModel('member'); | 
                                                        
| 50 | 50 | $logged_info = $oMemberModel->getLoggedInfo();  | 
                                                        
| 51 | - if($logged_info->is_admin != 'Y')  | 
                                                        |
| 51 | + if ($logged_info->is_admin != 'Y')  | 
                                                        |
| 52 | 52 |  		{ | 
                                                        
| 53 | 53 |  			return $this->stop("msg_is_not_administrator"); | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | // change into administration layout  | 
                                                        
| 57 | - $this->setTemplatePath($this->module_path . 'tpl');  | 
                                                        |
| 57 | + $this->setTemplatePath($this->module_path.'tpl');  | 
                                                        |
| 58 | 58 | $this->setLayoutPath($this->getTemplatePath());  | 
                                                        
| 59 | 59 |  		$this->setLayoutFile('layout.html'); | 
                                                        
| 60 | 60 | |
@@ -76,11 +76,11 @@ discard block  | 
                                                    ||
| 76 | 76 |  		Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); | 
                                                        
| 77 | 77 |  		Context::set('disable_csrf_token', $db_info->disable_csrf_token); | 
                                                        
| 78 | 78 |  		Context::set('disable_cookie_secure', $db_info->disable_cookie_secure); | 
                                                        
| 79 | - if($db_info->http_port)  | 
                                                        |
| 79 | + if ($db_info->http_port)  | 
                                                        |
| 80 | 80 |  		{ | 
                                                        
| 81 | 81 |  			Context::set('http_port', $db_info->http_port); | 
                                                        
| 82 | 82 | }  | 
                                                        
| 83 | - if($db_info->https_port)  | 
                                                        |
| 83 | + if ($db_info->https_port)  | 
                                                        |
| 84 | 84 |  		{ | 
                                                        
| 85 | 85 |  			Context::set('https_port', $db_info->https_port); | 
                                                        
| 86 | 86 | }  | 
                                                        
@@ -96,7 +96,7 @@ discard block  | 
                                                    ||
| 96 | 96 | function checkEasyinstall()  | 
                                                        
| 97 | 97 |  	{ | 
                                                        
| 98 | 98 | $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile);  | 
                                                        
| 99 | - if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30)  | 
                                                        |
| 99 | + if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30)  | 
                                                        |
| 100 | 100 |  		{ | 
                                                        
| 101 | 101 | return;  | 
                                                        
| 102 | 102 | }  | 
                                                        
@@ -110,14 +110,14 @@ discard block  | 
                                                    ||
| 110 | 110 | $lUpdateDoc = $xml_lUpdate->parse($buff);  | 
                                                        
| 111 | 111 | $updateDate = $lUpdateDoc->response->updatedate->body;  | 
                                                        
| 112 | 112 | |
| 113 | - if(!$updateDate)  | 
                                                        |
| 113 | + if (!$updateDate)  | 
                                                        |
| 114 | 114 |  		{ | 
                                                        
| 115 | 115 | $this->_markingCheckEasyinstall();  | 
                                                        
| 116 | 116 | return;  | 
                                                        
| 117 | 117 | }  | 
                                                        
| 118 | 118 | |
| 119 | 119 | $item = $oAutoinstallModel->getLatestPackage();  | 
                                                        
| 120 | - if(!$item || $item->updatedate < $updateDate)  | 
                                                        |
| 120 | + if (!$item || $item->updatedate < $updateDate)  | 
                                                        |
| 121 | 121 |  		{ | 
                                                        
| 122 | 122 |  			$oController = getAdminController('autoinstall'); | 
                                                        
| 123 | 123 | $oController->_updateinfo();  | 
                                                        
@@ -146,7 +146,7 @@ discard block  | 
                                                    ||
| 146 | 146 | |
| 147 | 147 | // Check is_shortcut column  | 
                                                        
| 148 | 148 | $oDB = DB::getInstance();  | 
                                                        
| 149 | -		if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) | 
                                                        |
| 149 | +		if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) | 
                                                        |
| 150 | 150 |  		{ | 
                                                        
| 151 | 151 | return;  | 
                                                        
| 152 | 152 | }  | 
                                                        
@@ -164,9 +164,9 @@ discard block  | 
                                                    ||
| 164 | 164 |  		$currentAct = Context::get('act'); | 
                                                        
| 165 | 165 | $subMenuTitle = '';  | 
                                                        
| 166 | 166 | |
| 167 | - foreach((array) $moduleActionInfo->menu as $key => $value)  | 
                                                        |
| 167 | + foreach ((array) $moduleActionInfo->menu as $key => $value)  | 
                                                        |
| 168 | 168 |  		{ | 
                                                        
| 169 | - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts))  | 
                                                        |
| 169 | + if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts))  | 
                                                        |
| 170 | 170 |  			{ | 
                                                        
| 171 | 171 | $subMenuTitle = $value->title;  | 
                                                        
| 172 | 172 | break;  | 
                                                        
@@ -175,21 +175,21 @@ discard block  | 
                                                    ||
| 175 | 175 | // get current menu's srl(=parentSrl)  | 
                                                        
| 176 | 176 | $parentSrl = 0;  | 
                                                        
| 177 | 177 |  		$oMenuAdminConroller = getAdminController('menu'); | 
                                                        
| 178 | - foreach((array) $menu->list as $parentKey => $parentMenu)  | 
                                                        |
| 178 | + foreach ((array) $menu->list as $parentKey => $parentMenu)  | 
                                                        |
| 179 | 179 |  		{ | 
                                                        
| 180 | - if(!is_array($parentMenu['list']) || !count($parentMenu['list']))  | 
                                                        |
| 180 | + if (!is_array($parentMenu['list']) || !count($parentMenu['list']))  | 
                                                        |
| 181 | 181 |  			{ | 
                                                        
| 182 | 182 | continue;  | 
                                                        
| 183 | 183 | }  | 
                                                        
| 184 | - if($parentMenu['href'] == '#' && count($parentMenu['list']))  | 
                                                        |
| 184 | + if ($parentMenu['href'] == '#' && count($parentMenu['list']))  | 
                                                        |
| 185 | 185 |  			{ | 
                                                        
| 186 | 186 | $firstChild = current($parentMenu['list']);  | 
                                                        
| 187 | 187 | $menu->list[$parentKey]['href'] = $firstChild['href'];  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | |
| 190 | - foreach($parentMenu['list'] as $childKey => $childMenu)  | 
                                                        |
| 190 | + foreach ($parentMenu['list'] as $childKey => $childMenu)  | 
                                                        |
| 191 | 191 |  			{ | 
                                                        
| 192 | - if($subMenuTitle == $childMenu['text'] && $parentSrl == 0)  | 
                                                        |
| 192 | + if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0)  | 
                                                        |
| 193 | 193 |  				{ | 
                                                        
| 194 | 194 | $parentSrl = $childMenu['parent_srl'];  | 
                                                        
| 195 | 195 | }  | 
                                                        
@@ -202,7 +202,7 @@ discard block  | 
                                                    ||
| 202 | 202 | $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin';  | 
                                                        
| 203 | 203 | $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png';  | 
                                                        
| 204 | 204 | |
| 205 | - $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle;  | 
                                                        |
| 205 | + $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle;  | 
                                                        |
| 206 | 206 | |
| 207 | 207 | // Get list of favorite  | 
                                                        
| 208 | 208 |  		$oAdminAdminModel = getAdminModel('admin'); | 
                                                        
@@ -213,7 +213,7 @@ discard block  | 
                                                    ||
| 213 | 213 | // move from index method, because use in admin footer  | 
                                                        
| 214 | 214 |  		$newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); | 
                                                        
| 215 | 215 |  		$cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); | 
                                                        
| 216 | - if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME'])  | 
                                                        |
| 216 | + if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME'])  | 
                                                        |
| 217 | 217 |  		{ | 
                                                        
| 218 | 218 | // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page  | 
                                                        
| 219 | 219 | // Ensure to access the administration page even though news cannot be displayed  | 
                                                        
@@ -221,20 +221,20 @@ discard block  | 
                                                    ||
| 221 | 221 |  			FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); | 
                                                        
| 222 | 222 | }  | 
                                                        
| 223 | 223 | |
| 224 | - if(file_exists($cache_file))  | 
                                                        |
| 224 | + if (file_exists($cache_file))  | 
                                                        |
| 225 | 225 |  		{ | 
                                                        
| 226 | 226 | $oXml = new XmlParser();  | 
                                                        
| 227 | 227 | $buff = $oXml->parse(FileHandler::readFile($cache_file));  | 
                                                        
| 228 | 228 | |
| 229 | 229 | $item = $buff->zbxe_news->item;  | 
                                                        
| 230 | - if($item)  | 
                                                        |
| 230 | + if ($item)  | 
                                                        |
| 231 | 231 |  			{ | 
                                                        
| 232 | - if(!is_array($item))  | 
                                                        |
| 232 | + if (!is_array($item))  | 
                                                        |
| 233 | 233 |  				{ | 
                                                        
| 234 | 234 | $item = array($item);  | 
                                                        
| 235 | 235 | }  | 
                                                        
| 236 | 236 | |
| 237 | - foreach($item as $key => $val)  | 
                                                        |
| 237 | + foreach ($item as $key => $val)  | 
                                                        |
| 238 | 238 |  				{ | 
                                                        
| 239 | 239 | $obj = new stdClass();  | 
                                                        
| 240 | 240 | $obj->title = $val->body;  | 
                                                        
@@ -243,7 +243,7 @@ discard block  | 
                                                    ||
| 243 | 243 | $news[] = $obj;  | 
                                                        
| 244 | 244 | }  | 
                                                        
| 245 | 245 |  				Context::set('news', $news); | 
                                                        
| 246 | - if(isset($news) && is_array($news))  | 
                                                        |
| 246 | + if (isset($news) && is_array($news))  | 
                                                        |
| 247 | 247 |  				{ | 
                                                        
| 248 | 248 |  					Context::set('latestVersion', array_shift($news)); | 
                                                        
| 249 | 249 | }  | 
                                                        
@@ -266,7 +266,7 @@ discard block  | 
                                                    ||
| 266 | 266 | function dispAdminIndex()  | 
                                                        
| 267 | 267 |  	{ | 
                                                        
| 268 | 268 | $db_info = Context::getDBInfo();  | 
                                                        
| 269 | -		Context::set('db_info',$db_info); | 
                                                        |
| 269 | +		Context::set('db_info', $db_info); | 
                                                        |
| 270 | 270 | |
| 271 | 271 | // Get statistics  | 
                                                        
| 272 | 272 | $args = new stdClass();  | 
                                                        
@@ -303,9 +303,9 @@ discard block  | 
                                                    ||
| 303 | 303 | $args = new stdClass();  | 
                                                        
| 304 | 304 | $args->list_count = 5;  | 
                                                        
| 305 | 305 | $output = $oCommentModel->getNewestCommentList($args, $columnList);  | 
                                                        
| 306 | - if(is_array($output))  | 
                                                        |
| 306 | + if (is_array($output))  | 
                                                        |
| 307 | 307 |  		{ | 
                                                        
| 308 | - foreach($output AS $key => $value)  | 
                                                        |
| 308 | + foreach ($output AS $key => $value)  | 
                                                        |
| 309 | 309 |  			{ | 
                                                        
| 310 | 310 | $value->content = strip_tags($value->content);  | 
                                                        
| 311 | 311 | }  | 
                                                        
@@ -316,17 +316,17 @@ discard block  | 
                                                    ||
| 316 | 316 | // Get list of modules  | 
                                                        
| 317 | 317 |  		$oModuleModel = getModel('module'); | 
                                                        
| 318 | 318 | $module_list = $oModuleModel->getModuleList();  | 
                                                        
| 319 | - if(is_array($module_list))  | 
                                                        |
| 319 | + if (is_array($module_list))  | 
                                                        |
| 320 | 320 |  		{ | 
                                                        
| 321 | 321 | $needUpdate = FALSE;  | 
                                                        
| 322 | 322 | $addTables = FALSE;  | 
                                                        
| 323 | - foreach($module_list AS $key => $value)  | 
                                                        |
| 323 | + foreach ($module_list AS $key => $value)  | 
                                                        |
| 324 | 324 |  			{ | 
                                                        
| 325 | - if($value->need_install)  | 
                                                        |
| 325 | + if ($value->need_install)  | 
                                                        |
| 326 | 326 |  				{ | 
                                                        
| 327 | 327 | $addTables = TRUE;  | 
                                                        
| 328 | 328 | }  | 
                                                        
| 329 | - if($value->need_update)  | 
                                                        |
| 329 | + if ($value->need_update)  | 
                                                        |
| 330 | 330 |  				{ | 
                                                        
| 331 | 331 | $needUpdate = TRUE;  | 
                                                        
| 332 | 332 | }  | 
                                                        
@@ -337,12 +337,12 @@ discard block  | 
                                                    ||
| 337 | 337 |  		$oAutoinstallAdminModel = getAdminModel('autoinstall'); | 
                                                        
| 338 | 338 | $needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList();  | 
                                                        
| 339 | 339 | |
| 340 | - if(is_array($needUpdateList))  | 
                                                        |
| 340 | + if (is_array($needUpdateList))  | 
                                                        |
| 341 | 341 |  		{ | 
                                                        
| 342 | - foreach($needUpdateList AS $key => $value)  | 
                                                        |
| 342 | + foreach ($needUpdateList AS $key => $value)  | 
                                                        |
| 343 | 343 |  			{ | 
                                                        
| 344 | 344 | $helpUrl = './admin/help/index.html#';  | 
                                                        
| 345 | - switch($value->type)  | 
                                                        |
| 345 | + switch ($value->type)  | 
                                                        |
| 346 | 346 |  				{ | 
                                                        
| 347 | 347 | case 'addon':  | 
                                                        
| 348 | 348 | $helpUrl .= 'UMAN_terminology_addon';  | 
                                                        
@@ -369,8 +369,8 @@ discard block  | 
                                                    ||
| 369 | 369 | |
| 370 | 370 |  		$site_module_info = Context::get('site_module_info'); | 
                                                        
| 371 | 371 |  		$oAddonAdminModel = getAdminModel('addon'); | 
                                                        
| 372 | -		$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); | 
                                                        |
| 373 | - if(!$counterAddonActivated)  | 
                                                        |
| 372 | +		$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl); | 
                                                        |
| 373 | + if (!$counterAddonActivated)  | 
                                                        |
| 374 | 374 |  		{ | 
                                                        
| 375 | 375 |  			$columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); | 
                                                        
| 376 | 376 | $args = new stdClass;  | 
                                                        
@@ -393,9 +393,9 @@ discard block  | 
                                                    ||
| 393 | 393 | |
| 394 | 394 | // gathering enviroment check  | 
                                                        
| 395 | 395 |  		$mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); | 
                                                        
| 396 | -		$path = FileHandler::getRealPath('./files/env/' . $mainVersion); | 
                                                        |
| 396 | +		$path = FileHandler::getRealPath('./files/env/'.$mainVersion); | 
                                                        |
| 397 | 397 | $isEnviromentGatheringAgreement = FALSE;  | 
                                                        
| 398 | - if(file_exists($path))  | 
                                                        |
| 398 | + if (file_exists($path))  | 
                                                        |
| 399 | 399 |  		{ | 
                                                        
| 400 | 400 | $isEnviromentGatheringAgreement = TRUE;  | 
                                                        
| 401 | 401 | }  | 
                                                        
@@ -405,7 +405,7 @@ discard block  | 
                                                    ||
| 405 | 405 | $isLicenseAgreement = FALSE;  | 
                                                        
| 406 | 406 |  		$path = FileHandler::getRealPath('./files/env/license_agreement'); | 
                                                        
| 407 | 407 | $isLicenseAgreement = FALSE;  | 
                                                        
| 408 | - if(file_exists($path))  | 
                                                        |
| 408 | + if (file_exists($path))  | 
                                                        |
| 409 | 409 |  		{ | 
                                                        
| 410 | 410 | $isLicenseAgreement = TRUE;  | 
                                                        
| 411 | 411 | }  | 
                                                        
@@ -427,7 +427,7 @@ discard block  | 
                                                    ||
| 427 | 427 | |
| 428 | 428 |  		Context::set('selected_lang', $db_info->lang_type); | 
                                                        
| 429 | 429 | |
| 430 | - if(strpos($db_info->default_url, 'xn--') !== FALSE)  | 
                                                        |
| 430 | + if (strpos($db_info->default_url, 'xn--') !== FALSE)  | 
                                                        |
| 431 | 431 |  		{ | 
                                                        
| 432 | 432 | $db_info->default_url = Context::decodeIdna($db_info->default_url);  | 
                                                        
| 433 | 433 | }  | 
                                                        
@@ -436,9 +436,9 @@ discard block  | 
                                                    ||
| 436 | 436 | |
| 437 | 437 | // site lock  | 
                                                        
| 438 | 438 |  		Context::set('IP', $_SERVER['REMOTE_ADDR']); | 
                                                        
| 439 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...';  | 
                                                        |
| 440 | -		if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; | 
                                                        |
| 441 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR'];  | 
                                                        |
| 439 | + if (!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...';  | 
                                                        |
| 440 | +		if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; | 
                                                        |
| 441 | + if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR'];  | 
                                                        |
| 442 | 442 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist);  | 
                                                        
| 443 | 443 |  		Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); | 
                                                        
| 444 | 444 |  		Context::set('use_sitelock', $db_info->use_sitelock); | 
                                                        
@@ -449,7 +449,7 @@ discard block  | 
                                                    ||
| 449 | 449 |  		Context::set('sitelock_whitelist', $whitelist); | 
                                                        
| 450 | 450 | |
| 451 | 451 | |
| 452 | -		if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); | 
                                                        |
| 452 | +		if ($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); | 
                                                        |
| 453 | 453 | else $admin_ip_list = '';  | 
                                                        
| 454 | 454 |  		Context::set('admin_ip_list', $admin_ip_list); | 
                                                        
| 455 | 455 | |
@@ -472,7 +472,7 @@ discard block  | 
                                                    ||
| 472 | 472 |  		Context::set('htmlFooter', htmlspecialchars($config->htmlFooter)); | 
                                                        
| 473 | 473 | |
| 474 | 474 | // embed filter  | 
                                                        
| 475 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 475 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 476 | 476 | $oEmbedFilter = EmbedFilter::getInstance();  | 
                                                        
| 477 | 477 |  		context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList)); | 
                                                        
| 478 | 478 |  		context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList)); | 
                                                        
@@ -531,36 +531,36 @@ discard block  | 
                                                    ||
| 531 | 531 | */  | 
                                                        
| 532 | 532 | function showSendEnv()  | 
                                                        
| 533 | 533 |  	{ | 
                                                        
| 534 | - if(Context::getResponseMethod() != 'HTML')  | 
                                                        |
| 534 | + if (Context::getResponseMethod() != 'HTML')  | 
                                                        |
| 535 | 535 |  		{ | 
                                                        
| 536 | 536 | return;  | 
                                                        
| 537 | 537 | }  | 
                                                        
| 538 | 538 | |
| 539 | 539 | $server = 'http://collect.xpressengine.com/env/img.php?';  | 
                                                        
| 540 | 540 | $path = './files/env/';  | 
                                                        
| 541 | - $install_env = $path . 'install';  | 
                                                        |
| 541 | + $install_env = $path.'install';  | 
                                                        |
| 542 | 542 |  		$mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); | 
                                                        
| 543 | 543 | |
| 544 | - if(file_exists(FileHandler::getRealPath($install_env)))  | 
                                                        |
| 544 | + if (file_exists(FileHandler::getRealPath($install_env)))  | 
                                                        |
| 545 | 545 |  		{ | 
                                                        
| 546 | 546 |  			$oAdminAdminModel = getAdminModel('admin'); | 
                                                        
| 547 | 547 |  			$params = $oAdminAdminModel->getEnv('INSTALL'); | 
                                                        
| 548 | -			$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); | 
                                                        |
| 548 | +			$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); | 
                                                        |
| 549 | 549 | Context::addHtmlFooter($img);  | 
                                                        
| 550 | 550 | |
| 551 | - FileHandler::writeFile($path . $mainVersion, '1');  | 
                                                        |
| 551 | + FileHandler::writeFile($path.$mainVersion, '1');  | 
                                                        |
| 552 | 552 | }  | 
                                                        
| 553 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion)))  | 
                                                        |
| 553 | + else if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion)))  | 
                                                        |
| 554 | 554 |  		{ | 
                                                        
| 555 | - if($_SESSION['enviroment_gather'] == 'Y')  | 
                                                        |
| 555 | + if ($_SESSION['enviroment_gather'] == 'Y')  | 
                                                        |
| 556 | 556 |  			{ | 
                                                        
| 557 | 557 |  				$oAdminAdminModel = getAdminModel('admin'); | 
                                                        
| 558 | 558 | $params = $oAdminAdminModel->getEnv();  | 
                                                        
| 559 | -				$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); | 
                                                        |
| 559 | +				$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); | 
                                                        |
| 560 | 560 | Context::addHtmlFooter($img);  | 
                                                        
| 561 | 561 | }  | 
                                                        
| 562 | 562 | |
| 563 | - FileHandler::writeFile($path . $mainVersion, '1');  | 
                                                        |
| 563 | + FileHandler::writeFile($path.$mainVersion, '1');  | 
                                                        |
| 564 | 564 | unset($_SESSION['enviroment_gather']);  | 
                                                        
| 565 | 565 | }  | 
                                                        
| 566 | 566 | }  | 
                                                        
@@ -578,64 +578,64 @@ discard block  | 
                                                    ||
| 578 | 578 |  		$tmp = explode("&", $envInfo); | 
                                                        
| 579 | 579 | $arrInfo = array();  | 
                                                        
| 580 | 580 | $xe_check_env = array();  | 
                                                        
| 581 | -		foreach($tmp as $value) { | 
                                                        |
| 581 | +		foreach ($tmp as $value) { | 
                                                        |
| 582 | 582 |  			$arr = explode("=", $value); | 
                                                        
| 583 | -			if($arr[0]=="type") { | 
                                                        |
| 583 | +			if ($arr[0] == "type") { | 
                                                        |
| 584 | 584 | continue;  | 
                                                        
| 585 | -			}elseif($arr[0]=="phpext" ) { | 
                                                        |
| 585 | +			}elseif ($arr[0] == "phpext") { | 
                                                        |
| 586 | 586 | $str = urldecode($arr[1]);  | 
                                                        
| 587 | -				$xe_check_env[$arr[0]]= str_replace("|", ", ", $str); | 
                                                        |
| 588 | -			} elseif($arr[0]=="module" ) { | 
                                                        |
| 587 | +				$xe_check_env[$arr[0]] = str_replace("|", ", ", $str); | 
                                                        |
| 588 | +			} elseif ($arr[0] == "module") { | 
                                                        |
| 589 | 589 | $str = urldecode($arr[1]);  | 
                                                        
| 590 | 590 |  				$arrModuleName = explode("|", $str); | 
                                                        
| 591 | 591 |  				$oModuleModel = getModel("module"); | 
                                                        
| 592 | 592 | $mInfo = array();  | 
                                                        
| 593 | -				foreach($arrModuleName as $moduleName) { | 
                                                        |
| 593 | +				foreach ($arrModuleName as $moduleName) { | 
                                                        |
| 594 | 594 | $moduleInfo = $oModuleModel->getModuleInfoXml($moduleName);  | 
                                                        
| 595 | 595 |  					$mInfo[] = "{$moduleName}({$moduleInfo->version})"; | 
                                                        
| 596 | 596 | }  | 
                                                        
| 597 | -				$xe_check_env[$arr[0]]= join(", ", $mInfo); | 
                                                        |
| 598 | -			} elseif($arr[0]=="addon") { | 
                                                        |
| 597 | +				$xe_check_env[$arr[0]] = join(", ", $mInfo); | 
                                                        |
| 598 | +			} elseif ($arr[0] == "addon") { | 
                                                        |
| 599 | 599 | $str = urldecode($arr[1]);  | 
                                                        
| 600 | 600 |  				$arrAddonName = explode("|", $str); | 
                                                        
| 601 | 601 |  				$oAddonModel = getAdminModel("addon"); | 
                                                        
| 602 | 602 | $mInfo = array();  | 
                                                        
| 603 | -				foreach($arrAddonName as $addonName) { | 
                                                        |
| 603 | +				foreach ($arrAddonName as $addonName) { | 
                                                        |
| 604 | 604 | $addonInfo = $oAddonModel->getAddonInfoXml($addonName);  | 
                                                        
| 605 | 605 |  					$mInfo[] = "{$addonName}({$addonInfo->version})"; | 
                                                        
| 606 | 606 | }  | 
                                                        
| 607 | -				$xe_check_env[$arr[0]]= join(", ", $mInfo); | 
                                                        |
| 608 | -			} elseif($arr[0]=="widget") { | 
                                                        |
| 607 | +				$xe_check_env[$arr[0]] = join(", ", $mInfo); | 
                                                        |
| 608 | +			} elseif ($arr[0] == "widget") { | 
                                                        |
| 609 | 609 | $str = urldecode($arr[1]);  | 
                                                        
| 610 | 610 |  				$arrWidgetName = explode("|", $str); | 
                                                        
| 611 | 611 |  				$oWidgetModel = getModel("widget"); | 
                                                        
| 612 | 612 | $mInfo = array();  | 
                                                        
| 613 | -				foreach($arrWidgetName as $widgetName) { | 
                                                        |
| 613 | +				foreach ($arrWidgetName as $widgetName) { | 
                                                        |
| 614 | 614 | $widgetInfo = $oWidgetModel->getWidgetInfo($widgetName);  | 
                                                        
| 615 | 615 |  					$mInfo[] = "{$widgetName}({$widgetInfo->version})"; | 
                                                        
| 616 | 616 | }  | 
                                                        
| 617 | -				$xe_check_env[$arr[0]]= join(", ", $mInfo); | 
                                                        |
| 618 | -			} elseif($arr[0]=="widgetstyle") { | 
                                                        |
| 617 | +				$xe_check_env[$arr[0]] = join(", ", $mInfo); | 
                                                        |
| 618 | +			} elseif ($arr[0] == "widgetstyle") { | 
                                                        |
| 619 | 619 | $str = urldecode($arr[1]);  | 
                                                        
| 620 | 620 |  				$arrWidgetstyleName = explode("|", $str); | 
                                                        
| 621 | 621 |  				$oWidgetModel = getModel("widget"); | 
                                                        
| 622 | 622 | $mInfo = array();  | 
                                                        
| 623 | -				foreach($arrWidgetstyleName as $widgetstyleName) { | 
                                                        |
| 623 | +				foreach ($arrWidgetstyleName as $widgetstyleName) { | 
                                                        |
| 624 | 624 | $widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName);  | 
                                                        
| 625 | 625 |  					$mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; | 
                                                        
| 626 | 626 | }  | 
                                                        
| 627 | -				$xe_check_env[$arr[0]]= join(", ", $mInfo); | 
                                                        |
| 627 | +				$xe_check_env[$arr[0]] = join(", ", $mInfo); | 
                                                        |
| 628 | 628 | |
| 629 | -			} elseif($arr[0]=="layout") { | 
                                                        |
| 629 | +			} elseif ($arr[0] == "layout") { | 
                                                        |
| 630 | 630 | $str = urldecode($arr[1]);  | 
                                                        
| 631 | 631 |  				$arrLayoutName = explode("|", $str); | 
                                                        
| 632 | 632 |  				$oLayoutModel = getModel("layout"); | 
                                                        
| 633 | 633 | $mInfo = array();  | 
                                                        
| 634 | -				foreach($arrLayoutName as $layoutName) { | 
                                                        |
| 634 | +				foreach ($arrLayoutName as $layoutName) { | 
                                                        |
| 635 | 635 | $layoutInfo = $oLayoutModel->getLayoutInfo($layoutName);  | 
                                                        
| 636 | 636 |  					$mInfo[] = "{$layoutName}({$layoutInfo->version})"; | 
                                                        
| 637 | 637 | }  | 
                                                        
| 638 | -				$xe_check_env[$arr[0]]= join(", ", $mInfo); | 
                                                        |
| 638 | +				$xe_check_env[$arr[0]] = join(", ", $mInfo); | 
                                                        |
| 639 | 639 |  			} else { | 
                                                        
| 640 | 640 | $xe_check_env[$arr[0]] = urldecode($arr[1]);  | 
                                                        
| 641 | 641 | }  | 
                                                        
@@ -649,15 +649,15 @@ discard block  | 
                                                    ||
| 649 | 649 |  		$php_core['memory_limit'] = "{$ini_info['memory_limit']['local_value']}"; | 
                                                        
| 650 | 650 | $info['PHP_Core'] = $php_core;  | 
                                                        
| 651 | 651 | |
| 652 | -		$str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; | 
                                                        |
| 652 | +		$str_info = "[XE Server Environment ".date("Y-m-d")."]\n\n"; | 
                                                        |
| 653 | 653 |  		$str_info .= "realpath : ".realpath('./')."\n"; | 
                                                        
| 654 | - foreach( $info as $key=>$value )  | 
                                                        |
| 654 | + foreach ($info as $key=>$value)  | 
                                                        |
| 655 | 655 |  		{ | 
                                                        
| 656 | -			if( is_array( $value ) == false ) { | 
                                                        |
| 656 | +			if (is_array($value) == false) { | 
                                                        |
| 657 | 657 |  				$str_info .= "{$key} : {$value}\n"; | 
                                                        
| 658 | 658 |  			} else { | 
                                                        
| 659 | 659 |  				//$str_info .= "\n{$key} \n"; | 
                                                        
| 660 | - foreach( $value as $key2=>$value2 )  | 
                                                        |
| 660 | + foreach ($value as $key2=>$value2)  | 
                                                        |
| 661 | 661 |  					$str_info .= "{$key2} : {$value2}\n"; | 
                                                        
| 662 | 662 | }  | 
                                                        
| 663 | 663 | }  | 
                                                        
@@ -674,7 +674,7 @@ discard block  | 
                                                    ||
| 674 | 674 |  		Context::set('use_rewrite', $useRewrite);  | 
                                                        
| 675 | 675 | |
| 676 | 676 | // nginx 체크, rewrite 사용법 안내  | 
                                                        
| 677 | -		if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); | 
                                                        |
| 677 | +		if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); | 
                                                        |
| 678 | 678 | |
| 679 | 679 |  		Context::set('useable', $oInstallController->checkInstallEnv()); | 
                                                        
| 680 | 680 |  		$this->setTemplateFile('check_env.html'); | 
                                                        
@@ -17,7 +17,7 @@ discard block  | 
                                                    ||
| 17 | 17 | function init()  | 
                                                        
| 18 | 18 |  	{ | 
                                                        
| 19 | 19 | // Error occurs if already installed  | 
                                                        
| 20 | - if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())  | 
                                                        |
| 20 | + if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())  | 
                                                        |
| 21 | 21 |  		{ | 
                                                        
| 22 | 22 |  			$this->stop('msg_already_installed'); | 
                                                        
| 23 | 23 | }  | 
                                                        
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | function _procDBSetting()  | 
                                                        
| 87 | 87 |  	{ | 
                                                        
| 88 | 88 | // Get DB-related variables  | 
                                                        
| 89 | -		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); | 
                                                        |
| 89 | +		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); | 
                                                        |
| 90 | 90 | |
| 91 | 91 | $db_info = new stdClass();  | 
                                                        
| 92 | 92 | $db_info->master_db = get_object_vars($con_string);  | 
                                                        
@@ -101,13 +101,13 @@ discard block  | 
                                                    ||
| 101 | 101 | // Check if available to connect to the DB  | 
                                                        
| 102 | 102 | $oDB = &DB::getInstance();  | 
                                                        
| 103 | 103 | $output = $oDB->getError();  | 
                                                        
| 104 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 105 | - if(!$oDB->isConnected()) return $oDB->getError();  | 
                                                        |
| 104 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 105 | + if (!$oDB->isConnected()) return $oDB->getError();  | 
                                                        |
| 106 | 106 | |
| 107 | 107 | // Create a db temp config file  | 
                                                        
| 108 | - if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 108 | + if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 109 | 109 | |
| 110 | -		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) | 
                                                        |
| 110 | +		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) | 
                                                        |
| 111 | 111 |  		{ | 
                                                        
| 112 | 112 |  			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); | 
                                                        
| 113 | 113 |  			header('location:'.$returnUrl); | 
                                                        
@@ -121,13 +121,13 @@ discard block  | 
                                                    ||
| 121 | 121 | function procConfigSetting()  | 
                                                        
| 122 | 122 |  	{ | 
                                                        
| 123 | 123 | // Get variables  | 
                                                        
| 124 | -		$config_info = Context::gets('use_rewrite','time_zone'); | 
                                                        |
| 125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';  | 
                                                        |
| 124 | +		$config_info = Context::gets('use_rewrite', 'time_zone'); | 
                                                        |
| 125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N';  | 
                                                        |
| 126 | 126 | |
| 127 | 127 | // Create a db temp config file  | 
                                                        
| 128 | - if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 128 | + if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 129 | 129 | |
| 130 | -		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) | 
                                                        |
| 130 | +		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) | 
                                                        |
| 131 | 131 |  		{ | 
                                                        
| 132 | 132 |  			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); | 
                                                        
| 133 | 133 |  			header('location:'.$returnUrl); | 
                                                        
@@ -141,13 +141,13 @@ discard block  | 
                                                    ||
| 141 | 141 | function procInstall()  | 
                                                        
| 142 | 142 |  	{ | 
                                                        
| 143 | 143 | // Check if it is already installed  | 
                                                        
| 144 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');  | 
                                                        |
| 144 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');  | 
                                                        |
| 145 | 145 | |
| 146 | 146 |  		Context::loadLang('modules/member/lang'); | 
                                                        
| 147 | 147 |  		$oMemberModel = getModel('member'); | 
                                                        
| 148 | 148 | $vars = Context::getRequestVars();  | 
                                                        
| 149 | 149 | |
| 150 | - if(!$oMemberModel->checkPasswordStrength($vars->password, 'high'))  | 
                                                        |
| 150 | + if (!$oMemberModel->checkPasswordStrength($vars->password, 'high'))  | 
                                                        |
| 151 | 151 |  		{ | 
                                                        
| 152 | 152 |  			Context::loadLang('modules/member/lang'); | 
                                                        
| 153 | 153 |  			$message = Context::getLang('about_password_strength'); | 
                                                        
@@ -160,15 +160,15 @@ discard block  | 
                                                    ||
| 160 | 160 |  		Context::set('logged_info', $logged_info); | 
                                                        
| 161 | 161 | |
| 162 | 162 | // check install config  | 
                                                        
| 163 | -		if(Context::get('install_config')) | 
                                                        |
| 163 | +		if (Context::get('install_config')) | 
                                                        |
| 164 | 164 |  		{ | 
                                                        
| 165 | 165 | $db_info = $this->_makeDbInfoByInstallConfig();  | 
                                                        
| 166 | 166 | }  | 
                                                        
| 167 | 167 | // install by default XE UI  | 
                                                        
| 168 | 168 | else  | 
                                                        
| 169 | 169 |  		{ | 
                                                        
| 170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;  | 
                                                        |
| 171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;  | 
                                                        |
| 170 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;  | 
                                                        |
| 171 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;  | 
                                                        |
| 172 | 172 | }  | 
                                                        
| 173 | 173 | |
| 174 | 174 | // Set DB type and information  | 
                                                        
@@ -176,30 +176,30 @@ discard block  | 
                                                    ||
| 176 | 176 | // Create DB Instance  | 
                                                        
| 177 | 177 | $oDB = &DB::getInstance();  | 
                                                        
| 178 | 178 | // Check if available to connect to the DB  | 
                                                        
| 179 | - if(!$oDB->isConnected()) return $oDB->getError();  | 
                                                        |
| 179 | + if (!$oDB->isConnected()) return $oDB->getError();  | 
                                                        |
| 180 | 180 | |
| 181 | 181 | // Install all the modules  | 
                                                        
| 182 | 182 |  		try { | 
                                                        
| 183 | 183 | $oDB->begin();  | 
                                                        
| 184 | 184 | $this->installDownloadedModule();  | 
                                                        
| 185 | 185 | $oDB->commit();  | 
                                                        
| 186 | -		} catch(Exception $e) { | 
                                                        |
| 186 | +		} catch (Exception $e) { | 
                                                        |
| 187 | 187 | $oDB->rollback();  | 
                                                        
| 188 | 188 | return new BaseObject(-1, $e->getMessage());  | 
                                                        
| 189 | 189 | }  | 
                                                        
| 190 | 190 | |
| 191 | 191 | // Create a config file  | 
                                                        
| 192 | - if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 192 | + if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');  | 
                                                        |
| 193 | 193 | |
| 194 | 194 | // load script  | 
                                                        
| 195 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');  | 
                                                        |
| 196 | - if(count($scripts)>0)  | 
                                                        |
| 195 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');  | 
                                                        |
| 196 | + if (count($scripts) > 0)  | 
                                                        |
| 197 | 197 |  		{ | 
                                                        
| 198 | 198 | sort($scripts);  | 
                                                        
| 199 | - foreach($scripts as $script)  | 
                                                        |
| 199 | + foreach ($scripts as $script)  | 
                                                        |
| 200 | 200 |  			{ | 
                                                        
| 201 | 201 |  				$script_path = FileHandler::getRealPath('./modules/install/script/'); | 
                                                        
| 202 | - $output = include($script_path . $script);  | 
                                                        |
| 202 | + $output = include($script_path.$script);  | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
@@ -212,7 +212,7 @@ discard block  | 
                                                    ||
| 212 | 212 | |
| 213 | 213 | unset($_SESSION['use_rewrite']);  | 
                                                        
| 214 | 214 | |
| 215 | -		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) | 
                                                        |
| 215 | +		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) | 
                                                        |
| 216 | 216 |  		{ | 
                                                        
| 217 | 217 |  			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); | 
                                                        
| 218 | 218 |  			header('location:'.$returnUrl); | 
                                                        
@@ -244,7 +244,7 @@ discard block  | 
                                                    ||
| 244 | 244 | $db_info->disable_cookie_secure = 'N';  | 
                                                        
| 245 | 245 | $db_info->disable_csrf_token = 'N';  | 
                                                        
| 246 | 246 | |
| 247 | - if($_SERVER['HTTPS'] == 'on')  | 
                                                        |
| 247 | + if ($_SERVER['HTTPS'] == 'on')  | 
                                                        |
| 248 | 248 |  		{ | 
                                                        
| 249 | 249 |  			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; | 
                                                        
| 250 | 250 | $https_port = (!$https_port != 443) ? $https_port : null;  | 
                                                        
@@ -254,8 +254,8 @@ discard block  | 
                                                    ||
| 254 | 254 |  			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; | 
                                                        
| 255 | 255 | $http_port = (!$http_port != 80) ? $http_port : null;  | 
                                                        
| 256 | 256 | }  | 
                                                        
| 257 | - if($http_port) $db_info->http_port = $http_port;  | 
                                                        |
| 258 | - if($https_port) $db_info->https_port = $https_port;  | 
                                                        |
| 257 | + if ($http_port) $db_info->http_port = $http_port;  | 
                                                        |
| 258 | + if ($https_port) $db_info->https_port = $https_port;  | 
                                                        |
| 259 | 259 | |
| 260 | 260 | return $db_info;  | 
                                                        
| 261 | 261 | }  | 
                                                        
@@ -265,57 +265,57 @@ discard block  | 
                                                    ||
| 265 | 265 | */  | 
                                                        
| 266 | 266 | function procInstallFTP()  | 
                                                        
| 267 | 267 |  	{ | 
                                                        
| 268 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');  | 
                                                        |
| 269 | -		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); | 
                                                        |
| 270 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port;  | 
                                                        |
| 271 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;  | 
                                                        |
| 272 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';  | 
                                                        |
| 273 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';  | 
                                                        |
| 268 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');  | 
                                                        |
| 269 | +		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); | 
                                                        |
| 270 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port;  | 
                                                        |
| 271 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;  | 
                                                        |
| 272 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';  | 
                                                        |
| 273 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';  | 
                                                        |
| 274 | 274 | |
| 275 | 275 |  		$buff = array('<?php if(!defined("__XE__")) exit();'); | 
                                                        
| 276 | 276 | $buff[] = "\$ftp_info = new stdClass();";  | 
                                                        
| 277 | - foreach($ftp_info as $key => $val)  | 
                                                        |
| 277 | + foreach ($ftp_info as $key => $val)  | 
                                                        |
| 278 | 278 |  		{ | 
                                                        
| 279 | -			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); | 
                                                        |
| 279 | +			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); | 
                                                        |
| 280 | 280 | }  | 
                                                        
| 281 | 281 | |
| 282 | 282 | // If safe_mode  | 
                                                        
| 283 | -		if(ini_get('safe_mode')) | 
                                                        |
| 283 | +		if (ini_get('safe_mode')) | 
                                                        |
| 284 | 284 |  		{ | 
                                                        
| 285 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');  | 
                                                        |
| 285 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');  | 
                                                        |
| 286 | 286 | |
| 287 | 287 | require_once(_XE_PATH_.'libs/ftp.class.php');  | 
                                                        
| 288 | 288 | $oFtp = new ftp();  | 
                                                        
| 289 | -			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); | 
                                                        |
| 289 | +			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); | 
                                                        |
| 290 | 290 | |
| 291 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 291 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 292 | 292 |  			{ | 
                                                        
| 293 | 293 | $oFtp->ftp_quit();  | 
                                                        
| 294 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info');  | 
                                                        |
| 294 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info');  | 
                                                        |
| 295 | 295 | }  | 
                                                        
| 296 | 296 | |
| 297 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))  | 
                                                        |
| 297 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))  | 
                                                        |
| 298 | 298 |  			{ | 
                                                        
| 299 | 299 | $oFtp->ftp_quit();  | 
                                                        
| 300 | - return new BaseObject(-1,'msg_ftp_mkdir_fail');  | 
                                                        |
| 300 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail');  | 
                                                        |
| 301 | 301 | }  | 
                                                        
| 302 | 302 | |
| 303 | -			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) | 
                                                        |
| 303 | +			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) | 
                                                        |
| 304 | 304 |  			{ | 
                                                        
| 305 | 305 | $oFtp->ftp_quit();  | 
                                                        
| 306 | - return new BaseObject(-1,'msg_ftp_chmod_fail');  | 
                                                        |
| 306 | + return new BaseObject(-1, 'msg_ftp_chmod_fail');  | 
                                                        |
| 307 | 307 | }  | 
                                                        
| 308 | 308 | |
| 309 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))  | 
                                                        |
| 309 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))  | 
                                                        |
| 310 | 310 |  			{ | 
                                                        
| 311 | 311 | $oFtp->ftp_quit();  | 
                                                        
| 312 | - return new BaseObject(-1,'msg_ftp_mkdir_fail');  | 
                                                        |
| 312 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail');  | 
                                                        |
| 313 | 313 | }  | 
                                                        
| 314 | 314 | |
| 315 | -			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) | 
                                                        |
| 315 | +			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) | 
                                                        |
| 316 | 316 |  			{ | 
                                                        
| 317 | 317 | $oFtp->ftp_quit();  | 
                                                        
| 318 | - return new BaseObject(-1,'msg_ftp_chmod_fail');  | 
                                                        |
| 318 | + return new BaseObject(-1, 'msg_ftp_chmod_fail');  | 
                                                        |
| 319 | 319 | }  | 
                                                        
| 320 | 320 | |
| 321 | 321 | $oFtp->ftp_quit();  | 
                                                        
@@ -326,31 +326,31 @@ discard block  | 
                                                    ||
| 326 | 326 | |
| 327 | 327 | function procInstallCheckFtp()  | 
                                                        
| 328 | 328 |  	{ | 
                                                        
| 329 | -		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); | 
                                                        |
| 330 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port;  | 
                                                        |
| 331 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;  | 
                                                        |
| 332 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N';  | 
                                                        |
| 329 | +		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); | 
                                                        |
| 330 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port;  | 
                                                        |
| 331 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;  | 
                                                        |
| 332 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N';  | 
                                                        |
| 333 | 333 | |
| 334 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');  | 
                                                        |
| 334 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');  | 
                                                        |
| 335 | 335 | |
| 336 | - if($ftp_info->sftp == 'Y')  | 
                                                        |
| 336 | + if ($ftp_info->sftp == 'Y')  | 
                                                        |
| 337 | 337 |  		{ | 
                                                        
| 338 | 338 |  			$connection = ssh2_connect('localhost', $ftp_info->ftp_port); | 
                                                        
| 339 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 339 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 340 | 340 |  			{ | 
                                                        
| 341 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info');  | 
                                                        |
| 341 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info');  | 
                                                        |
| 342 | 342 | }  | 
                                                        
| 343 | 343 | }  | 
                                                        
| 344 | 344 | else  | 
                                                        
| 345 | 345 |  		{ | 
                                                        
| 346 | 346 | require_once(_XE_PATH_.'libs/ftp.class.php');  | 
                                                        
| 347 | 347 | $oFtp = new ftp();  | 
                                                        
| 348 | -			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); | 
                                                        |
| 348 | +			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); | 
                                                        |
| 349 | 349 | |
| 350 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 350 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))  | 
                                                        |
| 351 | 351 |  			{ | 
                                                        
| 352 | 352 | $oFtp->ftp_quit();  | 
                                                        
| 353 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info');  | 
                                                        |
| 353 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info');  | 
                                                        |
| 354 | 354 | }  | 
                                                        
| 355 | 355 | $oFtp->ftp_quit();  | 
                                                        
| 356 | 356 | }  | 
                                                        
@@ -367,36 +367,36 @@ discard block  | 
                                                    ||
| 367 | 367 | $checklist = array();  | 
                                                        
| 368 | 368 | // 0. check your version of php (5.2.4 or higher)  | 
                                                        
| 369 | 369 | $checklist['php_version'] = true;  | 
                                                        
| 370 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))  | 
                                                        |
| 370 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))  | 
                                                        |
| 371 | 371 |  		{ | 
                                                        
| 372 | 372 | $checklist['php_version'] = false;  | 
                                                        
| 373 | 373 | }  | 
                                                        
| 374 | 374 | |
| 375 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))  | 
                                                        |
| 375 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))  | 
                                                        |
| 376 | 376 |  		{ | 
                                                        
| 377 | 377 |  			Context::set('phpversion_warning', true); | 
                                                        
| 378 | 378 | }  | 
                                                        
| 379 | 379 | |
| 380 | 380 | // 1. Check permission  | 
                                                        
| 381 | -		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; | 
                                                        |
| 381 | +		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; | 
                                                        |
| 382 | 382 | else $checklist['permission'] = false;  | 
                                                        
| 383 | 383 | // 2. Check if xml_parser_create exists  | 
                                                        
| 384 | -		if(function_exists('xml_parser_create')) $checklist['xml'] = true; | 
                                                        |
| 384 | +		if (function_exists('xml_parser_create')) $checklist['xml'] = true; | 
                                                        |
| 385 | 385 | else $checklist['xml'] = false;  | 
                                                        
| 386 | 386 | // 3. Check if ini_get (session.auto_start) == 1  | 
                                                        
| 387 | -		if(ini_get('session.auto_start')!=1) $checklist['session'] = true; | 
                                                        |
| 387 | +		if (ini_get('session.auto_start') != 1) $checklist['session'] = true; | 
                                                        |
| 388 | 388 | else $checklist['session'] = false;  | 
                                                        
| 389 | 389 | // 4. Check if iconv exists  | 
                                                        
| 390 | -		if(function_exists('iconv')) $checklist['iconv'] = true; | 
                                                        |
| 390 | +		if (function_exists('iconv')) $checklist['iconv'] = true; | 
                                                        |
| 391 | 391 | else $checklist['iconv'] = false;  | 
                                                        
| 392 | 392 | // 5. Check gd(imagecreatefromgif function)  | 
                                                        
| 393 | -		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; | 
                                                        |
| 393 | +		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; | 
                                                        |
| 394 | 394 | else $checklist['gd'] = false;  | 
                                                        
| 395 | 395 | // 6. Check DB  | 
                                                        
| 396 | - if(DB::getEnableList()) $checklist['db'] = true;  | 
                                                        |
| 396 | + if (DB::getEnableList()) $checklist['db'] = true;  | 
                                                        |
| 397 | 397 | else $checklist['db'] = false;  | 
                                                        
| 398 | 398 | |
| 399 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;  | 
                                                        |
| 399 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;  | 
                                                        |
| 400 | 400 | else $install_enable = true;  | 
                                                        
| 401 | 401 | |
| 402 | 402 | // Save the checked result to the Context  | 
                                                        
@@ -416,7 +416,7 @@ discard block  | 
                                                    ||
| 416 | 416 | |
| 417 | 417 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false;  | 
                                                        
| 418 | 418 | |
| 419 | - if($license_agreement)  | 
                                                        |
| 419 | + if ($license_agreement)  | 
                                                        |
| 420 | 420 |  		{ | 
                                                        
| 421 | 421 | $currentTime = $_SERVER['REQUEST_TIME'];  | 
                                                        
| 422 | 422 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);  | 
                                                        
@@ -427,7 +427,7 @@ discard block  | 
                                                    ||
| 427 | 427 | return new BaseObject(-1, 'msg_must_accept_license_agreement');  | 
                                                        
| 428 | 428 | }  | 
                                                        
| 429 | 429 | |
| 430 | -		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) | 
                                                        |
| 430 | +		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) | 
                                                        |
| 431 | 431 |  		{ | 
                                                        
| 432 | 432 |  			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); | 
                                                        
| 433 | 433 | $this->setRedirectUrl($returnUrl);  | 
                                                        
@@ -450,25 +450,25 @@ discard block  | 
                                                    ||
| 450 | 450 | $hostname = $_SERVER['SERVER_NAME'];  | 
                                                        
| 451 | 451 | $port = $_SERVER['SERVER_PORT'];  | 
                                                        
| 452 | 452 | $str_port = '';  | 
                                                        
| 453 | - if($port)  | 
                                                        |
| 453 | + if ($port)  | 
                                                        |
| 454 | 454 |  		{ | 
                                                        
| 455 | - $str_port = ':' . $port;  | 
                                                        |
| 455 | + $str_port = ':'.$port;  | 
                                                        |
| 456 | 456 | }  | 
                                                        
| 457 | 457 | |
| 458 | 458 | $tmpPath = $_SERVER['DOCUMENT_ROOT'];  | 
                                                        
| 459 | 459 | |
| 460 | 460 | //if DIRECTORY_SEPARATOR is not /(IIS)  | 
                                                        
| 461 | - if(DIRECTORY_SEPARATOR !== '/')  | 
                                                        |
| 461 | + if (DIRECTORY_SEPARATOR !== '/')  | 
                                                        |
| 462 | 462 |  		{ | 
                                                        
| 463 | 463 | //change to slash for compare  | 
                                                        
| 464 | 464 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);  | 
                                                        
| 465 | 465 | }  | 
                                                        
| 466 | 466 | |
| 467 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath;  | 
                                                        |
| 467 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath;  | 
                                                        |
| 468 | 468 | $currentPath = str_replace($tmpPath, "", _XE_PATH_);  | 
                                                        
| 469 | - if($currentPath != "")  | 
                                                        |
| 469 | + if ($currentPath != "")  | 
                                                        |
| 470 | 470 |  		{ | 
                                                        
| 471 | - $query = $currentPath . $query;  | 
                                                        |
| 471 | + $query = $currentPath.$query;  | 
                                                        |
| 472 | 472 | }  | 
                                                        
| 473 | 473 |  		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); | 
                                                        
| 474 | 474 | $requestConfig = array();  | 
                                                        
@@ -493,7 +493,7 @@ discard block  | 
                                                    ||
| 493 | 493 | './files/cache/template_compiled',  | 
                                                        
| 494 | 494 | );  | 
                                                        
| 495 | 495 | |
| 496 | - foreach($directory_list as $dir)  | 
                                                        |
| 496 | + foreach ($directory_list as $dir)  | 
                                                        |
| 497 | 497 |  		{ | 
                                                        
| 498 | 498 | FileHandler::makeDir($dir);  | 
                                                        
| 499 | 499 | }  | 
                                                        
@@ -509,57 +509,57 @@ discard block  | 
                                                    ||
| 509 | 509 |  		$oModuleModel = getModel('module'); | 
                                                        
| 510 | 510 | // Create a table ny finding schemas/*.xml file in each module  | 
                                                        
| 511 | 511 |  		$module_list = FileHandler::readDir('./modules/', NULL, false, true); | 
                                                        
| 512 | - foreach($module_list as $module_path)  | 
                                                        |
| 512 | + foreach ($module_list as $module_path)  | 
                                                        |
| 513 | 513 |  		{ | 
                                                        
| 514 | 514 | // Get module name  | 
                                                        
| 515 | -			$tmp_arr = explode('/',$module_path); | 
                                                        |
| 516 | - $module = $tmp_arr[count($tmp_arr)-1];  | 
                                                        |
| 515 | +			$tmp_arr = explode('/', $module_path); | 
                                                        |
| 516 | + $module = $tmp_arr[count($tmp_arr) - 1];  | 
                                                        |
| 517 | 517 | |
| 518 | 518 | $xml_info = $oModuleModel->getModuleInfoXml($module);  | 
                                                        
| 519 | - if(!$xml_info) continue;  | 
                                                        |
| 519 | + if (!$xml_info) continue;  | 
                                                        |
| 520 | 520 | $modules[$xml_info->category][] = $module;  | 
                                                        
| 521 | 521 | }  | 
                                                        
| 522 | 522 | // Install "module" module in advance  | 
                                                        
| 523 | -		$this->installModule('module','./modules/module'); | 
                                                        |
| 523 | +		$this->installModule('module', './modules/module'); | 
                                                        |
| 524 | 524 |  		$oModule = getClass('module'); | 
                                                        
| 525 | - if($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 525 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 526 | 526 | // Determine the order of module installation depending on category  | 
                                                        
| 527 | -		$install_step = array('system','content','member'); | 
                                                        |
| 527 | +		$install_step = array('system', 'content', 'member'); | 
                                                        |
| 528 | 528 | // Install all the remaining modules  | 
                                                        
| 529 | - foreach($install_step as $category)  | 
                                                        |
| 529 | + foreach ($install_step as $category)  | 
                                                        |
| 530 | 530 |  		{ | 
                                                        
| 531 | - if(count($modules[$category]))  | 
                                                        |
| 531 | + if (count($modules[$category]))  | 
                                                        |
| 532 | 532 |  			{ | 
                                                        
| 533 | - foreach($modules[$category] as $module)  | 
                                                        |
| 533 | + foreach ($modules[$category] as $module)  | 
                                                        |
| 534 | 534 |  				{ | 
                                                        
| 535 | - if($module == 'module') continue;  | 
                                                        |
| 535 | + if ($module == 'module') continue;  | 
                                                        |
| 536 | 536 |  					$this->installModule($module, sprintf('./modules/%s', $module)); | 
                                                        
| 537 | 537 | |
| 538 | 538 | $oModule = getClass($module);  | 
                                                        
| 539 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))  | 
                                                        |
| 539 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))  | 
                                                        |
| 540 | 540 |  					{ | 
                                                        
| 541 | - if($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 541 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 542 | 542 | }  | 
                                                        
| 543 | 543 | }  | 
                                                        
| 544 | 544 | unset($modules[$category]);  | 
                                                        
| 545 | 545 | }  | 
                                                        
| 546 | 546 | }  | 
                                                        
| 547 | 547 | // Install all the remaining modules  | 
                                                        
| 548 | - if(count($modules))  | 
                                                        |
| 548 | + if (count($modules))  | 
                                                        |
| 549 | 549 |  		{ | 
                                                        
| 550 | - foreach($modules as $category => $module_list)  | 
                                                        |
| 550 | + foreach ($modules as $category => $module_list)  | 
                                                        |
| 551 | 551 |  			{ | 
                                                        
| 552 | - if(count($module_list))  | 
                                                        |
| 552 | + if (count($module_list))  | 
                                                        |
| 553 | 553 |  				{ | 
                                                        
| 554 | - foreach($module_list as $module)  | 
                                                        |
| 554 | + foreach ($module_list as $module)  | 
                                                        |
| 555 | 555 |  					{ | 
                                                        
| 556 | - if($module == 'module') continue;  | 
                                                        |
| 556 | + if ($module == 'module') continue;  | 
                                                        |
| 557 | 557 |  						$this->installModule($module, sprintf('./modules/%s', $module)); | 
                                                        
| 558 | 558 | |
| 559 | 559 | $oModule = getClass($module);  | 
                                                        
| 560 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))  | 
                                                        |
| 560 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))  | 
                                                        |
| 561 | 561 |  						{ | 
                                                        
| 562 | - if($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 562 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate();  | 
                                                        |
| 563 | 563 | }  | 
                                                        
| 564 | 564 | }  | 
                                                        
| 565 | 565 | }  | 
                                                        
@@ -581,31 +581,31 @@ discard block  | 
                                                    ||
| 581 | 581 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true);  | 
                                                        
| 582 | 582 | |
| 583 | 583 | $file_cnt = count($schema_files);  | 
                                                        
| 584 | - for($i=0;$i<$file_cnt;$i++)  | 
                                                        |
| 584 | + for ($i = 0; $i < $file_cnt; $i++)  | 
                                                        |
| 585 | 585 |  		{ | 
                                                        
| 586 | 586 | $file = trim($schema_files[$i]);  | 
                                                        
| 587 | - if(!$file || substr($file,-4)!='.xml') continue;  | 
                                                        |
| 587 | + if (!$file || substr($file, -4) != '.xml') continue;  | 
                                                        |
| 588 | 588 | $output = $oDB->createTableByXmlFile($file);  | 
                                                        
| 589 | - if($output === false)  | 
                                                        |
| 589 | + if ($output === false)  | 
                                                        |
| 590 | 590 |  				throw new Exception('msg_create_table_failed'); | 
                                                        
| 591 | 591 | }  | 
                                                        
| 592 | 592 | // Create a table and module instance and then execute install() method  | 
                                                        
| 593 | 593 | unset($oModule);  | 
                                                        
| 594 | 594 | $oModule = getClass($module);  | 
                                                        
| 595 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();  | 
                                                        |
| 595 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();  | 
                                                        |
| 596 | 596 | return new BaseObject();  | 
                                                        
| 597 | 597 | }  | 
                                                        
| 598 | 598 | |
| 599 | 599 | function _getDBConfigFileContents($db_info)  | 
                                                        
| 600 | 600 |  	{ | 
                                                        
| 601 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_')  | 
                                                        |
| 601 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_')  | 
                                                        |
| 602 | 602 |  		{ | 
                                                        
| 603 | 603 | $db_info->master_db['db_table_prefix'] .= '_';  | 
                                                        
| 604 | 604 | }  | 
                                                        
| 605 | 605 | |
| 606 | - foreach($db_info->slave_db as &$slave)  | 
                                                        |
| 606 | + foreach ($db_info->slave_db as &$slave)  | 
                                                        |
| 607 | 607 |  		{ | 
                                                        
| 608 | - if(substr($slave['db_table_prefix'], -1) != '_')  | 
                                                        |
| 608 | + if (substr($slave['db_table_prefix'], -1) != '_')  | 
                                                        |
| 609 | 609 |  			{ | 
                                                        
| 610 | 610 | $slave['db_table_prefix'] .= '_';  | 
                                                        
| 611 | 611 | }  | 
                                                        
@@ -613,7 +613,7 @@ discard block  | 
                                                    ||
| 613 | 613 | |
| 614 | 614 | $buff = array();  | 
                                                        
| 615 | 615 |  		$buff[] = '<?php if(!defined("__XE__")) exit();'; | 
                                                        
| 616 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';  | 
                                                        |
| 616 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';  | 
                                                        |
| 617 | 617 | |
| 618 | 618 | return implode(PHP_EOL, $buff);  | 
                                                        
| 619 | 619 | }  | 
                                                        
@@ -627,13 +627,13 @@ discard block  | 
                                                    ||
| 627 | 627 | $db_tmp_config_file = $this->db_tmp_config_file;  | 
                                                        
| 628 | 628 | |
| 629 | 629 | $db_info = Context::getDBInfo();  | 
                                                        
| 630 | - if(!$db_info) return;  | 
                                                        |
| 630 | + if (!$db_info) return;  | 
                                                        |
| 631 | 631 | |
| 632 | 632 | $buff = $this->_getDBConfigFileContents($db_info);  | 
                                                        
| 633 | 633 | |
| 634 | 634 | FileHandler::writeFile($db_tmp_config_file, $buff);  | 
                                                        
| 635 | 635 | |
| 636 | - if(@file_exists($db_tmp_config_file)) return true;  | 
                                                        |
| 636 | + if (@file_exists($db_tmp_config_file)) return true;  | 
                                                        |
| 637 | 637 | return false;  | 
                                                        
| 638 | 638 | }  | 
                                                        
| 639 | 639 | |
@@ -646,14 +646,14 @@ discard block  | 
                                                    ||
| 646 | 646 | $etc_tmp_config_file = $this->etc_tmp_config_file;  | 
                                                        
| 647 | 647 | |
| 648 | 648 |  		$buff = '<?php if(!defined("__XE__")) exit();'."\n"; | 
                                                        
| 649 | - foreach($config_info as $key => $val)  | 
                                                        |
| 649 | + foreach ($config_info as $key => $val)  | 
                                                        |
| 650 | 650 |  		{ | 
                                                        
| 651 | -			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); | 
                                                        |
| 651 | +			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); | 
                                                        |
| 652 | 652 | }  | 
                                                        
| 653 | 653 | |
| 654 | 654 | FileHandler::writeFile($etc_tmp_config_file, $buff);  | 
                                                        
| 655 | 655 | |
| 656 | - if(@file_exists($etc_tmp_config_file)) return true;  | 
                                                        |
| 656 | + if (@file_exists($etc_tmp_config_file)) return true;  | 
                                                        |
| 657 | 657 | return false;  | 
                                                        
| 658 | 658 | }  | 
                                                        
| 659 | 659 | |
@@ -668,13 +668,13 @@ discard block  | 
                                                    ||
| 668 | 668 | //if(file_exists($config_file)) return;  | 
                                                        
| 669 | 669 | |
| 670 | 670 | $db_info = Context::getDBInfo();  | 
                                                        
| 671 | - if(!$db_info) return;  | 
                                                        |
| 671 | + if (!$db_info) return;  | 
                                                        |
| 672 | 672 | |
| 673 | 673 | $buff = $this->_getDBConfigFileContents($db_info);  | 
                                                        
| 674 | 674 | |
| 675 | 675 | FileHandler::writeFile($config_file, $buff);  | 
                                                        
| 676 | 676 | |
| 677 | - if(@file_exists($config_file))  | 
                                                        |
| 677 | + if (@file_exists($config_file))  | 
                                                        |
| 678 | 678 |  			{ | 
                                                        
| 679 | 679 | FileHandler::removeFile($this->db_tmp_config_file);  | 
                                                        
| 680 | 680 | FileHandler::removeFile($this->etc_tmp_config_file);  | 
                                                        
@@ -689,7 +689,7 @@ discard block  | 
                                                    ||
| 689 | 689 | function installByConfig($install_config_file)  | 
                                                        
| 690 | 690 |  	{ | 
                                                        
| 691 | 691 | include $install_config_file;  | 
                                                        
| 692 | - if(!is_array($auto_config)) return false;  | 
                                                        |
| 692 | + if (!is_array($auto_config)) return false;  | 
                                                        |
| 693 | 693 | |
| 694 | 694 | $auto_config['module'] = 'install';  | 
                                                        
| 695 | 695 | $auto_config['act'] = 'procInstall';  | 
                                                        
@@ -697,22 +697,22 @@ discard block  | 
                                                    ||
| 697 | 697 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n";  | 
                                                        
| 698 | 698 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";  | 
                                                        
| 699 | 699 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";  | 
                                                        
| 700 | - foreach($auto_config as $k => $v)  | 
                                                        |
| 700 | + foreach ($auto_config as $k => $v)  | 
                                                        |
| 701 | 701 |  		{ | 
                                                        
| 702 | -			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); | 
                                                        |
| 702 | +			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); | 
                                                        |
| 703 | 703 | }  | 
                                                        
| 704 | 704 | $body .= "</params>\r\n</methodCall>";  | 
                                                        
| 705 | 705 | |
| 706 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);  | 
                                                        |
| 706 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);  | 
                                                        |
| 707 | 707 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);  | 
                                                        
| 708 | 708 | |
| 709 | - if($fp)  | 
                                                        |
| 709 | + if ($fp)  | 
                                                        |
| 710 | 710 |  		{ | 
                                                        
| 711 | 711 | fputs($fp, $header);  | 
                                                        
| 712 | - while(!feof($fp))  | 
                                                        |
| 712 | + while (!feof($fp))  | 
                                                        |
| 713 | 713 |  			{ | 
                                                        
| 714 | 714 | $line = trim(fgets($fp, 4096));  | 
                                                        
| 715 | -				if(strncmp('<error>', $line, 7) === 0) | 
                                                        |
| 715 | +				if (strncmp('<error>', $line, 7) === 0) | 
                                                        |
| 716 | 716 |  				{ | 
                                                        
| 717 | 717 | fclose($fp);  | 
                                                        
| 718 | 718 | return false;  | 
                                                        
@@ -20,7 +20,7 @@ discard block  | 
                                                    ||
| 20 | 20 | function procInstallAdminInstall()  | 
                                                        
| 21 | 21 |  	{ | 
                                                        
| 22 | 22 |  		$module_name = Context::get('module_name'); | 
                                                        
| 23 | - if(!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 23 | + if (!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 24 | 24 | |
| 25 | 25 |  		$oInstallController = getController('install'); | 
                                                        
| 26 | 26 | $oInstallController->installModule($module_name, './modules/'.$module_name);  | 
                                                        
@@ -35,10 +35,10 @@ discard block  | 
                                                    ||
| 35 | 35 |  	{ | 
                                                        
| 36 | 36 | @set_time_limit(0);  | 
                                                        
| 37 | 37 |  		$module_name = Context::get('module_name'); | 
                                                        
| 38 | - if(!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 38 | + if (!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 39 | 39 | |
| 40 | 40 | $oModule = getModule($module_name, 'class');  | 
                                                        
| 41 | - if($oModule) $output = $oModule->moduleUpdate();  | 
                                                        |
| 41 | + if ($oModule) $output = $oModule->moduleUpdate();  | 
                                                        |
| 42 | 42 | else $output = new BaseObject(-1, 'invalid_request');  | 
                                                        
| 43 | 43 | |
| 44 | 44 | return $output;  | 
                                                        
@@ -53,54 +53,54 @@ discard block  | 
                                                    ||
| 53 | 53 | |
| 54 | 54 |  		$admin_ip_list = Context::get('admin_ip_list'); | 
                                                        
| 55 | 55 | |
| 56 | - if($admin_ip_list)  | 
                                                        |
| 56 | + if ($admin_ip_list)  | 
                                                        |
| 57 | 57 |  		{ | 
                                                        
| 58 | -			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list); | 
                                                        |
| 59 | -			$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list); | 
                                                        |
| 60 | -			if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list)) | 
                                                        |
| 58 | +			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list); | 
                                                        |
| 59 | +			$admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list); | 
                                                        |
| 60 | +			if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list)) | 
                                                        |
| 61 | 61 |  			{ | 
                                                        
| 62 | 62 | $admin_ip_list = '';  | 
                                                        
| 63 | 63 | }  | 
                                                        
| 64 | - $admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];  | 
                                                        |
| 65 | -			$admin_ip_list = explode(',',trim($admin_ip_list, ',')); | 
                                                        |
| 64 | + $admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];  | 
                                                        |
| 65 | +			$admin_ip_list = explode(',', trim($admin_ip_list, ',')); | 
                                                        |
| 66 | 66 | $admin_ip_list = array_unique($admin_ip_list);  | 
                                                        
| 67 | -			if(!IpFilter::validate($admin_ip_list)) { | 
                                                        |
| 67 | +			if (!IpFilter::validate($admin_ip_list)) { | 
                                                        |
| 68 | 68 | return new BaseObject(-1, 'msg_invalid_ip');  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | 70 | }  | 
                                                        
| 71 | 71 | |
| 72 | 72 |  		$default_url = Context::get('default_url'); | 
                                                        
| 73 | -		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; | 
                                                        |
| 74 | - if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';  | 
                                                        |
| 73 | +		if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; | 
                                                        |
| 74 | + if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';  | 
                                                        |
| 75 | 75 | |
| 76 | 76 | /* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */  | 
                                                        
| 77 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 77 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 78 | 78 |  		$IDN = new idna_convert(array('idn_version' => 2008)); | 
                                                        
| 79 | 79 | $default_url = $IDN->encode($default_url);  | 
                                                        
| 80 | 80 | |
| 81 | 81 |  		$use_ssl = Context::get('use_ssl'); | 
                                                        
| 82 | - if(!$use_ssl) $use_ssl = 'none';  | 
                                                        |
| 82 | + if (!$use_ssl) $use_ssl = 'none';  | 
                                                        |
| 83 | 83 | |
| 84 | 84 |  		$http_port = Context::get('http_port'); | 
                                                        
| 85 | 85 |  		$https_port = Context::get('https_port'); | 
                                                        
| 86 | 86 | |
| 87 | 87 |  		$use_rewrite = Context::get('use_rewrite'); | 
                                                        
| 88 | - if($use_rewrite!='Y') $use_rewrite = 'N';  | 
                                                        |
| 88 | + if ($use_rewrite != 'Y') $use_rewrite = 'N';  | 
                                                        |
| 89 | 89 | |
| 90 | 90 |  		$use_sso = Context::get('use_sso'); | 
                                                        
| 91 | - if($use_sso !='Y') $use_sso = 'N';  | 
                                                        |
| 91 | + if ($use_sso != 'Y') $use_sso = 'N';  | 
                                                        |
| 92 | 92 | |
| 93 | 93 |  		$use_db_session = Context::get('use_db_session'); | 
                                                        
| 94 | - if($use_db_session!='Y') $use_db_session = 'N';  | 
                                                        |
| 94 | + if ($use_db_session != 'Y') $use_db_session = 'N';  | 
                                                        |
| 95 | 95 | |
| 96 | 96 |  		$qmail_compatibility = Context::get('qmail_compatibility'); | 
                                                        
| 97 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N';  | 
                                                        |
| 97 | + if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N';  | 
                                                        |
| 98 | 98 | |
| 99 | 99 |  		$disable_csrf_token = (Context::get('disable_csrf_token') === 'Y') ? 'Y' : 'N'; | 
                                                        
| 100 | 100 |  		$disable_cookie_secure = (Context::get('disable_cookie_secure') === 'Y') ? 'Y' : 'N'; | 
                                                        
| 101 | 101 | |
| 102 | 102 |  		$use_html5 = Context::get('use_html5'); | 
                                                        
| 103 | - if(!$use_html5) $use_html5 = 'N';  | 
                                                        |
| 103 | + if (!$use_html5) $use_html5 = 'N';  | 
                                                        |
| 104 | 104 | |
| 105 | 105 | $db_info->default_url = $default_url;  | 
                                                        
| 106 | 106 | $db_info->qmail_compatibility = $qmail_compatibility;  | 
                                                        
@@ -114,23 +114,23 @@ discard block  | 
                                                    ||
| 114 | 114 | $db_info->use_html5 = $use_html5;  | 
                                                        
| 115 | 115 | $db_info->admin_ip_list = $admin_ip_list;  | 
                                                        
| 116 | 116 | |
| 117 | - if($http_port) $db_info->http_port = (int) $http_port;  | 
                                                        |
| 118 | - else if($db_info->http_port) unset($db_info->http_port);  | 
                                                        |
| 117 | + if ($http_port) $db_info->http_port = (int) $http_port;  | 
                                                        |
| 118 | + else if ($db_info->http_port) unset($db_info->http_port);  | 
                                                        |
| 119 | 119 | |
| 120 | - if($https_port) $db_info->https_port = (int) $https_port;  | 
                                                        |
| 121 | - else if($db_info->https_port) unset($db_info->https_port);  | 
                                                        |
| 120 | + if ($https_port) $db_info->https_port = (int) $https_port;  | 
                                                        |
| 121 | + else if ($db_info->https_port) unset($db_info->https_port);  | 
                                                        |
| 122 | 122 | |
| 123 | 123 | unset($db_info->lang_type);  | 
                                                        
| 124 | 124 | |
| 125 | 125 |  		$oInstallController = getController('install'); | 
                                                        
| 126 | - if(!$oInstallController->makeConfigFile())  | 
                                                        |
| 126 | + if (!$oInstallController->makeConfigFile())  | 
                                                        |
| 127 | 127 |  		{ | 
                                                        
| 128 | 128 | return new BaseObject(-1, 'msg_invalid_request');  | 
                                                        
| 129 | 129 | }  | 
                                                        
| 130 | 130 | else  | 
                                                        
| 131 | 131 |  		{ | 
                                                        
| 132 | 132 | Context::setDBInfo($db_info);  | 
                                                        
| 133 | - if($default_url)  | 
                                                        |
| 133 | + if ($default_url)  | 
                                                        |
| 134 | 134 |  			{ | 
                                                        
| 135 | 135 | $site_args = new stdClass;  | 
                                                        
| 136 | 136 | $site_args->site_srl = 0;  | 
                                                        
@@ -144,7 +144,7 @@ discard block  | 
                                                    ||
| 144 | 144 | |
| 145 | 145 | function procInstallAdminUpdateIndexModule()  | 
                                                        
| 146 | 146 |  	{ | 
                                                        
| 147 | -		if(!Context::get('index_module_srl') || !Context::get('menu_item_srl')) | 
                                                        |
| 147 | +		if (!Context::get('index_module_srl') || !Context::get('menu_item_srl')) | 
                                                        |
| 148 | 148 |  		{ | 
                                                        
| 149 | 149 | return new BaseObject(-1, 'msg_invalid_request');  | 
                                                        
| 150 | 150 | }  | 
                                                        
@@ -163,12 +163,12 @@ discard block  | 
                                                    ||
| 163 | 163 | // update homeSitemap.php cache file  | 
                                                        
| 164 | 164 |  		$oMenuAdminController = getAdminController('menu'); | 
                                                        
| 165 | 165 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();  | 
                                                        
| 166 | - if(file_exists($homeMenuCacheFile))  | 
                                                        |
| 166 | + if (file_exists($homeMenuCacheFile))  | 
                                                        |
| 167 | 167 |  		{ | 
                                                        
| 168 | 168 | include($homeMenuCacheFile);  | 
                                                        
| 169 | 169 | }  | 
                                                        
| 170 | 170 | |
| 171 | - if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)  | 
                                                        |
| 171 | + if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)  | 
                                                        |
| 172 | 172 |  		{ | 
                                                        
| 173 | 173 | $oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);  | 
                                                        
| 174 | 174 | }  | 
                                                        
@@ -179,8 +179,8 @@ discard block  | 
                                                    ||
| 179 | 179 | function procInstallAdminRemoveFTPInfo()  | 
                                                        
| 180 | 180 |  	{ | 
                                                        
| 181 | 181 | $ftp_config_file = Context::getFTPConfigFile();  | 
                                                        
| 182 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file);  | 
                                                        |
| 183 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 182 | + if (file_exists($ftp_config_file)) unlink($ftp_config_file);  | 
                                                        |
| 183 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 184 | 184 |  		$this->setMessage('success_deleted'); | 
                                                        
| 185 | 185 | }  | 
                                                        
| 186 | 186 | |
@@ -191,11 +191,11 @@ discard block  | 
                                                    ||
| 191 | 191 |  		$ftp_info->ftp_port = Context::get('ftp_port'); | 
                                                        
| 192 | 192 |  		$ftp_info->ftp_host = Context::get('ftp_host'); | 
                                                        
| 193 | 193 |  		$ftp_info->ftp_pasv = Context::get('ftp_pasv'); | 
                                                        
| 194 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";  | 
                                                        |
| 194 | + if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";  | 
                                                        |
| 195 | 195 |  		$ftp_info->sftp = Context::get('sftp'); | 
                                                        
| 196 | 196 | |
| 197 | 197 |  		$ftp_root_path = Context::get('ftp_root_path'); | 
                                                        
| 198 | - if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")  | 
                                                        |
| 198 | + if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/")  | 
                                                        |
| 199 | 199 |  		{ | 
                                                        
| 200 | 200 | $ftp_info->ftp_root_path = $ftp_root_path;  | 
                                                        
| 201 | 201 | }  | 
                                                        
@@ -204,25 +204,25 @@ discard block  | 
                                                    ||
| 204 | 204 | $ftp_info->ftp_root_path = $ftp_root_path.'/';  | 
                                                        
| 205 | 205 | }  | 
                                                        
| 206 | 206 | |
| 207 | -		if(ini_get('safe_mode')) | 
                                                        |
| 207 | +		if (ini_get('safe_mode')) | 
                                                        |
| 208 | 208 |  		{ | 
                                                        
| 209 | 209 |  			$ftp_info->ftp_password = Context::get('ftp_password'); | 
                                                        
| 210 | 210 | }  | 
                                                        
| 211 | 211 | |
| 212 | 212 |  		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; | 
                                                        
| 213 | - foreach($ftp_info as $key => $val)  | 
                                                        |
| 213 | + foreach ($ftp_info as $key => $val)  | 
                                                        |
| 214 | 214 |  		{ | 
                                                        
| 215 | - if(!$val) continue;  | 
                                                        |
| 216 | -			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) | 
                                                        |
| 215 | + if (!$val) continue;  | 
                                                        |
| 216 | +			if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) | 
                                                        |
| 217 | 217 |  			{ | 
                                                        
| 218 | 218 | continue;  | 
                                                        
| 219 | 219 | }  | 
                                                        
| 220 | -			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); | 
                                                        |
| 220 | +			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); | 
                                                        |
| 221 | 221 | }  | 
                                                        
| 222 | 222 | $buff .= "?>";  | 
                                                        
| 223 | 223 | $config_file = Context::getFTPConfigFile();  | 
                                                        
| 224 | 224 | FileHandler::WriteFile($config_file, $buff);  | 
                                                        
| 225 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 225 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 226 | 226 | |
| 227 | 227 |  		$this->setMessage('success_updated'); | 
                                                        
| 228 | 228 |  		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); | 
                                                        
@@ -232,7 +232,7 @@ discard block  | 
                                                    ||
| 232 | 232 | function procInstallAdminConfig()  | 
                                                        
| 233 | 233 |  	{ | 
                                                        
| 234 | 234 |  		$use_mobile_view = Context::get('use_mobile_view'); | 
                                                        
| 235 | - if($use_mobile_view!='Y') $use_mobile_view = 'N';  | 
                                                        |
| 235 | + if ($use_mobile_view != 'Y') $use_mobile_view = 'N';  | 
                                                        |
| 236 | 236 | |
| 237 | 237 |  		$time_zone = Context::get('time_zone'); | 
                                                        
| 238 | 238 | |
@@ -243,15 +243,15 @@ discard block  | 
                                                    ||
| 243 | 243 | unset($db_info->lang_type);  | 
                                                        
| 244 | 244 | Context::setDBInfo($db_info);  | 
                                                        
| 245 | 245 |  		$oInstallController = getController('install'); | 
                                                        
| 246 | - if(!$oInstallController->makeConfigFile())  | 
                                                        |
| 246 | + if (!$oInstallController->makeConfigFile())  | 
                                                        |
| 247 | 247 |  		{ | 
                                                        
| 248 | 248 | return new BaseObject(-1, 'msg_invalid_request');  | 
                                                        
| 249 | 249 | }  | 
                                                        
| 250 | 250 | |
| 251 | 251 | $site_args = new stdClass();  | 
                                                        
| 252 | 252 | $site_args->site_srl = 0;  | 
                                                        
| 253 | -		$site_args->index_module_srl = Context::get('index_module_srl');// | 
                                                        |
| 254 | -		$site_args->default_language = Context::get('change_lang_type');// | 
                                                        |
| 253 | +		$site_args->index_module_srl = Context::get('index_module_srl'); // | 
                                                        |
| 254 | +		$site_args->default_language = Context::get('change_lang_type'); // | 
                                                        |
| 255 | 255 |  		$oModuleController = getController('module'); | 
                                                        
| 256 | 256 | $oModuleController->updateSite($site_args);  | 
                                                        
| 257 | 257 | |
@@ -263,8 +263,8 @@ discard block  | 
                                                    ||
| 263 | 263 |  		$deleteFavicon = Context::get('is_delete_favicon'); | 
                                                        
| 264 | 264 |  		$deleteMobicon = Context::get('is_delete_mobicon'); | 
                                                        
| 265 | 265 | |
| 266 | -		$this->updateIcon('favicon.ico',$deleteFavicon); | 
                                                        |
| 267 | -		$this->updateIcon('mobicon.png',$deleteMobicon); | 
                                                        |
| 266 | +		$this->updateIcon('favicon.ico', $deleteFavicon); | 
                                                        |
| 267 | +		$this->updateIcon('mobicon.png', $deleteMobicon); | 
                                                        |
| 268 | 268 | |
| 269 | 269 | //모듈 설정 저장(썸네일, 풋터스크립트)  | 
                                                        
| 270 | 270 | $config = new stdClass();  | 
                                                        
@@ -282,16 +282,16 @@ discard block  | 
                                                    ||
| 282 | 282 | |
| 283 | 283 |  		$favicon = Context::get('favicon'); | 
                                                        
| 284 | 284 |  		$mobicon = Context::get('mobicon'); | 
                                                        
| 285 | -		if(!$favicon && !$mobicon) { | 
                                                        |
| 285 | +		if (!$favicon && !$mobicon) { | 
                                                        |
| 286 | 286 |  			Context::set('msg', Context::getLang("msg_invalid_format")); | 
                                                        
| 287 | 287 | return;  | 
                                                        
| 288 | 288 | }  | 
                                                        
| 289 | -		if($favicon) { | 
                                                        |
| 289 | +		if ($favicon) { | 
                                                        |
| 290 | 290 | $name = 'favicon';  | 
                                                        
| 291 | - $tmpFileName = $this->saveIconTmp($favicon,'favicon.ico');  | 
                                                        |
| 291 | + $tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico');  | 
                                                        |
| 292 | 292 |  		} else { | 
                                                        
| 293 | 293 | $name = 'mobicon';  | 
                                                        
| 294 | - $tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png');  | 
                                                        |
| 294 | + $tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png');  | 
                                                        |
| 295 | 295 | }  | 
                                                        
| 296 | 296 | |
| 297 | 297 |  		Context::set('name', $name); | 
                                                        
@@ -307,7 +307,7 @@ discard block  | 
                                                    ||
| 307 | 307 | |
| 308 | 308 | $lang_supported = Context::loadLangSupported();  | 
                                                        
| 309 | 309 | $buff = null;  | 
                                                        
| 310 | - for($i=0;$i<count($langs);$i++)  | 
                                                        |
| 310 | + for ($i = 0; $i < count($langs); $i++)  | 
                                                        |
| 311 | 311 |  		{ | 
                                                        
| 312 | 312 |  			$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]); | 
                                                        
| 313 | 313 | |
@@ -335,12 +335,12 @@ discard block  | 
                                                    ||
| 335 | 335 | }  | 
                                                        
| 336 | 336 | |
| 337 | 337 |  		$oModuleController = getController('module'); | 
                                                        
| 338 | -		$oModuleController->insertModuleConfig('document',$documentConfig); | 
                                                        |
| 338 | +		$oModuleController->insertModuleConfig('document', $documentConfig); | 
                                                        |
| 339 | 339 | |
| 340 | 340 | $args = new stdClass;  | 
                                                        
| 341 | 341 | $args->htmlFooter = $config->htmlFooter;  | 
                                                        
| 342 | 342 | $args->siteTitle = $config->siteTitle;  | 
                                                        
| 343 | -		$oModuleController->updateModuleConfig('module',$args); | 
                                                        |
| 343 | +		$oModuleController->updateModuleConfig('module', $args); | 
                                                        |
| 344 | 344 | }  | 
                                                        
| 345 | 345 | |
| 346 | 346 | private function saveIconTmp($icon, $iconname)  | 
                                                        
@@ -348,9 +348,9 @@ discard block  | 
                                                    ||
| 348 | 348 | |
| 349 | 349 |  		$site_info = Context::get('site_module_info'); | 
                                                        
| 350 | 350 | $virtual_site = '';  | 
                                                        
| 351 | - if($site_info->site_srl)  | 
                                                        |
| 351 | + if ($site_info->site_srl)  | 
                                                        |
| 352 | 352 |  		{ | 
                                                        
| 353 | - $virtual_site = $site_info->site_srl . '/';  | 
                                                        |
| 353 | + $virtual_site = $site_info->site_srl.'/';  | 
                                                        |
| 354 | 354 | }  | 
                                                        
| 355 | 355 | |
| 356 | 356 | $target_file = $icon['tmp_name'];  | 
                                                        
@@ -359,20 +359,20 @@ discard block  | 
                                                    ||
| 359 | 359 | $target_filename = _XE_PATH_.$relative_filename;  | 
                                                        
| 360 | 360 | |
| 361 | 361 | list($width, $height, $type_no, $attrs) = @getimagesize($target_file);  | 
                                                        
| 362 | - if($iconname == 'favicon.ico')  | 
                                                        |
| 362 | + if ($iconname == 'favicon.ico')  | 
                                                        |
| 363 | 363 |  		{ | 
                                                        
| 364 | -			if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) { | 
                                                        |
| 364 | +			if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) { | 
                                                        |
| 365 | 365 |  				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); | 
                                                        
| 366 | 366 | return;  | 
                                                        
| 367 | 367 | }  | 
                                                        
| 368 | 368 | }  | 
                                                        
| 369 | - else if($iconname == 'mobicon.png')  | 
                                                        |
| 369 | + else if ($iconname == 'mobicon.png')  | 
                                                        |
| 370 | 370 |  		{ | 
                                                        
| 371 | -			if(!preg_match('/^.*(png).*$/',$type)) { | 
                                                        |
| 371 | +			if (!preg_match('/^.*(png).*$/', $type)) { | 
                                                        |
| 372 | 372 |  				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); | 
                                                        
| 373 | 373 | return;  | 
                                                        
| 374 | 374 | }  | 
                                                        
| 375 | -			if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { | 
                                                        |
| 375 | +			if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { | 
                                                        |
| 376 | 376 |  				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); | 
                                                        
| 377 | 377 | return;  | 
                                                        
| 378 | 378 | }  | 
                                                        
@@ -393,21 +393,21 @@ discard block  | 
                                                    ||
| 393 | 393 | |
| 394 | 394 |  		$site_info = Context::get('site_module_info'); | 
                                                        
| 395 | 395 | $virtual_site = '';  | 
                                                        
| 396 | - if($site_info->site_srl)  | 
                                                        |
| 396 | + if ($site_info->site_srl)  | 
                                                        |
| 397 | 397 |  		{ | 
                                                        
| 398 | - $virtual_site = $site_info->site_srl . '/';  | 
                                                        |
| 398 | + $virtual_site = $site_info->site_srl.'/';  | 
                                                        |
| 399 | 399 | }  | 
                                                        
| 400 | 400 | |
| 401 | - $image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site;  | 
                                                        |
| 401 | + $image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site;  | 
                                                        |
| 402 | 402 | |
| 403 | -		if($deleteIcon) { | 
                                                        |
| 403 | +		if ($deleteIcon) { | 
                                                        |
| 404 | 404 | FileHandler::removeFile($image_filepath.$iconname);  | 
                                                        
| 405 | 405 | return;  | 
                                                        
| 406 | 406 | }  | 
                                                        
| 407 | 407 | |
| 408 | 408 | $tmpicon_filepath = $image_filepath.'tmp/'.$iconname;  | 
                                                        
| 409 | 409 | $icon_filepath = $image_filepath.$iconname;  | 
                                                        
| 410 | - if(file_exists($tmpicon_filepath))  | 
                                                        |
| 410 | + if (file_exists($tmpicon_filepath))  | 
                                                        |
| 411 | 411 |  		{ | 
                                                        
| 412 | 412 | FileHandler::moveFile($tmpicon_filepath, $icon_filepath);  | 
                                                        
| 413 | 413 | }  | 
                                                        
@@ -20,7 +20,9 @@ discard block  | 
                                                    ||
| 20 | 20 | function procInstallAdminInstall()  | 
                                                        
| 21 | 21 |  	{ | 
                                                        
| 22 | 22 |  		$module_name = Context::get('module_name'); | 
                                                        
| 23 | - if(!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 23 | +		if(!$module_name) { | 
                                                        |
| 24 | + return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 25 | + }  | 
                                                        |
| 24 | 26 | |
| 25 | 27 |  		$oInstallController = getController('install'); | 
                                                        
| 26 | 28 | $oInstallController->installModule($module_name, './modules/'.$module_name);  | 
                                                        
@@ -35,11 +37,16 @@ discard block  | 
                                                    ||
| 35 | 37 |  	{ | 
                                                        
| 36 | 38 | @set_time_limit(0);  | 
                                                        
| 37 | 39 |  		$module_name = Context::get('module_name'); | 
                                                        
| 38 | - if(!$module_name) return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 40 | +		if(!$module_name) { | 
                                                        |
| 41 | + return new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 42 | + }  | 
                                                        |
| 39 | 43 | |
| 40 | 44 | $oModule = getModule($module_name, 'class');  | 
                                                        
| 41 | - if($oModule) $output = $oModule->moduleUpdate();  | 
                                                        |
| 42 | - else $output = new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 45 | +		if($oModule) { | 
                                                        |
| 46 | + $output = $oModule->moduleUpdate();  | 
                                                        |
| 47 | +		} else { | 
                                                        |
| 48 | + $output = new BaseObject(-1, 'invalid_request');  | 
                                                        |
| 49 | + }  | 
                                                        |
| 43 | 50 | |
| 44 | 51 | return $output;  | 
                                                        
| 45 | 52 | }  | 
                                                        
@@ -70,8 +77,12 @@ discard block  | 
                                                    ||
| 70 | 77 | }  | 
                                                        
| 71 | 78 | |
| 72 | 79 |  		$default_url = Context::get('default_url'); | 
                                                        
| 73 | -		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; | 
                                                        |
| 74 | - if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';  | 
                                                        |
| 80 | +		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) { | 
                                                        |
| 81 | + $default_url = 'http://'.$default_url;  | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | +		if($default_url && substr($default_url, -1) !== '/') { | 
                                                        |
| 84 | + $default_url = $default_url.'/';  | 
                                                        |
| 85 | + }  | 
                                                        |
| 75 | 86 | |
| 76 | 87 | /* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */  | 
                                                        
| 77 | 88 | require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');  | 
                                                        
@@ -79,28 +90,40 @@ discard block  | 
                                                    ||
| 79 | 90 | $default_url = $IDN->encode($default_url);  | 
                                                        
| 80 | 91 | |
| 81 | 92 |  		$use_ssl = Context::get('use_ssl'); | 
                                                        
| 82 | - if(!$use_ssl) $use_ssl = 'none';  | 
                                                        |
| 93 | +		if(!$use_ssl) { | 
                                                        |
| 94 | + $use_ssl = 'none';  | 
                                                        |
| 95 | + }  | 
                                                        |
| 83 | 96 | |
| 84 | 97 |  		$http_port = Context::get('http_port'); | 
                                                        
| 85 | 98 |  		$https_port = Context::get('https_port'); | 
                                                        
| 86 | 99 | |
| 87 | 100 |  		$use_rewrite = Context::get('use_rewrite'); | 
                                                        
| 88 | - if($use_rewrite!='Y') $use_rewrite = 'N';  | 
                                                        |
| 101 | +		if($use_rewrite!='Y') { | 
                                                        |
| 102 | + $use_rewrite = 'N';  | 
                                                        |
| 103 | + }  | 
                                                        |
| 89 | 104 | |
| 90 | 105 |  		$use_sso = Context::get('use_sso'); | 
                                                        
| 91 | - if($use_sso !='Y') $use_sso = 'N';  | 
                                                        |
| 106 | +		if($use_sso !='Y') { | 
                                                        |
| 107 | + $use_sso = 'N';  | 
                                                        |
| 108 | + }  | 
                                                        |
| 92 | 109 | |
| 93 | 110 |  		$use_db_session = Context::get('use_db_session'); | 
                                                        
| 94 | - if($use_db_session!='Y') $use_db_session = 'N';  | 
                                                        |
| 111 | +		if($use_db_session!='Y') { | 
                                                        |
| 112 | + $use_db_session = 'N';  | 
                                                        |
| 113 | + }  | 
                                                        |
| 95 | 114 | |
| 96 | 115 |  		$qmail_compatibility = Context::get('qmail_compatibility'); | 
                                                        
| 97 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N';  | 
                                                        |
| 116 | +		if($qmail_compatibility!='Y') { | 
                                                        |
| 117 | + $qmail_compatibility = 'N';  | 
                                                        |
| 118 | + }  | 
                                                        |
| 98 | 119 | |
| 99 | 120 |  		$disable_csrf_token = (Context::get('disable_csrf_token') === 'Y') ? 'Y' : 'N'; | 
                                                        
| 100 | 121 |  		$disable_cookie_secure = (Context::get('disable_cookie_secure') === 'Y') ? 'Y' : 'N'; | 
                                                        
| 101 | 122 | |
| 102 | 123 |  		$use_html5 = Context::get('use_html5'); | 
                                                        
| 103 | - if(!$use_html5) $use_html5 = 'N';  | 
                                                        |
| 124 | +		if(!$use_html5) { | 
                                                        |
| 125 | + $use_html5 = 'N';  | 
                                                        |
| 126 | + }  | 
                                                        |
| 104 | 127 | |
| 105 | 128 | $db_info->default_url = $default_url;  | 
                                                        
| 106 | 129 | $db_info->qmail_compatibility = $qmail_compatibility;  | 
                                                        
@@ -114,11 +137,17 @@ discard block  | 
                                                    ||
| 114 | 137 | $db_info->use_html5 = $use_html5;  | 
                                                        
| 115 | 138 | $db_info->admin_ip_list = $admin_ip_list;  | 
                                                        
| 116 | 139 | |
| 117 | - if($http_port) $db_info->http_port = (int) $http_port;  | 
                                                        |
| 118 | - else if($db_info->http_port) unset($db_info->http_port);  | 
                                                        |
| 140 | +		if($http_port) { | 
                                                        |
| 141 | + $db_info->http_port = (int) $http_port;  | 
                                                        |
| 142 | +		} else if($db_info->http_port) { | 
                                                        |
| 143 | + unset($db_info->http_port);  | 
                                                        |
| 144 | + }  | 
                                                        |
| 119 | 145 | |
| 120 | - if($https_port) $db_info->https_port = (int) $https_port;  | 
                                                        |
| 121 | - else if($db_info->https_port) unset($db_info->https_port);  | 
                                                        |
| 146 | +		if($https_port) { | 
                                                        |
| 147 | + $db_info->https_port = (int) $https_port;  | 
                                                        |
| 148 | +		} else if($db_info->https_port) { | 
                                                        |
| 149 | + unset($db_info->https_port);  | 
                                                        |
| 150 | + }  | 
                                                        |
| 122 | 151 | |
| 123 | 152 | unset($db_info->lang_type);  | 
                                                        
| 124 | 153 | |
@@ -126,8 +155,7 @@ discard block  | 
                                                    ||
| 126 | 155 | if(!$oInstallController->makeConfigFile())  | 
                                                        
| 127 | 156 |  		{ | 
                                                        
| 128 | 157 | return new BaseObject(-1, 'msg_invalid_request');  | 
                                                        
| 129 | - }  | 
                                                        |
| 130 | - else  | 
                                                        |
| 158 | + } else  | 
                                                        |
| 131 | 159 |  		{ | 
                                                        
| 132 | 160 | Context::setDBInfo($db_info);  | 
                                                        
| 133 | 161 | if($default_url)  | 
                                                        
@@ -179,8 +207,12 @@ discard block  | 
                                                    ||
| 179 | 207 | function procInstallAdminRemoveFTPInfo()  | 
                                                        
| 180 | 208 |  	{ | 
                                                        
| 181 | 209 | $ftp_config_file = Context::getFTPConfigFile();  | 
                                                        
| 182 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file);  | 
                                                        |
| 183 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 210 | +		if(file_exists($ftp_config_file)) { | 
                                                        |
| 211 | + unlink($ftp_config_file);  | 
                                                        |
| 212 | + }  | 
                                                        |
| 213 | +		if($_SESSION['ftp_password']) { | 
                                                        |
| 214 | + unset($_SESSION['ftp_password']);  | 
                                                        |
| 215 | + }  | 
                                                        |
| 184 | 216 |  		$this->setMessage('success_deleted'); | 
                                                        
| 185 | 217 | }  | 
                                                        
| 186 | 218 | |
@@ -191,15 +223,16 @@ discard block  | 
                                                    ||
| 191 | 223 |  		$ftp_info->ftp_port = Context::get('ftp_port'); | 
                                                        
| 192 | 224 |  		$ftp_info->ftp_host = Context::get('ftp_host'); | 
                                                        
| 193 | 225 |  		$ftp_info->ftp_pasv = Context::get('ftp_pasv'); | 
                                                        
| 194 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";  | 
                                                        |
| 226 | +		if(!$ftp_info->ftp_pasv) { | 
                                                        |
| 227 | + $ftp_info->ftp_pasv = "N";  | 
                                                        |
| 228 | + }  | 
                                                        |
| 195 | 229 |  		$ftp_info->sftp = Context::get('sftp'); | 
                                                        
| 196 | 230 | |
| 197 | 231 |  		$ftp_root_path = Context::get('ftp_root_path'); | 
                                                        
| 198 | 232 | if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")  | 
                                                        
| 199 | 233 |  		{ | 
                                                        
| 200 | 234 | $ftp_info->ftp_root_path = $ftp_root_path;  | 
                                                        
| 201 | - }  | 
                                                        |
| 202 | - else  | 
                                                        |
| 235 | + } else  | 
                                                        |
| 203 | 236 |  		{ | 
                                                        
| 204 | 237 | $ftp_info->ftp_root_path = $ftp_root_path.'/';  | 
                                                        
| 205 | 238 | }  | 
                                                        
@@ -212,7 +245,9 @@ discard block  | 
                                                    ||
| 212 | 245 |  		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; | 
                                                        
| 213 | 246 | foreach($ftp_info as $key => $val)  | 
                                                        
| 214 | 247 |  		{ | 
                                                        
| 215 | - if(!$val) continue;  | 
                                                        |
| 248 | +			if(!$val) { | 
                                                        |
| 249 | + continue;  | 
                                                        |
| 250 | + }  | 
                                                        |
| 216 | 251 |  			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) | 
                                                        
| 217 | 252 |  			{ | 
                                                        
| 218 | 253 | continue;  | 
                                                        
@@ -222,7 +257,9 @@ discard block  | 
                                                    ||
| 222 | 257 | $buff .= "?>";  | 
                                                        
| 223 | 258 | $config_file = Context::getFTPConfigFile();  | 
                                                        
| 224 | 259 | FileHandler::WriteFile($config_file, $buff);  | 
                                                        
| 225 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);  | 
                                                        |
| 260 | +		if($_SESSION['ftp_password']) { | 
                                                        |
| 261 | + unset($_SESSION['ftp_password']);  | 
                                                        |
| 262 | + }  | 
                                                        |
| 226 | 263 | |
| 227 | 264 |  		$this->setMessage('success_updated'); | 
                                                        
| 228 | 265 |  		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); | 
                                                        
@@ -232,7 +269,9 @@ discard block  | 
                                                    ||
| 232 | 269 | function procInstallAdminConfig()  | 
                                                        
| 233 | 270 |  	{ | 
                                                        
| 234 | 271 |  		$use_mobile_view = Context::get('use_mobile_view'); | 
                                                        
| 235 | - if($use_mobile_view!='Y') $use_mobile_view = 'N';  | 
                                                        |
| 272 | +		if($use_mobile_view!='Y') { | 
                                                        |
| 273 | + $use_mobile_view = 'N';  | 
                                                        |
| 274 | + }  | 
                                                        |
| 236 | 275 | |
| 237 | 276 |  		$time_zone = Context::get('time_zone'); | 
                                                        
| 238 | 277 | |
@@ -328,8 +367,7 @@ discard block  | 
                                                    ||
| 328 | 367 | if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio')  | 
                                                        
| 329 | 368 |  		{ | 
                                                        
| 330 | 369 | $documentConfig->thumbnail_type = 'crop';  | 
                                                        
| 331 | - }  | 
                                                        |
| 332 | - else  | 
                                                        |
| 370 | + } else  | 
                                                        |
| 333 | 371 |  		{ | 
                                                        
| 334 | 372 | $documentConfig->thumbnail_type = 'ratio';  | 
                                                        
| 335 | 373 | }  | 
                                                        
@@ -365,8 +403,7 @@ discard block  | 
                                                    ||
| 365 | 403 |  				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); | 
                                                        
| 366 | 404 | return;  | 
                                                        
| 367 | 405 | }  | 
                                                        
| 368 | - }  | 
                                                        |
| 369 | - else if($iconname == 'mobicon.png')  | 
                                                        |
| 406 | + } else if($iconname == 'mobicon.png')  | 
                                                        |
| 370 | 407 |  		{ | 
                                                        
| 371 | 408 |  			if(!preg_match('/^.*(png).*$/',$type)) { | 
                                                        
| 372 | 409 |  				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); | 
                                                        
@@ -376,8 +413,7 @@ discard block  | 
                                                    ||
| 376 | 413 |  				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); | 
                                                        
| 377 | 414 | return;  | 
                                                        
| 378 | 415 | }  | 
                                                        
| 379 | - }  | 
                                                        |
| 380 | - else  | 
                                                        |
| 416 | + } else  | 
                                                        |
| 381 | 417 |  		{ | 
                                                        
| 382 | 418 |  			Context::set('msg', Context::getLang('msg_invalid_format')); | 
                                                        
| 383 | 419 | return;  | 
                                                        
@@ -6,13 +6,13 @@ discard block  | 
                                                    ||
| 6 | 6 | *  | 
                                                        
| 7 | 7 | * @author NAVER ([email protected])  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if(!defined('__XE__')) | 
                                                        |
| 9 | +if (!defined('__XE__')) | 
                                                        |
| 10 | 10 |  { | 
                                                        
| 11 | 11 | exit();  | 
                                                        
| 12 | 12 | }  | 
                                                        
| 13 | 13 | |
| 14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist  | 
                                                        
| 15 | -if(!function_exists('iconv')) | 
                                                        |
| 15 | +if (!function_exists('iconv')) | 
                                                        |
| 16 | 16 |  { | 
                                                        
| 17 | 17 |  	eval(' | 
                                                        
| 18 | 18 | function iconv($in_charset, $out_charset, $str)  | 
                                                        
@@ -220,7 +220,7 @@ discard block  | 
                                                    ||
| 220 | 220 |  { | 
                                                        
| 221 | 221 | $oDB = DB::getInstance();  | 
                                                        
| 222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns);  | 
                                                        
| 223 | - if(!is_array($output->data) && count($output->data) > 0)  | 
                                                        |
| 223 | + if (!is_array($output->data) && count($output->data) > 0)  | 
                                                        |
| 224 | 224 |  	{ | 
                                                        
| 225 | 225 | $output->data = array($output->data);  | 
                                                        
| 226 | 226 | }  | 
                                                        
@@ -250,7 +250,7 @@ discard block  | 
                                                    ||
| 250 | 250 | function setUserSequence($seq)  | 
                                                        
| 251 | 251 |  { | 
                                                        
| 252 | 252 | $arr_seq = array();  | 
                                                        
| 253 | - if(isset($_SESSION['seq']))  | 
                                                        |
| 253 | + if (isset($_SESSION['seq']))  | 
                                                        |
| 254 | 254 |  	{ | 
                                                        
| 255 | 255 | $arr_seq = $_SESSION['seq'];  | 
                                                        
| 256 | 256 | }  | 
                                                        
@@ -266,11 +266,11 @@ discard block  | 
                                                    ||
| 266 | 266 | */  | 
                                                        
| 267 | 267 | function checkUserSequence($seq)  | 
                                                        
| 268 | 268 |  { | 
                                                        
| 269 | - if(!isset($_SESSION['seq']))  | 
                                                        |
| 269 | + if (!isset($_SESSION['seq']))  | 
                                                        |
| 270 | 270 |  	{ | 
                                                        
| 271 | 271 | return false;  | 
                                                        
| 272 | 272 | }  | 
                                                        
| 273 | - if(!in_array($seq, $_SESSION['seq']))  | 
                                                        |
| 273 | + if (!in_array($seq, $_SESSION['seq']))  | 
                                                        |
| 274 | 274 |  	{ | 
                                                        
| 275 | 275 | return false;  | 
                                                        
| 276 | 276 | }  | 
                                                        
@@ -296,7 +296,7 @@ discard block  | 
                                                    ||
| 296 | 296 | $num_args = func_num_args();  | 
                                                        
| 297 | 297 | $args_list = func_get_args();  | 
                                                        
| 298 | 298 | |
| 299 | - if($num_args)  | 
                                                        |
| 299 | + if ($num_args)  | 
                                                        |
| 300 | 300 | $url = Context::getUrl($num_args, $args_list);  | 
                                                        
| 301 | 301 | else  | 
                                                        
| 302 | 302 | $url = Context::getRequestUri();  | 
                                                        
@@ -315,7 +315,7 @@ discard block  | 
                                                    ||
| 315 | 315 | $num_args = func_num_args();  | 
                                                        
| 316 | 316 | $args_list = func_get_args();  | 
                                                        
| 317 | 317 | |
| 318 | - if($num_args)  | 
                                                        |
| 318 | + if ($num_args)  | 
                                                        |
| 319 | 319 |  	{ | 
                                                        
| 320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 321 | 321 | }  | 
                                                        
@@ -338,7 +338,7 @@ discard block  | 
                                                    ||
| 338 | 338 | $num_args = func_num_args();  | 
                                                        
| 339 | 339 | $args_list = func_get_args();  | 
                                                        
| 340 | 340 | |
| 341 | - if($num_args)  | 
                                                        |
| 341 | + if ($num_args)  | 
                                                        |
| 342 | 342 |  	{ | 
                                                        
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);  | 
                                                        
| 344 | 344 | }  | 
                                                        
@@ -360,16 +360,16 @@ discard block  | 
                                                    ||
| 360 | 360 | $num_args = func_num_args();  | 
                                                        
| 361 | 361 | $args_list = func_get_args();  | 
                                                        
| 362 | 362 | $request_uri = Context::getRequestUri();  | 
                                                        
| 363 | - if(!$num_args)  | 
                                                        |
| 363 | + if (!$num_args)  | 
                                                        |
| 364 | 364 |  	{ | 
                                                        
| 365 | 365 | return $request_uri;  | 
                                                        
| 366 | 366 | }  | 
                                                        
| 367 | 367 | |
| 368 | 368 | $url = Context::getUrl($num_args, $args_list);  | 
                                                        
| 369 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 369 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 370 | 370 |  	{ | 
                                                        
| 371 | 371 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 372 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 372 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 373 | 373 | }  | 
                                                        
| 374 | 374 | return $url;  | 
                                                        
| 375 | 375 | }  | 
                                                        
@@ -384,17 +384,17 @@ discard block  | 
                                                    ||
| 384 | 384 | $num_args = func_num_args();  | 
                                                        
| 385 | 385 | $args_list = func_get_args();  | 
                                                        
| 386 | 386 | $request_uri = Context::getRequestUri();  | 
                                                        
| 387 | - if(!$num_args)  | 
                                                        |
| 387 | + if (!$num_args)  | 
                                                        |
| 388 | 388 |  	{ | 
                                                        
| 389 | 389 | return $request_uri;  | 
                                                        
| 390 | 390 | }  | 
                                                        
| 391 | 391 | |
| 392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 393 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 393 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 394 | 394 |  	{ | 
                                                        
| 395 | 395 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 397 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 397 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 398 | 398 | }  | 
                                                        
| 399 | 399 | return $url;  | 
                                                        
| 400 | 400 | }  | 
                                                        
@@ -410,7 +410,7 @@ discard block  | 
                                                    ||
| 410 | 410 | $num_args = func_num_args();  | 
                                                        
| 411 | 411 | $args_list = func_get_args();  | 
                                                        
| 412 | 412 | |
| 413 | - if(!$num_args)  | 
                                                        |
| 413 | + if (!$num_args)  | 
                                                        |
| 414 | 414 |  	{ | 
                                                        
| 415 | 415 | return Context::getRequestUri();  | 
                                                        
| 416 | 416 | }  | 
                                                        
@@ -432,7 +432,7 @@ discard block  | 
                                                    ||
| 432 | 432 | $num_args = func_num_args();  | 
                                                        
| 433 | 433 | $args_list = func_get_args();  | 
                                                        
| 434 | 434 | |
| 435 | - if(!$num_args)  | 
                                                        |
| 435 | + if (!$num_args)  | 
                                                        |
| 436 | 436 |  	{ | 
                                                        
| 437 | 437 | return Context::getRequestUri();  | 
                                                        
| 438 | 438 | }  | 
                                                        
@@ -454,7 +454,7 @@ discard block  | 
                                                    ||
| 454 | 454 | $args_list = func_get_args();  | 
                                                        
| 455 | 455 | |
| 456 | 456 | $request_uri = Context::getRequestUri();  | 
                                                        
| 457 | - if(!$num_args)  | 
                                                        |
| 457 | + if (!$num_args)  | 
                                                        |
| 458 | 458 |  	{ | 
                                                        
| 459 | 459 | return $request_uri;  | 
                                                        
| 460 | 460 | }  | 
                                                        
@@ -463,10 +463,10 @@ discard block  | 
                                                    ||
| 463 | 463 | $num_args = count($args_list);  | 
                                                        
| 464 | 464 | |
| 465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain);  | 
                                                        
| 466 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 466 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 467 | 467 |  	{ | 
                                                        
| 468 | 468 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 469 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 469 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 470 | 470 | }  | 
                                                        
| 471 | 471 | return $url;  | 
                                                        
| 472 | 472 | }  | 
                                                        
@@ -479,7 +479,7 @@ discard block  | 
                                                    ||
| 479 | 479 | function getCurrentPageUrl()  | 
                                                        
| 480 | 480 |  { | 
                                                        
| 481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';  | 
                                                        
| 482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];  | 
                                                        |
| 482 | + $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];  | 
                                                        |
| 483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);  | 
                                                        
| 484 | 484 | }  | 
                                                        
| 485 | 485 | |
@@ -509,7 +509,7 @@ discard block  | 
                                                    ||
| 509 | 509 | static $secure = null;  | 
                                                        
| 510 | 510 | static $db_info = null;  | 
                                                        
| 511 | 511 | |
| 512 | - if($db_info === null)  | 
                                                        |
| 512 | + if ($db_info === null)  | 
                                                        |
| 513 | 513 |  	{ | 
                                                        
| 514 | 514 | $db_info = Context::getDBInfo();  | 
                                                        
| 515 | 515 | }  | 
                                                        
@@ -517,9 +517,9 @@ discard block  | 
                                                    ||
| 517 | 517 | $path = '/';  | 
                                                        
| 518 | 518 | $domain = '';  | 
                                                        
| 519 | 519 | |
| 520 | - if($db_info->disable_cookie_secure !== 'Y')  | 
                                                        |
| 520 | + if ($db_info->disable_cookie_secure !== 'Y')  | 
                                                        |
| 521 | 521 |  	{ | 
                                                        
| 522 | - if($secure === null)  | 
                                                        |
| 522 | + if ($secure === null)  | 
                                                        |
| 523 | 523 |  		{ | 
                                                        
| 524 | 524 | $secure = (Context::getSslStatus() === 'always') ? true : false;  | 
                                                        
| 525 | 525 | }  | 
                                                        
@@ -542,12 +542,12 @@ discard block  | 
                                                    ||
| 542 | 542 | */  | 
                                                        
| 543 | 543 | function cut_str($string, $cut_size = 0, $tail = '...')  | 
                                                        
| 544 | 544 |  { | 
                                                        
| 545 | - if($cut_size < 1 || !$string)  | 
                                                        |
| 545 | + if ($cut_size < 1 || !$string)  | 
                                                        |
| 546 | 546 |  	{ | 
                                                        
| 547 | 547 | return $string;  | 
                                                        
| 548 | 548 | }  | 
                                                        
| 549 | 549 | |
| 550 | -	if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) | 
                                                        |
| 550 | +	if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) | 
                                                        |
| 551 | 551 |  	{ | 
                                                        
| 552 | 552 | $GLOBALS['use_mb_strimwidth'] = TRUE;  | 
                                                        
| 553 | 553 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8');  | 
                                                        
@@ -561,16 +561,16 @@ discard block  | 
                                                    ||
| 561 | 561 | $char_count = 0;  | 
                                                        
| 562 | 562 | |
| 563 | 563 | $idx = 0;  | 
                                                        
| 564 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)  | 
                                                        |
| 564 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)  | 
                                                        |
| 565 | 565 |  	{ | 
                                                        
| 566 | 566 | $c = ord(substr($string, $idx, 1));  | 
                                                        
| 567 | 567 | $char_count++;  | 
                                                        
| 568 | - if($c < 128)  | 
                                                        |
| 568 | + if ($c < 128)  | 
                                                        |
| 569 | 569 |  		{ | 
                                                        
| 570 | 570 | $char_width += (int) $chars[$c - 32];  | 
                                                        
| 571 | 571 | $idx++;  | 
                                                        
| 572 | 572 | }  | 
                                                        
| 573 | - else if(191 < $c && $c < 224)  | 
                                                        |
| 573 | + else if (191 < $c && $c < 224)  | 
                                                        |
| 574 | 574 |  		{ | 
                                                        
| 575 | 575 | $char_width += $chars[4];  | 
                                                        
| 576 | 576 | $idx += 2;  | 
                                                        
@@ -583,7 +583,7 @@ discard block  | 
                                                    ||
| 583 | 583 | }  | 
                                                        
| 584 | 584 | |
| 585 | 585 | $output = substr($string, 0, $idx);  | 
                                                        
| 586 | - if(strlen($output) < $string_length)  | 
                                                        |
| 586 | + if (strlen($output) < $string_length)  | 
                                                        |
| 587 | 587 |  	{ | 
                                                        
| 588 | 588 | $output .= $tail;  | 
                                                        
| 589 | 589 | }  | 
                                                        
@@ -599,7 +599,7 @@ discard block  | 
                                                    ||
| 599 | 599 | function zgap()  | 
                                                        
| 600 | 600 |  { | 
                                                        
| 601 | 601 | $time_zone = $GLOBALS['_time_zone'];  | 
                                                        
| 602 | - if($time_zone < 0)  | 
                                                        |
| 602 | + if ($time_zone < 0)  | 
                                                        |
| 603 | 603 |  	{ | 
                                                        
| 604 | 604 | $to = -1;  | 
                                                        
| 605 | 605 | }  | 
                                                        
@@ -612,7 +612,7 @@ discard block  | 
                                                    ||
| 612 | 612 | $t_min = substr($time_zone, 3, 2) * $to;  | 
                                                        
| 613 | 613 | |
| 614 | 614 |  	$server_time_zone = date("O"); | 
                                                        
| 615 | - if($server_time_zone < 0)  | 
                                                        |
| 615 | + if ($server_time_zone < 0)  | 
                                                        |
| 616 | 616 |  	{ | 
                                                        
| 617 | 617 | $so = -1;  | 
                                                        
| 618 | 618 | }  | 
                                                        
@@ -639,7 +639,7 @@ discard block  | 
                                                    ||
| 639 | 639 | */  | 
                                                        
| 640 | 640 | function ztime($str)  | 
                                                        
| 641 | 641 |  { | 
                                                        
| 642 | - if(!$str)  | 
                                                        |
| 642 | + if (!$str)  | 
                                                        |
| 643 | 643 |  	{ | 
                                                        
| 644 | 644 | return;  | 
                                                        
| 645 | 645 | }  | 
                                                        
@@ -650,7 +650,7 @@ discard block  | 
                                                    ||
| 650 | 650 | $year = (int) substr($str, 0, 4);  | 
                                                        
| 651 | 651 | $month = (int) substr($str, 4, 2);  | 
                                                        
| 652 | 652 | $day = (int) substr($str, 6, 2);  | 
                                                        
| 653 | - if(strlen($str) <= 8)  | 
                                                        |
| 653 | + if (strlen($str) <= 8)  | 
                                                        |
| 654 | 654 |  	{ | 
                                                        
| 655 | 655 | $gap = 0;  | 
                                                        
| 656 | 656 | }  | 
                                                        
@@ -674,19 +674,19 @@ discard block  | 
                                                    ||
| 674 | 674 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);  | 
                                                        
| 675 | 675 | |
| 676 | 676 |  	$lang_time_gap = Context::getLang('time_gap'); | 
                                                        
| 677 | - if($gap < 60)  | 
                                                        |
| 677 | + if ($gap < 60)  | 
                                                        |
| 678 | 678 |  	{ | 
                                                        
| 679 | 679 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);  | 
                                                        
| 680 | 680 | }  | 
                                                        
| 681 | - elseif($gap < 60 * 60)  | 
                                                        |
| 681 | + elseif ($gap < 60 * 60)  | 
                                                        |
| 682 | 682 |  	{ | 
                                                        
| 683 | 683 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);  | 
                                                        
| 684 | 684 | }  | 
                                                        
| 685 | - elseif($gap < 60 * 60 * 2)  | 
                                                        |
| 685 | + elseif ($gap < 60 * 60 * 2)  | 
                                                        |
| 686 | 686 |  	{ | 
                                                        
| 687 | 687 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);  | 
                                                        
| 688 | 688 | }  | 
                                                        
| 689 | - elseif($gap < 60 * 60 * 24)  | 
                                                        |
| 689 | + elseif ($gap < 60 * 60 * 24)  | 
                                                        |
| 690 | 690 |  	{ | 
                                                        
| 691 | 691 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);  | 
                                                        
| 692 | 692 | }  | 
                                                        
@@ -723,40 +723,40 @@ discard block  | 
                                                    ||
| 723 | 723 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)  | 
                                                        
| 724 | 724 |  { | 
                                                        
| 725 | 725 | // return null if no target time is specified  | 
                                                        
| 726 | - if(!$str)  | 
                                                        |
| 726 | + if (!$str)  | 
                                                        |
| 727 | 727 |  	{ | 
                                                        
| 728 | 728 | return;  | 
                                                        
| 729 | 729 | }  | 
                                                        
| 730 | 730 | // convert the date format according to the language  | 
                                                        
| 731 | - if($conversion == TRUE)  | 
                                                        |
| 731 | + if ($conversion == TRUE)  | 
                                                        |
| 732 | 732 |  	{ | 
                                                        
| 733 | - switch(Context::getLangType())  | 
                                                        |
| 733 | + switch (Context::getLangType())  | 
                                                        |
| 734 | 734 |  		{ | 
                                                        
| 735 | 735 | case 'en' :  | 
                                                        
| 736 | 736 | case 'es' :  | 
                                                        
| 737 | - if($format == 'Y-m-d')  | 
                                                        |
| 737 | + if ($format == 'Y-m-d')  | 
                                                        |
| 738 | 738 |  				{ | 
                                                        
| 739 | 739 | $format = 'M d, Y';  | 
                                                        
| 740 | 740 | }  | 
                                                        
| 741 | - elseif($format == 'Y-m-d H:i:s')  | 
                                                        |
| 741 | + elseif ($format == 'Y-m-d H:i:s')  | 
                                                        |
| 742 | 742 |  				{ | 
                                                        
| 743 | 743 | $format = 'M d, Y H:i:s';  | 
                                                        
| 744 | 744 | }  | 
                                                        
| 745 | - elseif($format == 'Y-m-d H:i')  | 
                                                        |
| 745 | + elseif ($format == 'Y-m-d H:i')  | 
                                                        |
| 746 | 746 |  				{ | 
                                                        
| 747 | 747 | $format = 'M d, Y H:i';  | 
                                                        
| 748 | 748 | }  | 
                                                        
| 749 | 749 | break;  | 
                                                        
| 750 | 750 | case 'vi' :  | 
                                                        
| 751 | - if($format == 'Y-m-d')  | 
                                                        |
| 751 | + if ($format == 'Y-m-d')  | 
                                                        |
| 752 | 752 |  				{ | 
                                                        
| 753 | 753 | $format = 'd-m-Y';  | 
                                                        
| 754 | 754 | }  | 
                                                        
| 755 | - elseif($format == 'Y-m-d H:i:s')  | 
                                                        |
| 755 | + elseif ($format == 'Y-m-d H:i:s')  | 
                                                        |
| 756 | 756 |  				{ | 
                                                        
| 757 | 757 | $format = 'H:i:s d-m-Y';  | 
                                                        
| 758 | 758 | }  | 
                                                        
| 759 | - elseif($format == 'Y-m-d H:i')  | 
                                                        |
| 759 | + elseif ($format == 'Y-m-d H:i')  | 
                                                        |
| 760 | 760 |  				{ | 
                                                        
| 761 | 761 | $format = 'H:i d-m-Y';  | 
                                                        
| 762 | 762 | }  | 
                                                        
@@ -765,7 +765,7 @@ discard block  | 
                                                    ||
| 765 | 765 | }  | 
                                                        
| 766 | 766 | |
| 767 | 767 | // If year value is less than 1970, handle it separately.  | 
                                                        
| 768 | - if((int) substr($str, 0, 4) < 1970)  | 
                                                        |
| 768 | + if ((int) substr($str, 0, 4) < 1970)  | 
                                                        |
| 769 | 769 |  	{ | 
                                                        
| 770 | 770 | $hour = (int) substr($str, 8, 2);  | 
                                                        
| 771 | 771 | $min = (int) substr($str, 10, 2);  | 
                                                        
@@ -815,9 +815,9 @@ discard block  | 
                                                    ||
| 815 | 815 | function getEncodeEmailAddress($email)  | 
                                                        
| 816 | 816 |  { | 
                                                        
| 817 | 817 | $return = '';  | 
                                                        
| 818 | - for($i = 0, $c = strlen($email); $i < $c; $i++)  | 
                                                        |
| 818 | + for ($i = 0, $c = strlen($email); $i < $c; $i++)  | 
                                                        |
| 819 | 819 |  	{ | 
                                                        
| 820 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';  | 
                                                        |
| 820 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';';  | 
                                                        |
| 821 | 821 | }  | 
                                                        
| 822 | 822 | return $return;  | 
                                                        
| 823 | 823 | }  | 
                                                        
@@ -837,25 +837,25 @@ discard block  | 
                                                    ||
| 837 | 837 |  { | 
                                                        
| 838 | 838 | static $debug_file;  | 
                                                        
| 839 | 839 | |
| 840 | - if(!(__DEBUG__ & 1))  | 
                                                        |
| 840 | + if (!(__DEBUG__ & 1))  | 
                                                        |
| 841 | 841 |  	{ | 
                                                        
| 842 | 842 | return;  | 
                                                        
| 843 | 843 | }  | 
                                                        
| 844 | 844 | |
| 845 | 845 | static $firephp;  | 
                                                        
| 846 | 846 | $bt = debug_backtrace();  | 
                                                        
| 847 | - if(is_array($bt))  | 
                                                        |
| 847 | + if (is_array($bt))  | 
                                                        |
| 848 | 848 |  	{ | 
                                                        
| 849 | 849 | $bt_debug_print = array_shift($bt);  | 
                                                        
| 850 | 850 | $bt_called_function = array_shift($bt);  | 
                                                        
| 851 | 851 | }  | 
                                                        
| 852 | 852 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);  | 
                                                        
| 853 | 853 | $line_num = $bt_debug_print['line'];  | 
                                                        
| 854 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];  | 
                                                        |
| 854 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];  | 
                                                        |
| 855 | 855 | |
| 856 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 856 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 857 | 857 |  	{ | 
                                                        
| 858 | - if(!isset($firephp))  | 
                                                        |
| 858 | + if (!isset($firephp))  | 
                                                        |
| 859 | 859 |  		{ | 
                                                        
| 860 | 860 | $firephp = FirePHP::getInstance(TRUE);  | 
                                                        
| 861 | 861 | }  | 
                                                        
@@ -864,16 +864,16 @@ discard block  | 
                                                    ||
| 864 | 864 |  		$label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); | 
                                                        
| 865 | 865 | |
| 866 | 866 | // Check a FirePHP option  | 
                                                        
| 867 | - if($display_option === 'TABLE')  | 
                                                        |
| 867 | + if ($display_option === 'TABLE')  | 
                                                        |
| 868 | 868 |  		{ | 
                                                        
| 869 | 869 | $label = $display_option;  | 
                                                        
| 870 | 870 | }  | 
                                                        
| 871 | - if($display_option === 'ERROR')  | 
                                                        |
| 871 | + if ($display_option === 'ERROR')  | 
                                                        |
| 872 | 872 |  		{ | 
                                                        
| 873 | 873 | $type = $display_option;  | 
                                                        
| 874 | 874 | }  | 
                                                        
| 875 | 875 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.  | 
                                                        
| 876 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 876 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 877 | 877 |  		{ | 
                                                        
| 878 | 878 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';  | 
                                                        
| 879 | 879 | $label = NULL;  | 
                                                        
@@ -883,52 +883,52 @@ discard block  | 
                                                    ||
| 883 | 883 | }  | 
                                                        
| 884 | 884 | else  | 
                                                        
| 885 | 885 |  	{ | 
                                                        
| 886 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 886 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 887 | 887 |  		{ | 
                                                        
| 888 | 888 | return;  | 
                                                        
| 889 | 889 | }  | 
                                                        
| 890 | 890 | |
| 891 | 891 | $print = array();  | 
                                                        
| 892 | - if(!$debug_file)  | 
                                                        |
| 892 | + if (!$debug_file)  | 
                                                        |
| 893 | 893 |  		{ | 
                                                        
| 894 | - $debug_file = _XE_PATH_ . 'files/' . $file;  | 
                                                        |
| 894 | + $debug_file = _XE_PATH_.'files/'.$file;  | 
                                                        |
| 895 | 895 | }  | 
                                                        
| 896 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';  | 
                                                        |
| 896 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';  | 
                                                        |
| 897 | 897 | |
| 898 | - if($display_option === TRUE || $display_option === 'ERROR')  | 
                                                        |
| 898 | + if ($display_option === TRUE || $display_option === 'ERROR')  | 
                                                        |
| 899 | 899 |  		{ | 
                                                        
| 900 | -			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; | 
                                                        |
| 900 | +			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; | 
                                                        |
| 901 | 901 |  			$print[] = str_repeat('=', 80); | 
                                                        
| 902 | 902 | }  | 
                                                        
| 903 | 903 | $type = gettype($debug_output);  | 
                                                        
| 904 | -		if(!in_array($type, array('array', 'object', 'resource'))) | 
                                                        |
| 904 | +		if (!in_array($type, array('array', 'object', 'resource'))) | 
                                                        |
| 905 | 905 |  		{ | 
                                                        
| 906 | - if($display_option === 'ERROR')  | 
                                                        |
| 906 | + if ($display_option === 'ERROR')  | 
                                                        |
| 907 | 907 |  			{ | 
                                                        
| 908 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE);  | 
                                                        |
| 908 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE);  | 
                                                        |
| 909 | 909 | }  | 
                                                        
| 910 | 910 | else  | 
                                                        
| 911 | 911 |  			{ | 
                                                        
| 912 | -				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; | 
                                                        |
| 912 | +				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; | 
                                                        |
| 913 | 913 | }  | 
                                                        
| 914 | 914 | }  | 
                                                        
| 915 | 915 | else  | 
                                                        
| 916 | 916 |  		{ | 
                                                        
| 917 | -			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true))); | 
                                                        |
| 917 | +			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true))); | 
                                                        |
| 918 | 918 | }  | 
                                                        
| 919 | 919 |  		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; | 
                                                        
| 920 | 920 | $backtrace = debug_backtrace($backtrace_args);  | 
                                                        
| 921 | 921 | |
| 922 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])  | 
                                                        |
| 922 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])  | 
                                                        |
| 923 | 923 |  		{ | 
                                                        
| 924 | 924 | array_shift($backtrace);  | 
                                                        
| 925 | 925 | }  | 
                                                        
| 926 | - foreach($backtrace as $val)  | 
                                                        |
| 926 | + foreach ($backtrace as $val)  | 
                                                        |
| 927 | 927 |  		{ | 
                                                        
| 928 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line'];  | 
                                                        |
| 928 | + $print[] = ' - '.$val['file'].' : '.$val['line'];  | 
                                                        |
| 929 | 929 | }  | 
                                                        
| 930 | 930 | $print[] = PHP_EOL;  | 
                                                        
| 931 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);  | 
                                                        |
| 931 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);  | 
                                                        |
| 932 | 932 | }  | 
                                                        
| 933 | 933 | }  | 
                                                        
| 934 | 934 | |
@@ -939,7 +939,7 @@ discard block  | 
                                                    ||
| 939 | 939 | */  | 
                                                        
| 940 | 940 | function writeSlowlog($type, $elapsed_time, $obj)  | 
                                                        
| 941 | 941 |  { | 
                                                        
| 942 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;  | 
                                                        |
| 942 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;  | 
                                                        |
| 943 | 943 | |
| 944 | 944 | static $log_filename = array(  | 
                                                        
| 945 | 945 | 'query' => 'files/_slowlog_query.php',  | 
                                                        
@@ -949,47 +949,47 @@ discard block  | 
                                                    ||
| 949 | 949 | );  | 
                                                        
| 950 | 950 | $write_file = true;  | 
                                                        
| 951 | 951 | |
| 952 | - $log_file = _XE_PATH_ . $log_filename[$type];  | 
                                                        |
| 952 | + $log_file = _XE_PATH_.$log_filename[$type];  | 
                                                        |
| 953 | 953 | |
| 954 | 954 | $buff = array();  | 
                                                        
| 955 | 955 | $buff[] = '<?php exit(); ?>';  | 
                                                        
| 956 | 956 |  	$buff[] = date('c'); | 
                                                        
| 957 | 957 | |
| 958 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)  | 
                                                        |
| 958 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)  | 
                                                        |
| 959 | 959 |  	{ | 
                                                        
| 960 | - $buff[] = "\tCaller : " . $obj->caller;  | 
                                                        |
| 961 | - $buff[] = "\tCalled : " . $obj->called;  | 
                                                        |
| 960 | + $buff[] = "\tCaller : ".$obj->caller;  | 
                                                        |
| 961 | + $buff[] = "\tCalled : ".$obj->called;  | 
                                                        |
| 962 | 962 | }  | 
                                                        
| 963 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)  | 
                                                        |
| 963 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)  | 
                                                        |
| 964 | 964 |  	{ | 
                                                        
| 965 | - $buff[] = "\tAddon : " . $obj->called;  | 
                                                        |
| 966 | - $buff[] = "\tCalled position : " . $obj->caller;  | 
                                                        |
| 965 | + $buff[] = "\tAddon : ".$obj->called;  | 
                                                        |
| 966 | + $buff[] = "\tCalled position : ".$obj->caller;  | 
                                                        |
| 967 | 967 | }  | 
                                                        
| 968 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)  | 
                                                        |
| 968 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)  | 
                                                        |
| 969 | 969 |  	{ | 
                                                        
| 970 | - $buff[] = "\tWidget : " . $obj->called;  | 
                                                        |
| 970 | + $buff[] = "\tWidget : ".$obj->called;  | 
                                                        |
| 971 | 971 | }  | 
                                                        
| 972 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)  | 
                                                        |
| 972 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)  | 
                                                        |
| 973 | 973 |  	{ | 
                                                        
| 974 | 974 | |
| 975 | 975 | $buff[] = $obj->query;  | 
                                                        
| 976 | - $buff[] = "\tQuery ID : " . $obj->query_id;  | 
                                                        |
| 977 | - $buff[] = "\tCaller : " . $obj->caller;  | 
                                                        |
| 978 | - $buff[] = "\tConnection : " . $obj->connection;  | 
                                                        |
| 976 | + $buff[] = "\tQuery ID : ".$obj->query_id;  | 
                                                        |
| 977 | + $buff[] = "\tCaller : ".$obj->caller;  | 
                                                        |
| 978 | + $buff[] = "\tConnection : ".$obj->connection;  | 
                                                        |
| 979 | 979 | }  | 
                                                        
| 980 | 980 | else  | 
                                                        
| 981 | 981 |  	{ | 
                                                        
| 982 | 982 | $write_file = false;  | 
                                                        
| 983 | 983 | }  | 
                                                        
| 984 | 984 | |
| 985 | - if($write_file)  | 
                                                        |
| 985 | + if ($write_file)  | 
                                                        |
| 986 | 986 |  	{ | 
                                                        
| 987 | 987 |  		$buff[] = sprintf("\t%0.6f sec", $elapsed_time); | 
                                                        
| 988 | - $buff[] = PHP_EOL . PHP_EOL;  | 
                                                        |
| 988 | + $buff[] = PHP_EOL.PHP_EOL;  | 
                                                        |
| 989 | 989 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);  | 
                                                        
| 990 | 990 | }  | 
                                                        
| 991 | 991 | |
| 992 | - if($type != 'query')  | 
                                                        |
| 992 | + if ($type != 'query')  | 
                                                        |
| 993 | 993 |  	{ | 
                                                        
| 994 | 994 | $trigger_args = $obj;  | 
                                                        
| 995 | 995 | $trigger_args->_log_type = $type;  | 
                                                        
@@ -1029,11 +1029,11 @@ discard block  | 
                                                    ||
| 1029 | 1029 | */  | 
                                                        
| 1030 | 1030 | function delObjectVars($target_obj, $del_obj)  | 
                                                        
| 1031 | 1031 |  { | 
                                                        
| 1032 | - if(!is_object($target_obj))  | 
                                                        |
| 1032 | + if (!is_object($target_obj))  | 
                                                        |
| 1033 | 1033 |  	{ | 
                                                        
| 1034 | 1034 | return;  | 
                                                        
| 1035 | 1035 | }  | 
                                                        
| 1036 | - if(!is_object($del_obj))  | 
                                                        |
| 1036 | + if (!is_object($del_obj))  | 
                                                        |
| 1037 | 1037 |  	{ | 
                                                        
| 1038 | 1038 | return;  | 
                                                        
| 1039 | 1039 | }  | 
                                                        
@@ -1043,7 +1043,7 @@ discard block  | 
                                                    ||
| 1043 | 1043 | |
| 1044 | 1044 | $target = array_keys($target_vars);  | 
                                                        
| 1045 | 1045 | $del = array_keys($del_vars);  | 
                                                        
| 1046 | - if(!count($target) || !count($del))  | 
                                                        |
| 1046 | + if (!count($target) || !count($del))  | 
                                                        |
| 1047 | 1047 |  	{ | 
                                                        
| 1048 | 1048 | return $target_obj;  | 
                                                        
| 1049 | 1049 | }  | 
                                                        
@@ -1051,10 +1051,10 @@ discard block  | 
                                                    ||
| 1051 | 1051 | $return_obj = new stdClass();  | 
                                                        
| 1052 | 1052 | |
| 1053 | 1053 | $target_count = count($target);  | 
                                                        
| 1054 | - for($i = 0; $i < $target_count; $i++)  | 
                                                        |
| 1054 | + for ($i = 0; $i < $target_count; $i++)  | 
                                                        |
| 1055 | 1055 |  	{ | 
                                                        
| 1056 | 1056 | $target_key = $target[$i];  | 
                                                        
| 1057 | - if(!in_array($target_key, $del))  | 
                                                        |
| 1057 | + if (!in_array($target_key, $del))  | 
                                                        |
| 1058 | 1058 |  		{ | 
                                                        
| 1059 | 1059 |  			$return_obj->{$target_key} = $target_obj->{$target_key}; | 
                                                        
| 1060 | 1060 | }  | 
                                                        
@@ -1067,10 +1067,10 @@ discard block  | 
                                                    ||
| 1067 | 1067 |  { | 
                                                        
| 1068 | 1068 |  	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); | 
                                                        
| 1069 | 1069 | |
| 1070 | - foreach($del_vars as $var)  | 
                                                        |
| 1070 | + foreach ($del_vars as $var)  | 
                                                        |
| 1071 | 1071 |  	{ | 
                                                        
| 1072 | - if(is_array($vars)) unset($vars[$var]);  | 
                                                        |
| 1073 | - else if(is_object($vars)) unset($vars->$var);  | 
                                                        |
| 1072 | + if (is_array($vars)) unset($vars[$var]);  | 
                                                        |
| 1073 | + else if (is_object($vars)) unset($vars->$var);  | 
                                                        |
| 1074 | 1074 | }  | 
                                                        
| 1075 | 1075 | |
| 1076 | 1076 | return $vars;  | 
                                                        
@@ -1087,12 +1087,12 @@ discard block  | 
                                                    ||
| 1087 | 1087 | */  | 
                                                        
| 1088 | 1088 | function handleError($errno, $errstr, $file, $line)  | 
                                                        
| 1089 | 1089 |  { | 
                                                        
| 1090 | - if(!__DEBUG__)  | 
                                                        |
| 1090 | + if (!__DEBUG__)  | 
                                                        |
| 1091 | 1091 |  	{ | 
                                                        
| 1092 | 1092 | return;  | 
                                                        
| 1093 | 1093 | }  | 
                                                        
| 1094 | 1094 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE);  | 
                                                        
| 1095 | - if(!in_array($errno, $errors))  | 
                                                        |
| 1095 | + if (!in_array($errno, $errors))  | 
                                                        |
| 1096 | 1096 |  	{ | 
                                                        
| 1097 | 1097 | return;  | 
                                                        
| 1098 | 1098 | }  | 
                                                        
@@ -1112,8 +1112,8 @@ discard block  | 
                                                    ||
| 1112 | 1112 | function getNumberingPath($no, $size = 3)  | 
                                                        
| 1113 | 1113 |  { | 
                                                        
| 1114 | 1114 | $mod = pow(10, $size);  | 
                                                        
| 1115 | -	$output = sprintf('%0' . $size . 'd/', $no % $mod); | 
                                                        |
| 1116 | - if($no >= $mod)  | 
                                                        |
| 1115 | +	$output = sprintf('%0'.$size.'d/', $no % $mod); | 
                                                        |
| 1116 | + if ($no >= $mod)  | 
                                                        |
| 1117 | 1117 |  	{ | 
                                                        
| 1118 | 1118 | $output .= getNumberingPath((int) $no / $mod, $size);  | 
                                                        
| 1119 | 1119 | }  | 
                                                        
@@ -1133,7 +1133,7 @@ discard block  | 
                                                    ||
| 1133 | 1133 | |
| 1134 | 1134 | function purifierHtml(&$content)  | 
                                                        
| 1135 | 1135 |  { | 
                                                        
| 1136 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');  | 
                                                        |
| 1136 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php');  | 
                                                        |
| 1137 | 1137 | $oPurifier = Purifier::getInstance();  | 
                                                        
| 1138 | 1138 | $oPurifier->purify($content);  | 
                                                        
| 1139 | 1139 | }  | 
                                                        
@@ -1146,7 +1146,7 @@ discard block  | 
                                                    ||
| 1146 | 1146 | */  | 
                                                        
| 1147 | 1147 | function removeHackTag($content)  | 
                                                        
| 1148 | 1148 |  { | 
                                                        
| 1149 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 1149 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 1150 | 1150 | $oEmbedFilter = EmbedFilter::getInstance();  | 
                                                        
| 1151 | 1151 | $oEmbedFilter->check($content);  | 
                                                        
| 1152 | 1152 | |
@@ -1188,7 +1188,7 @@ discard block  | 
                                                    ||
| 1188 | 1188 | */  | 
                                                        
| 1189 | 1189 | function checkUploadedFile($file)  | 
                                                        
| 1190 | 1190 |  { | 
                                                        
| 1191 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');  | 
                                                        |
| 1191 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');  | 
                                                        |
| 1192 | 1192 | return UploadFileFilter::check($file);  | 
                                                        
| 1193 | 1193 | }  | 
                                                        
| 1194 | 1194 | |
@@ -1202,13 +1202,13 @@ discard block  | 
                                                    ||
| 1202 | 1202 |  { | 
                                                        
| 1203 | 1203 |  	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); | 
                                                        
| 1204 | 1204 | |
| 1205 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)  | 
                                                        |
| 1205 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)  | 
                                                        |
| 1206 | 1206 |  	{ | 
                                                        
| 1207 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)  | 
                                                        |
| 1207 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)  | 
                                                        |
| 1208 | 1208 |  		{ | 
                                                        
| 1209 | 1209 | $content .= '</xmp>';  | 
                                                        
| 1210 | 1210 | }  | 
                                                        
| 1211 | - else if($close_xmp < $start_xmp)  | 
                                                        |
| 1211 | + else if ($close_xmp < $start_xmp)  | 
                                                        |
| 1212 | 1212 |  		{ | 
                                                        
| 1213 | 1213 | $content .= '</xmp>';  | 
                                                        
| 1214 | 1214 | }  | 
                                                        
@@ -1228,33 +1228,33 @@ discard block  | 
                                                    ||
| 1228 | 1228 | $tag = strtolower($match[2]);  | 
                                                        
| 1229 | 1229 | |
| 1230 | 1230 | // xmp tag ?뺣━  | 
                                                        
| 1231 | - if($tag == 'xmp')  | 
                                                        |
| 1231 | + if ($tag == 'xmp')  | 
                                                        |
| 1232 | 1232 |  	{ | 
                                                        
| 1233 | 1233 |  		return "<{$match[1]}xmp>"; | 
                                                        
| 1234 | 1234 | }  | 
                                                        
| 1235 | - if($match[1])  | 
                                                        |
| 1235 | + if ($match[1])  | 
                                                        |
| 1236 | 1236 |  	{ | 
                                                        
| 1237 | 1237 | return $match[0];  | 
                                                        
| 1238 | 1238 | }  | 
                                                        
| 1239 | - if($match[4])  | 
                                                        |
| 1239 | + if ($match[4])  | 
                                                        |
| 1240 | 1240 |  	{ | 
                                                        
| 1241 | - $match[4] = ' ' . $match[4];  | 
                                                        |
| 1241 | + $match[4] = ' '.$match[4];  | 
                                                        |
| 1242 | 1242 | }  | 
                                                        
| 1243 | 1243 | |
| 1244 | 1244 | $attrs = array();  | 
                                                        
| 1245 | -	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) | 
                                                        |
| 1245 | +	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) | 
                                                        |
| 1246 | 1246 |  	{ | 
                                                        
| 1247 | - foreach($m[1] as $idx => $name)  | 
                                                        |
| 1247 | + foreach ($m[1] as $idx => $name)  | 
                                                        |
| 1248 | 1248 |  		{ | 
                                                        
| 1249 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)  | 
                                                        |
| 1249 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)  | 
                                                        |
| 1250 | 1250 |  			{ | 
                                                        
| 1251 | 1251 | continue;  | 
                                                        
| 1252 | 1252 | }  | 
                                                        
| 1253 | 1253 | |
| 1254 | -			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); | 
                                                        |
| 1254 | +			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); | 
                                                        |
| 1255 | 1255 |  			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); | 
                                                        
| 1256 | 1256 | |
| 1257 | -			if(preg_match('/^[a-z]+script:/i', $val)) | 
                                                        |
| 1257 | +			if (preg_match('/^[a-z]+script:/i', $val)) | 
                                                        |
| 1258 | 1258 |  			{ | 
                                                        
| 1259 | 1259 | continue;  | 
                                                        
| 1260 | 1260 | }  | 
                                                        
@@ -1265,60 +1265,60 @@ discard block  | 
                                                    ||
| 1265 | 1265 | |
| 1266 | 1266 |  	$filter_arrts = array('style', 'src', 'href'); | 
                                                        
| 1267 | 1267 | |
| 1268 | - if($tag === 'object') array_push($filter_arrts, 'data');  | 
                                                        |
| 1269 | - if($tag === 'param') array_push($filter_arrts, 'value');  | 
                                                        |
| 1268 | + if ($tag === 'object') array_push($filter_arrts, 'data');  | 
                                                        |
| 1269 | + if ($tag === 'param') array_push($filter_arrts, 'value');  | 
                                                        |
| 1270 | 1270 | |
| 1271 | - foreach($filter_arrts as $attr)  | 
                                                        |
| 1271 | + foreach ($filter_arrts as $attr)  | 
                                                        |
| 1272 | 1272 |  	{ | 
                                                        
| 1273 | - if(!isset($attrs[$attr])) continue;  | 
                                                        |
| 1273 | + if (!isset($attrs[$attr])) continue;  | 
                                                        |
| 1274 | 1274 | |
| 1275 | 1275 | $attr_value = rawurldecode($attrs[$attr]);  | 
                                                        
| 1276 | 1276 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);  | 
                                                        
| 1277 | 1277 |  		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); | 
                                                        
| 1278 | -		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') | 
                                                        |
| 1278 | +		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') | 
                                                        |
| 1279 | 1279 |  		{ | 
                                                        
| 1280 | 1280 | unset($attrs[$attr]);  | 
                                                        
| 1281 | 1281 | }  | 
                                                        
| 1282 | 1282 | }  | 
                                                        
| 1283 | 1283 | |
| 1284 | -	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) | 
                                                        |
| 1284 | +	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) | 
                                                        |
| 1285 | 1285 |  	{ | 
                                                        
| 1286 | 1286 | unset($attrs['style']);  | 
                                                        
| 1287 | 1287 | }  | 
                                                        
| 1288 | 1288 | |
| 1289 | 1289 | $attr = array();  | 
                                                        
| 1290 | - foreach($attrs as $name => $val)  | 
                                                        |
| 1290 | + foreach ($attrs as $name => $val)  | 
                                                        |
| 1291 | 1291 |  	{ | 
                                                        
| 1292 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a')  | 
                                                        |
| 1292 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a')  | 
                                                        |
| 1293 | 1293 |  		{ | 
                                                        
| 1294 | 1294 | $attribute = strtolower(trim($name));  | 
                                                        
| 1295 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')  | 
                                                        |
| 1295 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')  | 
                                                        |
| 1296 | 1296 |  			{ | 
                                                        
| 1297 | - if(stripos($val, 'data:') === 0)  | 
                                                        |
| 1297 | + if (stripos($val, 'data:') === 0)  | 
                                                        |
| 1298 | 1298 |  				{ | 
                                                        
| 1299 | 1299 | continue;  | 
                                                        
| 1300 | 1300 | }  | 
                                                        
| 1301 | 1301 | }  | 
                                                        
| 1302 | 1302 | }  | 
                                                        
| 1303 | 1303 | |
| 1304 | - if($tag == 'img')  | 
                                                        |
| 1304 | + if ($tag == 'img')  | 
                                                        |
| 1305 | 1305 |  		{ | 
                                                        
| 1306 | 1306 | $attribute = strtolower(trim($name));  | 
                                                        
| 1307 | - if(stripos($val, 'data:') === 0)  | 
                                                        |
| 1307 | + if (stripos($val, 'data:') === 0)  | 
                                                        |
| 1308 | 1308 |  			{ | 
                                                        
| 1309 | 1309 | continue;  | 
                                                        
| 1310 | 1310 | }  | 
                                                        
| 1311 | 1311 | }  | 
                                                        
| 1312 | 1312 |  		$val = str_replace('"', '"', $val); | 
                                                        
| 1313 | -		$attr[] = $name . "=\"{$val}\""; | 
                                                        |
| 1313 | +		$attr[] = $name."=\"{$val}\""; | 
                                                        |
| 1314 | 1314 | }  | 
                                                        
| 1315 | -	$attr = count($attr) ? ' ' . implode(' ', $attr) : ''; | 
                                                        |
| 1315 | +	$attr = count($attr) ? ' '.implode(' ', $attr) : ''; | 
                                                        |
| 1316 | 1316 | |
| 1317 | 1317 |  	return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; | 
                                                        
| 1318 | 1318 | }  | 
                                                        
| 1319 | 1319 | |
| 1320 | 1320 | // convert hexa value to RGB  | 
                                                        
| 1321 | -if(!function_exists('hexrgb')) | 
                                                        |
| 1321 | +if (!function_exists('hexrgb')) | 
                                                        |
| 1322 | 1322 |  { | 
                                                        
| 1323 | 1323 | |
| 1324 | 1324 | /**  | 
                                                        
@@ -1354,9 +1354,9 @@ discard block  | 
                                                    ||
| 1354 | 1354 | |
| 1355 | 1355 | settype($password, "string");  | 
                                                        
| 1356 | 1356 | |
| 1357 | - for($i = 0; $i < strlen($password); $i++)  | 
                                                        |
| 1357 | + for ($i = 0; $i < strlen($password); $i++)  | 
                                                        |
| 1358 | 1358 |  	{ | 
                                                        
| 1359 | - if($password[$i] == ' ' || $password[$i] == '\t')  | 
                                                        |
| 1359 | + if ($password[$i] == ' ' || $password[$i] == '\t')  | 
                                                        |
| 1360 | 1360 |  		{ | 
                                                        
| 1361 | 1361 | continue;  | 
                                                        
| 1362 | 1362 | }  | 
                                                        
@@ -1368,11 +1368,11 @@ discard block  | 
                                                    ||
| 1368 | 1368 |  	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); | 
                                                        
| 1369 | 1369 |  	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); | 
                                                        
| 1370 | 1370 | |
| 1371 | - if($result1 == '80000000')  | 
                                                        |
| 1371 | + if ($result1 == '80000000')  | 
                                                        |
| 1372 | 1372 |  	{ | 
                                                        
| 1373 | 1373 | $nr += 0x80000000;  | 
                                                        
| 1374 | 1374 | }  | 
                                                        
| 1375 | - if($result2 == '80000000')  | 
                                                        |
| 1375 | + if ($result2 == '80000000')  | 
                                                        |
| 1376 | 1376 |  	{ | 
                                                        
| 1377 | 1377 | $nr2 += 0x80000000;  | 
                                                        
| 1378 | 1378 | }  | 
                                                        
@@ -1388,7 +1388,7 @@ discard block  | 
                                                    ||
| 1388 | 1388 | function getScriptPath()  | 
                                                        
| 1389 | 1389 |  { | 
                                                        
| 1390 | 1390 | static $url = NULL;  | 
                                                        
| 1391 | - if($url == NULL)  | 
                                                        |
| 1391 | + if ($url == NULL)  | 
                                                        |
| 1392 | 1392 |  	{ | 
                                                        
| 1393 | 1393 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);  | 
                                                        
| 1394 | 1394 |  		$url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); | 
                                                        
@@ -1419,14 +1419,14 @@ discard block  | 
                                                    ||
| 1419 | 1419 | $decodedStr = '';  | 
                                                        
| 1420 | 1420 | $pos = 0;  | 
                                                        
| 1421 | 1421 | $len = strlen($source);  | 
                                                        
| 1422 | - while($pos < $len)  | 
                                                        |
| 1422 | + while ($pos < $len)  | 
                                                        |
| 1423 | 1423 |  	{ | 
                                                        
| 1424 | 1424 | $charAt = substr($source, $pos, 1);  | 
                                                        
| 1425 | - if($charAt == '%')  | 
                                                        |
| 1425 | + if ($charAt == '%')  | 
                                                        |
| 1426 | 1426 |  		{ | 
                                                        
| 1427 | 1427 | $pos++;  | 
                                                        
| 1428 | 1428 | $charAt = substr($source, $pos, 1);  | 
                                                        
| 1429 | - if($charAt == 'u')  | 
                                                        |
| 1429 | + if ($charAt == 'u')  | 
                                                        |
| 1430 | 1430 |  			{ | 
                                                        
| 1431 | 1431 | // we got a unicode character  | 
                                                        
| 1432 | 1432 | $pos++;  | 
                                                        
@@ -1460,21 +1460,21 @@ discard block  | 
                                                    ||
| 1460 | 1460 | */  | 
                                                        
| 1461 | 1461 | function _code2utf($num)  | 
                                                        
| 1462 | 1462 |  { | 
                                                        
| 1463 | - if($num < 128)  | 
                                                        |
| 1463 | + if ($num < 128)  | 
                                                        |
| 1464 | 1464 |  	{ | 
                                                        
| 1465 | 1465 | return chr($num);  | 
                                                        
| 1466 | 1466 | }  | 
                                                        
| 1467 | - if($num < 2048)  | 
                                                        |
| 1467 | + if ($num < 2048)  | 
                                                        |
| 1468 | 1468 |  	{ | 
                                                        
| 1469 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128);  | 
                                                        |
| 1469 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128);  | 
                                                        |
| 1470 | 1470 | }  | 
                                                        
| 1471 | - if($num < 65536)  | 
                                                        |
| 1471 | + if ($num < 65536)  | 
                                                        |
| 1472 | 1472 |  	{ | 
                                                        
| 1473 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);  | 
                                                        |
| 1473 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);  | 
                                                        |
| 1474 | 1474 | }  | 
                                                        
| 1475 | - if($num < 2097152)  | 
                                                        |
| 1475 | + if ($num < 2097152)  | 
                                                        |
| 1476 | 1476 |  	{ | 
                                                        
| 1477 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);  | 
                                                        |
| 1477 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);  | 
                                                        |
| 1478 | 1478 | }  | 
                                                        
| 1479 | 1479 | return '';  | 
                                                        
| 1480 | 1480 | }  | 
                                                        
@@ -1489,7 +1489,7 @@ discard block  | 
                                                    ||
| 1489 | 1489 | */  | 
                                                        
| 1490 | 1490 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)  | 
                                                        
| 1491 | 1491 |  { | 
                                                        
| 1492 | - if($urldecode)  | 
                                                        |
| 1492 | + if ($urldecode)  | 
                                                        |
| 1493 | 1493 |  	{ | 
                                                        
| 1494 | 1494 | $string = urldecode($string);  | 
                                                        
| 1495 | 1495 | }  | 
                                                        
@@ -1497,12 +1497,12 @@ discard block  | 
                                                    ||
| 1497 | 1497 |  	$sample = iconv('utf-8', 'utf-8', $string); | 
                                                        
| 1498 | 1498 | $is_utf8 = (md5($sample) === md5($string));  | 
                                                        
| 1499 | 1499 | |
| 1500 | - if(!$urldecode)  | 
                                                        |
| 1500 | + if (!$urldecode)  | 
                                                        |
| 1501 | 1501 |  	{ | 
                                                        
| 1502 | 1502 | $string = urldecode($string);  | 
                                                        
| 1503 | 1503 | }  | 
                                                        
| 1504 | 1504 | |
| 1505 | - if($return_convert)  | 
                                                        |
| 1505 | + if ($return_convert)  | 
                                                        |
| 1506 | 1506 |  	{ | 
                                                        
| 1507 | 1507 |  		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); | 
                                                        
| 1508 | 1508 | }  | 
                                                        
@@ -1518,7 +1518,7 @@ discard block  | 
                                                    ||
| 1518 | 1518 | */  | 
                                                        
| 1519 | 1519 | function json_encode2($data)  | 
                                                        
| 1520 | 1520 |  { | 
                                                        
| 1521 | - switch(gettype($data))  | 
                                                        |
| 1521 | + switch (gettype($data))  | 
                                                        |
| 1522 | 1522 |  	{ | 
                                                        
| 1523 | 1523 | case 'boolean':  | 
                                                        
| 1524 | 1524 | return $data ? 'true' : 'false';  | 
                                                        
@@ -1526,15 +1526,15 @@ discard block  | 
                                                    ||
| 1526 | 1526 | case 'double':  | 
                                                        
| 1527 | 1527 | return $data;  | 
                                                        
| 1528 | 1528 | case 'string':  | 
                                                        
| 1529 | -			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; | 
                                                        |
| 1529 | +			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; | 
                                                        |
| 1530 | 1530 | case 'object':  | 
                                                        
| 1531 | 1531 | $data = get_object_vars($data);  | 
                                                        
| 1532 | 1532 | case 'array':  | 
                                                        
| 1533 | 1533 | $rel = FALSE; // relative array?  | 
                                                        
| 1534 | 1534 | $key = array_keys($data);  | 
                                                        
| 1535 | - foreach($key as $v)  | 
                                                        |
| 1535 | + foreach ($key as $v)  | 
                                                        |
| 1536 | 1536 |  			{ | 
                                                        
| 1537 | - if(!is_int($v))  | 
                                                        |
| 1537 | + if (!is_int($v))  | 
                                                        |
| 1538 | 1538 |  				{ | 
                                                        
| 1539 | 1539 | $rel = TRUE;  | 
                                                        
| 1540 | 1540 | break;  | 
                                                        
@@ -1542,12 +1542,12 @@ discard block  | 
                                                    ||
| 1542 | 1542 | }  | 
                                                        
| 1543 | 1543 | |
| 1544 | 1544 | $arr = array();  | 
                                                        
| 1545 | - foreach($data as $k => $v)  | 
                                                        |
| 1545 | + foreach ($data as $k => $v)  | 
                                                        |
| 1546 | 1546 |  			{ | 
                                                        
| 1547 | -				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); | 
                                                        |
| 1547 | +				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); | 
                                                        |
| 1548 | 1548 | }  | 
                                                        
| 1549 | 1549 | |
| 1550 | -			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; | 
                                                        |
| 1550 | +			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; | 
                                                        |
| 1551 | 1551 | default:  | 
                                                        
| 1552 | 1552 | return '""';  | 
                                                        
| 1553 | 1553 | }  | 
                                                        
@@ -1561,7 +1561,7 @@ discard block  | 
                                                    ||
| 1561 | 1561 | */  | 
                                                        
| 1562 | 1562 | function isCrawler($agent = NULL)  | 
                                                        
| 1563 | 1563 |  { | 
                                                        
| 1564 | - if(!$agent)  | 
                                                        |
| 1564 | + if (!$agent)  | 
                                                        |
| 1565 | 1565 |  	{ | 
                                                        
| 1566 | 1566 | $agent = $_SERVER['HTTP_USER_AGENT'];  | 
                                                        
| 1567 | 1567 | }  | 
                                                        
@@ -1571,9 +1571,9 @@ discard block  | 
                                                    ||
| 1571 | 1571 | /*'211.245.21.110-211.245.21.119' mixsh is closed */  | 
                                                        
| 1572 | 1572 | );  | 
                                                        
| 1573 | 1573 | |
| 1574 | - foreach($check_agent as $str)  | 
                                                        |
| 1574 | + foreach ($check_agent as $str)  | 
                                                        |
| 1575 | 1575 |  	{ | 
                                                        
| 1576 | - if(stristr($agent, $str) != FALSE)  | 
                                                        |
| 1576 | + if (stristr($agent, $str) != FALSE)  | 
                                                        |
| 1577 | 1577 |  		{ | 
                                                        
| 1578 | 1578 | return TRUE;  | 
                                                        
| 1579 | 1579 | }  | 
                                                        
@@ -1591,7 +1591,7 @@ discard block  | 
                                                    ||
| 1591 | 1591 | */  | 
                                                        
| 1592 | 1592 | function stripEmbedTagForAdmin(&$content, $writer_member_srl)  | 
                                                        
| 1593 | 1593 |  { | 
                                                        
| 1594 | -	if(!Context::get('is_logged')) | 
                                                        |
| 1594 | +	if (!Context::get('is_logged')) | 
                                                        |
| 1595 | 1595 |  	{ | 
                                                        
| 1596 | 1596 | return;  | 
                                                        
| 1597 | 1597 | }  | 
                                                        
@@ -1599,18 +1599,18 @@ discard block  | 
                                                    ||
| 1599 | 1599 |  	$oModuleModel = getModel('module'); | 
                                                        
| 1600 | 1600 |  	$logged_info = Context::get('logged_info'); | 
                                                        
| 1601 | 1601 | |
| 1602 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))  | 
                                                        |
| 1602 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))  | 
                                                        |
| 1603 | 1603 |  	{ | 
                                                        
| 1604 | - if($writer_member_srl)  | 
                                                        |
| 1604 | + if ($writer_member_srl)  | 
                                                        |
| 1605 | 1605 |  		{ | 
                                                        
| 1606 | 1606 |  			$oMemberModel = getModel('member'); | 
                                                        
| 1607 | 1607 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);  | 
                                                        
| 1608 | - if($member_info->is_admin == "Y")  | 
                                                        |
| 1608 | + if ($member_info->is_admin == "Y")  | 
                                                        |
| 1609 | 1609 |  			{ | 
                                                        
| 1610 | 1610 | return;  | 
                                                        
| 1611 | 1611 | }  | 
                                                        
| 1612 | 1612 | }  | 
                                                        
| 1613 | -		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; | 
                                                        |
| 1613 | +		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; | 
                                                        |
| 1614 | 1614 |  		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); | 
                                                        
| 1615 | 1615 |  		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); | 
                                                        
| 1616 | 1616 |  		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); | 
                                                        
@@ -1627,18 +1627,18 @@ discard block  | 
                                                    ||
| 1627 | 1627 | function requirePear()  | 
                                                        
| 1628 | 1628 |  { | 
                                                        
| 1629 | 1629 | static $required = false;  | 
                                                        
| 1630 | - if($required)  | 
                                                        |
| 1630 | + if ($required)  | 
                                                        |
| 1631 | 1631 |  	{ | 
                                                        
| 1632 | 1632 | return;  | 
                                                        
| 1633 | 1633 | }  | 
                                                        
| 1634 | 1634 | |
| 1635 | - if(version_compare(PHP_VERSION, "5.3.0") < 0)  | 
                                                        |
| 1635 | + if (version_compare(PHP_VERSION, "5.3.0") < 0)  | 
                                                        |
| 1636 | 1636 |  	{ | 
                                                        
| 1637 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());  | 
                                                        |
| 1637 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 1638 | 1638 | }  | 
                                                        
| 1639 | 1639 | else  | 
                                                        
| 1640 | 1640 |  	{ | 
                                                        
| 1641 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());  | 
                                                        |
| 1641 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 1642 | 1642 | }  | 
                                                        
| 1643 | 1643 | |
| 1644 | 1644 | $required = true;  | 
                                                        
@@ -1648,23 +1648,23 @@ discard block  | 
                                                    ||
| 1648 | 1648 |  { | 
                                                        
| 1649 | 1649 | static $disable_csrf_token = null;  | 
                                                        
| 1650 | 1650 | |
| 1651 | - if($_SERVER['REQUEST_METHOD'] != 'POST')  | 
                                                        |
| 1651 | + if ($_SERVER['REQUEST_METHOD'] != 'POST')  | 
                                                        |
| 1652 | 1652 |  	{ | 
                                                        
| 1653 | 1653 | return FALSE;  | 
                                                        
| 1654 | 1654 | }  | 
                                                        
| 1655 | 1655 | |
| 1656 | - if($disable_csrf_token === null)  | 
                                                        |
| 1656 | + if ($disable_csrf_token === null)  | 
                                                        |
| 1657 | 1657 |  	{ | 
                                                        
| 1658 | 1658 | $db_info = Context::getDBinfo();  | 
                                                        
| 1659 | 1659 | $disable_csrf_token = $db_info->disable_csrf_token;  | 
                                                        
| 1660 | 1660 | }  | 
                                                        
| 1661 | 1661 | |
| 1662 | - if($disable_csrf_token !== 'Y')  | 
                                                        |
| 1662 | + if ($disable_csrf_token !== 'Y')  | 
                                                        |
| 1663 | 1663 |  	{ | 
                                                        
| 1664 | 1664 | $csrf_token = ($_SERVER['HTTP_X_CSRF_TOKEN']) ? $_SERVER['HTTP_X_CSRF_TOKEN'] : $_POST['_token'];  | 
                                                        
| 1665 | 1665 | |
| 1666 | 1666 | // Token  | 
                                                        
| 1667 | - if(!$csrf_token || $_SESSION['csrf_token'] !== $csrf_token)  | 
                                                        |
| 1667 | + if (!$csrf_token || $_SESSION['csrf_token'] !== $csrf_token)  | 
                                                        |
| 1668 | 1668 |  		{ | 
                                                        
| 1669 | 1669 |  			header("HTTP/1.1 403 Forbidden"); | 
                                                        
| 1670 | 1670 | return FALSE;  | 
                                                        
@@ -1674,9 +1674,9 @@ discard block  | 
                                                    ||
| 1674 | 1674 | $default_url = Context::getDefaultUrl();  | 
                                                        
| 1675 | 1675 | $referer = $_SERVER["HTTP_REFERER"];  | 
                                                        
| 1676 | 1676 | |
| 1677 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)  | 
                                                        |
| 1677 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)  | 
                                                        |
| 1678 | 1678 |  	{ | 
                                                        
| 1679 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1679 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1680 | 1680 |  		$IDN = new idna_convert(array('idn_version' => 2008)); | 
                                                        
| 1681 | 1681 | $referer = $IDN->encode($referer);  | 
                                                        
| 1682 | 1682 | }  | 
                                                        
@@ -1687,9 +1687,9 @@ discard block  | 
                                                    ||
| 1687 | 1687 |  	$oModuleModel = getModel('module'); | 
                                                        
| 1688 | 1688 | $siteModuleInfo = $oModuleModel->getDefaultMid();  | 
                                                        
| 1689 | 1689 | |
| 1690 | - if($siteModuleInfo->site_srl == 0)  | 
                                                        |
| 1690 | + if ($siteModuleInfo->site_srl == 0)  | 
                                                        |
| 1691 | 1691 |  	{ | 
                                                        
| 1692 | - if($default_url['host'] !== $referer['host'])  | 
                                                        |
| 1692 | + if ($default_url['host'] !== $referer['host'])  | 
                                                        |
| 1693 | 1693 |  		{ | 
                                                        
| 1694 | 1694 | return FALSE;  | 
                                                        
| 1695 | 1695 | }  | 
                                                        
@@ -1697,7 +1697,7 @@ discard block  | 
                                                    ||
| 1697 | 1697 | else  | 
                                                        
| 1698 | 1698 |  	{ | 
                                                        
| 1699 | 1699 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);  | 
                                                        
| 1700 | -		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) | 
                                                        |
| 1700 | +		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) | 
                                                        |
| 1701 | 1701 |  		{ | 
                                                        
| 1702 | 1702 | return FALSE;  | 
                                                        
| 1703 | 1703 | }  | 
                                                        
@@ -1713,15 +1713,15 @@ discard block  | 
                                                    ||
| 1713 | 1713 | */  | 
                                                        
| 1714 | 1714 | function recurciveExposureCheck(&$menu)  | 
                                                        
| 1715 | 1715 |  { | 
                                                        
| 1716 | - if(is_array($menu))  | 
                                                        |
| 1716 | + if (is_array($menu))  | 
                                                        |
| 1717 | 1717 |  	{ | 
                                                        
| 1718 | - foreach($menu AS $key=>$value)  | 
                                                        |
| 1718 | + foreach ($menu AS $key=>$value)  | 
                                                        |
| 1719 | 1719 |  		{ | 
                                                        
| 1720 | - if(!$value['isShow'])  | 
                                                        |
| 1720 | + if (!$value['isShow'])  | 
                                                        |
| 1721 | 1721 |  			{ | 
                                                        
| 1722 | 1722 | unset($menu[$key]);  | 
                                                        
| 1723 | 1723 | }  | 
                                                        
| 1724 | - if(is_array($value['list']) && count($value['list']) > 0)  | 
                                                        |
| 1724 | + if (is_array($value['list']) && count($value['list']) > 0)  | 
                                                        |
| 1725 | 1725 |  			{ | 
                                                        
| 1726 | 1726 | recurciveExposureCheck($menu[$key]['list']);  | 
                                                        
| 1727 | 1727 | }  | 
                                                        
@@ -1731,14 +1731,14 @@ discard block  | 
                                                    ||
| 1731 | 1731 | |
| 1732 | 1732 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')  | 
                                                        
| 1733 | 1733 |  { | 
                                                        
| 1734 | - if($requestKey != $dbKey)  | 
                                                        |
| 1734 | + if ($requestKey != $dbKey)  | 
                                                        |
| 1735 | 1735 |  	{ | 
                                                        
| 1736 | 1736 |  		$arrayUrl = parse_url(Context::get('success_return_url')); | 
                                                        
| 1737 | - if($arrayUrl['query'])  | 
                                                        |
| 1737 | + if ($arrayUrl['query'])  | 
                                                        |
| 1738 | 1738 |  		{ | 
                                                        
| 1739 | 1739 | parse_str($arrayUrl['query'], $parsedStr);  | 
                                                        
| 1740 | 1740 | |
| 1741 | - if(isset($parsedStr[$key]))  | 
                                                        |
| 1741 | + if (isset($parsedStr[$key]))  | 
                                                        |
| 1742 | 1742 |  			{ | 
                                                        
| 1743 | 1743 | $parsedStr[$key] = $requestKey;  | 
                                                        
| 1744 | 1744 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);  | 
                                                        
@@ -1781,14 +1781,14 @@ discard block  | 
                                                    ||
| 1781 | 1781 | */  | 
                                                        
| 1782 | 1782 | function alertScript($msg)  | 
                                                        
| 1783 | 1783 |  { | 
                                                        
| 1784 | - if(!$msg)  | 
                                                        |
| 1784 | + if (!$msg)  | 
                                                        |
| 1785 | 1785 |  	{ | 
                                                        
| 1786 | 1786 | return;  | 
                                                        
| 1787 | 1787 | }  | 
                                                        
| 1788 | 1788 | |
| 1789 | 1789 | echo '<script type="text/javascript">  | 
                                                        
| 1790 | 1790 | //<![CDATA[  | 
                                                        
| 1791 | -alert("' . $msg . '"); | 
                                                        |
| 1791 | +alert("' . $msg.'"); | 
                                                        |
| 1792 | 1792 | //]]>  | 
                                                        
| 1793 | 1793 | </script>';  | 
                                                        
| 1794 | 1794 | }  | 
                                                        
@@ -1819,7 +1819,7 @@ discard block  | 
                                                    ||
| 1819 | 1819 | |
| 1820 | 1820 | echo '<script type="text/javascript">  | 
                                                        
| 1821 | 1821 | //<![CDATA[  | 
                                                        
| 1822 | -' . $reloadScript . '  | 
                                                        |
| 1822 | +' . $reloadScript.'  | 
                                                        |
| 1823 | 1823 | //]]>  | 
                                                        
| 1824 | 1824 | </script>';  | 
                                                        
| 1825 | 1825 | }  |