GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( d82f4c...356701 )
by gyeong-won
15:38 queued 07:48
created
classes/display/XMLDisplayHandler.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@
 block discarded – undo
31 31
 	 */
32 32
 	function _makeXmlDoc($obj)
33 33
 	{
34
-		if(!count($obj))
34
+		if (!count($obj))
35 35
 		{
36 36
 			return;
37 37
 		}
38 38
 
39 39
 		$xmlDoc = '';
40 40
 
41
-		foreach($obj as $key => $val)
41
+		foreach ($obj as $key => $val)
42 42
 		{
43
-			if(is_numeric($key))
43
+			if (is_numeric($key))
44 44
 			{
45 45
 				$key = 'item';
46 46
 			}
47 47
 
48
-			if(is_string($val))
48
+			if (is_string($val))
49 49
 			{
50 50
 				$xmlDoc .= sprintf('<%s>%s</%s>%s', $key, htmlspecialchars($val, ENT_COMPAT, 'UTF-8', true), $key, "\n");
51 51
 			}
52
-			else if(!is_array($val) && !is_object($val))
52
+			else if (!is_array($val) && !is_object($val))
53 53
 			{
54 54
 				$xmlDoc .= sprintf('<%s>%s</%s>%s', $key, $val, $key, "\n");
55 55
 			}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,12 +48,10 @@
 block discarded – undo
48 48
 			if(is_string($val))
49 49
 			{
50 50
 				$xmlDoc .= sprintf('<%s>%s</%s>%s', $key, htmlspecialchars($val, ENT_COMPAT, 'UTF-8', true), $key, "\n");
51
-			}
52
-			else if(!is_array($val) && !is_object($val))
51
+			} else if(!is_array($val) && !is_object($val))
53 52
 			{
54 53
 				$xmlDoc .= sprintf('<%s>%s</%s>%s', $key, $val, $key, "\n");
55
-			}
56
-			else
54
+			} else
57 55
 			{
58 56
 				$xmlDoc .= sprintf('<%s>%s%s</%s>%s', $key, "\n", $this->_makeXmlDoc($val), $key, "\n");
59 57
 			}
Please login to merge, or discard this patch.
modules/install/install.controller.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	function init()
18 18
 	{
19 19
 		// Error occurs if already installed
20
-		if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
20
+		if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
21 21
 		{
22 22
 			$this->stop('msg_already_installed');
23 23
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	function _procDBSetting()
87 87
 	{
88 88
 		// Get DB-related variables
89
-		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
89
+		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix');
90 90
 
91 91
 		$db_info = new stdClass();
92 92
 		$db_info->master_db = get_object_vars($con_string);
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
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 Object(-1, 'msg_install_failed');
108
+		if (!$this->makeDBConfigFile()) return new Object(-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
 block discarded – undo
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 Object(-1, 'msg_install_failed');
128
+		if (!$this->makeEtcConfigFile($config_info)) return new Object(-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,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	function procInstall()
142 142
 	{
143 143
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
144
+		if (Context::isInstalled()) return new Object(-1, 'msg_already_installed');
145 145
 
146 146
 		// Assign a temporary administrator when installing
147 147
 		$logged_info = new stdClass();
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 		Context::set('logged_info', $logged_info);
150 150
 
151 151
 		// check install config
152
-		if(Context::get('install_config'))
152
+		if (Context::get('install_config'))
153 153
 		{
154 154
 			$db_info = $this->_makeDbInfoByInstallConfig();
155 155
 		}
156 156
 		// install by default XE UI
157 157
 		else
158 158
 		{
159
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
160
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
159
+			if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
160
+			if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
161 161
 		}
162 162
 
163 163
 		// Set DB type and information
@@ -165,30 +165,30 @@  discard block
 block discarded – undo
165 165
 		// Create DB Instance
166 166
 		$oDB = &DB::getInstance();
167 167
 		// Check if available to connect to the DB
168
-		if(!$oDB->isConnected()) return $oDB->getError();
168
+		if (!$oDB->isConnected()) return $oDB->getError();
169 169
 
170 170
 		// Install all the modules
171 171
 		try {
172 172
 			$oDB->begin();
173 173
 			$this->installDownloadedModule();
174 174
 			$oDB->commit();
175
-		} catch(Exception $e) {
175
+		} catch (Exception $e) {
176 176
 			$oDB->rollback();
177 177
 			return new Object(-1, $e->getMessage());
178 178
 		}
179 179
 
180 180
 		// Create a config file
181
-		if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
181
+		if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
182 182
 
183 183
 		// load script
184
-		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
185
-		if(count($scripts)>0)
184
+		$scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');
185
+		if (count($scripts) > 0)
186 186
 		{
187 187
 			sort($scripts);
188
-			foreach($scripts as $script)
188
+			foreach ($scripts as $script)
189 189
 			{
190 190
 				$script_path = FileHandler::getRealPath('./modules/install/script/');
191
-				$output = include($script_path . $script);
191
+				$output = include($script_path.$script);
192 192
 			}
193 193
 		}
194 194
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 		unset($_SESSION['use_rewrite']);
203 203
 
204
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
204
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
205 205
 		{
206 206
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
207 207
 			header('location:'.$returnUrl);
@@ -239,57 +239,57 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	function procInstallFTP()
241 241
 	{
242
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
243
-		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
244
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
245
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
246
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
247
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
242
+		if (Context::isInstalled()) return new Object(-1, 'msg_already_installed');
243
+		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
244
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
245
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
246
+		if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
247
+		if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
248 248
 
249 249
 		$buff = array('<?php if(!defined("__XE__")) exit();');
250 250
 		$buff[] = "\$ftp_info = new stdClass();";
251
-		foreach($ftp_info as $key => $val)
251
+		foreach ($ftp_info as $key => $val)
252 252
 		{
253
-			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
253
+			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
254 254
 		}
255 255
 
256 256
 		// If safe_mode
257
-		if(ini_get('safe_mode'))
257
+		if (ini_get('safe_mode'))
258 258
 		{
259
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
259
+			if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed');
260 260
 
261 261
 			require_once(_XE_PATH_.'libs/ftp.class.php');
262 262
 			$oFtp = new ftp();
263
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
263
+			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
264 264
 
265
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
265
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
266 266
 			{
267 267
 				$oFtp->ftp_quit();
268
-				return new Object(-1,'msg_ftp_invalid_auth_info');
268
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
269 269
 			}
270 270
 
271
-			if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
271
+			if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
272 272
 			{
273 273
 				$oFtp->ftp_quit();
274
-				return new Object(-1,'msg_ftp_mkdir_fail');
274
+				return new Object(-1, 'msg_ftp_mkdir_fail');
275 275
 			}
276 276
 
277
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
277
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
278 278
 			{
279 279
 				$oFtp->ftp_quit();
280
-				return new Object(-1,'msg_ftp_chmod_fail');
280
+				return new Object(-1, 'msg_ftp_chmod_fail');
281 281
 			}
282 282
 
283
-			if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
283
+			if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
284 284
 			{
285 285
 				$oFtp->ftp_quit();
286
-				return new Object(-1,'msg_ftp_mkdir_fail');
286
+				return new Object(-1, 'msg_ftp_mkdir_fail');
287 287
 			}
288 288
 
289
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
289
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
290 290
 			{
291 291
 				$oFtp->ftp_quit();
292
-				return new Object(-1,'msg_ftp_chmod_fail');
292
+				return new Object(-1, 'msg_ftp_chmod_fail');
293 293
 			}
294 294
 
295 295
 			$oFtp->ftp_quit();
@@ -300,31 +300,31 @@  discard block
 block discarded – undo
300 300
 
301 301
 	function procInstallCheckFtp()
302 302
 	{
303
-		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
304
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
305
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
306
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
303
+		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp');
304
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
305
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
306
+		if (!$ftp_info->sftp) $ftp_info->sftp = 'N';
307 307
 
308
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
308
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed');
309 309
 
310
-		if($ftp_info->sftp == 'Y')
310
+		if ($ftp_info->sftp == 'Y')
311 311
 		{
312 312
 			$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
313
-			if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
313
+			if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
314 314
 			{
315
-				return new Object(-1,'msg_ftp_invalid_auth_info');
315
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
316 316
 			}
317 317
 		}
318 318
 		else
319 319
 		{
320 320
 			require_once(_XE_PATH_.'libs/ftp.class.php');
321 321
 			$oFtp = new ftp();
322
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
322
+			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
323 323
 
324
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
324
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
325 325
 			{
326 326
 				$oFtp->ftp_quit();
327
-				return new Object(-1,'msg_ftp_invalid_auth_info');
327
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
328 328
 			}
329 329
 			$oFtp->ftp_quit();
330 330
 		}
@@ -341,36 +341,36 @@  discard block
 block discarded – undo
341 341
 		$checklist = array();
342 342
 		// 0. check your version of php (5.2.4 or higher)
343 343
 		$checklist['php_version'] = true;
344
-		if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
344
+		if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
345 345
 		{
346 346
 			$checklist['php_version'] = false;
347 347
 		}
348 348
 
349
-		if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
349
+		if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
350 350
 		{
351 351
 			Context::set('phpversion_warning', true);
352 352
 		}
353 353
 
354 354
 		// 1. Check permission
355
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
355
+		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true;
356 356
 		else $checklist['permission'] = false;
357 357
 		// 2. Check if xml_parser_create exists
358
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
358
+		if (function_exists('xml_parser_create')) $checklist['xml'] = true;
359 359
 		else $checklist['xml'] = false;
360 360
 		// 3. Check if ini_get (session.auto_start) == 1
361
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
361
+		if (ini_get('session.auto_start') != 1) $checklist['session'] = true;
362 362
 		else $checklist['session'] = false;
363 363
 		// 4. Check if iconv exists
364
-		if(function_exists('iconv')) $checklist['iconv'] = true;
364
+		if (function_exists('iconv')) $checklist['iconv'] = true;
365 365
 		else $checklist['iconv'] = false;
366 366
 		// 5. Check gd(imagecreatefromgif function)
367
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
367
+		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true;
368 368
 		else $checklist['gd'] = false;
369 369
 		// 6. Check DB
370
-		if(DB::getEnableList()) $checklist['db'] = true;
370
+		if (DB::getEnableList()) $checklist['db'] = true;
371 371
 		else $checklist['db'] = false;
372 372
 
373
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
373
+		if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
374 374
 		else $install_enable = true;
375 375
 
376 376
 		// Save the checked result to the Context
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
 		$license_agreement = ($vars->license_agreement == 'Y') ? true : false;
392 392
 
393
-		if($license_agreement)
393
+		if ($license_agreement)
394 394
 		{
395 395
 			$currentTime = $_SERVER['REQUEST_TIME'];
396 396
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 			return new Object(-1, 'msg_must_accept_license_agreement');
402 402
 		}
403 403
 
404
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
404
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
405 405
 		{
406 406
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
407 407
 			$this->setRedirectUrl($returnUrl);
@@ -424,25 +424,25 @@  discard block
 block discarded – undo
424 424
 		$hostname = $_SERVER['SERVER_NAME'];
425 425
 		$port = $_SERVER['SERVER_PORT'];
426 426
 		$str_port = '';
427
-		if($port)
427
+		if ($port)
428 428
 		{
429
-			$str_port = ':' . $port;
429
+			$str_port = ':'.$port;
430 430
 		}
431 431
 
432 432
 		$tmpPath = $_SERVER['DOCUMENT_ROOT'];
433 433
 
434 434
 		//if DIRECTORY_SEPARATOR is not /(IIS)
435
-		if(DIRECTORY_SEPARATOR !== '/')
435
+		if (DIRECTORY_SEPARATOR !== '/')
436 436
 		{
437 437
 			//change to slash for compare
438 438
 			$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
439 439
 		}
440 440
 
441
-		$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
441
+		$query = "/JUST/CHECK/REWRITE/".$checkFilePath;
442 442
 		$currentPath = str_replace($tmpPath, "", _XE_PATH_);
443
-		if($currentPath != "")
443
+		if ($currentPath != "")
444 444
 		{
445
-			$query = $currentPath . $query;
445
+			$query = $currentPath.$query;
446 446
 		}
447 447
 		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
448 448
 		$requestConfig = array();
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 			'./files/cache/template_compiled',
468 468
 		);
469 469
 
470
-		foreach($directory_list as $dir)
470
+		foreach ($directory_list as $dir)
471 471
 		{
472 472
 			FileHandler::makeDir($dir);
473 473
 		}
@@ -483,57 +483,57 @@  discard block
 block discarded – undo
483 483
 		$oModuleModel = getModel('module');
484 484
 		// Create a table ny finding schemas/*.xml file in each module
485 485
 		$module_list = FileHandler::readDir('./modules/', NULL, false, true);
486
-		foreach($module_list as $module_path)
486
+		foreach ($module_list as $module_path)
487 487
 		{
488 488
 			// Get module name
489
-			$tmp_arr = explode('/',$module_path);
490
-			$module = $tmp_arr[count($tmp_arr)-1];
489
+			$tmp_arr = explode('/', $module_path);
490
+			$module = $tmp_arr[count($tmp_arr) - 1];
491 491
 
492 492
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
493
-			if(!$xml_info) continue;
493
+			if (!$xml_info) continue;
494 494
 			$modules[$xml_info->category][] = $module;
495 495
 		}
496 496
 		// Install "module" module in advance
497
-		$this->installModule('module','./modules/module');
497
+		$this->installModule('module', './modules/module');
498 498
 		$oModule = getClass('module');
499
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
499
+		if ($oModule->checkUpdate()) $oModule->moduleUpdate();
500 500
 		// Determine the order of module installation depending on category
501
-		$install_step = array('system','content','member');
501
+		$install_step = array('system', 'content', 'member');
502 502
 		// Install all the remaining modules
503
-		foreach($install_step as $category)
503
+		foreach ($install_step as $category)
504 504
 		{
505
-			if(count($modules[$category]))
505
+			if (count($modules[$category]))
506 506
 			{
507
-				foreach($modules[$category] as $module)
507
+				foreach ($modules[$category] as $module)
508 508
 				{
509
-					if($module == 'module') continue;
509
+					if ($module == 'module') continue;
510 510
 					$this->installModule($module, sprintf('./modules/%s', $module));
511 511
 
512 512
 					$oModule = getClass($module);
513
-					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
513
+					if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))
514 514
 					{
515
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
515
+						if ($oModule->checkUpdate()) $oModule->moduleUpdate();
516 516
 					}
517 517
 				}
518 518
 				unset($modules[$category]);
519 519
 			}
520 520
 		}
521 521
 		// Install all the remaining modules
522
-		if(count($modules))
522
+		if (count($modules))
523 523
 		{
524
-			foreach($modules as $category => $module_list)
524
+			foreach ($modules as $category => $module_list)
525 525
 			{
526
-				if(count($module_list))
526
+				if (count($module_list))
527 527
 				{
528
-					foreach($module_list as $module)
528
+					foreach ($module_list as $module)
529 529
 					{
530
-						if($module == 'module') continue;
530
+						if ($module == 'module') continue;
531 531
 						$this->installModule($module, sprintf('./modules/%s', $module));
532 532
 
533 533
 						$oModule = getClass($module);
534
-						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
534
+						if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
535 535
 						{
536
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
536
+							if ($oModule->checkUpdate()) $oModule->moduleUpdate();
537 537
 						}
538 538
 					}
539 539
 				}
@@ -555,31 +555,31 @@  discard block
 block discarded – undo
555 555
 		$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
556 556
 
557 557
 		$file_cnt = count($schema_files);
558
-		for($i=0;$i<$file_cnt;$i++)
558
+		for ($i = 0; $i < $file_cnt; $i++)
559 559
 		{
560 560
 			$file = trim($schema_files[$i]);
561
-			if(!$file || substr($file,-4)!='.xml') continue;
561
+			if (!$file || substr($file, -4) != '.xml') continue;
562 562
 			$output = $oDB->createTableByXmlFile($file);
563
-			if($output === false)
563
+			if ($output === false)
564 564
 				throw new Exception('msg_create_table_failed');
565 565
 		}
566 566
 		// Create a table and module instance and then execute install() method
567 567
 		unset($oModule);
568 568
 		$oModule = getClass($module);
569
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
569
+		if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
570 570
 		return new Object();
571 571
 	}
572 572
 
573 573
 	function _getDBConfigFileContents($db_info)
574 574
 	{
575
-		if(substr($db_info->master_db['db_table_prefix'], -1) != '_')
575
+		if (substr($db_info->master_db['db_table_prefix'], -1) != '_')
576 576
 		{
577 577
 			$db_info->master_db['db_table_prefix'] .= '_';
578 578
 		}
579 579
 
580
-		foreach($db_info->slave_db as &$slave)
580
+		foreach ($db_info->slave_db as &$slave)
581 581
 		{
582
-			if(substr($slave['db_table_prefix'], -1) != '_')
582
+			if (substr($slave['db_table_prefix'], -1) != '_')
583 583
 			{
584 584
 				$slave['db_table_prefix'] .= '_';
585 585
 			}
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
 		$buff = array();
589 589
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
590
-		$buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';
590
+		$buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';
591 591
 
592 592
 		return implode(PHP_EOL, $buff);
593 593
 	}
@@ -601,13 +601,13 @@  discard block
 block discarded – undo
601 601
 		$db_tmp_config_file = $this->db_tmp_config_file;
602 602
 
603 603
 		$db_info = Context::getDBInfo();
604
-		if(!$db_info) return;
604
+		if (!$db_info) return;
605 605
 
606 606
 		$buff = $this->_getDBConfigFileContents($db_info);
607 607
 
608 608
 		FileHandler::writeFile($db_tmp_config_file, $buff);
609 609
 
610
-		if(@file_exists($db_tmp_config_file)) return true;
610
+		if (@file_exists($db_tmp_config_file)) return true;
611 611
 		return false;
612 612
 	}
613 613
 
@@ -620,14 +620,14 @@  discard block
 block discarded – undo
620 620
 		$etc_tmp_config_file = $this->etc_tmp_config_file;
621 621
 
622 622
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n";
623
-		foreach($config_info as $key => $val)
623
+		foreach ($config_info as $key => $val)
624 624
 		{
625
-			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
625
+			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
626 626
 		}
627 627
 
628 628
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
629 629
 
630
-		if(@file_exists($etc_tmp_config_file)) return true;
630
+		if (@file_exists($etc_tmp_config_file)) return true;
631 631
 		return false;
632 632
 	}
633 633
 
@@ -642,13 +642,13 @@  discard block
 block discarded – undo
642 642
 			//if(file_exists($config_file)) return;
643 643
 
644 644
 			$db_info = Context::getDBInfo();
645
-			if(!$db_info) return;
645
+			if (!$db_info) return;
646 646
 
647 647
 			$buff = $this->_getDBConfigFileContents($db_info);
648 648
 
649 649
 			FileHandler::writeFile($config_file, $buff);
650 650
 
651
-			if(@file_exists($config_file))
651
+			if (@file_exists($config_file))
652 652
 			{
653 653
 				FileHandler::removeFile($this->db_tmp_config_file);
654 654
 				FileHandler::removeFile($this->etc_tmp_config_file);
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	function installByConfig($install_config_file)
664 664
 	{
665 665
 		include $install_config_file;
666
-		if(!is_array($auto_config)) return false;
666
+		if (!is_array($auto_config)) return false;
667 667
 
668 668
 		$auto_config['module'] = 'install';
669 669
 		$auto_config['act'] = 'procInstall';
@@ -671,22 +671,22 @@  discard block
 block discarded – undo
671 671
 		$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
672 672
 		$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";
673 673
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
674
-		foreach($auto_config as $k => $v)
674
+		foreach ($auto_config as $k => $v)
675 675
 		{
676
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
676
+			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k);
677 677
 		}
678 678
 		$body .= "</params>\r\n</methodCall>";
679 679
 
680
-		$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
680
+		$header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);
681 681
 		$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
682 682
 
683
-		if($fp)
683
+		if ($fp)
684 684
 		{
685 685
 			fputs($fp, $header);
686
-			while(!feof($fp))
686
+			while (!feof($fp))
687 687
 			{
688 688
 				$line = trim(fgets($fp, 4096));
689
-				if(strncmp('<error>', $line, 7) === 0)
689
+				if (strncmp('<error>', $line, 7) === 0)
690 690
 				{
691 691
 					fclose($fp);
692 692
 					return false;
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 2 patches
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	function __construct() {
59
-		$this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile;
59
+		$this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile;
60 60
 	}
61 61
 
62 62
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new Object(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new Object(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new Object(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new Object(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368 368
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new Object(0,'success_deleted');
378
+		return new Object(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new Object(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new Object(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new Object($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -465,27 +465,27 @@  discard block
 block discarded – undo
465 465
 			$args->is_shortcut = $request->is_shortcut;
466 466
 			$args->url = $request->shortcut_target;
467 467
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
468
+			if (!$args->open_window) $args->open_window = 'N';
469
+			if (!$args->expand) $args->expand = 'N';
470
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
471 471
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
473 473
 			else $args->name = $request->menu_name;
474 474
 		}
475 475
 		// type is module short cut
476
-		else if(is_numeric($request->shortcut_target))
476
+		else if (is_numeric($request->shortcut_target))
477 477
 		{
478 478
 			// Get original information
479 479
 			$oMenuAdminModel = getAdminModel('menu');
480 480
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
481
-			if(!$itemInfo->menu_item_srl)
481
+			if (!$itemInfo->menu_item_srl)
482 482
 			{
483 483
 				return new Object(-1, 'msg_invalid_request');
484 484
 			}
485 485
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
486 486
 
487 487
 			$args = $itemInfo;
488
-			if(count($args->group_srls) == 0)
488
+			if (count($args->group_srls) == 0)
489 489
 			{
490 490
 				unset($args->group_srls);
491 491
 			}
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 			$args->url = '#';
506 506
 		}
507 507
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
509 509
 		else $args->desc = '';
510 510
 
511 511
 		$args->menu_item_srl = getNextSequence();
512
-		$args->listorder = -1*$args->menu_item_srl;
512
+		$args->listorder = -1 * $args->menu_item_srl;
513 513
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
514
+		if (!$output->toBool()) return $output;
515 515
 
516 516
 		$oDB->commit();
517 517
 
@@ -533,46 +533,46 @@  discard block
 block discarded – undo
533 533
 		$args->expand = $request->menu_expand;
534 534
 		$args->is_shortcut = $request->is_shortcut;
535 535
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
536
+		if (!$args->open_window) $args->open_window = 'N';
537
+		if (!$args->expand) $args->expand = 'N';
538
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
539 539
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
541 541
 		else $args->name = $request->menu_name;
542 542
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
544 544
 		else $args->desc = '';
545 545
 
546
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 547
 		{
548 548
 			return new Object(-1, 'msg_invalid_request');
549 549
 		}
550 550
 
551 551
 		// when menu copy, module already copied
552
-		if($isProc)
552
+		if ($isProc)
553 553
 		{
554 554
 			$result = $this->_insertModule($request, $args);
555
-			if(!$result->toBool())
555
+			if (!$result->toBool())
556 556
 			{
557 557
 				return new Object(-1, $result->message);
558 558
 			}
559 559
 		}
560 560
 
561 561
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
562
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
565 565
 
566
-		if(!$request->module_id)
566
+		if (!$request->module_id)
567 567
 		{
568 568
 			return new Object(-1, 'msg_invalid_request');
569 569
 		}
570 570
 
571 571
 		$args->url = $request->module_id;
572 572
 		$args->menu_item_srl = getNextSequence();
573
-		$args->listorder = -1*$args->menu_item_srl;
573
+		$args->listorder = -1 * $args->menu_item_srl;
574 574
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
575
+		if (!$output->toBool()) return $output;
576 576
 
577 577
 		$oDB->commit();
578 578
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		//module create
606 606
 		$site_module_info = Context::get('site_module_info');
607
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
607
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
608 608
 		$cmArgs->browser_title = $args->name;
609 609
 		$cmArgs->menu_srl = $request->menu_srl;
610 610
 		$cmArgs->layout_srl = -1;
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
 		$cmArgs->is_skin_fix = 'N';
613 613
 		$cmArgs->is_mskin_fix = 'N';
614 614
 
615
-		if(Mobile::isMobileEnabled() === true)
615
+		if (Mobile::isMobileEnabled() === true)
616 616
 		{
617 617
 			$cmArgs->use_mobile = 'Y';
618 618
 		}
619 619
 
620 620
 		// if mid is empty, auto create mid
621
-		if(!$request->module_id)
621
+		if (!$request->module_id)
622 622
 		{
623 623
 			$randomMid = $this->_makeRandomMid();
624 624
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 		// check already created module instance
629 629
 		$oModuleModel = getModel('module');
630 630
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
631
-		if($output->module_srl)
631
+		if ($output->module_srl)
632 632
 		{
633 633
 			return new Object(-1, 'msg_module_name_exists');
634 634
 		}
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 	{
648 648
 		$request = Context::getRequestVars();
649 649
 
650
-		if(!$request->menu_item_srl || !$request->menu_name)
650
+		if (!$request->menu_item_srl || !$request->menu_name)
651 651
 		{
652 652
 			return new Object(-1, 'msg_invalid_request');
653 653
 		}
654 654
 
655 655
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
656
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
658 658
 
659 659
 		// Get original information
660 660
 		$oMenuAdminModel = getAdminModel('menu');
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		$args = $itemInfo;
663 663
 
664 664
 		// if menu type is module, check exists module and update
665
-		if($itemInfo->is_shortcut == 'Y')
665
+		if ($itemInfo->is_shortcut == 'Y')
666 666
 		{
667 667
 			// type is url
668
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
669 669
 			{
670 670
 				$args->url = $request->shortcut_target;
671 671
 			}
672 672
 			// type is module short cut
673
-			else if(is_numeric($request->shortcut_target))
673
+			else if (is_numeric($request->shortcut_target))
674 674
 			{
675 675
 				// Get new original information
676 676
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
677
-				if(!$newItemInfo->menu_item_srl)
677
+				if (!$newItemInfo->menu_item_srl)
678 678
 				{
679 679
 					return new Object(-1, 'msg_invalid_request');
680 680
 				}
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
 		{
692 692
 			// check already created module instance
693 693
 			$oModuleModel = getModel('module');
694
-			if($request->module_id != $itemInfo->url)
694
+			if ($request->module_id != $itemInfo->url)
695 695
 			{
696 696
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
697
-				if($output->module_srl)
697
+				if ($output->module_srl)
698 698
 				{
699 699
 					return new Object(-1, 'msg_module_name_exists');
700 700
 				}
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
 
703 703
 			// if not exist module, return error
704 704
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
705
-			if(!$moduleInfo)
705
+			if (!$moduleInfo)
706 706
 			{
707 707
 				return new Object(-1, 'msg_invalid_request');
708 708
 			}
709 709
 
710 710
 			$moduleInfo->mid = $request->module_id;
711
-			if($request->browser_title)
711
+			if ($request->browser_title)
712 712
 			{
713 713
 				$moduleInfo->browser_title = $request->browser_title;
714 714
 			}
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			$args->url = $request->module_id;
718 718
 		}
719 719
 
720
-		if($request->menu_name_key)
720
+		if ($request->menu_name_key)
721 721
 		{
722 722
 			$args->name = $request->menu_name_key;
723 723
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			$args->name = $request->menu_name;
727 727
 		}
728 728
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
730 730
 		else $args->desc = '';
731 731
 
732 732
 		unset($args->group_srls);
@@ -754,38 +754,38 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$btnOutput = $this->_uploadButton($args);
756 756
 
757
-		if($btnOutput['normal_btn'])
757
+		if ($btnOutput['normal_btn'])
758 758
 		{
759 759
 			$this->add('normal_btn', $btnOutput['normal_btn']);
760 760
 			$item_info->normal_btn = $btnOutput['normal_btn'];
761 761
 		}
762
-		if($btnOutput['hover_btn'])
762
+		if ($btnOutput['hover_btn'])
763 763
 		{
764 764
 			$this->add('hover_btn', $btnOutput['hover_btn']);
765 765
 			$item_info->hover_btn = $btnOutput['hover_btn'];
766 766
 		}
767
-		if($btnOutput['active_btn'])
767
+		if ($btnOutput['active_btn'])
768 768
 		{
769 769
 			$this->add('active_btn', $btnOutput['active_btn']);
770 770
 			$item_info->active_btn = $btnOutput['active_btn'];
771 771
 		}
772 772
 
773 773
 		// group_srls check
774
-		if(count($item_info->group_srls) == 0)
774
+		if (count($item_info->group_srls) == 0)
775 775
 		{
776 776
 			unset($item_info->group_srls);
777 777
 		}
778 778
 
779 779
 		// Button delete check
780
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
781 781
 		{
782 782
 			$item_info->normal_btn = '';
783 783
 		}
784
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
785 785
 		{
786 786
 			$item_info->hover_btn = '';
787 787
 		}
788
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
789 789
 		{
790 790
 			$item_info->active_btn = '';
791 791
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$args->is_force = Context::get('is_force');
826 826
 
827 827
 		$returnObj = $this->deleteItem($args);
828
-		if(is_object($returnObj))
828
+		if (is_object($returnObj))
829 829
 		{
830 830
 			$this->setError($returnObj->error);
831 831
 			$this->setMessage($returnObj->message);
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
 		$args->menu_srl = $itemInfo->menu_srl;
855 855
 
856 856
 		// Display an error that the category cannot be deleted if it has a child node	603
857
-		if($args->is_force != 'Y')
857
+		if ($args->is_force != 'Y')
858 858
 		{
859 859
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
861
-			if($output->data->count > 0)
860
+			if (!$output->toBool()) return $output;
861
+			if ($output->data->count > 0)
862 862
 			{
863 863
 				return new Object(-1001, 'msg_cannot_delete_for_child');
864 864
 			}
@@ -870,22 +870,22 @@  discard block
 block discarded – undo
870 870
 
871 871
 		// check admin menu delete
872 872
 		$oAdmin = getClass('admin');
873
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
874 874
 		{
875 875
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 876
 		}
877 877
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
879 879
 
880 880
 		// get menu properies with child menu
881 881
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
882 882
 		$originMenu = NULL;
883 883
 
884
-		if(is_readable(FileHandler::getRealPath($phpFile)))
884
+		if (is_readable(FileHandler::getRealPath($phpFile)))
885 885
 		{
886 886
 			include(FileHandler::getRealPath($phpFile));
887 887
 
888
-			if(is_array($menu->list))
888
+			if (is_array($menu->list))
889 889
 			{
890 890
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
891 891
 			}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
896 896
 		$isStartmenuInclude = false;
897 897
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
898
-		if($isStartmenuInclude)
898
+		if ($isStartmenuInclude)
899 899
 		{
900 900
 			return new Object(-1, 'msg_cannot_delete_homemenu');
901 901
 		}
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 
920 920
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
921 921
 	{
922
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
923 923
 		{
924 924
 			$isStartmenuInclude = true;
925 925
 		}
926 926
 
927
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
927
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
928 928
 		{
929
-			foreach($originMenu['list'] AS $key=>$value)
929
+			foreach ($originMenu['list'] AS $key=>$value)
930 930
 			{
931 931
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
932 932
 			}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		$args->menu_srl = $menuSrl;
941 941
 		$args->menu_item_srl = $node['node_srl'];
942 942
 		$output = executeQuery("menu.deleteMenuItem", $args);
943
-		if(!$output->toBool())
943
+		if (!$output->toBool())
944 944
 		{
945 945
 			$oDB->rollback();
946 946
 			return $output;
@@ -949,12 +949,12 @@  discard block
 block discarded – undo
949 949
 		// Update the xml file and get its location
950 950
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 951
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
952
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
955 955
 
956 956
 		// Delete module
957
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
958 958
 		{
959 959
 			$oModuleController = getController('module');
960 960
 			$oModuleModel = getModel('module');
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 			$args->site_srl = $menuInfo->site_srl;
965 965
 			$args->is_shortcut = 'Y';
966 966
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
967
-			if($output->data->menu_item_srl)
967
+			if ($output->data->menu_item_srl)
968 968
 			{
969 969
 				$output->data->url = '';
970 970
 				$referenceItem = $output->data;
971 971
 				$output = $this->_updateMenuItem($referenceItem);
972
-				if(!$output->toBool())
972
+				if (!$output->toBool())
973 973
 				{
974 974
 					$oDB->rollback();
975 975
 					return $output;
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 			}
978 978
 
979 979
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
980
-			if($moduleInfo->module_srl)
980
+			if ($moduleInfo->module_srl)
981 981
 			{
982 982
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
983
-				if(!$output->toBool())
983
+				if (!$output->toBool())
984 984
 				{
985 985
 					$oDB->rollback();
986 986
 					return $output;
@@ -993,14 +993,14 @@  discard block
 block discarded – undo
993 993
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
994 994
 	{
995 995
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
996
-		if(!$output->toBool())
996
+		if (!$output->toBool())
997 997
 		{
998 998
 			return new Object(-1, $output->message);
999 999
 		}
1000 1000
 
1001
-		if(is_array($node['list']))
1001
+		if (is_array($node['list']))
1002 1002
 		{
1003
-			foreach($node['list'] AS $key=>$value)
1003
+			foreach ($node['list'] AS $key=>$value)
1004 1004
 			{
1005 1005
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1006 1006
 			}
@@ -1013,31 +1013,31 @@  discard block
 block discarded – undo
1013 1013
 	 */
1014 1014
 	function procMenuAdminMoveItem()
1015 1015
 	{
1016
-		$mode = Context::get('mode');	//move
1017
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1018
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1016
+		$mode = Context::get('mode'); //move
1017
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1018
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1019
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1020 1020
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1021
+		if (!$mode || !$parent_srl || !$target_srl) return new Object(-1, 'msg_invalid_request');
1022 1022
 
1023 1023
 		$oMenuAdminModel = getAdminModel('menu');
1024 1024
 
1025 1025
 		// get original menu item info for cache file recreate
1026 1026
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1027
-		if(!$originalItemInfo->menu_item_srl)
1027
+		if (!$originalItemInfo->menu_item_srl)
1028 1028
 		{
1029 1029
 			return new Object(-1, 'msg_empty_menu_item');
1030 1030
 		}
1031 1031
 
1032 1032
 		// get menu properies with child menu
1033
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1034 1034
 		$originMenu = NULL;
1035 1035
 
1036
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1036
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1037 1037
 		{
1038 1038
 			include(FileHandler::getRealPath($phpFile));
1039 1039
 
1040
-			if(is_array($menu->list))
1040
+			if (is_array($menu->list))
1041 1041
 			{
1042 1042
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1043 1043
 			}
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 		// get target menu info for move
1047 1047
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1048 1048
 		// if move in same sitemap
1049
-		if($targetMenuItemInfo->menu_item_srl)
1049
+		if ($targetMenuItemInfo->menu_item_srl)
1050 1050
 		{
1051 1051
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1052 1052
 		}
@@ -1058,20 +1058,20 @@  discard block
 block discarded – undo
1058 1058
 			$parent_srl = 0;
1059 1059
 		}
1060 1060
 
1061
-		if(!$this->homeModuleMid)
1061
+		if (!$this->homeModuleMid)
1062 1062
 		{
1063 1063
 			$oModuleModel = getModel('module');
1064 1064
 			$oMenuAdminController = getAdminController('menu');
1065 1065
 			$columnList = array('modules.mid',);
1066 1066
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1067
-			if($output->mid)
1067
+			if ($output->mid)
1068 1068
 			{
1069 1069
 				$this->homeModuleMid = $output->mid;
1070 1070
 			}
1071 1071
 		}
1072 1072
 
1073 1073
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1074
-		if(count($originMenu['list']) > 0)
1074
+		if (count($originMenu['list']) > 0)
1075 1075
 		{
1076 1076
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1077 1077
 		}
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1087 1087
 	{
1088
-		if(is_array($node))
1088
+		if (is_array($node))
1089 1089
 		{
1090
-			foreach($node AS $key=>$node)
1090
+			foreach ($node AS $key=>$node)
1091 1091
 			{
1092 1092
 				$args = new stdClass();
1093 1093
 				$args->menu_srl = $menu_srl;
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 				$output = $this->_updateMenuItem($args);
1096 1096
 
1097 1097
 				//module's menu_srl move also
1098
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1098
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1099 1099
 				{
1100 1100
 					$oModuleModel = getModel('module');
1101 1101
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1102
-					if($menu_srl != $moduleInfo->menu_srl)
1102
+					if ($menu_srl != $moduleInfo->menu_srl)
1103 1103
 					{
1104 1104
 						$moduleInfo->menu_srl = $menu_srl;
1105 1105
 						$oModuleController = getController('module');
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 					}
1108 1108
 				}
1109 1109
 
1110
-				if(count($node['list']) > 0)
1110
+				if (count($node['list']) > 0)
1111 1111
 				{
1112 1112
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1113 1113
 				}
@@ -1129,21 +1129,21 @@  discard block
 block discarded – undo
1129 1129
 		$menuSrl = $itemInfo->menu_srl;
1130 1130
 
1131 1131
 		// get menu properies with child menu
1132
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1132
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1133 1133
 		$originMenu = NULL;
1134 1134
 
1135
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1135
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1136 1136
 		{
1137 1137
 			include(FileHandler::getRealPath($phpFile));
1138 1138
 
1139
-			if(is_array($menu->list))
1139
+			if (is_array($menu->list))
1140 1140
 			{
1141 1141
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		// copy the menu item with recursively
1146
-		if(is_array($originMenu))
1146
+		if (is_array($originMenu))
1147 1147
 		{
1148 1148
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1149 1149
 		}
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1161 1161
 	{
1162
-		if(array_key_exists($menuItemSrl, $menuList))
1162
+		if (array_key_exists($menuItemSrl, $menuList))
1163 1163
 		{
1164 1164
 			$originMenu = $menuList[$menuItemSrl];
1165 1165
 			return;
1166 1166
 		}
1167 1167
 
1168
-		foreach($menuList AS $key=>$value)
1168
+		foreach ($menuList AS $key=>$value)
1169 1169
 		{
1170
-			if(count($value['list']) > 0)
1170
+			if (count($value['list']) > 0)
1171 1171
 			{
1172 1172
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1173 1173
 			}
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		// default argument setting
1183 1183
 		$args = new stdClass();
1184 1184
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1186 1186
 		else $args->parent_srl = $parentSrl;
1187 1187
 		$args->menu_name_key = $originMenu['text'];
1188 1188
 		$args->menu_name = $originMenu['text'];
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$isModuleCopySuccess = false;
1197 1197
 		// if menu have a reference of module instance
1198
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1198
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1199 1199
 		{
1200 1200
 			$oModuleModel = getModel('module');
1201 1201
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1215,22 +1215,22 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 			$args->module_srl = $copiedModuleSrl;
1217 1217
 
1218
-			if($copiedModuleSrl)
1218
+			if ($copiedModuleSrl)
1219 1219
 			{
1220 1220
 				$isModuleCopySuccess = true;
1221 1221
 			}
1222 1222
 		}
1223 1223
 		// if menu type is shortcut
1224
-		else if($menuItemInfo->is_shortcut == 'Y')
1224
+		else if ($menuItemInfo->is_shortcut == 'Y')
1225 1225
 		{
1226 1226
 			$args->shortcut_target = $originMenu['url'];
1227 1227
 			$isModuleCopySuccess = true;
1228 1228
 		}
1229 1229
 
1230
-		if($isModuleCopySuccess)
1230
+		if ($isModuleCopySuccess)
1231 1231
 		{
1232 1232
 			// if have a group permission
1233
-			if($menuItemInfo->group_srls)
1233
+			if ($menuItemInfo->group_srls)
1234 1234
 			{
1235 1235
 				$args->group_srls = $menuItemInfo->group_srls;
1236 1236
 			}
@@ -1244,12 +1244,12 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 			// if have a button, copy a button image also
1246 1246
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1247
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1248 1248
 			{
1249 1249
 				// copy & upate
1250 1250
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1251
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1252
-				if(count($update_item_info->group_srls) == 0)
1251
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1252
+				if (count($update_item_info->group_srls) == 0)
1253 1253
 				{
1254 1254
 					unset($update_item_info->group_srls);
1255 1255
 				}
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 		// if have a child menu, copy child menu also
1265 1265
 		$childMenu = array_shift($originMenu['list']);
1266
-		if(count($childMenu) > 0)
1266
+		if (count($childMenu) > 0)
1267 1267
 		{
1268 1268
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1269 1269
 		}
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 	{
1274 1274
 		$time = $_SERVER['REQUEST_TIME'];
1275 1275
 		$randomString = "";
1276
-		for($i=0;$i<4;$i++)
1276
+		for ($i = 0; $i < 4; $i++)
1277 1277
 		{
1278 1278
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1279
+			if ($case) $doc = rand(65, 90);
1280 1280
 			else $doc = rand(97, 122);
1281 1281
 
1282 1282
 			$randomString .= chr($doc);
@@ -1300,32 +1300,32 @@  discard block
 block discarded – undo
1300 1300
 		// menu name update
1301 1301
 		$args->menu_srl = $this->menuSrl;
1302 1302
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1303
+		if (!$output->toBool()) return $output;
1304 1304
 
1305 1305
 		$this->map = array();
1306
-		if(is_array($parentKeyList))
1306
+		if (is_array($parentKeyList))
1307 1307
 		{
1308
-			foreach($parentKeyList as $no=>$srl)
1308
+			foreach ($parentKeyList as $no=>$srl)
1309 1309
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1310
+				if ($srl === 0) continue;
1311
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1312 1312
 				$this->map[$srl][] = $no;
1313 1313
 			}
1314 1314
 		}
1315 1315
 
1316 1316
 		$result = array();
1317
-		if(is_array($this->itemKeyList))
1317
+		if (is_array($this->itemKeyList))
1318 1318
 		{
1319
-			foreach($this->itemKeyList as $srl)
1319
+			foreach ($this->itemKeyList as $srl)
1320 1320
 			{
1321
-				if(!$this->checked[$srl])
1321
+				if (!$this->checked[$srl])
1322 1322
 				{
1323 1323
 					$target = new stdClass();
1324 1324
 					$this->checked[$srl] = 1;
1325 1325
 					$target->node = $srl;
1326
-					$target->child= array();
1326
+					$target->child = array();
1327 1327
 
1328
-					while(count($this->map[$srl]))
1328
+					while (count($this->map[$srl]))
1329 1329
 					{
1330 1330
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1331 1331
 					}
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
 			}
1335 1335
 		}
1336 1336
 
1337
-		if(is_array($result))
1337
+		if (is_array($result))
1338 1338
 		{
1339 1339
 			$i = 0;
1340
-			foreach($result AS $key=>$node)
1340
+			foreach ($result AS $key=>$node)
1341 1341
 			{
1342
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1343
-				$this->_recursiveMoveMenuItem($node);	//move child node
1342
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1343
+				$this->_recursiveMoveMenuItem($node); //move child node
1344 1344
 				$i = $node->node;
1345 1345
 			}
1346 1346
 		}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 		$child_node->child = array();
1370 1370
 		$target->child[] = $child_node;
1371 1371
 
1372
-		while(count($this->map[$child_srl]))
1372
+		while (count($this->map[$child_srl]))
1373 1373
 		{
1374 1374
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1375 1375
 		}
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 	function _recursiveMoveMenuItem($result)
1385 1385
 	{
1386 1386
 		$i = 0;
1387
-		while(count($result->child))
1387
+		while (count($result->child))
1388 1388
 		{
1389 1389
 			unset($node);
1390 1390
 			$node = array_shift($result->child);
@@ -1404,48 +1404,48 @@  discard block
 block discarded – undo
1404 1404
 	 * @param string $mode 'move' or 'insert'
1405 1405
 	 * @return void
1406 1406
 	 */
1407
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1407
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1408 1408
 	{
1409 1409
 		// Get the original menus
1410 1410
 		$oMenuAdminModel = getAdminModel('menu');
1411 1411
 
1412 1412
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1413
+		if ($target_item->menu_item_srl != $target_srl) return new Object(-1, 'msg_invalid_request');
1414 1414
 		// Move the menu location(change the order menu appears)
1415
-		if($mode == 'move')
1415
+		if ($mode == 'move')
1416 1416
 		{
1417 1417
 			$args = new stdClass();
1418 1418
 			$args->parent_srl = $parent_srl;
1419 1419
 			$args->menu_srl = $menu_srl;
1420 1420
 
1421
-			if($source_srl)
1421
+			if ($source_srl)
1422 1422
 			{
1423 1423
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1425
-				$args->listorder = $source_item->listorder-1;
1424
+				if ($source_item->menu_item_srl != $source_srl) return new Object(-1, 'msg_invalid_request');
1425
+				$args->listorder = $source_item->listorder - 1;
1426 1426
 			}
1427 1427
 			else
1428 1428
 			{
1429 1429
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1431
-				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1430
+				if (!$output->toBool()) return $output;
1431
+				$args->listorder = (int) $output->data->listorder;
1432
+				if (!$args->listorder) $args->listorder = 0;
1433 1433
 			}
1434 1434
 			$args->parent_srl = $parent_srl;
1435 1435
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1436
+			if (!$output->toBool()) return $output;
1437 1437
 
1438 1438
 			$args->parent_srl = $parent_srl;
1439 1439
 			$args->menu_item_srl = $target_srl;
1440 1440
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1441
+			if (!$output->toBool()) return $output;
1442 1442
 
1443 1443
 			//module's menu_srl move also
1444
-			if($isShortcut == 'N' && !empty($url))
1444
+			if ($isShortcut == 'N' && !empty($url))
1445 1445
 			{
1446 1446
 				$oModuleModel = getModel('module');
1447 1447
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1448
-				if($menu_srl != $moduleInfo->menu_srl)
1448
+				if ($menu_srl != $moduleInfo->menu_srl)
1449 1449
 				{
1450 1450
 					$moduleInfo->menu_srl = $menu_srl;
1451 1451
 					$oModuleController = getController('module');
@@ -1453,13 +1453,13 @@  discard block
 block discarded – undo
1453 1453
 				}
1454 1454
 
1455 1455
 				// change home menu cache file
1456
-				if($url == $this->homeModuleMid)
1456
+				if ($url == $this->homeModuleMid)
1457 1457
 				{
1458
-					if(file_exists($this->homeMenuCacheFile))
1458
+					if (file_exists($this->homeMenuCacheFile))
1459 1459
 					{
1460 1460
 						include($this->homeMenuCacheFile);
1461 1461
 					}
1462
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1463 1463
 					{
1464 1464
 						$this->makeHomemenuCacheFile($menu_srl);
1465 1465
 					}
@@ -1467,13 +1467,13 @@  discard block
 block discarded – undo
1467 1467
 			}
1468 1468
 			// Add a child
1469 1469
 		}
1470
-		elseif($mode == 'insert')
1470
+		elseif ($mode == 'insert')
1471 1471
 		{
1472 1472
 			$args->menu_item_srl = $target_srl;
1473 1473
 			$args->parent_srl = $parent_srl;
1474
-			$args->listorder = -1*getNextSequence();
1474
+			$args->listorder = -1 * getNextSequence();
1475 1475
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1476
+			if (!$output->toBool()) return $output;
1477 1477
 		}
1478 1478
 
1479 1479
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
 		// Re-generate the xml file
1499 1499
 		$xml_file = $this->makeXmlFile($menu_srl);
1500 1500
 		// Set return value
1501
-		$this->add('menu_title',$menu_title);
1502
-		$this->add('xml_file',$xml_file);
1501
+		$this->add('menu_title', $menu_title);
1502
+		$this->add('xml_file', $xml_file);
1503 1503
 	}
1504 1504
 
1505 1505
 	/**
@@ -1513,12 +1513,12 @@  discard block
 block discarded – undo
1513 1513
 		$target = Context::get('target');
1514 1514
 		$target_file = Context::get($target);
1515 1515
 		// Error occurs when the target is neither a uploaded file nor a valid file
1516
-		if(!$menu_srl || !$menu_item_srl)
1516
+		if (!$menu_srl || !$menu_item_srl)
1517 1517
 		{
1518 1518
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1519
 
1520 1520
 		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1522 1522
 		{
1523 1523
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1524
 		}
@@ -1526,13 +1526,13 @@  discard block
 block discarded – undo
1526 1526
 		// Move the file to a specific director if the uploaded file meets requirement
1527 1527
 		else
1528 1528
 		{
1529
-			$tmp_arr = explode('.',$target_file['name']);
1530
-			$ext = $tmp_arr[count($tmp_arr)-1];
1529
+			$tmp_arr = explode('.', $target_file['name']);
1530
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1531 1531
 
1532 1532
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1533
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1534
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1535
+			if (!is_dir($path)) FileHandler::makeDir($path);
1536 1536
 
1537 1537
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1538
 			Context::set('filename', $filename);
@@ -1565,14 +1565,14 @@  discard block
 block discarded – undo
1565 1565
 	{
1566 1566
 		$oModuleModel = getModel('module');
1567 1567
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1568
-		if(is_array($installed_module_list))
1568
+		if (is_array($installed_module_list))
1569 1569
 		{
1570 1570
 			$currentLang = Context::getLangType();
1571 1571
 			$menuList = array();
1572
-			foreach($installed_module_list AS $key=>$value)
1572
+			foreach ($installed_module_list AS $key=>$value)
1573 1573
 			{
1574 1574
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1575
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1576 1576
 				unset($info->menu);
1577 1577
 			}
1578 1578
 		}
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1605
 
1606 1606
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1609 1609
 		$dbInfo = Context::getDBInfo();
1610 1610
 
1611 1611
 		$args = new stdClass();
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		$args->menu_srl = $requestArgs->menu_srl;
1615 1615
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1616 1616
 		//if now page is https...
1617
-		if(strpos($url, 'https') !== false)
1617
+		if (strpos($url, 'https') !== false)
1618 1618
 		{
1619 1619
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620 1620
 		}
@@ -1628,23 +1628,23 @@  discard block
 block discarded – undo
1628 1628
 		$args->hover_btn = '';
1629 1629
 		$args->active_btn = '';
1630 1630
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1631
-		$args->listorder = -1*$args->menu_item_srl;
1631
+		$args->listorder = -1 * $args->menu_item_srl;
1632 1632
 
1633 1633
 		// Check if already exists
1634 1634
 		$oMenuModel = getAdminModel('menu');
1635 1635
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1636 1636
 		// Update if exists
1637
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1637
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1638 1638
 		{
1639 1639
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1640
+			if (!$output->toBool()) return $output;
1641 1641
 		}
1642 1642
 		// Insert if not exist
1643 1643
 		else
1644 1644
 		{
1645
-			$args->listorder = -1*$args->menu_item_srl;
1645
+			$args->listorder = -1 * $args->menu_item_srl;
1646 1646
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1647
+			if (!$output->toBool()) return $output;
1648 1648
 		}
1649 1649
 		// Get information of the menu
1650 1650
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1672,23 +1672,23 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 		// Menu Exposure update
1674 1674
 		// if exposure target is only login user...
1675
-		if(!$exposure)
1675
+		if (!$exposure)
1676 1676
 		{
1677 1677
 			$args->group_srls = '';
1678 1678
 		}
1679 1679
 		else
1680 1680
 		{
1681 1681
 			$exposure = explode(',', $exposure);
1682
-			if(in_array($exposure, array('-1','-3')))
1682
+			if (in_array($exposure, array('-1', '-3')))
1683 1683
 			{
1684 1684
 				$args->group_srls = $exposure;
1685 1685
 			}
1686 1686
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1687
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1688 1688
 		}
1689 1689
 
1690 1690
 		$output = $this->_updateMenuItem($args);
1691
-		if(!$output->toBool())
1691
+		if (!$output->toBool())
1692 1692
 		{
1693 1693
 			return $output;
1694 1694
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1705
 
1706 1706
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1707
+		if (!$grantList) $grantList = new stdClass;
1708 1708
 
1709 1709
 		$grantList->access = new stdClass();
1710 1710
 		$grantList->access->default = 'guest';
@@ -1712,9 +1712,9 @@  discard block
 block discarded – undo
1712 1712
 		$grantList->manager->default = 'manager';
1713 1713
 
1714 1714
 		$grant = new stdClass;
1715
-		foreach($grantList AS $grantName=>$grantInfo)
1715
+		foreach ($grantList AS $grantName=>$grantInfo)
1716 1716
 		{
1717
-			if(!$htPerm[$grantName])
1717
+			if (!$htPerm[$grantName])
1718 1718
 			{
1719 1719
 				continue;
1720 1720
 			}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 			$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1723 1723
 
1724 1724
 			// users in a particular group
1725
-			if(is_array($htPerm[$grantName]))
1725
+			if (is_array($htPerm[$grantName]))
1726 1726
 			{
1727 1727
 				$grant->{$grantName} = $htPerm[$grantName];
1728 1728
 				continue;
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 			$grant->{$group_srls} = array();
1737 1737
 		}
1738 1738
 
1739
-		if(count($grant))
1739
+		if (count($grant))
1740 1740
 		{
1741 1741
 			$oModuleController = getController('module');
1742 1742
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
 	function makeXmlFile($menu_srl)
1755 1755
 	{
1756 1756
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1757
+		if (!$menu_srl) return;
1758 1758
 		// Get menu informaton
1759 1759
 		$args = new stdClass();
1760 1760
 		$args->menu_srl = $menu_srl;
1761 1761
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1763
-		$site_srl = (int)$output->data->site_srl;
1762
+		if (!$output->toBool() || !$output->data) return $output;
1763
+		$site_srl = (int) $output->data->site_srl;
1764 1764
 
1765
-		if($site_srl)
1765
+		if ($site_srl)
1766 1766
 		{
1767 1767
 			$oModuleModel = getModel('module');
1768 1768
 			$columnList = array('sites.domain');
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 		$args->menu_srl = $menu_srl;
1774 1774
 		$args->sort_index = 'listorder';
1775 1775
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1776
+		if (!$output->toBool()) return;
1777 1777
 		// Specify the name of the cache file
1778
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1778
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1779
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1780 1780
 		// If no data found, generate an XML file without node data
1781 1781
 		$list = $output->data;
1782
-		if(!$list)
1782
+		if (!$list)
1783 1783
 		{
1784 1784
 			$xml_buff = "<root />";
1785 1785
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1787,10 +1787,10 @@  discard block
 block discarded – undo
1787 1787
 			return $xml_file;
1788 1788
 		}
1789 1789
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1790
+		if (!is_array($list)) $list = array($list);
1791 1791
 		// Create a tree for loop
1792 1792
 		$list_count = count($list);
1793
-		for($i=0;$i<$list_count;$i++)
1793
+		for ($i = 0; $i < $list_count; $i++)
1794 1794
 		{
1795 1795
 			$node = $list[$i];
1796 1796
 			$menu_item_srl = $node->menu_item_srl;
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 		$php_buff = sprintf(
1847 1847
 			'<?php '.
1848 1848
 			'if(!defined("__XE__")) exit(); '.
1849
-			'$menu = new stdClass();' .
1849
+			'$menu = new stdClass();'.
1850 1850
 			'%s; '.
1851 1851
 			'%s; '.
1852 1852
 			'$menu->list = array(%s); '.
@@ -1875,26 +1875,26 @@  discard block
 block discarded – undo
1875 1875
 	 */
1876 1876
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1877
 	{
1878
-		if(!$source_node) return;
1878
+		if (!$source_node) return;
1879 1879
 
1880 1880
 		$oMenuAdminModel = getAdminModel('menu');
1881 1881
 
1882
-		foreach($source_node as $menu_item_srl => $node)
1882
+		foreach ($source_node as $menu_item_srl => $node)
1883 1883
 		{
1884 1884
 			$child_buff = "";
1885 1885
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1886
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1887 1887
 			// List variables
1888 1888
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889
-			foreach($names as $key => $val)
1889
+			foreach ($names as $key => $val)
1890 1890
 			{
1891
-				$name_arr_str .= sprintf('"%s"=>\'%s\',',$key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1891
+				$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), $val));
1892 1892
 			}
1893 1893
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1894 1894
 
1895
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1896
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1897
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1895
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1896
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1897
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 1898
 			{
1899 1899
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1900 1900
 			}
@@ -1904,21 +1904,21 @@  discard block
 block discarded – undo
1904 1904
 			$expand = $node->expand;
1905 1905
 
1906 1906
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1907
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1908 1908
 			else $normal_btn = '';
1909 1909
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1910
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1911 1911
 			else $hover_btn = '';
1912 1912
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1913
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1914 1914
 			else $active_btn = '';
1915 1915
 
1916 1916
 			$group_srls = $node->group_srls;
1917 1917
 
1918
-			if($normal_btn)
1918
+			if ($normal_btn)
1919 1919
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1920
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1922 1922
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923 1923
 			}
1924 1924
 			else
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 1927
 			}
1928 1928
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1929
+			if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1930 1930
 			else $group_check_code = "true";
1931 1931
 			$attribute = sprintf(
1932 1932
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 				$link
1951 1951
 			);
1952 1952
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
1953
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
+			else $buff .= sprintf('<node %s />', $attribute);
1955 1955
 		}
1956 1956
 		return $buff;
1957 1957
 	}
@@ -1970,84 +1970,84 @@  discard block
 block discarded – undo
1970 1970
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 1971
 	{
1972 1972
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
1973
+		if (!$source_node) return $output;
1974 1974
 
1975 1975
 		$oMenuAdminModel = getAdminModel('menu');
1976 1976
 
1977
-		foreach($source_node as $menu_item_srl => $node)
1977
+		foreach ($source_node as $menu_item_srl => $node)
1978 1978
 		{
1979 1979
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1980
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981 1981
 			else $child_output = array("buff"=>"", "url_list"=>array());
1982 1982
 
1983 1983
 			// List variables
1984 1984
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1985 1985
 			unset($name_arr_str);
1986
-			foreach($names as $key => $val)
1986
+			foreach ($names as $key => $val)
1987 1987
 			{
1988
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1988
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1989 1989
 				{
1990 1990
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
1991 1991
 				}
1992 1992
 				else
1993 1993
 				{
1994
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
1994
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val)));
1995 1995
 				}
1996 1996
 			}
1997 1997
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1998 1998
 
1999 1999
 			// If url value is not empty in the current node, put the value into an array url_list
2000
-			if($node->url) $child_output['url_list'][] = $node->url;
2000
+			if ($node->url) $child_output['url_list'][] = $node->url;
2001 2001
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2002 2002
 			// If node->group_srls value exists
2003
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2003
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
2004 2004
 			else $group_check_code = "true";
2005 2005
 
2006 2006
 			// List variables
2007
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2008
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2009
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2010
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2007
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2008
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2009
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2010
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2011 2011
 			{
2012 2012
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2013 2013
 			}
2014 2014
 			else $href = sprintf('"%s"', $url);
2015 2015
 			$is_shortcut = $node->is_shortcut;
2016 2016
 			$open_window = $node->open_window;
2017
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2018
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2019
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2017
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2018
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2019
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2020 2020
 
2021
-			foreach($child_output['url_list'] as $key =>$val)
2021
+			foreach ($child_output['url_list'] as $key =>$val)
2022 2022
 			{
2023 2023
 				$child_output['url_list'][$key] = addslashes($val);
2024 2024
 			}
2025 2025
 
2026
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2026
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2027 2027
 			$child_buff = $child_output['buff'];
2028 2028
 			$expand = $node->expand;
2029 2029
 
2030 2030
 			$normal_btn = $node->normal_btn;
2031
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2031
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2032 2032
 			else $normal_btn = '';
2033 2033
 
2034 2034
 			$hover_btn = $node->hover_btn;
2035
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2035
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2036 2036
 			else $hover_btn = '';
2037 2037
 
2038 2038
 			$active_btn = $node->active_btn;
2039
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2039
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2040 2040
 			else $active_btn = '';
2041 2041
 
2042 2042
 
2043 2043
 			$group_srls = $node->group_srls;
2044 2044
 
2045
-			if($normal_btn)
2045
+			if ($normal_btn)
2046 2046
 			{
2047
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2047
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2049 2049
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2050
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2050
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2051 2051
 				else $link_active = $link;
2052 2052
 			}
2053 2053
 			else
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
 			);
2086 2086
 
2087 2087
 			// Generate buff data
2088
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2088
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2089 2089
 			$output['name'] .= $name_str;
2090 2090
 		}
2091 2091
 		return $output;
@@ -2099,19 +2099,19 @@  discard block
 block discarded – undo
2099 2099
 	 */
2100 2100
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2101 2101
 	{
2102
-		if(!count($menu_srl_list)) return;
2102
+		if (!count($menu_srl_list)) return;
2103 2103
 		// Delete the value of menu_srls
2104
-		$args->menu_srls = implode(',',$menu_srl_list);
2104
+		$args->menu_srls = implode(',', $menu_srl_list);
2105 2105
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2106
-		if(!$output->toBool()) return $output;
2106
+		if (!$output->toBool()) return $output;
2107 2107
 
2108 2108
 		$args->layout_srl = $layout_srl;
2109 2109
 		// Mapping menu_srls, layout_srl
2110
-		for($i=0;$i<count($menu_srl_list);$i++)
2110
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2111 2111
 		{
2112 2112
 			$args->menu_srl = $menu_srl_list[$i];
2113 2113
 			$output = executeQuery('menu.insertMenuLayout', $args);
2114
-			if(!$output->toBool()) return $output;
2114
+			if (!$output->toBool()) return $output;
2115 2115
 		}
2116 2116
 	}
2117 2117
 
@@ -2124,47 +2124,47 @@  discard block
 block discarded – undo
2124 2124
 	{
2125 2125
 		// path setting
2126 2126
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2127
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2127
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2128 2128
 		{
2129 2129
 			FileHandler::makeDir($path);
2130 2130
 		}
2131 2131
 
2132
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2132
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2133 2133
 		{
2134 2134
 			$oMenuModel = getAdminModel('menu');
2135 2135
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2136 2136
 
2137
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2137
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2140 2140
 		}
2141 2141
 
2142 2142
 		$returnArray = array();
2143 2143
 		$date = date('YmdHis');
2144 2144
 		// normal button
2145
-		if($args->menu_normal_btn)
2145
+		if ($args->menu_normal_btn)
2146 2146
 		{
2147
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2148
-			$ext = $tmp_arr[count($tmp_arr)-1];
2147
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2148
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2149 2149
 
2150 2150
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2151 2151
 
2152
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2152
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2153 2153
 			{
2154
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2154
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2155 2155
 				$returnArray ['normal_btn'] = $filename;
2156 2156
 			}
2157 2157
 		}
2158 2158
 
2159 2159
 		// hover button
2160
-		if($args->menu_hover_btn)
2160
+		if ($args->menu_hover_btn)
2161 2161
 		{
2162
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2163
-			$ext = $tmp_arr[count($tmp_arr)-1];
2162
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2163
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2164 2164
 
2165 2165
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2166 2166
 
2167
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2167
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2168 2168
 			{
2169 2169
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2170 2170
 				$returnArray['hover_btn'] = $filename;
@@ -2172,14 +2172,14 @@  discard block
 block discarded – undo
2172 2172
 		}
2173 2173
 
2174 2174
 		// active button
2175
-		if($args->menu_active_btn)
2175
+		if ($args->menu_active_btn)
2176 2176
 		{
2177
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2178
-			$ext = $tmp_arr[count($tmp_arr)-1];
2177
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2178
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2179 2179
 
2180 2180
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2181 2181
 
2182
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2182
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2183 2183
 			{
2184 2184
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2185 2185
 				$returnArray['active_btn'] = $filename;
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 			"active_btn"=>"",
2202 2202
 		);
2203 2203
 		//normal_btn
2204
-		if($menuItemInfo->normal_btn)
2204
+		if ($menuItemInfo->normal_btn)
2205 2205
 		{
2206 2206
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2207 2207
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 		}
2212 2212
 
2213 2213
 		//hover_btn
2214
-		if($menuItemInfo->hover_btn)
2214
+		if ($menuItemInfo->hover_btn)
2215 2215
 		{
2216 2216
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2217 2217
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 		}
2222 2222
 
2223 2223
 		//active_btn
2224
-		if($menuItemInfo->active_btn)
2224
+		if ($menuItemInfo->active_btn)
2225 2225
 		{
2226 2226
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2227 2227
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2236,9 +2236,9 @@  discard block
 block discarded – undo
2236 2236
 	{
2237 2237
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2238 2238
 		$tmp_arr = explode('.', $buttonPath);
2239
-		$ext = $tmp_arr[count($tmp_arr)-1];
2239
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2240 2240
 		$date = date("YmdHis");
2241
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2241
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2242 2242
 	}
2243 2243
 
2244 2244
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +297 added lines, -130 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new Object(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new Object(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -465,12 +470,21 @@  discard block
 block discarded – undo
465 470
 			$args->is_shortcut = $request->is_shortcut;
466 471
 			$args->url = $request->shortcut_target;
467 472
 
468
-			if(!$args->open_window) $args->open_window = 'N';
469
-			if(!$args->expand) $args->expand = 'N';
470
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
473
+			if(!$args->open_window) {
474
+				$args->open_window = 'N';
475
+			}
476
+			if(!$args->expand) {
477
+				$args->expand = 'N';
478
+			}
479
+			if(!$args->is_shortcut) {
480
+				$args->is_shortcut = 'Y';
481
+			}
471 482
 
472
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
473
-			else $args->name = $request->menu_name;
483
+			if($request->menu_name_key) {
484
+				$args->name = $request->menu_name_key;
485
+			} else {
486
+				$args->name = $request->menu_name;
487
+			}
474 488
 		}
475 489
 		// type is module short cut
476 490
 		else if(is_numeric($request->shortcut_target))
@@ -505,13 +519,18 @@  discard block
 block discarded – undo
505 519
 			$args->url = '#';
506 520
 		}
507 521
 
508
-		if($request->menu_desc) $args->desc = $request->menu_desc;
509
-		else $args->desc = '';
522
+		if($request->menu_desc) {
523
+			$args->desc = $request->menu_desc;
524
+		} else {
525
+			$args->desc = '';
526
+		}
510 527
 
511 528
 		$args->menu_item_srl = getNextSequence();
512 529
 		$args->listorder = -1*$args->menu_item_srl;
513 530
 		$output = executeQuery('menu.insertMenuItem', $args);
514
-		if(!$output->toBool()) return $output;
531
+		if(!$output->toBool()) {
532
+			return $output;
533
+		}
515 534
 
516 535
 		$oDB->commit();
517 536
 
@@ -533,15 +552,27 @@  discard block
 block discarded – undo
533 552
 		$args->expand = $request->menu_expand;
534 553
 		$args->is_shortcut = $request->is_shortcut;
535 554
 
536
-		if(!$args->open_window) $args->open_window = 'N';
537
-		if(!$args->expand) $args->expand = 'N';
538
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
555
+		if(!$args->open_window) {
556
+			$args->open_window = 'N';
557
+		}
558
+		if(!$args->expand) {
559
+			$args->expand = 'N';
560
+		}
561
+		if(!$args->is_shortcut) {
562
+			$args->is_shortcut = 'N';
563
+		}
539 564
 
540
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
541
-		else $args->name = $request->menu_name;
565
+		if($request->menu_name_key) {
566
+			$args->name = $request->menu_name_key;
567
+		} else {
568
+			$args->name = $request->menu_name;
569
+		}
542 570
 
543
-		if($request->menu_desc) $args->desc = $request->menu_desc;
544
-		else $args->desc = '';
571
+		if($request->menu_desc) {
572
+			$args->desc = $request->menu_desc;
573
+		} else {
574
+			$args->desc = '';
575
+		}
545 576
 
546 577
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
547 578
 		{
@@ -559,9 +590,15 @@  discard block
 block discarded – undo
559 590
 		}
560 591
 
561 592
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
562
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
563
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
564
-		if($request->active_btn) $args->active_btn = $request->active_btn;
593
+		if($request->normal_btn) {
594
+			$args->normal_btn = $request->normal_btn;
595
+		}
596
+		if($request->hover_btn) {
597
+			$args->hover_btn = $request->hover_btn;
598
+		}
599
+		if($request->active_btn) {
600
+			$args->active_btn = $request->active_btn;
601
+		}
565 602
 
566 603
 		if(!$request->module_id)
567 604
 		{
@@ -572,7 +609,9 @@  discard block
 block discarded – undo
572 609
 		$args->menu_item_srl = getNextSequence();
573 610
 		$args->listorder = -1*$args->menu_item_srl;
574 611
 		$output = executeQuery('menu.insertMenuItem', $args);
575
-		if(!$output->toBool()) return $output;
612
+		if(!$output->toBool()) {
613
+			return $output;
614
+		}
576 615
 
577 616
 		$oDB->commit();
578 617
 
@@ -653,8 +692,12 @@  discard block
 block discarded – undo
653 692
 		}
654 693
 
655 694
 		// variables set
656
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
657
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
695
+		if($request->menu_open_window != "Y") {
696
+			$request->menu_open_window = "N";
697
+		}
698
+		if($request->menu_expand != "Y") {
699
+			$request->menu_expand = "N";
700
+		}
658 701
 
659 702
 		// Get original information
660 703
 		$oMenuAdminModel = getAdminModel('menu');
@@ -681,13 +724,11 @@  discard block
 block discarded – undo
681 724
 
682 725
 				$args->url = $newItemInfo->url;
683 726
 				$args->is_shortcut = 'Y';
684
-			}
685
-			else
727
+			} else
686 728
 			{
687 729
 				$args->url = '#';
688 730
 			}
689
-		}
690
-		else
731
+		} else
691 732
 		{
692 733
 			// check already created module instance
693 734
 			$oModuleModel = getModel('module');
@@ -720,14 +761,16 @@  discard block
 block discarded – undo
720 761
 		if($request->menu_name_key)
721 762
 		{
722 763
 			$args->name = $request->menu_name_key;
723
-		}
724
-		else
764
+		} else
725 765
 		{
726 766
 			$args->name = $request->menu_name;
727 767
 		}
728 768
 
729
-		if($request->menu_desc) $args->desc = $request->menu_desc;
730
-		else $args->desc = '';
769
+		if($request->menu_desc) {
770
+			$args->desc = $request->menu_desc;
771
+		} else {
772
+			$args->desc = '';
773
+		}
731 774
 
732 775
 		unset($args->group_srls);
733 776
 		$args->open_window = $request->menu_open_window;
@@ -829,8 +872,7 @@  discard block
 block discarded – undo
829 872
 		{
830 873
 			$this->setError($returnObj->error);
831 874
 			$this->setMessage($returnObj->message);
832
-		}
833
-		else
875
+		} else
834 876
 		{
835 877
 			$this->setMessage('success_deleted');
836 878
 		}
@@ -857,7 +899,9 @@  discard block
 block discarded – undo
857 899
 		if($args->is_force != 'Y')
858 900
 		{
859 901
 			$output = executeQuery('menu.getChildMenuCount', $args);
860
-			if(!$output->toBool()) return $output;
902
+			if(!$output->toBool()) {
903
+				return $output;
904
+			}
861 905
 			if($output->data->count > 0)
862 906
 			{
863 907
 				return new Object(-1001, 'msg_cannot_delete_for_child');
@@ -875,7 +919,9 @@  discard block
 block discarded – undo
875 919
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
876 920
 		}
877 921
 
878
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
922
+		if($itemInfo->parent_srl) {
923
+			$parent_srl = $itemInfo->parent_srl;
924
+		}
879 925
 
880 926
 		// get menu properies with child menu
881 927
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -949,9 +995,15 @@  discard block
 block discarded – undo
949 995
 		// Update the xml file and get its location
950 996
 		$xml_file = $this->makeXmlFile($args->menu_srl);
951 997
 		// Delete all of image buttons
952
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
953
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
954
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
998
+		if($node['normal_btn']) {
999
+			FileHandler::removeFile($node['normal_btn']);
1000
+		}
1001
+		if($node['hover_btn']) {
1002
+			FileHandler::removeFile($node['hover_btn']);
1003
+		}
1004
+		if($node['active_btn']) {
1005
+			FileHandler::removeFile($node['active_btn']);
1006
+		}
955 1007
 
956 1008
 		// Delete module
957 1009
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1018,7 +1070,9 @@  discard block
 block discarded – undo
1018 1070
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1019 1071
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1020 1072
 
1021
-		if(!$mode || !$parent_srl || !$target_srl) return new Object(-1,'msg_invalid_request');
1073
+		if(!$mode || !$parent_srl || !$target_srl) {
1074
+			return new Object(-1,'msg_invalid_request');
1075
+		}
1022 1076
 
1023 1077
 		$oMenuAdminModel = getAdminModel('menu');
1024 1078
 
@@ -1182,8 +1236,11 @@  discard block
 block discarded – undo
1182 1236
 		// default argument setting
1183 1237
 		$args = new stdClass();
1184 1238
 		$args->menu_srl = $menuSrl;
1185
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1186
-		else $args->parent_srl = $parentSrl;
1239
+		if($parentSrl == 0) {
1240
+			$args->parent_srl = $menuSrl;
1241
+		} else {
1242
+			$args->parent_srl = $parentSrl;
1243
+		}
1187 1244
 		$args->menu_name_key = $originMenu['text'];
1188 1245
 		$args->menu_name = $originMenu['text'];
1189 1246
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1276,8 +1333,11 @@  discard block
 block discarded – undo
1276 1333
 		for($i=0;$i<4;$i++)
1277 1334
 		{
1278 1335
 			$case = rand(0, 1);
1279
-			if($case) $doc = rand(65, 90);
1280
-			else $doc = rand(97, 122);
1336
+			if($case) {
1337
+				$doc = rand(65, 90);
1338
+			} else {
1339
+				$doc = rand(97, 122);
1340
+			}
1281 1341
 
1282 1342
 			$randomString .= chr($doc);
1283 1343
 		}
@@ -1300,15 +1360,21 @@  discard block
 block discarded – undo
1300 1360
 		// menu name update
1301 1361
 		$args->menu_srl = $this->menuSrl;
1302 1362
 		$output = executeQuery('menu.updateMenu', $args);
1303
-		if(!$output->toBool()) return $output;
1363
+		if(!$output->toBool()) {
1364
+			return $output;
1365
+		}
1304 1366
 
1305 1367
 		$this->map = array();
1306 1368
 		if(is_array($parentKeyList))
1307 1369
 		{
1308 1370
 			foreach($parentKeyList as $no=>$srl)
1309 1371
 			{
1310
-				if($srl === 0) continue;
1311
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1372
+				if($srl === 0) {
1373
+					continue;
1374
+				}
1375
+				if(!is_array($this->map[$srl])) {
1376
+					$this->map[$srl] = array();
1377
+				}
1312 1378
 				$this->map[$srl][] = $no;
1313 1379
 			}
1314 1380
 		}
@@ -1410,7 +1476,9 @@  discard block
 block discarded – undo
1410 1476
 		$oMenuAdminModel = getAdminModel('menu');
1411 1477
 
1412 1478
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1413
-		if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
1479
+		if($target_item->menu_item_srl != $target_srl) {
1480
+			return new Object(-1,'msg_invalid_request');
1481
+		}
1414 1482
 		// Move the menu location(change the order menu appears)
1415 1483
 		if($mode == 'move')
1416 1484
 		{
@@ -1421,24 +1489,33 @@  discard block
 block discarded – undo
1421 1489
 			if($source_srl)
1422 1490
 			{
1423 1491
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1424
-				if($source_item->menu_item_srl != $source_srl) return new Object(-1,'msg_invalid_request');
1492
+				if($source_item->menu_item_srl != $source_srl) {
1493
+					return new Object(-1,'msg_invalid_request');
1494
+				}
1425 1495
 				$args->listorder = $source_item->listorder-1;
1426
-			}
1427
-			else
1496
+			} else
1428 1497
 			{
1429 1498
 				$output = executeQuery('menu.getMaxListorder', $args);
1430
-				if(!$output->toBool()) return $output;
1499
+				if(!$output->toBool()) {
1500
+					return $output;
1501
+				}
1431 1502
 				$args->listorder = (int)$output->data->listorder;
1432
-				if(!$args->listorder) $args->listorder= 0;
1503
+				if(!$args->listorder) {
1504
+					$args->listorder= 0;
1505
+				}
1433 1506
 			}
1434 1507
 			$args->parent_srl = $parent_srl;
1435 1508
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1436
-			if(!$output->toBool()) return $output;
1509
+			if(!$output->toBool()) {
1510
+				return $output;
1511
+			}
1437 1512
 
1438 1513
 			$args->parent_srl = $parent_srl;
1439 1514
 			$args->menu_item_srl = $target_srl;
1440 1515
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1441
-			if(!$output->toBool()) return $output;
1516
+			if(!$output->toBool()) {
1517
+				return $output;
1518
+			}
1442 1519
 
1443 1520
 			//module's menu_srl move also
1444 1521
 			if($isShortcut == 'N' && !empty($url))
@@ -1466,14 +1543,15 @@  discard block
 block discarded – undo
1466 1543
 				}
1467 1544
 			}
1468 1545
 			// Add a child
1469
-		}
1470
-		elseif($mode == 'insert')
1546
+		} elseif($mode == 'insert')
1471 1547
 		{
1472 1548
 			$args->menu_item_srl = $target_srl;
1473 1549
 			$args->parent_srl = $parent_srl;
1474 1550
 			$args->listorder = -1*getNextSequence();
1475 1551
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1476
-			if(!$output->toBool()) return $output;
1552
+			if(!$output->toBool()) {
1553
+				return $output;
1554
+			}
1477 1555
 		}
1478 1556
 
1479 1557
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1517,8 +1595,7 @@  discard block
 block discarded – undo
1517 1595
 		{
1518 1596
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1519 1597
 
1520
-		}
1521
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1598
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1522 1599
 		{
1523 1600
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1524 1601
 		}
@@ -1532,7 +1609,9 @@  discard block
 block discarded – undo
1532 1609
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1533 1610
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1534 1611
 
1535
-			if(!is_dir($path)) FileHandler::makeDir($path);
1612
+			if(!is_dir($path)) {
1613
+				FileHandler::makeDir($path);
1614
+			}
1536 1615
 
1537 1616
 			move_uploaded_file($target_file['tmp_name'], $filename);
1538 1617
 			Context::set('filename', $filename);
@@ -1572,7 +1651,9 @@  discard block
 block discarded – undo
1572 1651
 			foreach($installed_module_list AS $key=>$value)
1573 1652
 			{
1574 1653
 				$info = $oModuleModel->getModuleActionXml($value->module);
1575
-				if($info->menu) $menuList[$value->module] = $info->menu;
1654
+				if($info->menu) {
1655
+					$menuList[$value->module] = $info->menu;
1656
+				}
1576 1657
 				unset($info->menu);
1577 1658
 			}
1578 1659
 		}
@@ -1604,8 +1685,12 @@  discard block
 block discarded – undo
1604 1685
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1605 1686
 
1606 1687
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1608
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1688
+		if(empty($url)) {
1689
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1690
+		}
1691
+		if(empty($url)) {
1692
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1693
+		}
1609 1694
 		$dbInfo = Context::getDBInfo();
1610 1695
 
1611 1696
 		$args = new stdClass();
@@ -1617,8 +1702,7 @@  discard block
 block discarded – undo
1617 1702
 		if(strpos($url, 'https') !== false)
1618 1703
 		{
1619 1704
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1620
-		}
1621
-		else
1705
+		} else
1622 1706
 		{
1623 1707
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1624 1708
 		}
@@ -1637,14 +1721,18 @@  discard block
 block discarded – undo
1637 1721
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1638 1722
 		{
1639 1723
 			$output = $this->_updateMenuItem($args);
1640
-			if(!$output->toBool()) return $output;
1724
+			if(!$output->toBool()) {
1725
+				return $output;
1726
+			}
1641 1727
 		}
1642 1728
 		// Insert if not exist
1643 1729
 		else
1644 1730
 		{
1645 1731
 			$args->listorder = -1*$args->menu_item_srl;
1646 1732
 			$output = executeQuery('menu.insertMenuItem', $args);
1647
-			if(!$output->toBool()) return $output;
1733
+			if(!$output->toBool()) {
1734
+				return $output;
1735
+			}
1648 1736
 		}
1649 1737
 		// Get information of the menu
1650 1738
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1675,8 +1763,7 @@  discard block
 block discarded – undo
1675 1763
 		if(!$exposure)
1676 1764
 		{
1677 1765
 			$args->group_srls = '';
1678
-		}
1679
-		else
1766
+		} else
1680 1767
 		{
1681 1768
 			$exposure = explode(',', $exposure);
1682 1769
 			if(in_array($exposure, array('-1','-3')))
@@ -1684,7 +1771,9 @@  discard block
 block discarded – undo
1684 1771
 				$args->group_srls = $exposure;
1685 1772
 			}
1686 1773
 
1687
-			if($exposure) $args->group_srls = implode(',', $exposure);
1774
+			if($exposure) {
1775
+				$args->group_srls = implode(',', $exposure);
1776
+			}
1688 1777
 		}
1689 1778
 
1690 1779
 		$output = $this->_updateMenuItem($args);
@@ -1704,7 +1793,9 @@  discard block
 block discarded – undo
1704 1793
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1705 1794
 
1706 1795
 		$grantList = $xml_info->grant;
1707
-		if(!$grantList) $grantList = new stdClass;
1796
+		if(!$grantList) {
1797
+			$grantList = new stdClass;
1798
+		}
1708 1799
 
1709 1800
 		$grantList->access = new stdClass();
1710 1801
 		$grantList->access->default = 'guest';
@@ -1754,12 +1845,16 @@  discard block
 block discarded – undo
1754 1845
 	function makeXmlFile($menu_srl)
1755 1846
 	{
1756 1847
 		// Return if there is no information when creating the xml file
1757
-		if(!$menu_srl) return;
1848
+		if(!$menu_srl) {
1849
+			return;
1850
+		}
1758 1851
 		// Get menu informaton
1759 1852
 		$args = new stdClass();
1760 1853
 		$args->menu_srl = $menu_srl;
1761 1854
 		$output = executeQuery('menu.getMenu', $args);
1762
-		if(!$output->toBool() || !$output->data) return $output;
1855
+		if(!$output->toBool() || !$output->data) {
1856
+			return $output;
1857
+		}
1763 1858
 		$site_srl = (int)$output->data->site_srl;
1764 1859
 
1765 1860
 		if($site_srl)
@@ -1773,7 +1868,9 @@  discard block
 block discarded – undo
1773 1868
 		$args->menu_srl = $menu_srl;
1774 1869
 		$args->sort_index = 'listorder';
1775 1870
 		$output = executeQuery('menu.getMenuItems', $args);
1776
-		if(!$output->toBool()) return;
1871
+		if(!$output->toBool()) {
1872
+			return;
1873
+		}
1777 1874
 		// Specify the name of the cache file
1778 1875
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1779 1876
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1787,7 +1884,9 @@  discard block
 block discarded – undo
1787 1884
 			return $xml_file;
1788 1885
 		}
1789 1886
 		// Change to an array if only a single data is obtained
1790
-		if(!is_array($list)) $list = array($list);
1887
+		if(!is_array($list)) {
1888
+			$list = array($list);
1889
+		}
1791 1890
 		// Create a tree for loop
1792 1891
 		$list_count = count($list);
1793 1892
 		for($i=0;$i<$list_count;$i++)
@@ -1875,7 +1974,9 @@  discard block
 block discarded – undo
1875 1974
 	 */
1876 1975
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1877 1976
 	{
1878
-		if(!$source_node) return;
1977
+		if(!$source_node) {
1978
+			return;
1979
+		}
1879 1980
 
1880 1981
 		$oMenuAdminModel = getAdminModel('menu');
1881 1982
 
@@ -1883,7 +1984,9 @@  discard block
 block discarded – undo
1883 1984
 		{
1884 1985
 			$child_buff = "";
1885 1986
 			// Get data of the child nodes
1886
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1987
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
1988
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1989
+			}
1887 1990
 			// List variables
1888 1991
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1889 1992
 			foreach($names as $key => $val)
@@ -1897,37 +2000,57 @@  discard block
 block discarded – undo
1897 2000
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1898 2001
 			{
1899 2002
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2003
+			} else {
2004
+				$href = sprintf('"%s"', $url);
1900 2005
 			}
1901
-			else $href = sprintf('"%s"', $url);
1902 2006
 			$is_shortcut = $node->is_shortcut;
1903 2007
 			$open_window = $node->open_window;
1904 2008
 			$expand = $node->expand;
1905 2009
 
1906 2010
 			$normal_btn = $node->normal_btn;
1907
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1908
-			else $normal_btn = '';
2011
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2012
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2013
+			} else {
2014
+				$normal_btn = '';
2015
+			}
1909 2016
 			$hover_btn = $node->hover_btn;
1910
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1911
-			else $hover_btn = '';
2017
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2018
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2019
+			} else {
2020
+				$hover_btn = '';
2021
+			}
1912 2022
 			$active_btn = $node->active_btn;
1913
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1914
-			else $active_btn = '';
2023
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2024
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2025
+			} else {
2026
+				$active_btn = '';
2027
+			}
1915 2028
 
1916 2029
 			$group_srls = $node->group_srls;
1917 2030
 
1918 2031
 			if($normal_btn)
1919 2032
 			{
1920
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1921
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2033
+				if($hover_btn) {
2034
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2035
+				} else {
2036
+					$hover_str = '';
2037
+				}
2038
+				if($active_btn) {
2039
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2040
+				} else {
2041
+					$active_str = '';
2042
+				}
1922 2043
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1923
-			}
1924
-			else
2044
+			} else
1925 2045
 			{
1926 2046
 				$link = '<?php print $_names[$lang_type]; ?>';
1927 2047
 			}
1928 2048
 			// If the value of node->group_srls exists
1929
-			if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1930
-			else $group_check_code = "true";
2049
+			if($group_srls) {
2050
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
2051
+			} else {
2052
+				$group_check_code = "true";
2053
+			}
1931 2054
 			$attribute = sprintf(
1932 2055
 				'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
1933 2056
 				$menu_item_srl,
@@ -1950,8 +2073,11 @@  discard block
 block discarded – undo
1950 2073
 				$link
1951 2074
 			);
1952 2075
 
1953
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1954
-			else $buff .=  sprintf('<node %s />', $attribute);
2076
+			if($child_buff) {
2077
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2078
+			} else {
2079
+				$buff .=  sprintf('<node %s />', $attribute);
2080
+			}
1955 2081
 		}
1956 2082
 		return $buff;
1957 2083
 	}
@@ -1970,15 +2096,20 @@  discard block
 block discarded – undo
1970 2096
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1971 2097
 	{
1972 2098
 		$output = array("buff"=>"", "url_list"=>array());
1973
-		if(!$source_node) return $output;
2099
+		if(!$source_node) {
2100
+			return $output;
2101
+		}
1974 2102
 
1975 2103
 		$oMenuAdminModel = getAdminModel('menu');
1976 2104
 
1977 2105
 		foreach($source_node as $menu_item_srl => $node)
1978 2106
 		{
1979 2107
 			// Get data from child nodes if exist.
1980
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1981
-			else $child_output = array("buff"=>"", "url_list"=>array());
2108
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2109
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2110
+			} else {
2111
+				$child_output = array("buff"=>"", "url_list"=>array());
2112
+			}
1982 2113
 
1983 2114
 			// List variables
1984 2115
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -1988,8 +2119,7 @@  discard block
 block discarded – undo
1988 2119
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
1989 2120
 				{
1990 2121
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
1991
-				}
1992
-				else
2122
+				} else
1993 2123
 				{
1994 2124
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
1995 2125
 				}
@@ -1997,11 +2127,16 @@  discard block
 block discarded – undo
1997 2127
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
1998 2128
 
1999 2129
 			// If url value is not empty in the current node, put the value into an array url_list
2000
-			if($node->url) $child_output['url_list'][] = $node->url;
2130
+			if($node->url) {
2131
+				$child_output['url_list'][] = $node->url;
2132
+			}
2001 2133
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2002 2134
 			// If node->group_srls value exists
2003
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2004
-			else $group_check_code = "true";
2135
+			if($node->group_srls) {
2136
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2137
+			} else {
2138
+				$group_check_code = "true";
2139
+			}
2005 2140
 
2006 2141
 			// List variables
2007 2142
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2010,8 +2145,9 @@  discard block
 block discarded – undo
2010 2145
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2011 2146
 			{
2012 2147
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2148
+			} else {
2149
+				$href = sprintf('"%s"', $url);
2013 2150
 			}
2014
-			else $href = sprintf('"%s"', $url);
2015 2151
 			$is_shortcut = $node->is_shortcut;
2016 2152
 			$open_window = $node->open_window;
2017 2153
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2028,29 +2164,48 @@  discard block
 block discarded – undo
2028 2164
 			$expand = $node->expand;
2029 2165
 
2030 2166
 			$normal_btn = $node->normal_btn;
2031
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2032
-			else $normal_btn = '';
2167
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2168
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2169
+			} else {
2170
+				$normal_btn = '';
2171
+			}
2033 2172
 
2034 2173
 			$hover_btn = $node->hover_btn;
2035
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2036
-			else $hover_btn = '';
2174
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2175
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2176
+			} else {
2177
+				$hover_btn = '';
2178
+			}
2037 2179
 
2038 2180
 			$active_btn = $node->active_btn;
2039
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2040
-			else $active_btn = '';
2181
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2182
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2183
+			} else {
2184
+				$active_btn = '';
2185
+			}
2041 2186
 
2042 2187
 
2043 2188
 			$group_srls = $node->group_srls;
2044 2189
 
2045 2190
 			if($normal_btn)
2046 2191
 			{
2047
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2048
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2192
+				if($hover_btn) {
2193
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2194
+				} else {
2195
+					$hover_str = '';
2196
+				}
2197
+				if($active_btn) {
2198
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2199
+				} else {
2200
+					$active_str = '';
2201
+				}
2049 2202
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2050
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2051
-				else $link_active = $link;
2052
-			}
2053
-			else
2203
+				if($active_btn) {
2204
+					$link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2205
+				} else {
2206
+					$link_active = $link;
2207
+				}
2208
+			} else
2054 2209
 			{
2055 2210
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2056 2211
 			}
@@ -2099,11 +2254,15 @@  discard block
 block discarded – undo
2099 2254
 	 */
2100 2255
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2101 2256
 	{
2102
-		if(!count($menu_srl_list)) return;
2257
+		if(!count($menu_srl_list)) {
2258
+			return;
2259
+		}
2103 2260
 		// Delete the value of menu_srls
2104 2261
 		$args->menu_srls = implode(',',$menu_srl_list);
2105 2262
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2106
-		if(!$output->toBool()) return $output;
2263
+		if(!$output->toBool()) {
2264
+			return $output;
2265
+		}
2107 2266
 
2108 2267
 		$args->layout_srl = $layout_srl;
2109 2268
 		// Mapping menu_srls, layout_srl
@@ -2111,7 +2270,9 @@  discard block
 block discarded – undo
2111 2270
 		{
2112 2271
 			$args->menu_srl = $menu_srl_list[$i];
2113 2272
 			$output = executeQuery('menu.insertMenuLayout', $args);
2114
-			if(!$output->toBool()) return $output;
2273
+			if(!$output->toBool()) {
2274
+				return $output;
2275
+			}
2115 2276
 		}
2116 2277
 	}
2117 2278
 
@@ -2134,9 +2295,15 @@  discard block
 block discarded – undo
2134 2295
 			$oMenuModel = getAdminModel('menu');
2135 2296
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2136 2297
 
2137
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2138
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2139
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2298
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2299
+				FileHandler::removeFile($itemInfo->normal_btn);
2300
+			}
2301
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2302
+				FileHandler::removeFile($itemInfo->hover_btn);
2303
+			}
2304
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2305
+				FileHandler::removeFile($itemInfo->active_btn);
2306
+			}
2140 2307
 		}
2141 2308
 
2142 2309
 		$returnArray = array();
Please login to merge, or discard this patch.
modules/board/board.api.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @brief notice list
19 19
 	 **/
20 20
 	function dispBoardNoticeList(&$oModule) {
21
-		 $oModule->add('notice_list',$this->arrangeContentList(Context::get('notice_list')));
21
+		 $oModule->add('notice_list', $this->arrangeContentList(Context::get('notice_list')));
22 22
 	}
23 23
 
24 24
 
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 		$api_type = Context::get('api_type');
30 30
 		$document_list = $this->arrangeContentList(Context::get('document_list'));
31 31
 
32
-		if($api_type =='summary')
32
+		if ($api_type == 'summary')
33 33
 		{
34 34
 			$content_cut_size = Context::get('content_cut_size');
35
-			$content_cut_size = $content_cut_size?$content_cut_size:50;
36
-			foreach($document_list as $k=>$v)
35
+			$content_cut_size = $content_cut_size ? $content_cut_size : 50;
36
+			foreach ($document_list as $k=>$v)
37 37
 			{
38 38
 				$oDocument = new documentItem();
39 39
 				$oDocument->setAttribute($v, false);
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 			}
43 43
 		}
44 44
 
45
-		$oModule->add('document_list',$document_list);
46
-		$oModule->add('page_navigation',Context::get('page_navigation'));
45
+		$oModule->add('document_list', $document_list);
46
+		$oModule->add('page_navigation', Context::get('page_navigation'));
47 47
 	}
48 48
 
49 49
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @brief category list
52 52
 	 **/
53 53
 	function dispBoardCategoryList(&$oModule) {
54
-		$oModule->add('category_list',Context::get('category_list'));
54
+		$oModule->add('category_list', Context::get('category_list'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	function dispBoardContentView(&$oModule) {
61 61
 		$oDocument = Context::get('oDocument');
62 62
 		$extra_vars = $oDocument->getExtraVars();
63
-		if($oDocument->isGranted())
63
+		if ($oDocument->isGranted())
64 64
 		{
65
-			$oDocument->add('extra_vars',$this->arrangeExtraVars($extra_vars));
65
+			$oDocument->add('extra_vars', $this->arrangeExtraVars($extra_vars));
66 66
 		}
67
-		$oModule->add('oDocument',$this->arrangeContent($oDocument));
67
+		$oModule->add('oDocument', $this->arrangeContent($oDocument));
68 68
 	}
69 69
 
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 **/
74 74
 	function dispBoardContentFileList(&$oModule) {
75 75
 		$oDocument = Context::get('oDocument');
76
-		if($oDocument->isAccessible())
76
+		if ($oDocument->isAccessible())
77 77
 		{
78 78
 			$oModule->add('file_list', $this->arrangeFile(Context::get('file_list')));
79 79
 		}
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
 	 * @brief tag list
89 89
 	 **/
90 90
 	function dispBoardTagList(&$oModule) {
91
-		$oModule->add('tag_list',Context::get('tag_list'));
91
+		$oModule->add('tag_list', Context::get('tag_list'));
92 92
 	}
93 93
 
94 94
 	/**
95 95
 	 * @brief comments list
96 96
 	 **/
97 97
 	function dispBoardContentCommentList(&$oModule) {
98
-		$oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list')));
98
+		$oModule->add('comment_list', $this->arrangeComment(Context::get('comment_list')));
99 99
 	}
100 100
 
101 101
 	function arrangeContentList($content_list) {
102 102
 		$output = array();
103
-		if(count($content_list)) {
104
-			foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
103
+		if (count($content_list)) {
104
+			foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val);
105 105
 		}
106 106
 		return $output;
107 107
 	}
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	function arrangeContent($content) {
111 111
 		$oBoardView = getView('board');
112 112
 		$output = new stdClass;
113
-		if($content){
114
-			$output = $content->gets('document_srl','category_srl','member_srl','nick_name','title','content','tags','readed_count','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status');
113
+		if ($content) {
114
+			$output = $content->gets('document_srl', 'category_srl', 'member_srl', 'nick_name', 'title', 'content', 'tags', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status');
115 115
 
116
-			if(!$oBoardView->grant->view)
116
+			if (!$oBoardView->grant->view)
117 117
 			{
118 118
 				unset($output->content);
119 119
 				unset($output->tags);
120 120
 				unset($output->extra_vars);
121 121
 			}
122
-			if(!$content->isAccessible())
122
+			if (!$content->isAccessible())
123 123
 			{
124 124
 				$output->content = Context::getLang('msg_is_secret');
125 125
 			}
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 
138 138
 	function arrangeComment($comment_list) {
139 139
 		$output = array();
140
-		if(count($comment_list) > 0 ) {
141
-			foreach($comment_list as $key => $val){
140
+		if (count($comment_list) > 0) {
141
+			foreach ($comment_list as $key => $val) {
142 142
 				$item = null;
143
-				$item = $val->gets('comment_srl','parent_srl','depth','nick_name','content','is_secret','voted_count','blamed_count','regdate','last_update');
144
-				if(!$val->isAccessible())
143
+				$item = $val->gets('comment_srl', 'parent_srl', 'depth', 'nick_name', 'content', 'is_secret', 'voted_count', 'blamed_count', 'regdate', 'last_update');
144
+				if (!$val->isAccessible())
145 145
 				{
146 146
 					$item->content = Context::getLang('msg_is_secret');
147 147
 				}
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 
155 155
 	function arrangeFile($file_list) {
156 156
 		$output = array();
157
-		if(count($file_list) > 0) {
158
-			foreach($file_list as $key => $val){
157
+		if (count($file_list) > 0) {
158
+			foreach ($file_list as $key => $val) {
159 159
 				$item = new stdClass;
160 160
 				$item->download_count = $val->download_count;
161 161
 				$item->source_filename = $val->source_filename;
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 
170 170
 	function arrangeExtraVars($list) {
171 171
 		$output = array();
172
-		if(count($list)) {
173
-			foreach($list as $key => $val){
172
+		if (count($list)) {
173
+			foreach ($list as $key => $val) {
174 174
 				$item = new stdClass;
175 175
 				$item->name = $val->name;
176 176
 				$item->type = $val->type;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
 		if($oDocument->isAccessible())
77 77
 		{
78 78
 			$oModule->add('file_list', $this->arrangeFile(Context::get('file_list')));
79
-		}
80
-		else
79
+		} else
81 80
 		{
82 81
 			$oModule->add('file_list', array());
83 82
 		}
@@ -101,7 +100,9 @@  discard block
 block discarded – undo
101 100
 	function arrangeContentList($content_list) {
102 101
 		$output = array();
103 102
 		if(count($content_list)) {
104
-			foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
103
+			foreach($content_list as $key => $val) {
104
+				$output[] = $this->arrangeContent($val);
105
+			}
105 106
 		}
106 107
 		return $output;
107 108
 	}
Please login to merge, or discard this patch.
modules/board/board.view.php 1 patch
Spacing   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 		/**
24 24
 		 * setup the module general information
25 25
 		 **/
26
-		if($this->module_info->list_count)
26
+		if ($this->module_info->list_count)
27 27
 		{
28 28
 			$this->list_count = $this->module_info->list_count;
29 29
 		}
30
-		if($this->module_info->search_list_count)
30
+		if ($this->module_info->search_list_count)
31 31
 		{
32 32
 			$this->search_list_count = $this->module_info->search_list_count;
33 33
 		}
34
-		if($this->module_info->page_count)
34
+		if ($this->module_info->page_count)
35 35
 		{
36 36
 			$this->page_count = $this->module_info->page_count;
37 37
 		}
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 		$oDocumentModel = getModel('document');
42 42
 
43 43
 		$statusList = $this->_getStatusNameList($oDocumentModel);
44
-		if(isset($statusList['SECRET']))
44
+		if (isset($statusList['SECRET']))
45 45
 		{
46 46
 			$this->module_info->secret = 'Y';
47 47
 		}
48 48
 
49 49
 		// use_category <=1.5.x, hide_category >=1.7.x
50 50
 		$count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl));
51
-		if($count_category)
51
+		if ($count_category)
52 52
 		{
53
-			if($this->module_info->hide_category)
53
+			if ($this->module_info->hide_category)
54 54
 			{
55 55
 				$this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y';
56 56
 			}
57
-			else if($this->module_info->use_category)
57
+			else if ($this->module_info->use_category)
58 58
 			{
59 59
 				$this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y';
60 60
 			}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		 * check the consultation function, if the user is admin then swich off consultation function
75 75
 		 * if the user is not logged, then disppear write document/write comment./ view document
76 76
 		 **/
77
-		if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)
77
+		if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)
78 78
 		{
79 79
 			$this->consultation = TRUE;
80
-			if(!Context::get('is_logged'))
80
+			if (!Context::get('is_logged'))
81 81
 			{
82 82
 				$this->grant->list = FALSE;
83 83
 				$this->grant->write_document = FALSE;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 		 * setup the template path based on the skin
95 95
 		 * the default skin is default
96 96
 		 **/
97
-		$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
98
-		if(!is_dir($template_path)||!$this->module_info->skin)
97
+		$template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin);
98
+		if (!is_dir($template_path) || !$this->module_info->skin)
99 99
 		{
100 100
 			$this->module_info->skin = 'default';
101
-			$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
101
+			$template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin);
102 102
 		}
103 103
 		$this->setTemplatePath($template_path);
104 104
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		 **/
115 115
 		if (is_array($extra_keys))
116 116
 		{
117
-			foreach($extra_keys as $val)
117
+			foreach ($extra_keys as $val)
118 118
 			{
119 119
 				$this->order_target[] = $val->eid;
120 120
 			}
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
 		// remove [document_srl]_cpage from get_vars
129 129
 		$args = Context::getRequestVars();
130
-		foreach($args as $name => $value)
130
+		foreach ($args as $name => $value)
131 131
 		{
132
-			if(preg_match('/[0-9]+_cpage/', $name))
132
+			if (preg_match('/[0-9]+_cpage/', $name))
133 133
 			{
134 134
 				Context::set($name, '', TRUE);
135 135
 				Context::set($name, $value);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		/**
146 146
 		 * check the access grant (all the grant has been set by the module object)
147 147
 		 **/
148
-		if(!$this->grant->access || !$this->grant->list)
148
+		if (!$this->grant->access || !$this->grant->list)
149 149
 		{
150 150
 			return $this->dispBoardMessage('msg_not_permitted');
151 151
 		}
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
 		 * add extra vaiables to the search options
161 161
 		 **/
162 162
 		// use search options on the template (the search options key has been declared, based on the language selected)
163
-		foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt);
163
+		foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt);
164 164
 		$extra_keys = Context::get('extra_keys');
165
-		if($extra_keys)
165
+		if ($extra_keys)
166 166
 		{
167
-			foreach($extra_keys as $key => $val)
167
+			foreach ($extra_keys as $key => $val)
168 168
 			{
169
-				if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name;
169
+				if ($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name;
170 170
 			}
171 171
 		}
172 172
 		// remove a search option that is not public in member config
173 173
 		$memberConfig = getModel('module')->getModuleConfig('member');
174
-		foreach($memberConfig->signupForm as $signupFormElement)
174
+		foreach ($memberConfig->signupForm as $signupFormElement)
175 175
 		{
176
-			if(in_array($signupFormElement->title, $search_option))
176
+			if (in_array($signupFormElement->title, $search_option))
177 177
 			{
178
-				if($signupFormElement->isPublic == 'N')
178
+				if ($signupFormElement->isPublic == 'N')
179 179
 					unset($search_option[$signupFormElement->name]);
180 180
 			}
181 181
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$oDocumentModel = getModel('document');
185 185
 		$statusNameList = $this->_getStatusNameList($oDocumentModel);
186
-		if(count($statusNameList) > 0)
186
+		if (count($statusNameList) > 0)
187 187
 		{
188 188
 			Context::set('status_list', $statusNameList);
189 189
 		}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		// list config, columnList setting
195 195
 		$oBoardModel = getModel('board');
196 196
 		$this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl);
197
-		if(!$this->listConfig) $this->listConfig = array();
197
+		if (!$this->listConfig) $this->listConfig = array();
198 198
 		$this->_makeListColumnList();
199 199
 
200 200
 		// display the notice list
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	/**
219 219
 	 * @brief display the category list
220 220
 	 **/
221
-	function dispBoardCategoryList(){
221
+	function dispBoardCategoryList() {
222 222
 		// check if the use_category option is enabled
223
-		if($this->module_info->use_category=='Y')
223
+		if ($this->module_info->use_category == 'Y')
224 224
 		{
225 225
 			// check the grant
226
-			if(!$this->grant->list)
226
+			if (!$this->grant->list)
227 227
 			{
228 228
 				Context::set('category_list', array());
229 229
 				return;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	/**
241 241
 	 * @brief display the board conent view
242 242
 	 **/
243
-	function dispBoardContentView(){
243
+	function dispBoardContentView() {
244 244
 		// get the variable value
245 245
 		$document_srl = Context::get('document_srl');
246 246
 		$page = Context::get('page');
@@ -251,36 +251,36 @@  discard block
 block discarded – undo
251 251
 		/**
252 252
 		 * if the document exists, then get the document information
253 253
 		 **/
254
-		if($document_srl)
254
+		if ($document_srl)
255 255
 		{
256 256
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, true);
257 257
 
258 258
 			// if the document is existed
259
-			if($oDocument->isExists())
259
+			if ($oDocument->isExists())
260 260
 			{
261 261
 				// if the module srl is not consistent
262
-				if($oDocument->get('module_srl')!=$this->module_info->module_srl )
262
+				if ($oDocument->get('module_srl') != $this->module_info->module_srl)
263 263
 				{
264 264
 					return $this->stop('msg_invalid_request');
265 265
 				}
266 266
 
267 267
 				// check the manage grant
268
-				if($this->grant->manager) $oDocument->setGrant();
268
+				if ($this->grant->manager) $oDocument->setGrant();
269 269
 
270 270
 				// if the consultation function is enabled, and the document is not a notice
271
-				if($this->consultation && !$oDocument->isNotice())
271
+				if ($this->consultation && !$oDocument->isNotice())
272 272
 				{
273 273
 					$logged_info = Context::get('logged_info');
274
-					if($oDocument->get('member_srl')!=$logged_info->member_srl)
274
+					if ($oDocument->get('member_srl') != $logged_info->member_srl)
275 275
 					{
276 276
 						$oDocument = $oDocumentModel->getDocument(0);
277 277
 					}
278 278
 				}
279 279
 
280 280
 				// if the document is TEMP saved, check Grant
281
-				if($oDocument->getStatus() == 'TEMP')
281
+				if ($oDocument->getStatus() == 'TEMP')
282 282
 				{
283
-					if(!$oDocument->isGranted())
283
+					if (!$oDocument->isGranted())
284 284
 					{
285 285
 						$oDocument = $oDocumentModel->getDocument(0);
286 286
 					}
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			else
291 291
 			{
292 292
 				// if the document is not existed, then alert a warning message
293
-				Context::set('document_srl','',true);
293
+				Context::set('document_srl', '', true);
294 294
 				$this->alertMessage('msg_not_founded');
295 295
 			}
296 296
 
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 		/**
307 307
 		 *check the document view grant
308 308
 		 **/
309
-		if($oDocument->isExists())
309
+		if ($oDocument->isExists())
310 310
 		{
311
-			if(!$this->grant->view && !$oDocument->isGranted())
311
+			if (!$this->grant->view && !$oDocument->isGranted())
312 312
 			{
313 313
 				$oDocument = $oDocumentModel->getDocument(0);
314
-				Context::set('document_srl','',true);
314
+				Context::set('document_srl', '', true);
315 315
 				$this->alertMessage('msg_not_permitted');
316 316
 			}
317 317
 			else
@@ -320,15 +320,15 @@  discard block
 block discarded – undo
320 320
 				Context::addBrowserTitle($oDocument->getTitleText());
321 321
 
322 322
 				// update the document view count (if the document is not secret)
323
-				if(!$oDocument->isSecret() || $oDocument->isGranted())
323
+				if (!$oDocument->isSecret() || $oDocument->isGranted())
324 324
 				{
325 325
 					$oDocument->updateReadedCount();
326 326
 				}
327 327
 
328 328
 				// disappear the document if it is secret
329
-				if($oDocument->isSecret() && !$oDocument->isGranted())
329
+				if ($oDocument->isSecret() && !$oDocument->isGranted())
330 330
 				{
331
-					$oDocument->add('content',Context::getLang('thisissecret'));
331
+					$oDocument->add('content', Context::getLang('thisissecret'));
332 332
 				}
333 333
 			}
334 334
 		}
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 	/**
349 349
 	 * @brief  display the document file list (can be used by API)
350 350
 	 **/
351
-	function dispBoardContentFileList(){
351
+	function dispBoardContentFileList() {
352 352
 		/**
353 353
 		 * check the access grant (all the grant has been set by the module object)
354 354
 		 **/
355
-		if(!$this->grant->access)
355
+		if (!$this->grant->access)
356 356
 		{
357 357
 			return $this->dispBoardMessage('msg_not_permitted');
358 358
 		}
@@ -363,41 +363,41 @@  discard block
 block discarded – undo
363 363
 		// Check if a permission for file download is granted
364 364
 		// Get configurations (using module model object)
365 365
 		$oModuleModel = getModel('module');
366
-		$file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl);
366
+		$file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl);
367 367
 		
368 368
 		$downloadGrantCount = 0;
369
-		if(is_array($file_module_config->download_grant))
369
+		if (is_array($file_module_config->download_grant))
370 370
 		{
371
-			foreach($file_module_config->download_grant AS $value)
372
-				if($value) $downloadGrantCount++;
371
+			foreach ($file_module_config->download_grant AS $value)
372
+				if ($value) $downloadGrantCount++;
373 373
 		}
374 374
 
375
-		if(is_array($file_module_config->download_grant) && $downloadGrantCount>0)
375
+		if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0)
376 376
 		{
377
-			if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
377
+			if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
378 378
 			$logged_info = Context::get('logged_info');
379
-			if($logged_info->is_admin != 'Y')
379
+			if ($logged_info->is_admin != 'Y')
380 380
 			{
381
-				$oModuleModel =& getModel('module');
381
+				$oModuleModel = & getModel('module');
382 382
 				$columnList = array('module_srl', 'site_srl');
383 383
 				$module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList);
384 384
 
385
-				if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))
385
+				if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))
386 386
 				{
387
-					$oMemberModel =& getModel('member');
387
+					$oMemberModel = & getModel('member');
388 388
 					$member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl);
389 389
 
390 390
 					$is_permitted = false;
391
-					for($i=0;$i<count($file_module_config->download_grant);$i++)
391
+					for ($i = 0; $i < count($file_module_config->download_grant); $i++)
392 392
 					{
393 393
 						$group_srl = $file_module_config->download_grant[$i];
394
-						if($member_groups[$group_srl])
394
+						if ($member_groups[$group_srl])
395 395
 						{
396 396
 							$is_permitted = true;
397 397
 							break;
398 398
 						}
399 399
 					}
400
-					if(!$is_permitted) return $this->stop('msg_not_permitted_download');
400
+					if (!$is_permitted) return $this->stop('msg_not_permitted_download');
401 401
 				}
402 402
 			}
403 403
 		}
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 		$document_srl = Context::get('document_srl');
407 407
 		$oDocument = $oDocumentModel->getDocument($document_srl);
408 408
 		Context::set('oDocument', $oDocument);
409
-		Context::set('file_list',$oDocument->getUploadedFiles());
409
+		Context::set('file_list', $oDocument->getUploadedFiles());
410 410
 
411 411
 		$oSecurity = new Security();
412 412
 		$oSecurity->encodeHTML('file_list..source_filename');
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	/**
416 416
 	 * @brief display the document comment list (can be used by API)
417 417
 	 **/
418
-	function dispBoardContentCommentList(){
418
+	function dispBoardContentCommentList() {
419 419
 		// check document view grant
420 420
 		$this->dispBoardContentView();
421 421
 
@@ -425,26 +425,26 @@  discard block
 block discarded – undo
425 425
 		$comment_list = $oDocument->getComments();
426 426
 
427 427
 		// setup the comment list
428
-		if(is_array($comment_list))
428
+		if (is_array($comment_list))
429 429
 		{
430
-			foreach($comment_list as $key => $val)
430
+			foreach ($comment_list as $key => $val)
431 431
 			{
432
-				if(!$val->isAccessible())
432
+				if (!$val->isAccessible())
433 433
 				{
434
-					$val->add('content',Context::getLang('thisissecret'));
434
+					$val->add('content', Context::getLang('thisissecret'));
435 435
 				}
436 436
 			}
437 437
 		}
438
-		Context::set('comment_list',$comment_list);
438
+		Context::set('comment_list', $comment_list);
439 439
 
440 440
 	}
441 441
 
442 442
 	/**
443 443
 	 * @brief display notice list (can be used by API)
444 444
 	 **/
445
-	function dispBoardNoticeList(){
445
+	function dispBoardNoticeList() {
446 446
 		// check the grant
447
-		if(!$this->grant->list)
447
+		if (!$this->grant->list)
448 448
 		{
449 449
 			Context::set('notice_list', array());
450 450
 			return;
@@ -460,15 +460,15 @@  discard block
 block discarded – undo
460 460
 	/**
461 461
 	 * @brief display board content list
462 462
 	 **/
463
-	function dispBoardContentList(){
463
+	function dispBoardContentList() {
464 464
 		// check the grant
465
-		if(!$this->grant->list)
465
+		if (!$this->grant->list)
466 466
 		{
467 467
 			Context::set('document_list', array());
468 468
 			Context::set('total_count', 0);
469 469
 			Context::set('total_page', 1);
470 470
 			Context::set('page', 1);
471
-			Context::set('page_navigation', new PageHandler(0,0,1,10));
471
+			Context::set('page_navigation', new PageHandler(0, 0, 1, 10));
472 472
 			return;
473 473
 		}
474 474
 
@@ -486,17 +486,17 @@  discard block
 block discarded – undo
486 486
 		$args->search_keyword = Context::get('search_keyword');
487 487
 
488 488
 		$search_option = Context::get('search_option');
489
-		if($search_option==FALSE)
489
+		if ($search_option == FALSE)
490 490
 		{
491 491
 			$search_option = $this->search_option;
492 492
 		}
493
-		if(isset($search_option[$args->search_target])==FALSE)
493
+		if (isset($search_option[$args->search_target]) == FALSE)
494 494
 		{
495 495
 			$args->search_target = '';
496 496
 		}
497 497
 
498 498
 		// if the category is enabled, then get the category
499
-		if($this->module_info->use_category=='Y')
499
+		if ($this->module_info->use_category == 'Y')
500 500
 		{
501 501
 			$args->category_srl = Context::get('category');
502 502
 		}
@@ -504,21 +504,21 @@  discard block
 block discarded – undo
504 504
 		// setup the sort index and order index
505 505
 		$args->sort_index = Context::get('sort_index');
506 506
 		$args->order_type = Context::get('order_type');
507
-		if(!in_array($args->sort_index, $this->order_target))
507
+		if (!in_array($args->sort_index, $this->order_target))
508 508
 		{
509
-			$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
509
+			$args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order';
510 510
 		}
511
-		if(!in_array($args->order_type, array('asc','desc')))
511
+		if (!in_array($args->order_type, array('asc', 'desc')))
512 512
 		{
513
-			$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
513
+			$args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc';
514 514
 		}
515 515
 
516 516
 		// set the current page of documents
517 517
 		$document_srl = Context::get('document_srl');
518
-		if(!$args->page && $document_srl)
518
+		if (!$args->page && $document_srl)
519 519
 		{
520 520
 			$oDocument = $oDocumentModel->getDocument($document_srl);
521
-			if($oDocument->isExists() && !$oDocument->isNotice())
521
+			if ($oDocument->isExists() && !$oDocument->isNotice())
522 522
 			{
523 523
 				$page = $oDocumentModel->getDocumentPage($oDocument, $args);
524 524
 				Context::set('page', $page);
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 		}
528 528
 
529 529
 		// setup the list count to be serach list count, if the category or search keyword has been set
530
-		if($args->category_srl || $args->search_keyword)
530
+		if ($args->category_srl || $args->search_keyword)
531 531
 		{
532 532
 			$args->list_count = $this->search_list_count;
533 533
 		}
534 534
 
535 535
 		// if the consultation function is enabled,  the get the logged user information
536
-		if($this->consultation)
536
+		if ($this->consultation)
537 537
 		{
538 538
 			$logged_info = Context::get('logged_info');
539 539
 			$args->member_srl = $logged_info->member_srl;
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
 				'allow_trackback', 'notify_message', 'status', 'comment_status');
562 562
 		$this->columnList = array_intersect($configColumList, $tableColumnList);
563 563
 
564
-		if(in_array('summary', $configColumList)) array_push($this->columnList, 'content');
564
+		if (in_array('summary', $configColumList)) array_push($this->columnList, 'content');
565 565
 
566 566
 		// default column list add
567 567
 		$defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color');
568 568
 
569 569
 		//TODO guestbook, blog style supports legacy codes.
570
-		if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
570
+		if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
571 571
 		{
572 572
 			$defaultColumn = $tableColumnList;
573 573
 		}
574 574
 
575
-		if (in_array('last_post', $configColumList)){
575
+		if (in_array('last_post', $configColumList)) {
576 576
 			array_push($this->columnList, 'last_updater');
577 577
 		}
578 578
 
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 		$this->columnList = array_unique(array_merge($this->columnList, $defaultColumn));
585 585
 
586 586
 		// add table name
587
-		foreach($this->columnList as $no => $value)
587
+		foreach ($this->columnList as $no => $value)
588 588
 		{
589
-			$this->columnList[$no] = 'documents.' . $value;
589
+			$this->columnList[$no] = 'documents.'.$value;
590 590
 		}
591 591
 	}
592 592
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	function dispBoardTagList()
597 597
 	{
598 598
 		// check if there is not grant fot view list, then alert an warning message
599
-		if(!$this->grant->list)
599
+		if (!$this->grant->list)
600 600
 		{
601 601
 			return $this->dispBoardMessage('msg_not_permitted');
602 602
 		}
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 		$output = $oTagModel->getTagList($obj);
611 611
 
612 612
 		// automatically order
613
-		if(count($output->data))
613
+		if (count($output->data))
614 614
 		{
615 615
 			$numbers = array_keys($output->data);
616 616
 			shuffle($numbers);
617 617
 
618
-			if(count($output->data))
618
+			if (count($output->data))
619 619
 			{
620
-				foreach($numbers as $k => $v)
620
+				foreach ($numbers as $k => $v)
621 621
 				{
622 622
 					$tag_list[] = $output->data[$v];
623 623
 				}
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	function dispBoardWrite()
639 639
 	{
640 640
 		// check grant
641
-		if(!$this->grant->write_document)
641
+		if (!$this->grant->write_document)
642 642
 		{
643 643
 			return $this->dispBoardMessage('msg_not_permitted');
644 644
 		}
@@ -648,10 +648,10 @@  discard block
 block discarded – undo
648 648
 		/**
649 649
 		 * check if the category option is enabled not not
650 650
 		 **/
651
-		if($this->module_info->use_category=='Y')
651
+		if ($this->module_info->use_category == 'Y')
652 652
 		{
653 653
 			// get the user group information
654
-			if(Context::get('is_logged'))
654
+			if (Context::get('is_logged'))
655 655
 			{
656 656
 				$logged_info = Context::get('logged_info');
657 657
 				$group_srls = array_keys($logged_info->group_list);
@@ -664,19 +664,19 @@  discard block
 block discarded – undo
664 664
 
665 665
 			// check the grant after obtained the category list
666 666
 			$normal_category_list = $oDocumentModel->getCategoryList($this->module_srl);
667
-			if(count($normal_category_list))
667
+			if (count($normal_category_list))
668 668
 			{
669
-				foreach($normal_category_list as $category_srl => $category)
669
+				foreach ($normal_category_list as $category_srl => $category)
670 670
 				{
671 671
 					$is_granted = TRUE;
672
-					if($category->group_srls)
672
+					if ($category->group_srls)
673 673
 					{
674
-						$category_group_srls = explode(',',$category->group_srls);
674
+						$category_group_srls = explode(',', $category->group_srls);
675 675
 						$is_granted = FALSE;
676
-						if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE;
676
+						if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE;
677 677
 
678 678
 					}
679
-					if($is_granted) $category_list[$category_srl] = $category;
679
+					if ($is_granted) $category_list[$category_srl] = $category;
680 680
 				}
681 681
 			}
682 682
 			Context::set('category_list', $category_list);
@@ -687,46 +687,46 @@  discard block
 block discarded – undo
687 687
 		$oDocument = $oDocumentModel->getDocument(0, $this->grant->manager);
688 688
 		$oDocument->setDocument($document_srl);
689 689
 
690
-		if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
690
+		if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
691 691
 		$oDocument->add('module_srl', $this->module_srl);
692 692
 
693
-		if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
693
+		if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
694 694
 		{
695 695
 			return new Object(-1, 'msg_protect_content');
696 696
 		}
697 697
 
698 698
 		// if the document is not granted, then back to the password input form
699 699
 		$oModuleModel = getModel('module');
700
-		if($oDocument->isExists()&&!$oDocument->isGranted())
700
+		if ($oDocument->isExists() && !$oDocument->isGranted())
701 701
 		{
702 702
 			return $this->setTemplateFile('input_password_form');
703 703
 		}
704 704
 
705
-		if(!$oDocument->isExists())
705
+		if (!$oDocument->isExists())
706 706
 		{
707
-			$point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl);
707
+			$point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl);
708 708
 			$logged_info = Context::get('logged_info');
709 709
 			$oPointModel = getModel('point');
710 710
 			$pointForInsert = $point_config["insert_document"];
711
-			if($pointForInsert < 0)
711
+			if ($pointForInsert < 0)
712 712
 			{
713
-				if( !$logged_info )
713
+				if (!$logged_info)
714 714
 				{
715 715
 					return $this->dispBoardMessage('msg_not_permitted');
716 716
 				}
717
-				else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 )
717
+				else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0)
718 718
 				{
719 719
 					return $this->dispBoardMessage('msg_not_enough_point');
720 720
 				}
721 721
 			}
722 722
 		}
723
-		if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus());
723
+		if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus());
724 724
 
725 725
 		$statusList = $this->_getStatusNameList($oDocumentModel);
726
-		if(count($statusList) > 0) Context::set('status_list', $statusList);
726
+		if (count($statusList) > 0) Context::set('status_list', $statusList);
727 727
 
728 728
 		// get Document status config value
729
-		Context::set('document_srl',$document_srl);
729
+		Context::set('document_srl', $document_srl);
730 730
 		Context::set('oDocument', $oDocument);
731 731
 
732 732
 		// apply xml_js_filter on header
@@ -734,12 +734,12 @@  discard block
 block discarded – undo
734 734
 		$oDocumentController->addXmlJsFilter($this->module_info->module_srl);
735 735
 
736 736
 		// if the document exists, then setup extra variabels on context
737
-		if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars());
737
+		if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars());
738 738
 
739 739
 		/**
740 740
 		 * add JS filters
741 741
 		 **/
742
-		if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
742
+		if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
743 743
 		else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml');
744 744
 
745 745
 		$oSecurity = new Security();
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 	function _getStatusNameList(&$oDocumentModel)
752 752
 	{
753 753
 		$resultList = array();
754
-		if(!empty($this->module_info->use_status))
754
+		if (!empty($this->module_info->use_status))
755 755
 		{
756 756
 			$statusNameList = $oDocumentModel->getStatusNameList();
757 757
 			$statusList = explode('|@|', $this->module_info->use_status);
758 758
 
759
-			if(is_array($statusList))
759
+			if (is_array($statusList))
760 760
 			{
761
-				foreach($statusList as $key => $value)
761
+				foreach ($statusList as $key => $value)
762 762
 				{
763 763
 					$resultList[$value] = $statusNameList[$value];
764 764
 				}
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 	function dispBoardDelete()
774 774
 	{
775 775
 		// check grant
776
-		if(!$this->grant->write_document)
776
+		if (!$this->grant->write_document)
777 777
 		{
778 778
 			return $this->dispBoardMessage('msg_not_permitted');
779 779
 		}
@@ -782,30 +782,30 @@  discard block
 block discarded – undo
782 782
 		$document_srl = Context::get('document_srl');
783 783
 
784 784
 		// if document exists, get the document information
785
-		if($document_srl)
785
+		if ($document_srl)
786 786
 		{
787 787
 			$oDocumentModel = getModel('document');
788 788
 			$oDocument = $oDocumentModel->getDocument($document_srl);
789 789
 		}
790 790
 
791 791
 		// if the document is not existed, then back to the board content page
792
-		if(!$oDocument || !$oDocument->isExists())
792
+		if (!$oDocument || !$oDocument->isExists())
793 793
 		{
794 794
 			return $this->dispBoardContent();
795 795
 		}
796 796
 
797 797
 		// if the document is not granted, then back to the password input form
798
-		if(!$oDocument->isGranted())
798
+		if (!$oDocument->isGranted())
799 799
 		{
800 800
 			return $this->setTemplateFile('input_password_form');
801 801
 		}
802 802
 
803
-		if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
803
+		if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
804 804
 		{
805 805
 			return $this->dispBoardMessage('msg_protect_content');
806 806
 		}
807 807
 
808
-		Context::set('oDocument',$oDocument);
808
+		Context::set('oDocument', $oDocument);
809 809
 
810 810
 		/**
811 811
 		 * add JS filters
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$document_srl = Context::get('document_srl');
824 824
 
825 825
 		// check grant
826
-		if(!$this->grant->write_comment)
826
+		if (!$this->grant->write_comment)
827 827
 		{
828 828
 			return $this->dispBoardMessage('msg_not_permitted');
829 829
 		}
@@ -831,13 +831,13 @@  discard block
 block discarded – undo
831 831
 		// get the document information
832 832
 		$oDocumentModel = getModel('document');
833 833
 		$oDocument = $oDocumentModel->getDocument($document_srl);
834
-		if(!$oDocument->isExists())
834
+		if (!$oDocument->isExists())
835 835
 		{
836 836
 			return $this->dispBoardMessage('msg_invalid_request');
837 837
 		}
838 838
 
839 839
 		// Check allow comment
840
-		if(!$oDocument->allowComment())
840
+		if (!$oDocument->allowComment())
841 841
 		{
842 842
 			return $this->dispBoardMessage('msg_not_allow_comment');
843 843
 		}
@@ -849,9 +849,9 @@  discard block
 block discarded – undo
849 849
 		$oComment->add('module_srl', $this->module_srl);
850 850
 
851 851
 		// setup document variables on context
852
-		Context::set('oDocument',$oDocument);
853
-		Context::set('oSourceComment',$oSourceComment);
854
-		Context::set('oComment',$oComment);
852
+		Context::set('oDocument', $oDocument);
853
+		Context::set('oSourceComment', $oSourceComment);
854
+		Context::set('oComment', $oComment);
855 855
 
856 856
 		/**
857 857
 		 * add JS filter
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	function dispBoardReplyComment()
868 868
 	{
869 869
 		// check grant
870
-		if(!$this->grant->write_comment)
870
+		if (!$this->grant->write_comment)
871 871
 		{
872 872
 			return $this->dispBoardMessage('msg_not_permitted');
873 873
 		}
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		$parent_srl = Context::get('comment_srl');
877 877
 
878 878
 		// if the parent comment is not existed
879
-		if(!$parent_srl)
879
+		if (!$parent_srl)
880 880
 		{
881 881
 			return new Object(-1, 'msg_invalid_request');
882 882
 		}
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
 		$oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager);
887 887
 
888 888
 		// if the comment is not existed, opoup an error message
889
-		if(!$oSourceComment->isExists())
889
+		if (!$oSourceComment->isExists())
890 890
 		{
891 891
 			return $this->dispBoardMessage('msg_invalid_request');
892 892
 		}
893
-		if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl'))
893
+		if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl'))
894 894
 		{
895 895
 			return $this->dispBoardMessage('msg_invalid_request');
896 896
 		}
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 		// Check allow comment
899 899
 		$oDocumentModel = getModel('document');
900 900
 		$oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl'));
901
-		if(!$oDocument->allowComment())
901
+		if (!$oDocument->allowComment())
902 902
 		{
903 903
 			return $this->dispBoardMessage('msg_not_allow_comment');
904 904
 		}
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 		$oComment->add('document_srl', $oSourceComment->get('document_srl'));
910 910
 
911 911
 		// setup comment variables
912
-		Context::set('oSourceComment',$oSourceComment);
913
-		Context::set('oComment',$oComment);
914
-		Context::set('module_srl',$this->module_info->module_srl);
912
+		Context::set('oSourceComment', $oSourceComment);
913
+		Context::set('oComment', $oComment);
914
+		Context::set('module_srl', $this->module_info->module_srl);
915 915
 
916 916
 		/**
917 917
 		 * add JS filters
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	function dispBoardModifyComment()
928 928
 	{
929 929
 		// check grant
930
-		if(!$this->grant->write_comment)
930
+		if (!$this->grant->write_comment)
931 931
 		{
932 932
 			return $this->dispBoardMessage('msg_not_permitted');
933 933
 		}
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 		$comment_srl = Context::get('comment_srl');
938 938
 
939 939
 		// if the comment is not existed
940
-		if(!$comment_srl)
940
+		if (!$comment_srl)
941 941
 		{
942 942
 			return new Object(-1, 'msg_invalid_request');
943 943
 		}
@@ -947,13 +947,13 @@  discard block
 block discarded – undo
947 947
 		$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
948 948
 
949 949
 		// if the comment is not exited, alert an error message
950
-		if(!$oComment->isExists())
950
+		if (!$oComment->isExists())
951 951
 		{
952 952
 			return $this->dispBoardMessage('msg_invalid_request');
953 953
 		}
954 954
 
955 955
 		// if the comment is not granted, then back to the password input form
956
-		if(!$oComment->isGranted())
956
+		if (!$oComment->isGranted())
957 957
 		{
958 958
 			return $this->setTemplateFile('input_password_form');
959 959
 		}
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 	function dispBoardDeleteComment()
977 977
 	{
978 978
 		// check grant
979
-		if(!$this->grant->write_comment)
979
+		if (!$this->grant->write_comment)
980 980
 		{
981 981
 			return $this->dispBoardMessage('msg_not_permitted');
982 982
 		}
@@ -985,25 +985,25 @@  discard block
 block discarded – undo
985 985
 		$comment_srl = Context::get('comment_srl');
986 986
 
987 987
 		// if the comment exists, then get the comment information
988
-		if($comment_srl)
988
+		if ($comment_srl)
989 989
 		{
990 990
 			$oCommentModel = getModel('comment');
991 991
 			$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
992 992
 		}
993 993
 
994 994
 		// if the comment is not existed, then back to the board content page
995
-		if(!$oComment->isExists() )
995
+		if (!$oComment->isExists())
996 996
 		{
997 997
 			return $this->dispBoardContent();
998 998
 		}
999 999
 
1000 1000
 		// if the comment is not granted, then back to the password input form
1001
-		if(!$oComment->isGranted())
1001
+		if (!$oComment->isGranted())
1002 1002
 		{
1003 1003
 			return $this->setTemplateFile('input_password_form');
1004 1004
 		}
1005 1005
 
1006
-		Context::set('oComment',$oComment);
1006
+		Context::set('oComment', $oComment);
1007 1007
 
1008 1008
 		/**
1009 1009
 		 * add JS filters
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	{
1021 1021
 		$oTrackbackModel = getModel('trackback');
1022 1022
 
1023
-		if(!$oTrackbackModel)
1023
+		if (!$oTrackbackModel)
1024 1024
 		{
1025 1025
 			return;
1026 1026
 		}
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 		$trackback = $output->data;
1035 1035
 
1036 1036
 		// if no trackback, then display the board content
1037
-		if(!$trackback)
1037
+		if (!$trackback)
1038 1038
 		{
1039 1039
 			return $this->dispBoardContent();
1040 1040
 		}
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 	function dispBoardMessage($msg_code)
1056 1056
 	{
1057 1057
 		$msg = Context::getLang($msg_code);
1058
-		if(!$msg) $msg = $msg_code;
1058
+		if (!$msg) $msg = $msg_code;
1059 1059
 		Context::set('message', $msg);
1060 1060
 		$this->setTemplateFile('message');
1061 1061
 	}
@@ -1066,8 +1066,8 @@  discard block
 block discarded – undo
1066 1066
 	 **/
1067 1067
 	function alertMessage($message)
1068 1068
 	{
1069
-		$script =  sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message));
1070
-		Context::addHtmlFooter( $script );
1069
+		$script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message));
1070
+		Context::addHtmlFooter($script);
1071 1071
 	}
1072 1072
 
1073 1073
 }
Please login to merge, or discard this patch.
modules/document/document.view.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * Document printing
23 23
 	 * I make it out to find the geulman;;
24
-	 * @return void|Object
24
+	 * @return Object|null
25 25
 	 */
26 26
 	function dispDocumentPrint()
27 27
 	{
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	/**
54 54
 	 * Preview
55
-	 * @return void
55
+	 * @return Object|null
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	/**
76 76
 	 * Selected by the administrator for the document management
77
-	 * @return void|Object
77
+	 * @return Object|null
78 78
 	 */
79 79
 	function dispDocumentManageDocument()
80 80
 	{
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	/**
157 157
 	 * Document temp saved list
158
-	 * @return void
158
+	 * @return ModuleObject|null
159 159
 	 */
160 160
 	function dispTempSavedList()
161 161
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
39
+		if (!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request');
40 40
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
41
+		if (!$oDocument->isAccessible()) return new Object(-1, 'msg_not_permitted');
42 42
 		// Information setting module
43 43
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 44
 		// Browser title settings
45 45
 		Context::setBrowserTitle($oDocument->getTitleText());
46 46
 		Context::set('oDocument', $oDocument);
47 47
 
48
-		Context::set('layout','none');
48
+		Context::set('layout', 'none');
49 49
 		$this->setTemplatePath($this->module_path.'tpl');
50 50
 		$this->setTemplateFile('print_page');
51 51
 	}
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
59
-		if(!checkCSRF())
59
+		if (!checkCSRF())
60 60
 		{
61 61
 			return new Object(-1, 'msg_invalid_request');
62 62
 		} 
63 63
 
64
-		if(Context::get('logged_info')->is_admin != 'Y')
64
+		if (Context::get('logged_info')->is_admin != 'Y')
65 65
 		{
66 66
 			Context::set('content', removeHackTag(Context::get('content')));
67 67
 		}
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	function dispDocumentManageDocument()
80 80
 	{
81
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
81
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
82 82
 		// Taken from a list of selected sessions
83 83
 		$flag_list = $_SESSION['document_management'];
84
-		if(count($flag_list))
84
+		if (count($flag_list))
85 85
 		{
86
-			foreach($flag_list as $key => $val)
86
+			foreach ($flag_list as $key => $val)
87 87
 			{
88
-				if(!is_bool($val)) continue;
88
+				if (!is_bool($val)) continue;
89 89
 				$document_srl_list[] = $key;
90 90
 			}
91 91
 		}
92 92
 
93
-		if(count($document_srl_list))
93
+		if (count($document_srl_list))
94 94
 		{
95 95
 			$oDocumentModel = getModel('document');
96 96
 			$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$oModuleModel = getModel('module');
101 101
 		// The combination of module categories list and the list of modules
102
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
102
+		if (count($module_list) > 1) Context::set('module_list', $module_categories);
103 103
 
104
-		$module_srl=Context::get('module_srl');
105
-		Context::set('module_srl',$module_srl);
104
+		$module_srl = Context::get('module_srl');
105
+		Context::set('module_srl', $module_srl);
106 106
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
107
-		Context::set('mid',$module_info->mid);
108
-		Context::set('browser_title',$module_info->browser_title);
107
+		Context::set('mid', $module_info->mid);
108
+		Context::set('browser_title', $module_info->browser_title);
109 109
 
110 110
 		// Select Pop-up layout
111 111
 		$this->setLayoutPath('./common/tpl');
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 		$current_module_srl = Context::get('module_srl');
127 127
 		$current_module_srls = Context::get('module_srls');
128 128
 
129
-		if(!$current_module_srl && !$current_module_srls)
129
+		if (!$current_module_srl && !$current_module_srls)
130 130
 		{
131 131
 			// Get information of the current module
132 132
 			$current_module_info = Context::get('current_module_info');
133 133
 			$current_module_srl = $current_module_info->module_srl;
134
-			if(!$current_module_srl) return new Object();
134
+			if (!$current_module_srl) return new Object();
135 135
 		}
136 136
 
137 137
 		$oModuleModel = getModel('module');
138
-		if($current_module_srl)
138
+		if ($current_module_srl)
139 139
 		{
140 140
 			$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
141 141
 		}
142
-		if(!$document_config)
142
+		if (!$document_config)
143 143
 		{
144 144
 			$document_config = new stdClass();
145 145
 		}
146
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
146
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
147 147
 		Context::set('document_config', $document_config);
148 148
 
149 149
 		$oTemplate = &TemplateHandler::getInstance();
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oMemberModel = getModel('member');
165 165
 		// A message appears if the user is not logged-in
166
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
166
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
167 167
 		// Get the saved document (module_srl is set to member_srl instead)
168 168
 		$logged_info = Context::get('logged_info');
169 169
 		$args = new stdClass();
170 170
 		$args->member_srl = $logged_info->member_srl;
171 171
 		$args->statusList = array($this->getConfigStatus('temp'));
172
-		$args->page = (int)Context::get('page');
172
+		$args->page = (int) Context::get('page');
173 173
 		$args->list_count = 10;
174 174
 
175 175
 		$oDocumentModel = getModel('document');
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
36 36
 	{
37 37
 		// If XE has not installed yet, set module as install
38
-		if(!Context::isInstalled())
38
+		if (!Context::isInstalled())
39 39
 		{
40 40
 			$this->module = 'install';
41 41
 			$this->act = Context::get('act');
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// call a trigger before moduleHandler init
104 104
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
105
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
106 106
 		{
107
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110 110
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -115,40 +115,40 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if (file_exists($addon_file)) include($addon_file);
119 119
 	}
120 120
 
121 121
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
122 122
 	{
123
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
123
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
124 124
 		{
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		set_error_handler(function() { }, ~0);
129 129
 
130
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
131
-		if(!file_exists($debug_file))
130
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
131
+		if (!file_exists($debug_file))
132 132
 		{
133 133
 			$print[] = '<?php exit() ?>';
134 134
 		}
135 135
 
136 136
 		$errorname = self::getErrorType($errnumber);
137
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
137
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
138 138
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
139 139
 		$backtrace = debug_backtrace($backtrace_args);
140
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
140
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
141 141
 		{
142 142
 			array_shift($backtrace);
143 143
 		}
144 144
 
145
-		foreach($backtrace as $key => $value)
145
+		foreach ($backtrace as $key => $value)
146 146
 		{
147
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
147
+			$message = '    - '.$value['file'].' : '.$value['line'];
148 148
 			$print[] = $message;
149 149
 		}
150 150
 		$print[] = PHP_EOL;
151
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
151
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
152 152
 		restore_error_handler();
153 153
 
154 154
 		return true;
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 
165 165
 		set_error_handler(function() { }, ~0);
166 166
 
167
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
168
-		if(!file_exists($debug_file))
167
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
168
+		if (!file_exists($debug_file))
169 169
 		{
170 170
 			$print[] = '<?php exit() ?>';
171 171
 		}
172 172
 
173 173
 		$errorname = self::getErrorType($errinfo['type']);
174 174
 		$print[] = '['.date('Y-m-d H:i:s').']';
175
-		$print[] = $errorname . ' : ' . $errinfo['message'];
175
+		$print[] = $errorname.' : '.$errinfo['message'];
176 176
 
177
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
177
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
178 178
 		$print[] = $message;
179 179
 
180 180
 		$print[] = PHP_EOL;
181
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
181
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
182 182
 		set_error_handler(array($this, 'dummyHandler'), ~0);
183 183
 
184 184
 		return true;
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
223 223
 		$defaultHost = $defaultUrlInfo['host'];
224 224
 
225
-		foreach($urls as $url)
225
+		foreach ($urls as $url)
226 226
 		{
227
-			if(empty($url))
227
+			if (empty($url))
228 228
 			{
229 229
 				continue;
230 230
 			}
@@ -232,29 +232,29 @@  discard block
 block discarded – undo
232 232
 			$urlInfo = parse_url($url);
233 233
 			$host = $urlInfo['host'];
234 234
 
235
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
235
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
236 236
 			{
237 237
 				throw new Exception('msg_default_url_is_null');
238 238
 			}
239 239
 		}
240 240
 
241
-		if(!$this->document_srl && $this->mid && $this->entry)
241
+		if (!$this->document_srl && $this->mid && $this->entry)
242 242
 		{
243 243
 			$oDocumentModel = getModel('document');
244 244
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
245
-			if($this->document_srl)
245
+			if ($this->document_srl)
246 246
 			{
247 247
 				Context::set('document_srl', $this->document_srl);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		// Get module's information based on document_srl, if it's specified
252
-		if($this->document_srl)
252
+		if ($this->document_srl)
253 253
 		{
254 254
 
255 255
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
256 256
 			// If the document does not exist, remove document_srl
257
-			if(!$module_info)
257
+			if (!$module_info)
258 258
 			{
259 259
 				unset($this->document_srl);
260 260
 			}
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			{
263 263
 				// If it exists, compare mid based on the module information
264 264
 				// if mids are not matching, set it as the document's mid
265
-				if(!$this->mid || ($this->mid != $module_info->mid))
265
+				if (!$this->mid || ($this->mid != $module_info->mid))
266 266
 				{
267 267
 
268
-					if(Context::getRequestMethod() == 'GET')
268
+					if (Context::getRequestMethod() == 'GET')
269 269
 					{
270 270
 						$this->mid = $module_info->mid;
271
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
271
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 272
 						return FALSE;
273 273
 					}
274 274
 					else
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 				}
281 281
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
282
-				if($this->module && $module_info->module != $this->module)
282
+				if ($this->module && $module_info->module != $this->module)
283 283
 				{
284 284
 					unset($module_info);
285 285
 				}
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
291
-		if(!$module_info && $this->mid)
291
+		if (!$module_info && $this->mid)
292 292
 		{
293 293
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
294 294
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
295 295
 		}
296 296
 
297 297
 		// redirect, if module_site_srl and site_srl are different
298
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
298
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
299 299
 		{
300 300
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
301
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
301
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
302 302
 			return FALSE;
303 303
 		}
304 304
 
305 305
 		// If module_info is not set still, and $module does not exist, find the default module
306
-		if(!$module_info && !$this->module && !$this->mid)
306
+		if (!$module_info && !$this->module && !$this->mid)
307 307
 		{
308 308
 			$module_info = $site_module_info;
309 309
 		}
310 310
 
311
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
311
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316 316
 		// redirect, if site_srl of module_info is different from one of site's module_info
317
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
317
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
318 318
 		{
319 319
 			// If the module is of virtual site
320
-			if($module_info->site_srl)
320
+			if ($module_info->site_srl)
321 321
 			{
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			else
327 327
 			{
328 328
 				$db_info = Context::getDBInfo();
329
-				if(!$db_info->default_url)
329
+				if (!$db_info->default_url)
330 330
 				{
331 331
 					return Context::getLang('msg_default_url_is_not_defined');
332 332
 				}
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
336 336
 				}
337 337
 			}
338
-			header("location:" . $redirect_url);
338
+			header("location:".$redirect_url);
339 339
 			return FALSE;
340 340
 		}
341 341
 
342 342
 		// If module info was set, retrieve variables from the module information
343
-		if($module_info)
343
+		if ($module_info)
344 344
 		{
345 345
 			$this->module = $module_info->module;
346 346
 			$this->mid = $module_info->mid;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
352 352
 
353 353
 			// use the site default layout.
354
-			if($module_info->{$targetSrl} == -1)
354
+			if ($module_info->{$targetSrl} == -1)
355 355
 			{
356 356
 				$oLayoutAdminModel = getAdminModel('layout');
357 357
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// Set module and mid into module_info
372
-		if(!isset($this->module_info))
372
+		if (!isset($this->module_info))
373 373
 		{
374 374
 			$this->module_info = new stdClass();
375 375
 		}
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		$this->module_info->site_srl = $site_module_info->site_srl;
381 381
 
382 382
 		// Still no module? it's an error
383
-		if(!$this->module)
383
+		if (!$this->module)
384 384
 		{
385 385
 			$this->error = 'msg_module_is_not_exists';
386 386
 			$this->httpStatusCode = '404';
387 387
 		}
388 388
 
389 389
 		// If mid exists, set mid into context
390
-		if($this->mid)
390
+		if ($this->mid)
391 391
 		{
392 392
 			Context::set('mid', $this->mid, TRUE);
393 393
 		}
394 394
 
395 395
 		// Call a trigger after moduleHandler init
396 396
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
397
-		if(!$output->toBool())
397
+		if (!$output->toBool())
398 398
 		{
399 399
 			$this->error = $output->getMessage();
400 400
 			return TRUE;
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
417 417
 
418 418
 		// If error occurred while preparation, return a message instance
419
-		if($this->error)
419
+		if ($this->error)
420 420
 		{
421 421
 			$this->_setInputErrorToContext();
422 422
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
423 423
 			$oMessageObject->setError(-1);
424 424
 			$oMessageObject->setMessage($this->error);
425 425
 			$oMessageObject->dispMessage();
426
-			if($this->httpStatusCode)
426
+			if ($this->httpStatusCode)
427 427
 			{
428 428
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
429 429
 			}
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
435 435
 
436 436
 		// If not installed yet, modify act
437
-		if($this->module == "install")
437
+		if ($this->module == "install")
438 438
 		{
439
-			if(!$this->act || !$xml_info->action->{$this->act})
439
+			if (!$this->act || !$xml_info->action->{$this->act})
440 440
 			{
441 441
 				$this->act = $xml_info->default_index_act;
442 442
 			}
443 443
 		}
444 444
 
445 445
 		// if act exists, find type of the action, if not use default index act
446
-		if(!$this->act)
446
+		if (!$this->act)
447 447
 		{
448 448
 			$this->act = $xml_info->default_index_act;
449 449
 		}
450 450
 
451 451
 		// still no act means error
452
-		if(!$this->act)
452
+		if (!$this->act)
453 453
 		{
454 454
 			$this->error = 'msg_module_is_not_exists';
455 455
 			$this->httpStatusCode = '404';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 		$type = $xml_info->action->{$this->act}->type;
471 471
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
472 472
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
473
-		if(!$kind && $this->module == 'admin')
473
+		if (!$kind && $this->module == 'admin')
474 474
 		{
475 475
 			$kind = 'admin';
476 476
 		}
477 477
 
478 478
 		// check REQUEST_METHOD in controller
479
-		if($type == 'controller')
479
+		if ($type == 'controller')
480 480
 		{
481 481
 			$allowedMethod = $xml_info->action->{$this->act}->method;
482 482
 
483
-			if(!$allowedMethod)
483
+			if (!$allowedMethod)
484 484
 			{
485 485
 				$allowedMethodList[0] = 'POST';
486 486
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 490
 			}
491 491
 
492
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
492
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
493 493
 			{
494 494
 				$this->error = "msg_invalid_request";
495 495
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if($this->module_info->use_mobile != "Y")
503
+		if ($this->module_info->use_mobile != "Y")
504 504
 		{
505 505
 			Mobile::setMobile(FALSE);
506 506
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$logged_info = Context::get('logged_info');
509 509
 
510 510
 		// check CSRF for POST actions
511
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
511
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
512 512
 			$this->error = 'msg_invalid_request';
513 513
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
514 514
 			$oMessageObject->setError(-1);
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		}
519 519
 
520 520
 		// Admin ip
521
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
521
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
522 522
 		{
523 523
 			$this->_setInputErrorToContext();
524 524
 			$this->error = "msg_not_permitted_act";
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 		}
531 531
 
532 532
 		// if(type == view, and case for using mobilephone)
533
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
533
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
534 534
 		{
535 535
 			$orig_type = "view";
536 536
 			$type = "mobile";
537 537
 			// create a module instance
538 538
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
539
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
539
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
540 540
 			{
541 541
 				$type = $orig_type;
542 542
 				Mobile::setMobile(FALSE);
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
550 550
 		}
551 551
 
552
-		if(!is_object($oModule))
552
+		if (!is_object($oModule))
553 553
 		{
554 554
 			$this->_setInputErrorToContext();
555 555
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
556 556
 			$oMessageObject->setError(-1);
557 557
 			$oMessageObject->setMessage($this->error);
558 558
 			$oMessageObject->dispMessage();
559
-			if($this->httpStatusCode)
559
+			if ($this->httpStatusCode)
560 560
 			{
561 561
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
562 562
 			}
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 		}
565 565
 
566 566
 		// If there is no such action in the module object
567
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
567
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
568 568
 		{
569 569
 
570
-			if(!Context::isInstalled())
570
+			if (!Context::isInstalled())
571 571
 			{
572 572
 				$this->_setInputErrorToContext();
573 573
 				$this->error = 'msg_invalid_request';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 				$oMessageObject->setError(-1);
576 576
 				$oMessageObject->setMessage($this->error);
577 577
 				$oMessageObject->dispMessage();
578
-				if($this->httpStatusCode)
578
+				if ($this->httpStatusCode)
579 579
 				{
580 580
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
581 581
 				}
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
 
585 585
 			$forward = NULL;
586 586
 			// 1. Look for the module with action name
587
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
587
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
588 588
 			{
589
-				$module = strtolower($matches[2] . $matches[3]);
589
+				$module = strtolower($matches[2].$matches[3]);
590 590
 				$xml_info = $oModuleModel->getModuleActionXml($module);
591 591
 
592
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
592
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
593 593
 				{
594 594
 					$forward = new stdClass();
595 595
 					$forward->module = $module;
@@ -609,12 +609,12 @@  discard block
 block discarded – undo
609 609
 				}
610 610
 			}
611 611
 
612
-			if(!$forward)
612
+			if (!$forward)
613 613
 			{
614 614
 				$forward = $oModuleModel->getActionForward($this->act);
615 615
 			}
616 616
 
617
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
617
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
618 618
 			{
619 619
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
620 620
 				$type = $forward->type;
@@ -626,11 +626,11 @@  discard block
 block discarded – undo
626 626
 
627 627
 				// SECISSUE also check foward act method
628 628
 				// check REQUEST_METHOD in controller
629
-				if($type == 'controller')
629
+				if ($type == 'controller')
630 630
 				{
631 631
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
632 632
 
633
-					if(!$allowedMethod)
633
+					if (!$allowedMethod)
634 634
 					{
635 635
 						$allowedMethodList[0] = 'POST';
636 636
 					}
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
640 640
 					}
641 641
 
642
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
642
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
643 643
 					{
644 644
 						$this->error = "msg_invalid_request";
645 645
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 					}
651 651
 				}
652 652
 
653
-				if($type == "view" && Mobile::isFromMobilePhone())
653
+				if ($type == "view" && Mobile::isFromMobilePhone())
654 654
 				{
655 655
 					$orig_type = "view";
656 656
 					$type = "mobile";
657 657
 					// create a module instance
658 658
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
659
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
659
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
660 660
 					{
661 661
 						$type = $orig_type;
662 662
 						Mobile::setMobile(FALSE);
@@ -668,25 +668,25 @@  discard block
 block discarded – undo
668 668
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
669 669
 				}
670 670
 
671
-				if(!is_object($oModule))
671
+				if (!is_object($oModule))
672 672
 				{
673 673
 					$this->_setInputErrorToContext();
674 674
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
675 675
 					$oMessageObject->setError(-1);
676 676
 					$oMessageObject->setMessage('msg_module_is_not_exists');
677 677
 					$oMessageObject->dispMessage();
678
-					if($this->httpStatusCode)
678
+					if ($this->httpStatusCode)
679 679
 					{
680 680
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
681 681
 					}
682 682
 					return $oMessageObject;
683 683
 				}
684 684
 
685
-				if($this->module == "admin" && $type == "view")
685
+				if ($this->module == "admin" && $type == "view")
686 686
 				{
687
-					if($logged_info->is_admin == 'Y')
687
+					if ($logged_info->is_admin == 'Y')
688 688
 					{
689
-						if($this->act != 'dispLayoutAdminLayoutModify')
689
+						if ($this->act != 'dispLayoutAdminLayoutModify')
690 690
 						{
691 691
 							$oAdminView = getAdminView('admin');
692 692
 							$oAdminView->makeGnbUrl($forward->module);
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 						return $oMessageObject;
707 707
 					}
708 708
 				}
709
-				if($kind == 'admin')
709
+				if ($kind == 'admin')
710 710
 				{
711 711
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
712
-					if(!$grant->manager)
712
+					if (!$grant->manager)
713 713
 					{
714 714
 						$this->_setInputErrorToContext();
715 715
 						$this->error = 'msg_is_not_manager';
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 					}
722 722
 					else
723 723
 					{
724
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
724
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
725 725
 						{
726 726
 							$this->_setInputErrorToContext();
727 727
 							$this->error = 'msg_is_not_administrator';
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 					}
735 735
 				}
736 736
 			}
737
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
737
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
738 738
 			{
739 739
 				$this->act = $xml_info->default_index_act;
740 740
 			}
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 		}
749 749
 
750 750
 		// ruleset check...
751
-		if(!empty($ruleset))
751
+		if (!empty($ruleset))
752 752
 		{
753 753
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
754 754
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
755
-			if(!empty($rulesetFile))
755
+			if (!empty($rulesetFile))
756 756
 			{
757
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
757
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
758 758
 				{
759 759
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
760
-					foreach($errorLang as $key => $val)
760
+					foreach ($errorLang as $key => $val)
761 761
 					{
762 762
 						Context::setLang($key, $val);
763 763
 					}
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 				$Validator = new Validator($rulesetFile);
768 768
 				$result = $Validator->validate();
769
-				if(!$result)
769
+				if (!$result)
770 770
 				{
771 771
 					$lastError = $Validator->getLastError();
772 772
 					$returnUrl = Context::get('error_return_url');
@@ -798,26 +798,26 @@  discard block
 block discarded – undo
798 798
 				'dispLayoutPreviewWithModule' => 1
799 799
 		);
800 800
 		$db_use_mobile = Mobile::isMobileEnabled();
801
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
801
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
802 802
 		{
803 803
 			global $lang;
804 804
 			$header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
805
-			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
805
+			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>';
806 806
 			Context::addHtmlHeader($header);
807 807
 			Context::addHtmlFooter($footer);
808 808
 		}
809 809
 
810
-		if($type == "view" && $kind != 'admin')
810
+		if ($type == "view" && $kind != 'admin')
811 811
 		{
812 812
 			$module_config = $oModuleModel->getModuleConfig('module');
813
-			if($module_config->htmlFooter)
813
+			if ($module_config->htmlFooter)
814 814
 			{
815 815
 				Context::addHtmlFooter($module_config->htmlFooter);
816 816
 			}
817
-			if($module_config->siteTitle)
817
+			if ($module_config->siteTitle)
818 818
 			{
819 819
 				$siteTitle = Context::getBrowserTitle();
820
-				if(!$siteTitle)
820
+				if (!$siteTitle)
821 821
 				{
822 822
 					Context::setBrowserTitle($module_config->siteTitle);
823 823
 				}
@@ -830,18 +830,18 @@  discard block
 block discarded – undo
830 830
 		$procResult = $oModule->proc();
831 831
 
832 832
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
833
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
833
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
834 834
 		{
835 835
 			$error = $oModule->getError();
836 836
 			$message = $oModule->getMessage();
837 837
 			$messageType = $oModule->getMessageType();
838 838
 			$redirectUrl = $oModule->getRedirectUrl();
839
-			if($messageType == 'error') debugPrint($message, 'ERROR');
839
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
840 840
 
841
-			if(!$procResult)
841
+			if (!$procResult)
842 842
 			{
843 843
 				$this->error = $message;
844
-				if(!$redirectUrl && Context::get('error_return_url'))
844
+				if (!$redirectUrl && Context::get('error_return_url'))
845 845
 				{
846 846
 					$redirectUrl = Context::get('error_return_url');
847 847
 				}
@@ -854,13 +854,13 @@  discard block
 block discarded – undo
854 854
 
855 855
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
856 856
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
857
-			if($message != 'success')
857
+			if ($message != 'success')
858 858
 			{
859 859
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
860 860
 			}
861 861
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
862 862
 
863
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
863
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
864 864
 			{
865 865
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
866 866
 			}
@@ -876,27 +876,27 @@  discard block
 block discarded – undo
876 876
 	 * */
877 877
 	function _setInputErrorToContext()
878 878
 	{
879
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
879
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
880 880
 		{
881 881
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
882 882
 		}
883
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
883
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
884 884
 		{
885 885
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
886 886
 		}
887
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
887
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
888 888
 		{
889 889
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
890 890
 		}
891
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
891
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
892 892
 		{
893 893
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
894 894
 		}
895
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
895
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
896 896
 		{
897 897
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
898 898
 		}
899
-		if(count($_SESSION['INPUT_ERROR']))
899
+		if (count($_SESSION['INPUT_ERROR']))
900 900
 		{
901 901
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
902 902
 		}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	{
927 927
 		$requestVars = Context::getRequestVars();
928 928
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
929
-		foreach($requestVars AS $key => $value)
929
+		foreach ($requestVars AS $key => $value)
930 930
 		{
931 931
 			$_SESSION['INPUT_ERROR'][$key] = $value;
932 932
 		}
@@ -940,41 +940,41 @@  discard block
 block discarded – undo
940 940
 	function displayContent($oModule = NULL)
941 941
 	{
942 942
 		// If the module is not set or not an object, set error
943
-		if(!$oModule || !is_object($oModule))
943
+		if (!$oModule || !is_object($oModule))
944 944
 		{
945 945
 			$this->error = 'msg_module_is_not_exists';
946 946
 			$this->httpStatusCode = '404';
947 947
 		}
948 948
 
949 949
 		// If connection to DB has a problem even though it's not install module, set error
950
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
950
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
951 951
 		{
952 952
 			$this->error = 'msg_dbconnect_failed';
953 953
 		}
954 954
 
955 955
 		// Call trigger after moduleHandler proc
956 956
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
957
-		if(!$output->toBool())
957
+		if (!$output->toBool())
958 958
 		{
959 959
 			$this->error = $output->getMessage();
960 960
 		}
961 961
 
962 962
 		// Use message view object, if HTML call
963 963
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
964
-		if(!isset($methodList[Context::getRequestMethod()]))
964
+		if (!isset($methodList[Context::getRequestMethod()]))
965 965
 		{
966 966
 
967
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
967
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
968 968
 			{
969 969
 				$display_handler = new DisplayHandler();
970 970
 				$display_handler->_debugOutput();
971 971
 
972
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
972
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
973 973
 				return;
974 974
 			}
975 975
 
976 976
 			// If error occurred, handle it
977
-			if($this->error)
977
+			if ($this->error)
978 978
 			{
979 979
 				// display content with message module instance
980 980
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -983,14 +983,14 @@  discard block
 block discarded – undo
983 983
 				$oMessageObject->setMessage($this->error);
984 984
 				$oMessageObject->dispMessage();
985 985
 
986
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
986
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
987 987
 				{
988 988
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
989 989
 					$oMessageObject->setTemplateFile('http_status_code');
990 990
 				}
991 991
 
992 992
 				// If module was called normally, change the templates of the module into ones of the message view module
993
-				if($oModule)
993
+				if ($oModule)
994 994
 				{
995 995
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
996 996
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			}
1006 1006
 
1007 1007
 			// Check if layout_srl exists for the module
1008
-			if(Mobile::isFromMobilePhone())
1008
+			if (Mobile::isFromMobilePhone())
1009 1009
 			{
1010 1010
 				$layout_srl = $oModule->module_info->mlayout_srl;
1011 1011
 			}
@@ -1015,58 +1015,58 @@  discard block
 block discarded – undo
1015 1015
 			}
1016 1016
 
1017 1017
 			// if layout_srl is rollback by module, set default layout
1018
-			if($layout_srl == -1)
1018
+			if ($layout_srl == -1)
1019 1019
 			{
1020 1020
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1021 1021
 				$oLayoutAdminModel = getAdminModel('layout');
1022 1022
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1023 1023
 			}
1024 1024
 
1025
-			if($layout_srl && !$oModule->getLayoutFile())
1025
+			if ($layout_srl && !$oModule->getLayoutFile())
1026 1026
 			{
1027 1027
 
1028 1028
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1029 1029
 				$oLayoutModel = getModel('layout');
1030 1030
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1031
-				if($layout_info)
1031
+				if ($layout_info)
1032 1032
 				{
1033 1033
 
1034 1034
 					// Input extra_vars into $layout_info
1035
-					if($layout_info->extra_var_count)
1035
+					if ($layout_info->extra_var_count)
1036 1036
 					{
1037 1037
 
1038
-						foreach($layout_info->extra_var as $var_id => $val)
1038
+						foreach ($layout_info->extra_var as $var_id => $val)
1039 1039
 						{
1040
-							if($val->type == 'image')
1040
+							if ($val->type == 'image')
1041 1041
 							{
1042
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1042
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1043 1043
 								{
1044
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1044
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1045 1045
 								}
1046 1046
 							}
1047 1047
 							$layout_info->{$var_id} = $val->value;
1048 1048
 						}
1049 1049
 					}
1050 1050
 					// Set menus into context
1051
-					if($layout_info->menu_count)
1051
+					if ($layout_info->menu_count)
1052 1052
 					{
1053
-						foreach($layout_info->menu as $menu_id => $menu)
1053
+						foreach ($layout_info->menu as $menu_id => $menu)
1054 1054
 						{
1055 1055
 							// set default menu set(included home menu)
1056
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1056
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1057 1057
 							{
1058 1058
 								$oMenuAdminController = getAdminController('menu');
1059 1059
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1060 1060
 
1061
-								if(FileHandler::exists($homeMenuCacheFile))
1061
+								if (FileHandler::exists($homeMenuCacheFile))
1062 1062
 								{
1063 1063
 									include($homeMenuCacheFile);
1064 1064
 								}
1065 1065
 
1066
-								if(!$menu->menu_srl)
1066
+								if (!$menu->menu_srl)
1067 1067
 								{
1068
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1069
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1068
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1069
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1070 1070
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1071 1071
 								}
1072 1072
 								else
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 							}
1078 1078
 
1079 1079
 							$php_file = FileHandler::exists($menu->php_file);
1080
-							if($php_file)
1080
+							if ($php_file)
1081 1081
 							{
1082 1082
 								include($php_file);
1083 1083
 							}
@@ -1093,17 +1093,17 @@  discard block
 block discarded – undo
1093 1093
 
1094 1094
 					// If layout was modified, use the modified version
1095 1095
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1096
-					if(file_exists($edited_layout))
1096
+					if (file_exists($edited_layout))
1097 1097
 					{
1098 1098
 						$oModule->setEditedLayoutFile($edited_layout);
1099 1099
 					}
1100 1100
 				}
1101 1101
 			}
1102 1102
 			$isLayoutDrop = Context::get('isLayoutDrop');
1103
-			if($isLayoutDrop)
1103
+			if ($isLayoutDrop)
1104 1104
 			{
1105 1105
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1106
-				if($kind == 'admin')
1106
+				if ($kind == 'admin')
1107 1107
 				{
1108 1108
 					$oModule->setLayoutFile('popup_layout');
1109 1109
 				}
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1142 1142
 	{
1143 1143
 
1144
-		if(__DEBUG__ == 3)
1144
+		if (__DEBUG__ == 3)
1145 1145
 		{
1146 1146
 			$start_time = getMicroTime();
1147 1147
 		}
@@ -1151,51 +1151,51 @@  discard block
 block discarded – undo
1151 1151
 		$type = strtolower($type);
1152 1152
 
1153 1153
 		$kinds = array('svc' => 1, 'admin' => 1);
1154
-		if(!isset($kinds[$kind]))
1154
+		if (!isset($kinds[$kind]))
1155 1155
 		{
1156 1156
 			$kind = 'svc';
1157 1157
 		}
1158 1158
 
1159
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1159
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1160 1160
 
1161
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1161
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1162 1162
 		{
1163 1163
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1164 1164
 		}
1165 1165
 
1166 1166
 		// if there is no instance of the module in global variable, create a new one
1167
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1167
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1168 1168
 		{
1169 1169
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1170 1170
 
1171
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1171
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1172 1172
 			{
1173 1173
 				$module = $parent_module;
1174 1174
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1175 1175
 			}
1176 1176
 
1177 1177
 			// Check if the base class and instance class exist
1178
-			if(!class_exists($module, true))
1178
+			if (!class_exists($module, true))
1179 1179
 			{
1180 1180
 				return NULL;
1181 1181
 			}
1182
-			if(!class_exists($instance_name, true))
1182
+			if (!class_exists($instance_name, true))
1183 1183
 			{
1184 1184
 				return NULL;
1185 1185
 			}
1186 1186
 
1187 1187
 			// Create an instance
1188 1188
 			$oModule = new $instance_name();
1189
-			if(!is_object($oModule))
1189
+			if (!is_object($oModule))
1190 1190
 			{
1191 1191
 				return NULL;
1192 1192
 			}
1193 1193
 
1194 1194
 			// Load language files for the class
1195
-			Context::loadLang($class_path . 'lang');
1196
-			if($extend_module)
1195
+			Context::loadLang($class_path.'lang');
1196
+			if ($extend_module)
1197 1197
 			{
1198
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1198
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1199 1199
 			}
1200 1200
 
1201 1201
 			// Set variables to the instance
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
 			$oModule->setModulePath($class_path);
1204 1204
 
1205 1205
 			// If the module has a constructor, run it.
1206
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1206
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1207 1207
 			{
1208 1208
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1209
-				if(@method_exists($oModule, $instance_name))
1209
+				if (@method_exists($oModule, $instance_name))
1210 1210
 				{
1211 1211
 					$oModule->{$instance_name}();
1212 1212
 				}
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1217 1217
 		}
1218 1218
 
1219
-		if(__DEBUG__ == 3)
1219
+		if (__DEBUG__ == 3)
1220 1220
 		{
1221 1221
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1222 1222
 		}
@@ -1232,17 +1232,17 @@  discard block
 block discarded – undo
1232 1232
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1233 1233
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1234 1234
 
1235
-		$types = array('view','controller','model','api','wap','mobile','class');
1236
-		if(!in_array($type, $types))
1235
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1236
+		if (!in_array($type, $types))
1237 1237
 		{
1238 1238
 			$type = $types[0];
1239 1239
 		}
1240
-		if($type == 'class')
1240
+		if ($type == 'class')
1241 1241
 		{
1242 1242
 			$instanceName = '%s';
1243 1243
 			$classFile = '%s%s.%s.php';
1244 1244
 		}
1245
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1245
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1246 1246
 		{
1247 1247
 			$instanceName = '%sAdmin%s';
1248 1248
 			$classFile = '%s%s.admin.%s.php';
@@ -1267,26 +1267,26 @@  discard block
 block discarded – undo
1267 1267
 	function triggerCall($trigger_name, $called_position, &$obj)
1268 1268
 	{
1269 1269
 		// skip if not installed
1270
-		if(!Context::isInstalled())
1270
+		if (!Context::isInstalled())
1271 1271
 		{
1272 1272
 			return new Object();
1273 1273
 		}
1274 1274
 
1275 1275
 		$oModuleModel = getModel('module');
1276 1276
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1277
-		if(!$triggers || count($triggers) < 1)
1277
+		if (!$triggers || count($triggers) < 1)
1278 1278
 		{
1279 1279
 			return new Object();
1280 1280
 		}
1281 1281
 
1282 1282
 		//store before trigger call time
1283 1283
 		$before_trigger_time = NULL;
1284
-		if(__LOG_SLOW_TRIGGER__> 0)
1284
+		if (__LOG_SLOW_TRIGGER__ > 0)
1285 1285
 		{
1286 1286
 			$before_trigger_time = microtime(true);
1287 1287
 		}
1288 1288
 
1289
-		foreach($triggers as $item)
1289
+		foreach ($triggers as $item)
1290 1290
 		{
1291 1291
 			$module = $item->module;
1292 1292
 			$type = $item->type;
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 
1295 1295
 			// todo why don't we call a normal class object ?
1296 1296
 			$oModule = getModule($module, $type);
1297
-			if(!$oModule || !method_exists($oModule, $called_method))
1297
+			if (!$oModule || !method_exists($oModule, $called_method))
1298 1298
 			{
1299 1299
 				continue;
1300 1300
 			}
@@ -1307,12 +1307,12 @@  discard block
 block discarded – undo
1307 1307
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1308 1308
 
1309 1309
 			$slowlog = new stdClass;
1310
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1311
-			$slowlog->called = $module . '.' . $called_method;
1310
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1311
+			$slowlog->called = $module.'.'.$called_method;
1312 1312
 			$slowlog->called_extension = $module;
1313
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1313
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1314 1314
 
1315
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1315
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1316 1316
 			{
1317 1317
 				return $output;
1318 1318
 			}
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 			'511' => 'Network Authentication Required',
1398 1398
 		);
1399 1399
 		$statusMessage = $statusMessageList[$code];
1400
-		if(!$statusMessage)
1400
+		if (!$statusMessage)
1401 1401
 		{
1402
-			$statusMessage = 'HTTP ' . $code;
1402
+			$statusMessage = 'HTTP '.$code;
1403 1403
 		}
1404 1404
 
1405 1405
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Spacing   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		include($self::getConfigFile());
456 456
 
457 457
 		// If master_db information does not exist, the config file needs to be updated
458
-		if(!isset($db_info->master_db))
458
+		if (!isset($db_info->master_db))
459 459
 		{
460 460
 			$db_info->master_db = array();
461 461
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
474 474
 			unset($db_info->db_table_prefix);
475 475
 
476
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
476
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
477 477
 			{
478 478
 				$db_info->master_db["db_table_prefix"] .= '_';
479 479
 			}
@@ -485,33 +485,33 @@  discard block
 block discarded – undo
485 485
 			$oInstallController->makeConfigFile();
486 486
 		}
487 487
 
488
-		if(!$db_info->use_prepared_statements)
488
+		if (!$db_info->use_prepared_statements)
489 489
 		{
490 490
 			$db_info->use_prepared_statements = 'Y';
491 491
 		}
492 492
 
493
-		if(!$db_info->time_zone)
493
+		if (!$db_info->time_zone)
494 494
 			$db_info->time_zone = date('O');
495 495
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 496
 
497
-		if($db_info->qmail_compatibility != 'Y')
497
+		if ($db_info->qmail_compatibility != 'Y')
498 498
 			$db_info->qmail_compatibility = 'N';
499 499
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 500
 
501
-		if(!$db_info->use_db_session)
501
+		if (!$db_info->use_db_session)
502 502
 			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
503
+		if (!$db_info->use_ssl)
504 504
 			$db_info->use_ssl = 'none';
505 505
 		$this->set('_use_ssl', $db_info->use_ssl);
506 506
 
507 507
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
508 508
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
509 509
 
510
-		if(!$db_info->sitelock_whitelist) {
510
+		if (!$db_info->sitelock_whitelist) {
511 511
 			$db_info->sitelock_whitelist = '127.0.0.1';
512 512
 		}
513 513
 
514
-		if(is_string($db_info->sitelock_whitelist)) {
514
+		if (is_string($db_info->sitelock_whitelist)) {
515 515
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
516 516
 		}
517 517
 
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
 	function loadLangSupported()
583 583
 	{
584 584
 		static $lang_supported = null;
585
-		if(!$lang_supported)
585
+		if (!$lang_supported)
586 586
 		{
587
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
588
-			foreach($langs as $val)
587
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
588
+			foreach ($langs as $val)
589 589
 			{
590 590
 				list($lang_prefix, $lang_text) = explode(',', $val);
591 591
 				$lang_text = trim($lang_text);
@@ -603,17 +603,17 @@  discard block
 block discarded – undo
603 603
 	function loadLangSelected()
604 604
 	{
605 605
 		static $lang_selected = null;
606
-		if(!$lang_selected)
606
+		if (!$lang_selected)
607 607
 		{
608
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
609
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
610
-			if(!FileHandler::hasContent($selected_lang_file))
608
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
609
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
610
+			if (!FileHandler::hasContent($selected_lang_file))
611 611
 			{
612
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
612
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
613 613
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
614 614
 			}
615 615
 
616
-			if(!FileHandler::hasContent($selected_lang_file))
616
+			if (!FileHandler::hasContent($selected_lang_file))
617 617
 			{
618 618
 				$buff = FileHandler::readFile($orig_lang_file);
619 619
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			else
623 623
 			{
624 624
 				$langs = file($selected_lang_file);
625
-				foreach($langs as $val)
625
+				foreach ($langs as $val)
626 626
 				{
627 627
 					list($lang_prefix, $lang_text) = explode(',', $val);
628 628
 					$lang_text = trim($lang_text);
@@ -641,56 +641,56 @@  discard block
 block discarded – undo
641 641
 	function checkSSO()
642 642
 	{
643 643
 		// pass if it's not GET request or XE is not yet installed
644
-		if($this->db_info->use_sso != 'Y' || isCrawler())
644
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
645 645
 		{
646 646
 			return TRUE;
647 647
 		}
648 648
 		$checkActList = array('rss' => 1, 'atom' => 1);
649
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
649
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
650 650
 		{
651 651
 			return TRUE;
652 652
 		}
653 653
 
654 654
 		// pass if default URL is not set
655 655
 		$default_url = trim($this->db_info->default_url);
656
-		if(!$default_url)
656
+		if (!$default_url)
657 657
 		{
658 658
 			return TRUE;
659 659
 		}
660 660
 
661
-		if(substr_compare($default_url, '/', -1) !== 0)
661
+		if (substr_compare($default_url, '/', -1) !== 0)
662 662
 		{
663 663
 			$default_url .= '/';
664 664
 		}
665 665
 
666 666
 		// for sites recieving SSO valdiation
667
-		if($default_url == self::getRequestUri())
667
+		if ($default_url == self::getRequestUri())
668 668
 		{
669
-			if(self::get('url'))
669
+			if (self::get('url'))
670 670
 			{
671 671
 				$url = base64_decode(self::get('url'));
672 672
 				$url_info = parse_url($url);
673
-				if(!Password::checkSignature($url, self::get('sig')))
673
+				if (!Password::checkSignature($url, self::get('sig')))
674 674
 				{
675 675
 					echo self::get('lang')->msg_invalid_request;
676 676
 					return false;
677 677
 				}
678 678
 
679 679
 				$oModuleModel = getModel('module');
680
-				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
680
+				$domain = $url_info['host'].$url_info['path'];
681
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682 682
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 683
 
684
-				if($site_info->site_srl)
684
+				if ($site_info->site_srl)
685 685
 				{
686
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687
-				$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']);
686
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
687
+				$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']);
688 688
 				}
689 689
 				else
690 690
 				{
691 691
 					$redirect_url = $url;
692 692
 				}
693
-				header('location:' . $redirect_url);
693
+				header('location:'.$redirect_url);
694 694
 
695 695
 				return FALSE;
696 696
 			}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 		else
700 700
 		{
701 701
 			// result handling : set session_name()
702
-			if($session_name = self::get('SSOID'))
702
+			if ($session_name = self::get('SSOID'))
703 703
 			{
704
-				if(!Password::checkSignature($session_name, self::get('sig')))
704
+				if (!Password::checkSignature($session_name, self::get('sig')))
705 705
 				{
706 706
 					echo self::get('lang')->msg_invalid_request;
707 707
 					return false;
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
 				setcookie(session_name(), $session_name);
711 711
 
712 712
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
713
-				header('location:' . $url);
713
+				header('location:'.$url);
714 714
 				return FALSE;
715 715
 				// send SSO request
716 716
 			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
717
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 718
 			{
719 719
 				setcookie('sso', md5(self::getRequestUri()));
720 720
 				$origin_url = self::getRequestUrl();
721 721
 				$origin_sig = Password::createSignature($origin_url);
722 722
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
723
-				header('location:' . $url);
723
+				header('location:'.$url);
724 724
 				return FALSE;
725 725
 			}
726 726
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		$self = self::getInstance();
749 749
 
750
-		if(!$self->isFTPRegisted())
750
+		if (!$self->isFTPRegisted())
751 751
 		{
752 752
 			return null;
753 753
 		}
@@ -765,15 +765,15 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	function addBrowserTitle($site_title)
767 767
 	{
768
-		if(!$site_title)
768
+		if (!$site_title)
769 769
 		{
770 770
 			return;
771 771
 		}
772 772
 		$self = self::getInstance();
773 773
 
774
-		if($self->site_title)
774
+		if ($self->site_title)
775 775
 		{
776
-			$self->site_title .= ' - ' . $site_title;
776
+			$self->site_title .= ' - '.$site_title;
777 777
 		}
778 778
 		else
779 779
 		{
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 */
790 790
 	function setBrowserTitle($site_title)
791 791
 	{
792
-		if(!$site_title)
792
+		if (!$site_title)
793 793
 		{
794 794
 			return;
795 795
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		$oModuleModel = getModel('module');
822 822
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
823 823
 
824
-		if(isset($moduleConfig->siteTitle))
824
+		if (isset($moduleConfig->siteTitle))
825 825
 		{
826 826
 			return $moduleConfig->siteTitle;
827 827
 		}
@@ -848,30 +848,30 @@  discard block
 block discarded – undo
848 848
 		global $lang;
849 849
 
850 850
 		$self = self::getInstance();
851
-		if(!$self->lang_type)
851
+		if (!$self->lang_type)
852 852
 		{
853 853
 			return;
854 854
 		}
855
-		if(!is_object($lang))
855
+		if (!is_object($lang))
856 856
 		{
857 857
 			$lang = new stdClass;
858 858
 		}
859 859
 
860
-		if(!($filename = $self->_loadXmlLang($path)))
860
+		if (!($filename = $self->_loadXmlLang($path)))
861 861
 		{
862 862
 			$filename = $self->_loadPhpLang($path);
863 863
 		}
864 864
 
865
-		if(!is_array($self->loaded_lang_files))
865
+		if (!is_array($self->loaded_lang_files))
866 866
 		{
867 867
 			$self->loaded_lang_files = array();
868 868
 		}
869
-		if(in_array($filename, $self->loaded_lang_files))
869
+		if (in_array($filename, $self->loaded_lang_files))
870 870
 		{
871 871
 			return;
872 872
 		}
873 873
 
874
-		if($filename && is_readable($filename))
874
+		if ($filename && is_readable($filename))
875 875
 		{
876 876
 			$self->loaded_lang_files[] = $filename;
877 877
 			include($filename);
@@ -892,24 +892,24 @@  discard block
 block discarded – undo
892 892
 	{
893 893
 		global $lang;
894 894
 
895
-		if(!$path) return;
895
+		if (!$path) return;
896 896
 
897
-		$_path = 'eval://' . $path;
897
+		$_path = 'eval://'.$path;
898 898
 
899
-		if(in_array($_path, $this->loaded_lang_files))
899
+		if (in_array($_path, $this->loaded_lang_files))
900 900
 		{
901 901
 			return;
902 902
 		}
903 903
 
904
-		if(substr_compare($path, '/', -1) !== 0)
904
+		if (substr_compare($path, '/', -1) !== 0)
905 905
 		{
906 906
 			$path .= '/';
907 907
 		}
908 908
 
909
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
909
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
910 910
 		$content = $oXmlLangParser->getCompileContent();
911 911
 
912
-		if($content)
912
+		if ($content)
913 913
 		{
914 914
 			$this->loaded_lang_files[] = $_path;
915 915
 			eval($content);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadXmlLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
929
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
930 930
 		return $oXmlLangParser->compile();
931 931
 	}
932 932
 
@@ -938,22 +938,22 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	function _loadPhpLang($path)
940 940
 	{
941
-		if(!$path) return;
941
+		if (!$path) return;
942 942
 
943
-		if(substr_compare($path, '/', -1) !== 0)
943
+		if (substr_compare($path, '/', -1) !== 0)
944 944
 		{
945 945
 			$path .= '/';
946 946
 		}
947
-		$path_tpl = $path . '%s.lang.php';
947
+		$path_tpl = $path.'%s.lang.php';
948 948
 		$file = sprintf($path_tpl, $this->lang_type);
949 949
 
950 950
 		$langs = array('ko', 'en'); // this will be configurable.
951
-		while(!is_readable($file) && $langs[0])
951
+		while (!is_readable($file) && $langs[0])
952 952
 		{
953 953
 			$file = sprintf($path_tpl, array_shift($langs));
954 954
 		}
955 955
 
956
-		if(!is_readable($file))
956
+		if (!is_readable($file))
957 957
 		{
958 958
 			return FALSE;
959 959
 		}
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	function getLang($code)
997 997
 	{
998
-		if(!$code)
998
+		if (!$code)
999 999
 		{
1000 1000
 			return;
1001 1001
 		}
1002
-		if($GLOBALS['lang']->{$code})
1002
+		if ($GLOBALS['lang']->{$code})
1003 1003
 		{
1004 1004
 			return $GLOBALS['lang']->{$code};
1005 1005
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	function setLang($code, $val)
1017 1017
 	{
1018
-		if(!isset($GLOBALS['lang']))
1018
+		if (!isset($GLOBALS['lang']))
1019 1019
 		{
1020 1020
 			$GLOBALS['lang'] = new stdClass();
1021 1021
 		}
@@ -1043,17 +1043,17 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$obj = clone $source_obj;
1045 1045
 
1046
-		foreach($charset_list as $charset)
1046
+		foreach ($charset_list as $charset)
1047 1047
 		{
1048
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1048
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1049 1049
 			$flag = self::checkConvertFlag($flag = TRUE);
1050
-			if($flag)
1050
+			if ($flag)
1051 1051
 			{
1052
-				if($charset == 'UTF-8')
1052
+				if ($charset == 'UTF-8')
1053 1053
 				{
1054 1054
 					return $obj;
1055 1055
 				}
1056
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1056
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1057 1057
 				return $obj;
1058 1058
 			}
1059 1059
 		}
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1073
 	{
1074 1074
 		static $flag = TRUE;
1075
-		if($charset)
1075
+		if ($charset)
1076 1076
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1077
+			if (is_array($val))
1078
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1079
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1080 1080
 			else $flag = FALSE;
1081 1081
 		}
1082 1082
 		else
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
 	{
1101 1101
 		if (is_array($val))
1102 1102
 		{
1103
-			array_walk($val,'Context::doConvertEncoding',$charset);
1103
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1104 1104
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1105
+		else $val = iconv($charset, 'UTF-8', $val);
1106 1106
 	}
1107 1107
 
1108 1108
 	/**
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	 */
1114 1114
 	function convertEncodingStr($str)
1115 1115
 	{
1116
-        if(!$str) return null;
1116
+        if (!$str) return null;
1117 1117
 		$obj = new stdClass();
1118 1118
 		$obj->str = $str;
1119 1119
 		$obj = self::convertEncoding($obj);
@@ -1122,9 +1122,9 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 	function decodeIdna($domain)
1124 1124
 	{
1125
-		if(strpos($domain, 'xn--') !== FALSE)
1125
+		if (strpos($domain, 'xn--') !== FALSE)
1126 1126
 		{
1127
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1127
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1128 1128
 			$IDN = new idna_convert(array('idn_version' => 2008));
1129 1129
 			$domain = $IDN->decode($domain);
1130 1130
 		}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	{
1156 1156
 		$self = self::getInstance();
1157 1157
 
1158
-		if($self->response_method)
1158
+		if ($self->response_method)
1159 1159
 		{
1160 1160
 			return $self->response_method;
1161 1161
 		}
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1196 1196
 
1197 1197
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1198
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1198
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1199 1199
 		{
1200 1200
 			$this->isSuccessInit = FALSE;
1201 1201
 		}
@@ -1208,30 +1208,30 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	function _setRequestArgument()
1210 1210
 	{
1211
-		if(!count($_REQUEST))
1211
+		if (!count($_REQUEST))
1212 1212
 		{
1213 1213
 			return;
1214 1214
 		}
1215 1215
 
1216 1216
 		$requestMethod = $this->getRequestMethod();
1217
-		foreach($_REQUEST as $key => $val)
1217
+		foreach ($_REQUEST as $key => $val)
1218 1218
 		{
1219
-			if($val === '' || self::get($key))
1219
+			if ($val === '' || self::get($key))
1220 1220
 			{
1221 1221
 				continue;
1222 1222
 			}
1223 1223
 			$key = htmlentities($key);
1224 1224
 			$val = $this->_filterRequestVar($key, $val);
1225 1225
 
1226
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1226
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1230
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1231 1231
 			{
1232 1232
 				$set_to_vars = TRUE;
1233 1233
 			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1235
 			{
1236 1236
 				$set_to_vars = TRUE;
1237 1237
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 				$set_to_vars = FALSE;
1241 1241
 			}
1242 1242
 
1243
-			if($set_to_vars)
1243
+			if ($set_to_vars)
1244 1244
 			{
1245 1245
 				$this->_recursiveCheckVar($val);
1246 1246
 			}
@@ -1251,20 +1251,20 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
 	function _recursiveCheckVar($val)
1253 1253
 	{
1254
-		if(is_string($val))
1254
+		if (is_string($val))
1255 1255
 		{
1256
-			foreach($this->patterns as $pattern)
1256
+			foreach ($this->patterns as $pattern)
1257 1257
 			{
1258
-				if(preg_match($pattern, $val))
1258
+				if (preg_match($pattern, $val))
1259 1259
 				{
1260 1260
 					$this->isSuccessInit = FALSE;
1261 1261
 					return;
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265
-		else if(is_array($val))
1265
+		else if (is_array($val))
1266 1266
 		{
1267
-			foreach($val as $val2)
1267
+			foreach ($val as $val2)
1268 1268
 			{
1269 1269
 				$this->_recursiveCheckVar($val2);
1270 1270
 			}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	function _setJSONRequestArgument()
1280 1280
 	{
1281
-		if($this->getRequestMethod() != 'JSON')
1281
+		if ($this->getRequestMethod() != 'JSON')
1282 1282
 		{
1283 1283
 			return;
1284 1284
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		$params = array();
1287 1287
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1288 1288
 
1289
-		foreach($params as $key => $val)
1289
+		foreach ($params as $key => $val)
1290 1290
 		{
1291 1291
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1292 1292
 		}
@@ -1299,13 +1299,13 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	function _setXmlRpcArgument()
1301 1301
 	{
1302
-		if($this->getRequestMethod() != 'XMLRPC')
1302
+		if ($this->getRequestMethod() != 'XMLRPC')
1303 1303
 		{
1304 1304
 			return;
1305 1305
 		}
1306 1306
 
1307 1307
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1308
-		if(Security::detectingXEE($xml))
1308
+		if (Security::detectingXEE($xml))
1309 1309
 		{
1310 1310
 			header("HTTP/1.0 400 Bad Request");
1311 1311
 			exit;
@@ -1317,12 +1317,12 @@  discard block
 block discarded – undo
1317 1317
 		$params = $xml_obj->methodcall->params;
1318 1318
 		unset($params->node_name, $params->attrs, $params->body);
1319 1319
 
1320
-		if(!count(get_object_vars($params)))
1320
+		if (!count(get_object_vars($params)))
1321 1321
 		{
1322 1322
 			return;
1323 1323
 		}
1324 1324
 
1325
-		foreach($params as $key => $val)
1325
+		foreach ($params as $key => $val)
1326 1326
 		{
1327 1327
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1328 1328
 		}
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 	 */
1338 1338
 	function _filterXmlVars($key, $val)
1339 1339
 	{
1340
-		if(is_array($val))
1340
+		if (is_array($val))
1341 1341
 		{
1342 1342
 			$stack = array();
1343
-			foreach($val as $k => $v)
1343
+			foreach ($val as $k => $v)
1344 1344
 			{
1345 1345
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1346 1346
 			}
@@ -1350,20 +1350,20 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 		$body = $val->body;
1352 1352
 		unset($val->node_name, $val->attrs, $val->body);
1353
-		if(!count(get_object_vars($val)))
1353
+		if (!count(get_object_vars($val)))
1354 1354
 		{
1355 1355
 			return $this->_filterRequestVar($key, $body, 0);
1356 1356
 		}
1357 1357
 
1358 1358
 		$stack = new stdClass();
1359
-		foreach($val as $k => $v)
1359
+		foreach ($val as $k => $v)
1360 1360
 		{
1361 1361
 			$output = $this->_filterXmlVars($k, $v);
1362
-			if(is_object($v) && $v->attrs->type == 'array')
1362
+			if (is_object($v) && $v->attrs->type == 'array')
1363 1363
 			{
1364 1364
 				$output = array($output);
1365 1365
 			}
1366
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1366
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1367 1367
 			{
1368 1368
 				return $output;
1369 1369
 			}
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 			$stack->{$k} = $output;
1372 1372
 		}
1373 1373
 
1374
-		if(!count(get_object_vars($stack)))
1374
+		if (!count(get_object_vars($stack)))
1375 1375
 		{
1376 1376
 			return NULL;
1377 1377
 		}
@@ -1390,32 +1390,32 @@  discard block
 block discarded – undo
1390 1390
 	 */
1391 1391
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1392 1392
 	{
1393
-		if(!($isArray = is_array($val)))
1393
+		if (!($isArray = is_array($val)))
1394 1394
 		{
1395 1395
 			$val = array($val);
1396 1396
 		}
1397 1397
 
1398 1398
 		$result = array();
1399
-		foreach($val as $k => $v)
1399
+		foreach ($val as $k => $v)
1400 1400
 		{
1401 1401
 			$k = htmlentities($k);
1402
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1402
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1403
 			{
1404 1404
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405 1405
 			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1406
+			elseif ($key === 'mid' || $key === 'search_keyword')
1407 1407
 			{
1408 1408
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409 1409
 			}
1410
-			elseif($key === 'vid')
1410
+			elseif ($key === 'vid')
1411 1411
 			{
1412 1412
 				$result[$k] = urlencode($v);
1413 1413
 			}
1414
-			elseif($key === 'xe_validator_id')
1414
+			elseif ($key === 'xe_validator_id')
1415 1415
 			{
1416 1416
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417 1417
 			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1418
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1419
 			{
1420 1420
 				unset($result[$k]);
1421 1421
 			}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 			{
1424 1424
 				$result[$k] = $v;
1425 1425
 
1426
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1426
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1427 1427
 				{
1428 1428
 					if (is_array($result[$k]))
1429 1429
 					{
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438
-				if(is_array($result[$k]))
1438
+				if (is_array($result[$k]))
1439 1439
 				{
1440 1440
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441 1441
 				}
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
 	 */
1468 1468
 	function _setUploadedArgument()
1469 1469
 	{
1470
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1470
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1471 1471
 		{
1472 1472
 			return;
1473 1473
 		}
1474 1474
 
1475
-		foreach($_FILES as $key => $val)
1475
+		foreach ($_FILES as $key => $val)
1476 1476
 		{
1477 1477
 			$tmp_name = $val['tmp_name'];
1478
-			if(!is_array($tmp_name))
1478
+			if (!is_array($tmp_name))
1479 1479
 			{
1480
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1480
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1481 1481
 				{
1482 1482
 					continue;
1483 1483
 				}
@@ -1487,9 +1487,9 @@  discard block
 block discarded – undo
1487 1487
 			}
1488 1488
 			else
1489 1489
 			{
1490
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1490
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1491 1491
 				{
1492
-					if($val['size'][$i] > 0)
1492
+					if ($val['size'][$i] > 0)
1493 1493
 					{
1494 1494
 						$file['name'] = $val['name'][$i];
1495 1495
 						$file['type'] = $val['type'][$i];
@@ -1521,16 +1521,16 @@  discard block
 block discarded – undo
1521 1521
 	function getRequestUrl()
1522 1522
 	{
1523 1523
 		static $url = null;
1524
-		if(is_null($url))
1524
+		if (is_null($url))
1525 1525
 		{
1526 1526
 			$url = self::getRequestUri();
1527
-			if(count($_GET) > 0)
1527
+			if (count($_GET) > 0)
1528 1528
 			{
1529
-				foreach($_GET as $key => $val)
1529
+				foreach ($_GET as $key => $val)
1530 1530
 				{
1531
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1531
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1532 1532
 				}
1533
-				$url .= '?' . join('&', $vars);
1533
+				$url .= '?'.join('&', $vars);
1534 1534
 			}
1535 1535
 		}
1536 1536
 		return $url;
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 		$self = self::getInstance();
1546 1546
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1547 1547
 
1548
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1548
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1549 1549
 		{
1550 1550
 			unset($js_callback_func);
1551 1551
 			unset($_GET['xe_js_callback']);
@@ -1573,22 +1573,22 @@  discard block
 block discarded – undo
1573 1573
 		$self = self::getInstance();
1574 1574
 
1575 1575
 		// retrieve virtual site information
1576
-		if(is_null($site_module_info))
1576
+		if (is_null($site_module_info))
1577 1577
 		{
1578 1578
 			$site_module_info = self::get('site_module_info');
1579 1579
 		}
1580 1580
 
1581 1581
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1582
-		if($domain && isSiteID($domain))
1582
+		if ($domain && isSiteID($domain))
1583 1583
 		{
1584 1584
 			$vid = $domain;
1585 1585
 			$domain = '';
1586 1586
 		}
1587 1587
 
1588 1588
 		// If $domain, $vid are not set, use current site information
1589
-		if(!$domain && !$vid)
1589
+		if (!$domain && !$vid)
1590 1590
 		{
1591
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1591
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1592 1592
 			{
1593 1593
 				$vid = $site_module_info->domain;
1594 1594
 			}
@@ -1599,21 +1599,21 @@  discard block
 block discarded – undo
1599 1599
 		}
1600 1600
 
1601 1601
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1602
-		if($domain)
1602
+		if ($domain)
1603 1603
 		{
1604 1604
 			$domain_info = parse_url($domain);
1605
-			if(is_null($current_info))
1605
+			if (is_null($current_info))
1606 1606
 			{
1607
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1607
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1608 1608
 			}
1609
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1609
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1610 1610
 			{
1611 1611
 				unset($domain);
1612 1612
 			}
1613 1613
 			else
1614 1614
 			{
1615 1615
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1616
-				if(substr_compare($domain, '/', -1) !== 0)
1616
+				if (substr_compare($domain, '/', -1) !== 0)
1617 1617
 				{
1618 1618
 					$domain .= '/';
1619 1619
 				}
@@ -1623,10 +1623,10 @@  discard block
 block discarded – undo
1623 1623
 		$get_vars = array();
1624 1624
 
1625 1625
 		// If there is no GET variables or first argument is '' to reset variables
1626
-		if(!$self->get_vars || $args_list[0] == '')
1626
+		if (!$self->get_vars || $args_list[0] == '')
1627 1627
 		{
1628 1628
 			// rearrange args_list
1629
-			if(is_array($args_list) && $args_list[0] == '')
1629
+			if (is_array($args_list) && $args_list[0] == '')
1630 1630
 			{
1631 1631
 				array_shift($args_list);
1632 1632
 			}
@@ -1638,13 +1638,13 @@  discard block
 block discarded – undo
1638 1638
 		}
1639 1639
 
1640 1640
 		// arrange args_list
1641
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1641
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1642 1642
 		{
1643 1643
 			$key = $args_list[$i];
1644 1644
 			$val = trim($args_list[$i + 1]);
1645 1645
 
1646 1646
 			// If value is not set, remove the key
1647
-			if(!isset($val) || !strlen($val))
1647
+			if (!isset($val) || !strlen($val))
1648 1648
 			{
1649 1649
 				unset($get_vars[$key]);
1650 1650
 				continue;
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 
1656 1656
 		// remove vid, rnd
1657 1657
 		unset($get_vars['rnd']);
1658
-		if($vid)
1658
+		if ($vid)
1659 1659
 		{
1660 1660
 			$get_vars['vid'] = $vid;
1661 1661
 		}
@@ -1672,17 +1672,17 @@  discard block
 block discarded – undo
1672 1672
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1673 1673
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1674 1674
 		);
1675
-		if($act_alias[$act])
1675
+		if ($act_alias[$act])
1676 1676
 		{
1677 1677
 			$get_vars['act'] = $act_alias[$act];
1678 1678
 		}
1679 1679
 
1680 1680
 		// organize URL
1681 1681
 		$query = '';
1682
-		if(count($get_vars) > 0)
1682
+		if (count($get_vars) > 0)
1683 1683
 		{
1684 1684
 			// if using rewrite mod
1685
-			if($self->allow_rewrite)
1685
+			if ($self->allow_rewrite)
1686 1686
 			{
1687 1687
 				$var_keys = array_keys($get_vars);
1688 1688
 				sort($var_keys);
@@ -1702,8 +1702,8 @@  discard block
 block discarded – undo
1702 1702
 					'vid' => $vid,
1703 1703
 					'mid' => $mid,
1704 1704
 					'mid.vid' => "$vid/$mid",
1705
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1706
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1705
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1706
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1707 1707
 					'document_srl' => $srl,
1708 1708
 					'document_srl.mid' => "$mid/$srl",
1709 1709
 					'document_srl.vid' => "$vid/$srl",
@@ -1720,66 +1720,66 @@  discard block
 block discarded – undo
1720 1720
 				$query = $target_map[$target];
1721 1721
 			}
1722 1722
 
1723
-			if(!$query)
1723
+			if (!$query)
1724 1724
 			{
1725 1725
 				$queries = array();
1726
-				foreach($get_vars as $key => $val)
1726
+				foreach ($get_vars as $key => $val)
1727 1727
 				{
1728
-					if(is_array($val) && count($val) > 0)
1728
+					if (is_array($val) && count($val) > 0)
1729 1729
 					{
1730
-						foreach($val as $k => $v)
1730
+						foreach ($val as $k => $v)
1731 1731
 						{
1732
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1732
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1733 1733
 						}
1734 1734
 					}
1735
-					elseif(!is_array($val))
1735
+					elseif (!is_array($val))
1736 1736
 					{
1737
-						$queries[] = $key . '=' . urlencode($val);
1737
+						$queries[] = $key.'='.urlencode($val);
1738 1738
 					}
1739 1739
 				}
1740
-				if(count($queries) > 0)
1740
+				if (count($queries) > 0)
1741 1741
 				{
1742
-					$query = 'index.php?' . join('&', $queries);
1742
+					$query = 'index.php?'.join('&', $queries);
1743 1743
 				}
1744 1744
 			}
1745 1745
 		}
1746 1746
 
1747 1747
 		// If using SSL always
1748 1748
 		$_use_ssl = $self->get('_use_ssl');
1749
-		if($_use_ssl == 'always')
1749
+		if ($_use_ssl == 'always')
1750 1750
 		{
1751
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1751
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1752 1752
 			// optional SSL use
1753 1753
 		}
1754
-		elseif($_use_ssl == 'optional')
1754
+		elseif ($_use_ssl == 'optional')
1755 1755
 		{
1756 1756
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1757
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1757
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1758 1758
 			// no SSL
1759 1759
 		}
1760 1760
 		else
1761 1761
 		{
1762 1762
 			// currently on SSL but target is not based on SSL
1763
-			if($_SERVER['HTTPS'] == 'on')
1763
+			if ($_SERVER['HTTPS'] == 'on')
1764 1764
 			{
1765
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1765
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1766 1766
 			}
1767
-			else if($domain) // if $domain is set
1767
+			else if ($domain) // if $domain is set
1768 1768
 			{
1769
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1769
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1770 1770
 			}
1771 1771
 			else
1772 1772
 			{
1773
-				$query = getScriptPath() . $query;
1773
+				$query = getScriptPath().$query;
1774 1774
 			}
1775 1775
 		}
1776 1776
 
1777
-		if(!$encode)
1777
+		if (!$encode)
1778 1778
 		{
1779 1779
 			return $query;
1780 1780
 		}
1781 1781
 
1782
-		if(!$autoEncode)
1782
+		if (!$autoEncode)
1783 1783
 		{
1784 1784
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1785 1785
 		}
@@ -1788,16 +1788,16 @@  discard block
 block discarded – undo
1788 1788
 		$encode_queries = array();
1789 1789
 		$parsedUrl = parse_url($query);
1790 1790
 		parse_str($parsedUrl['query'], $output);
1791
-		foreach($output as $key => $value)
1791
+		foreach ($output as $key => $value)
1792 1792
 		{
1793
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1793
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1794 1794
 			{
1795 1795
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1796 1796
 			}
1797
-			$encode_queries[] = $key . '=' . $value;
1797
+			$encode_queries[] = $key.'='.$value;
1798 1798
 		}
1799 1799
 
1800
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1800
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1801 1801
 	}
1802 1802
 
1803 1803
 	/**
@@ -1812,17 +1812,17 @@  discard block
 block discarded – undo
1812 1812
 		static $url = array();
1813 1813
 
1814 1814
 		// Check HTTP Request
1815
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1815
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1816 1816
 		{
1817 1817
 			return;
1818 1818
 		}
1819 1819
 
1820
-		if(self::get('_use_ssl') == 'always')
1820
+		if (self::get('_use_ssl') == 'always')
1821 1821
 		{
1822 1822
 			$ssl_mode = ENFORCE_SSL;
1823 1823
 		}
1824 1824
 
1825
-		if($domain)
1825
+		if ($domain)
1826 1826
 		{
1827 1827
 			$domain_key = md5($domain);
1828 1828
 		}
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
 			$domain_key = 'default';
1832 1832
 		}
1833 1833
 
1834
-		if(isset($url[$ssl_mode][$domain_key]))
1834
+		if (isset($url[$ssl_mode][$domain_key]))
1835 1835
 		{
1836 1836
 			return $url[$ssl_mode][$domain_key];
1837 1837
 		}
1838 1838
 
1839 1839
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1840 1840
 
1841
-		switch($ssl_mode)
1841
+		switch ($ssl_mode)
1842 1842
 		{
1843 1843
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1844 1844
 				break;
@@ -1848,34 +1848,34 @@  discard block
 block discarded – undo
1848 1848
 				break;
1849 1849
 		}
1850 1850
 
1851
-		if($domain)
1851
+		if ($domain)
1852 1852
 		{
1853 1853
 			$target_url = trim($domain);
1854
-			if(substr_compare($target_url, '/', -1) !== 0)
1854
+			if (substr_compare($target_url, '/', -1) !== 0)
1855 1855
 			{
1856
-				$target_url.= '/';
1856
+				$target_url .= '/';
1857 1857
 			}
1858 1858
 		}
1859 1859
 		else
1860 1860
 		{
1861
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1861
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1862 1862
 		}
1863 1863
 
1864
-		$url_info = parse_url('http://' . $target_url);
1864
+		$url_info = parse_url('http://'.$target_url);
1865 1865
 
1866
-		if($current_use_ssl != $use_ssl)
1866
+		if ($current_use_ssl != $use_ssl)
1867 1867
 		{
1868 1868
 			unset($url_info['port']);
1869 1869
 		}
1870 1870
 
1871
-		if($use_ssl)
1871
+		if ($use_ssl)
1872 1872
 		{
1873 1873
 			$port = self::get('_https_port');
1874
-			if($port && $port != 443)
1874
+			if ($port && $port != 443)
1875 1875
 			{
1876 1876
 				$url_info['port'] = $port;
1877 1877
 			}
1878
-			elseif($url_info['port'] == 443)
1878
+			elseif ($url_info['port'] == 443)
1879 1879
 			{
1880 1880
 				unset($url_info['port']);
1881 1881
 			}
@@ -1883,17 +1883,17 @@  discard block
 block discarded – undo
1883 1883
 		else
1884 1884
 		{
1885 1885
 			$port = self::get('_http_port');
1886
-			if($port && $port != 80)
1886
+			if ($port && $port != 80)
1887 1887
 			{
1888 1888
 				$url_info['port'] = $port;
1889 1889
 			}
1890
-			elseif($url_info['port'] == 80)
1890
+			elseif ($url_info['port'] == 80)
1891 1891
 			{
1892 1892
 				unset($url_info['port']);
1893 1893
 			}
1894 1894
 		}
1895 1895
 
1896
-		$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']);
1896
+		$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']);
1897 1897
 
1898 1898
 		return $url[$ssl_mode][$domain_key];
1899 1899
 	}
@@ -1910,16 +1910,16 @@  discard block
 block discarded – undo
1910 1910
 	{
1911 1911
 		$self = self::getInstance();
1912 1912
 		$self->context->{$key} = $val;
1913
-		if($set_to_get_vars === FALSE)
1913
+		if ($set_to_get_vars === FALSE)
1914 1914
 		{
1915 1915
 			return;
1916 1916
 		}
1917
-		if($val === NULL || $val === '')
1917
+		if ($val === NULL || $val === '')
1918 1918
 		{
1919 1919
 			unset($self->get_vars->{$key});
1920 1920
 			return;
1921 1921
 		}
1922
-		if($set_to_get_vars || $self->get_vars->{$key})
1922
+		if ($set_to_get_vars || $self->get_vars->{$key})
1923 1923
 		{
1924 1924
 			$self->get_vars->{$key} = $val;
1925 1925
 		}
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 	{
1936 1936
 		$self = self::getInstance();
1937 1937
 
1938
-		if(!isset($self->context->{$key}))
1938
+		if (!isset($self->context->{$key}))
1939 1939
 		{
1940 1940
 			return null;
1941 1941
 		}
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
 	function gets()
1951 1951
 	{
1952 1952
 		$num_args = func_num_args();
1953
-		if($num_args < 1)
1953
+		if ($num_args < 1)
1954 1954
 		{
1955 1955
 			return;
1956 1956
 		}
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
 
1959 1959
 		$args_list = func_get_args();
1960 1960
 		$output = new stdClass();
1961
-		foreach($args_list as $v)
1961
+		foreach ($args_list as $v)
1962 1962
 		{
1963 1963
 			$output->{$v} = $self->get($v);
1964 1964
 		}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 	function getRequestVars()
1985 1985
 	{
1986 1986
 		$self = self::getInstance();
1987
-		if($self->get_vars)
1987
+		if ($self->get_vars)
1988 1988
 		{
1989 1989
 			return clone($self->get_vars);
1990 1990
 		}
@@ -2001,13 +2001,13 @@  discard block
 block discarded – undo
2001 2001
 	{
2002 2002
 		$self = self::getInstance();
2003 2003
 
2004
-		if(!is_readable($self->sslActionCacheFile))
2004
+		if (!is_readable($self->sslActionCacheFile))
2005 2005
 		{
2006 2006
 			$buff = '<?php if(!defined("__XE__"))exit;';
2007 2007
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2008 2008
 		}
2009 2009
 
2010
-		if(!isset($self->ssl_actions[$action]))
2010
+		if (!isset($self->ssl_actions[$action]))
2011 2011
 		{
2012 2012
 			$self->ssl_actions[$action] = 1;
2013 2013
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2025,16 +2025,16 @@  discard block
 block discarded – undo
2025 2025
 	{
2026 2026
 		$self = self::getInstance();
2027 2027
 
2028
-		if(!is_readable($self->sslActionCacheFile))
2028
+		if (!is_readable($self->sslActionCacheFile))
2029 2029
 		{
2030 2030
 			unset($self->ssl_actions);
2031 2031
 			$buff = '<?php if(!defined("__XE__"))exit;';
2032 2032
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2033 2033
 		}
2034 2034
 
2035
-		foreach($action_array as $action)
2035
+		foreach ($action_array as $action)
2036 2036
 		{
2037
-			if(!isset($self->ssl_actions[$action]))
2037
+			if (!isset($self->ssl_actions[$action]))
2038 2038
 			{
2039 2039
 				$self->ssl_actions[$action] = 1;
2040 2040
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 	{
2054 2054
 		$self = self::getInstance();
2055 2055
 
2056
-		if($self->isExistsSSLAction($action))
2056
+		if ($self->isExistsSSLAction($action))
2057 2057
 		{
2058 2058
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2059 2059
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 	function getSSLActions()
2071 2071
 	{
2072 2072
 		$self = self::getInstance();
2073
-		if($self->getSslStatus() == 'optional')
2073
+		if ($self->getSslStatus() == 'optional')
2074 2074
 		{
2075 2075
 			return $self->ssl_actions;
2076 2076
 		}
@@ -2097,12 +2097,12 @@  discard block
 block discarded – undo
2097 2097
 	 */
2098 2098
 	function normalizeFilePath($file)
2099 2099
 	{
2100
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2100
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2101 2101
 		{
2102
-			$file = './' . $file;
2102
+			$file = './'.$file;
2103 2103
 		}
2104 2104
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2105
-		while(strpos($file, '/../') !== FALSE)
2105
+		while (strpos($file, '/../') !== FALSE)
2106 2106
 		{
2107 2107
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2108 2108
 		}
@@ -2121,13 +2121,13 @@  discard block
 block discarded – undo
2121 2121
 	{
2122 2122
 		$file = self::normalizeFilePath($file);
2123 2123
 		$script_path = getScriptPath();
2124
-		if(strpos($file, './') === 0)
2124
+		if (strpos($file, './') === 0)
2125 2125
 		{
2126
-			$file = $script_path . substr($file, 2);
2126
+			$file = $script_path.substr($file, 2);
2127 2127
 		}
2128
-		elseif(strpos($file, '../') === 0)
2128
+		elseif (strpos($file, '../') === 0)
2129 2129
 		{
2130
-			$file = self::normalizeFilePath($script_path . $file);
2130
+			$file = self::normalizeFilePath($script_path.$file);
2131 2131
 		}
2132 2132
 
2133 2133
 		return $file;
@@ -2197,12 +2197,12 @@  discard block
 block discarded – undo
2197 2197
 	 */
2198 2198
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2199 2199
 	{
2200
-		if($isRuleset)
2200
+		if ($isRuleset)
2201 2201
 		{
2202
-			if(strpos($file, '#') !== FALSE)
2202
+			if (strpos($file, '#') !== FALSE)
2203 2203
 			{
2204 2204
 				$file = str_replace('#', '', $file);
2205
-				if(!is_readable($file))
2205
+				if (!is_readable($file))
2206 2206
 				{
2207 2207
 					$file = $autoPath;
2208 2208
 				}
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 		ksort($files);
2268 2268
 		$files = array_values($files);
2269 2269
 		$filenames = array();
2270
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2270
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2271 2271
 		{
2272
-			if(in_array($files[$i]['file'], $filenames))
2272
+			if (in_array($files[$i]['file'], $filenames))
2273 2273
 			{
2274 2274
 				unset($files[$i]);
2275 2275
 			}
@@ -2354,14 +2354,14 @@  discard block
 block discarded – undo
2354 2354
 	 */
2355 2355
 	function getJavascriptPluginInfo($pluginName)
2356 2356
 	{
2357
-		if($plugin_name == 'ui.datepicker')
2357
+		if ($plugin_name == 'ui.datepicker')
2358 2358
 		{
2359 2359
 			$plugin_name = 'ui';
2360 2360
 		}
2361 2361
 
2362
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2363
-		$info_file = $plugin_path . 'plugin.load';
2364
-		if(!is_readable($info_file))
2362
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2363
+		$info_file = $plugin_path.'plugin.load';
2364
+		if (!is_readable($info_file))
2365 2365
 		{
2366 2366
 			return;
2367 2367
 		}
@@ -2371,32 +2371,32 @@  discard block
 block discarded – undo
2371 2371
 		$result->jsList = array();
2372 2372
 		$result->cssList = array();
2373 2373
 
2374
-		foreach($list as $filename)
2374
+		foreach ($list as $filename)
2375 2375
 		{
2376 2376
 			$filename = trim($filename);
2377
-			if(!$filename)
2377
+			if (!$filename)
2378 2378
 			{
2379 2379
 				continue;
2380 2380
 			}
2381 2381
 
2382
-			if(strncasecmp('./', $filename, 2) === 0)
2382
+			if (strncasecmp('./', $filename, 2) === 0)
2383 2383
 			{
2384 2384
 				$filename = substr($filename, 2);
2385 2385
 			}
2386 2386
 
2387
-			if(substr_compare($filename, '.js', -3) === 0)
2387
+			if (substr_compare($filename, '.js', -3) === 0)
2388 2388
 			{
2389
-				$result->jsList[] = $plugin_path . $filename;
2389
+				$result->jsList[] = $plugin_path.$filename;
2390 2390
 			}
2391
-			elseif(substr_compare($filename, '.css', -4) === 0)
2391
+			elseif (substr_compare($filename, '.css', -4) === 0)
2392 2392
 			{
2393
-				$result->cssList[] = $plugin_path . $filename;
2393
+				$result->cssList[] = $plugin_path.$filename;
2394 2394
 			}
2395 2395
 		}
2396 2396
 
2397
-		if(is_dir($plugin_path . 'lang'))
2397
+		if (is_dir($plugin_path.'lang'))
2398 2398
 		{
2399
-			$result->langPath = $plugin_path . 'lang';
2399
+			$result->langPath = $plugin_path.'lang';
2400 2400
 		}
2401 2401
 
2402 2402
 		return $result;
@@ -2412,50 +2412,50 @@  discard block
 block discarded – undo
2412 2412
 		static $loaded_plugins = array();
2413 2413
 
2414 2414
 		$self = self::getInstance();
2415
-		if($plugin_name == 'ui.datepicker')
2415
+		if ($plugin_name == 'ui.datepicker')
2416 2416
 		{
2417 2417
 			$plugin_name = 'ui';
2418 2418
 		}
2419 2419
 
2420
-		if($loaded_plugins[$plugin_name])
2420
+		if ($loaded_plugins[$plugin_name])
2421 2421
 		{
2422 2422
 			return;
2423 2423
 		}
2424 2424
 		$loaded_plugins[$plugin_name] = TRUE;
2425 2425
 
2426
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2427
-		$info_file = $plugin_path . 'plugin.load';
2428
-		if(!is_readable($info_file))
2426
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2427
+		$info_file = $plugin_path.'plugin.load';
2428
+		if (!is_readable($info_file))
2429 2429
 		{
2430 2430
 			return;
2431 2431
 		}
2432 2432
 
2433 2433
 		$list = file($info_file);
2434
-		foreach($list as $filename)
2434
+		foreach ($list as $filename)
2435 2435
 		{
2436 2436
 			$filename = trim($filename);
2437
-			if(!$filename)
2437
+			if (!$filename)
2438 2438
 			{
2439 2439
 				continue;
2440 2440
 			}
2441 2441
 
2442
-			if(strncasecmp('./', $filename, 2) === 0)
2442
+			if (strncasecmp('./', $filename, 2) === 0)
2443 2443
 			{
2444 2444
 				$filename = substr($filename, 2);
2445 2445
 			}
2446
-			if(substr_compare($filename, '.js', -3) === 0)
2446
+			if (substr_compare($filename, '.js', -3) === 0)
2447 2447
 			{
2448
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2448
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2449 2449
 			}
2450
-			if(substr_compare($filename, '.css', -4) === 0)
2450
+			if (substr_compare($filename, '.css', -4) === 0)
2451 2451
 			{
2452
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2452
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2453 2453
 			}
2454 2454
 		}
2455 2455
 
2456
-		if(is_dir($plugin_path . 'lang'))
2456
+		if (is_dir($plugin_path.'lang'))
2457 2457
 		{
2458
-			$self->loadLang($plugin_path . 'lang');
2458
+			$self->loadLang($plugin_path.'lang');
2459 2459
 		}
2460 2460
 	}
2461 2461
 
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 	function addHtmlHeader($header)
2469 2469
 	{
2470 2470
 		$self = self::getInstance();
2471
-		$self->html_header .= "\n" . $header;
2471
+		$self->html_header .= "\n".$header;
2472 2472
 	}
2473 2473
 
2474 2474
 	function clearHtmlHeader()
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
 	function addBodyHeader($header)
2521 2521
 	{
2522 2522
 		$self = self::getInstance();
2523
-		$self->body_header .= "\n" . $header;
2523
+		$self->body_header .= "\n".$header;
2524 2524
 	}
2525 2525
 
2526 2526
 	/**
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
 	function addHtmlFooter($footer)
2543 2543
 	{
2544 2544
 		$self = self::getInstance();
2545
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2545
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2546 2546
 	}
2547 2547
 
2548 2548
 	/**
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 	 */
2564 2564
 	function getConfigFile()
2565 2565
 	{
2566
-		return _XE_PATH_ . 'files/config/db.config.php';
2566
+		return _XE_PATH_.'files/config/db.config.php';
2567 2567
 	}
2568 2568
 
2569 2569
 	/**
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 	 */
2574 2574
 	function getFTPConfigFile()
2575 2575
 	{
2576
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2576
+		return _XE_PATH_.'files/config/ftp.config.php';
2577 2577
 	}
2578 2578
 
2579 2579
 	/**
@@ -2625,14 +2625,14 @@  discard block
 block discarded – undo
2625 2625
 		$_path = explode('/', $path);
2626 2626
 		$_base = explode('/', $base_url);
2627 2627
 
2628
-		if(!$_base[count($_base) - 1])
2628
+		if (!$_base[count($_base) - 1])
2629 2629
 		{
2630 2630
 			array_pop($_base);
2631 2631
 		}
2632 2632
 
2633
-		foreach($_xe as $idx => $dir)
2633
+		foreach ($_xe as $idx => $dir)
2634 2634
 		{
2635
-			if($_path[0] != $dir)
2635
+			if ($_path[0] != $dir)
2636 2636
 			{
2637 2637
 				break;
2638 2638
 			}
@@ -2640,9 +2640,9 @@  discard block
 block discarded – undo
2640 2640
 		}
2641 2641
 
2642 2642
 		$idx = count($_xe) - $idx - 1;
2643
-		while($idx--)
2643
+		while ($idx--)
2644 2644
 		{
2645
-			if(count($_base) > 0)
2645
+			if (count($_base) > 0)
2646 2646
 			{
2647 2647
 				array_shift($_base);
2648 2648
 			}
@@ -2652,13 +2652,13 @@  discard block
 block discarded – undo
2652 2652
 			}
2653 2653
 		}
2654 2654
 
2655
-		if(count($_base) > 0)
2655
+		if (count($_base) > 0)
2656 2656
 		{
2657 2657
 			array_unshift($_path, join('/', $_base));
2658 2658
 		}
2659 2659
 
2660
-		$path = '/' . join('/', $_path);
2661
-		if(substr_compare($path, '/', -1) !== 0)
2660
+		$path = '/'.join('/', $_path);
2661
+		if (substr_compare($path, '/', -1) !== 0)
2662 2662
 		{
2663 2663
 			$path .= '/';
2664 2664
 		}
@@ -2673,13 +2673,13 @@  discard block
 block discarded – undo
2673 2673
 	{
2674 2674
 		$self = self::getInstance();
2675 2675
 
2676
-		if(!is_array($self->meta_tags))
2676
+		if (!is_array($self->meta_tags))
2677 2677
 		{
2678 2678
 			$self->meta_tags = array();
2679 2679
 		}
2680 2680
 
2681 2681
 		$ret = array();
2682
-		foreach($self->meta_tags as $key => $val)
2682
+		foreach ($self->meta_tags as $key => $val)
2683 2683
 		{
2684 2684
 			list($name, $is_http_equiv) = explode("\t", $key);
2685 2685
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2700 2700
 	{
2701 2701
 		$self = self::getInstance();
2702
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2702
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2703 2703
 	}
2704 2704
 
2705 2705
 }
Please login to merge, or discard this patch.
Braces   +87 added lines, -102 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -490,18 +491,22 @@  discard block
 block discarded – undo
490 491
 			$db_info->use_prepared_statements = 'Y';
491 492
 		}
492 493
 
493
-		if(!$db_info->time_zone)
494
-			$db_info->time_zone = date('O');
494
+		if(!$db_info->time_zone) {
495
+					$db_info->time_zone = date('O');
496
+		}
495 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 498
 
497
-		if($db_info->qmail_compatibility != 'Y')
498
-			$db_info->qmail_compatibility = 'N';
499
+		if($db_info->qmail_compatibility != 'Y') {
500
+					$db_info->qmail_compatibility = 'N';
501
+		}
499 502
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 503
 
501
-		if(!$db_info->use_db_session)
502
-			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
504
-			$db_info->use_ssl = 'none';
504
+		if(!$db_info->use_db_session) {
505
+					$db_info->use_db_session = 'N';
506
+		}
507
+		if(!$db_info->use_ssl) {
508
+					$db_info->use_ssl = 'none';
509
+		}
505 510
 		$this->set('_use_ssl', $db_info->use_ssl);
506 511
 
507 512
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -618,8 +623,7 @@  discard block
 block discarded – undo
618 623
 				$buff = FileHandler::readFile($orig_lang_file);
619 624
 				FileHandler::writeFile($selected_lang_file, $buff);
620 625
 				$lang_selected = self::loadLangSupported();
621
-			}
622
-			else
626
+			} else
623 627
 			{
624 628
 				$langs = file($selected_lang_file);
625 629
 				foreach($langs as $val)
@@ -678,15 +682,16 @@  discard block
 block discarded – undo
678 682
 
679 683
 				$oModuleModel = getModel('module');
680 684
 				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				if(substr_compare($domain, '/', -1) === 0) {
686
+					$domain = substr($domain, 0, -1);
687
+				}
682 688
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 689
 
684 690
 				if($site_info->site_srl)
685 691
 				{
686 692
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687 693
 				$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']);
688
-				}
689
-				else
694
+				} else
690 695
 				{
691 696
 					$redirect_url = $url;
692 697
 				}
@@ -695,8 +700,7 @@  discard block
 block discarded – undo
695 700
 				return FALSE;
696 701
 			}
697 702
 			// for sites requesting SSO validation
698
-		}
699
-		else
703
+		} else
700 704
 		{
701 705
 			// result handling : set session_name()
702 706
 			if($session_name = self::get('SSOID'))
@@ -713,8 +717,7 @@  discard block
 block discarded – undo
713 717
 				header('location:' . $url);
714 718
 				return FALSE;
715 719
 				// send SSO request
716
-			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 721
 			{
719 722
 				setcookie('sso', md5(self::getRequestUri()));
720 723
 				$origin_url = self::getRequestUrl();
@@ -774,8 +777,7 @@  discard block
 block discarded – undo
774 777
 		if($self->site_title)
775 778
 		{
776 779
 			$self->site_title .= ' - ' . $site_title;
777
-		}
778
-		else
780
+		} else
779 781
 		{
780 782
 			$self->site_title = $site_title;
781 783
 		}
@@ -875,8 +877,7 @@  discard block
 block discarded – undo
875 877
 		{
876 878
 			$self->loaded_lang_files[] = $filename;
877 879
 			include($filename);
878
-		}
879
-		else
880
+		} else
880 881
 		{
881 882
 			$self->_evalxmlLang($path);
882 883
 		}
@@ -892,7 +893,9 @@  discard block
 block discarded – undo
892 893
 	{
893 894
 		global $lang;
894 895
 
895
-		if(!$path) return;
896
+		if(!$path) {
897
+			return;
898
+		}
896 899
 
897 900
 		$_path = 'eval://' . $path;
898 901
 
@@ -924,7 +927,9 @@  discard block
 block discarded – undo
924 927
 	 */
925 928
 	function _loadXmlLang($path)
926 929
 	{
927
-		if(!$path) return;
930
+		if(!$path) {
931
+			return;
932
+		}
928 933
 
929 934
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
930 935
 		return $oXmlLangParser->compile();
@@ -938,7 +943,9 @@  discard block
 block discarded – undo
938 943
 	 */
939 944
 	function _loadPhpLang($path)
940 945
 	{
941
-		if(!$path) return;
946
+		if(!$path) {
947
+			return;
948
+		}
942 949
 
943 950
 		if(substr_compare($path, '/', -1) !== 0)
944 951
 		{
@@ -1074,12 +1081,14 @@  discard block
 block discarded – undo
1074 1081
 		static $flag = TRUE;
1075 1082
 		if($charset)
1076 1083
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1080
-			else $flag = FALSE;
1081
-		}
1082
-		else
1084
+			if(is_array($val)) {
1085
+							array_walk($val,'Context::checkConvertFlag',$charset);
1086
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1087
+				$flag = FALSE;
1088
+			} else {
1089
+				$flag = FALSE;
1090
+			}
1091
+		} else
1083 1092
 		{
1084 1093
 			$return = $flag;
1085 1094
 			$flag = TRUE;
@@ -1101,8 +1110,9 @@  discard block
 block discarded – undo
1101 1110
 		if (is_array($val))
1102 1111
 		{
1103 1112
 			array_walk($val,'Context::doConvertEncoding',$charset);
1113
+		} else {
1114
+			$val = iconv($charset,'UTF-8',$val);
1104 1115
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1106 1116
 	}
1107 1117
 
1108 1118
 	/**
@@ -1113,7 +1123,9 @@  discard block
 block discarded – undo
1113 1123
 	 */
1114 1124
 	function convertEncodingStr($str)
1115 1125
 	{
1116
-        if(!$str) return null;
1126
+        if(!$str) {
1127
+        	return null;
1128
+        }
1117 1129
 		$obj = new stdClass();
1118 1130
 		$obj->str = $str;
1119 1131
 		$obj = self::convertEncoding($obj);
@@ -1226,16 +1238,13 @@  discard block
 block discarded – undo
1226 1238
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1227 1239
 			{
1228 1240
 				$set_to_vars = TRUE;
1229
-			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1241
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1231 1242
 			{
1232 1243
 				$set_to_vars = TRUE;
1233
-			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1245
 			{
1236 1246
 				$set_to_vars = TRUE;
1237
-			}
1238
-			else
1247
+			} else
1239 1248
 			{
1240 1249
 				$set_to_vars = FALSE;
1241 1250
 			}
@@ -1261,8 +1270,7 @@  discard block
 block discarded – undo
1261 1270
 					return;
1262 1271
 				}
1263 1272
 			}
1264
-		}
1265
-		else if(is_array($val))
1273
+		} else if(is_array($val))
1266 1274
 		{
1267 1275
 			foreach($val as $val2)
1268 1276
 			{
@@ -1402,24 +1410,19 @@  discard block
 block discarded – undo
1402 1410
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1411
 			{
1404 1412
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405
-			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1413
+			} elseif($key === 'mid' || $key === 'search_keyword')
1407 1414
 			{
1408 1415
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409
-			}
1410
-			elseif($key === 'vid')
1416
+			} elseif($key === 'vid')
1411 1417
 			{
1412 1418
 				$result[$k] = urlencode($v);
1413
-			}
1414
-			elseif($key === 'xe_validator_id')
1419
+			} elseif($key === 'xe_validator_id')
1415 1420
 			{
1416 1421
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417
-			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1422
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1423
 			{
1420 1424
 				unset($result[$k]);
1421
-			}
1422
-			else
1425
+			} else
1423 1426
 			{
1424 1427
 				$result[$k] = $v;
1425 1428
 
@@ -1428,8 +1431,7 @@  discard block
 block discarded – undo
1428 1431
 					if (is_array($result[$k]))
1429 1432
 					{
1430 1433
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1431
-					}
1432
-					else
1434
+					} else
1433 1435
 					{
1434 1436
 						$result[$k] = stripslashes($result[$k]);
1435 1437
 					}
@@ -1438,8 +1440,7 @@  discard block
 block discarded – undo
1438 1440
 				if(is_array($result[$k]))
1439 1441
 				{
1440 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441
-				}
1442
-				else
1443
+				} else
1443 1444
 				{
1444 1445
 					$result[$k] = trim($result[$k]);
1445 1446
 				}
@@ -1484,8 +1485,7 @@  discard block
 block discarded – undo
1484 1485
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1485 1486
 				$this->set($key, $val, TRUE);
1486 1487
 				$this->is_uploaded = TRUE;
1487
-			}
1488
-			else
1488
+			} else
1489 1489
 			{
1490 1490
 				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1491 1491
 				{
@@ -1591,8 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1592 1592
 			{
1593 1593
 				$vid = $site_module_info->domain;
1594
-			}
1595
-			else
1594
+			} else
1596 1595
 			{
1597 1596
 				$domain = $site_module_info->domain;
1598 1597
 			}
@@ -1609,8 +1608,7 @@  discard block
 block discarded – undo
1609 1608
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1610 1609
 			{
1611 1610
 				unset($domain);
1612
-			}
1613
-			else
1611
+			} else
1614 1612
 			{
1615 1613
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1616 1614
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1630,8 +1628,7 @@  discard block
 block discarded – undo
1630 1628
 			{
1631 1629
 				array_shift($args_list);
1632 1630
 			}
1633
-		}
1634
-		else
1631
+		} else
1635 1632
 		{
1636 1633
 			// Otherwise, make GET variables into array
1637 1634
 			$get_vars = get_object_vars($self->get_vars);
@@ -1658,8 +1655,7 @@  discard block
 block discarded – undo
1658 1655
 		if($vid)
1659 1656
 		{
1660 1657
 			$get_vars['vid'] = $vid;
1661
-		}
1662
-		else
1658
+		} else
1663 1659
 		{
1664 1660
 			unset($get_vars['vid']);
1665 1661
 		}
@@ -1731,8 +1727,7 @@  discard block
 block discarded – undo
1731 1727
 						{
1732 1728
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1733 1729
 						}
1734
-					}
1735
-					elseif(!is_array($val))
1730
+					} elseif(!is_array($val))
1736 1731
 					{
1737 1732
 						$queries[] = $key . '=' . urlencode($val);
1738 1733
 					}
@@ -1750,25 +1745,23 @@  discard block
 block discarded – undo
1750 1745
 		{
1751 1746
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1752 1747
 			// optional SSL use
1753
-		}
1754
-		elseif($_use_ssl == 'optional')
1748
+		} elseif($_use_ssl == 'optional')
1755 1749
 		{
1756 1750
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1757 1751
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1758 1752
 			// no SSL
1759
-		}
1760
-		else
1753
+		} else
1761 1754
 		{
1762 1755
 			// currently on SSL but target is not based on SSL
1763 1756
 			if($_SERVER['HTTPS'] == 'on')
1764 1757
 			{
1765 1758
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1766
-			}
1767
-			else if($domain) // if $domain is set
1759
+			} else if($domain) {
1760
+				// if $domain is set
1768 1761
 			{
1769 1762
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1770 1763
 			}
1771
-			else
1764
+			} else
1772 1765
 			{
1773 1766
 				$query = getScriptPath() . $query;
1774 1767
 			}
@@ -1825,8 +1818,7 @@  discard block
 block discarded – undo
1825 1818
 		if($domain)
1826 1819
 		{
1827 1820
 			$domain_key = md5($domain);
1828
-		}
1829
-		else
1821
+		} else
1830 1822
 		{
1831 1823
 			$domain_key = 'default';
1832 1824
 		}
@@ -1855,8 +1847,7 @@  discard block
 block discarded – undo
1855 1847
 			{
1856 1848
 				$target_url.= '/';
1857 1849
 			}
1858
-		}
1859
-		else
1850
+		} else
1860 1851
 		{
1861 1852
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1862 1853
 		}
@@ -1874,20 +1865,17 @@  discard block
 block discarded – undo
1874 1865
 			if($port && $port != 443)
1875 1866
 			{
1876 1867
 				$url_info['port'] = $port;
1877
-			}
1878
-			elseif($url_info['port'] == 443)
1868
+			} elseif($url_info['port'] == 443)
1879 1869
 			{
1880 1870
 				unset($url_info['port']);
1881 1871
 			}
1882
-		}
1883
-		else
1872
+		} else
1884 1873
 		{
1885 1874
 			$port = self::get('_http_port');
1886 1875
 			if($port && $port != 80)
1887 1876
 			{
1888 1877
 				$url_info['port'] = $port;
1889
-			}
1890
-			elseif($url_info['port'] == 80)
1878
+			} elseif($url_info['port'] == 80)
1891 1879
 			{
1892 1880
 				unset($url_info['port']);
1893 1881
 			}
@@ -2124,8 +2112,7 @@  discard block
 block discarded – undo
2124 2112
 		if(strpos($file, './') === 0)
2125 2113
 		{
2126 2114
 			$file = $script_path . substr($file, 2);
2127
-		}
2128
-		elseif(strpos($file, '../') === 0)
2115
+		} elseif(strpos($file, '../') === 0)
2129 2116
 		{
2130 2117
 			$file = self::normalizeFilePath($script_path . $file);
2131 2118
 		}
@@ -2387,8 +2374,7 @@  discard block
 block discarded – undo
2387 2374
 			if(substr_compare($filename, '.js', -3) === 0)
2388 2375
 			{
2389 2376
 				$result->jsList[] = $plugin_path . $filename;
2390
-			}
2391
-			elseif(substr_compare($filename, '.css', -4) === 0)
2377
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2392 2378
 			{
2393 2379
 				$result->cssList[] = $plugin_path . $filename;
2394 2380
 			}
@@ -2645,8 +2631,7 @@  discard block
 block discarded – undo
2645 2631
 			if(count($_base) > 0)
2646 2632
 			{
2647 2633
 				array_shift($_base);
2648
-			}
2649
-			else
2634
+			} else
2650 2635
 			{
2651 2636
 				array_unshift($_base, '..');
2652 2637
 			}
Please login to merge, or discard this patch.
classes/display/VirtualXMLDisplayHandler.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,35 +17,35 @@
 block discarded – undo
17 17
 		$request_url = Context::getRequestUri();
18 18
 		$output = new stdClass();
19 19
 
20
-		if(substr_compare($request_url, '/', -1) !== 0)
20
+		if (substr_compare($request_url, '/', -1) !== 0)
21 21
 		{
22 22
 			$request_url .= '/';
23 23
 		}
24 24
 
25
-		if($error === 0)
25
+		if ($error === 0)
26 26
 		{
27
-			if($message != 'success') $output->message = $message;
27
+			if ($message != 'success') $output->message = $message;
28 28
 
29 29
 			$output->url = ($redirect_url) ? $redirect_url : $request_uri;
30 30
 		}
31 31
 		else
32 32
 		{
33
-			if($message != 'fail') $output->message = $message;
33
+			if ($message != 'fail') $output->message = $message;
34 34
 		}
35 35
 
36 36
 		$html = array();
37 37
 		$html[] = '<!DOCTYPE html><html><head><title>Moved...</title><meta charset="utf-8" /><script>';
38 38
 
39
-		if($output->message)
39
+		if ($output->message)
40 40
 		{
41
-			$html[] = 'alert(' . json_encode($output->message, JSON_UNESCAPED_SLASHES) . ');';
41
+			$html[] = 'alert('.json_encode($output->message, JSON_UNESCAPED_SLASHES).');';
42 42
 		}
43 43
 
44
-		if($output->url)
44
+		if ($output->url)
45 45
 		{
46 46
 			$url = json_encode(preg_replace('/#(.+)$/i', '', $output->url), JSON_UNESCAPED_SLASHES);
47 47
 			$html[] = 'var win = (window.opener) ? window.opener : window.parent;';
48
-			$html[] = 'win.location.href = ' . $url;
48
+			$html[] = 'win.location.href = '.$url;
49 49
 			$html[] = 'if(window.opener) self.close();';
50 50
 		}
51 51
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,13 +24,16 @@
 block discarded – undo
24 24
 
25 25
 		if($error === 0)
26 26
 		{
27
-			if($message != 'success') $output->message = $message;
27
+			if($message != 'success') {
28
+				$output->message = $message;
29
+			}
28 30
 
29 31
 			$output->url = ($redirect_url) ? $redirect_url : $request_uri;
30
-		}
31
-		else
32
+		} else
32 33
 		{
33
-			if($message != 'fail') $output->message = $message;
34
+			if($message != 'fail') {
35
+				$output->message = $message;
36
+			}
34 37
 		}
35 38
 
36 39
 		$html = array();
Please login to merge, or discard this patch.