GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 6c018e...f9f436 )
by gyeong-won
13:36 queued 11s
created
config/func.inc.php 1 patch
Doc Comments   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  * @param string $module_name The module name to get a instance
75 75
  * @param string $type disp, proc, controller, class
76 76
  * @param string $kind admin, null
77
- * @return mixed Module instance
77
+ * @return ModuleObject Module instance
78 78
  */
79 79
 function getModule($module_name, $type = 'view', $kind = '')
80 80
 {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * Create a controller instance of the module
86 86
  *
87 87
  * @param string $module_name The module name to get a controller instance
88
- * @return mixed Module controller instance
88
+ * @return ModuleObject Module controller instance
89 89
  */
90 90
 function getController($module_name)
91 91
 {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * Create a admin controller instance of the module
97 97
  *
98 98
  * @param string $module_name The module name to get a admin controller instance
99
- * @return mixed Module admin controller instance
99
+ * @return ModuleObject Module admin controller instance
100 100
  */
101 101
 function getAdminController($module_name)
102 102
 {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * Create a view instance of the module
108 108
  *
109 109
  * @param string $module_name The module name to get a view instance
110
- * @return mixed Module view instance
110
+ * @return ModuleObject Module view instance
111 111
  */
112 112
 function getView($module_name)
113 113
 {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  * Create a mobile instance of the module
119 119
  *
120 120
  * @param string $module_name The module name to get a mobile instance
121
- * @return mixed Module mobile instance
121
+ * @return ModuleObject Module mobile instance
122 122
  */
123 123
 function &getMobile($module_name)
124 124
 {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * Create a admin view instance of the module
130 130
  *
131 131
  * @param string $module_name The module name to get a admin view instance
132
- * @return mixed Module admin view instance
132
+ * @return ModuleObject Module admin view instance
133 133
  */
134 134
 function getAdminView($module_name)
135 135
 {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * Create a model instance of the module
141 141
  *
142 142
  * @param string $module_name The module name to get a model instance
143
- * @return mixed Module model instance
143
+ * @return ModuleObject Module model instance
144 144
  */
145 145
 function getModel($module_name)
146 146
 {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  * Create an admin model instance of the module
152 152
  *
153 153
  * @param string $module_name The module name to get a admin model instance
154
- * @return mixed Module admin model instance
154
+ * @return ModuleObject Module admin model instance
155 155
  */
156 156
 function getAdminModel($module_name)
157 157
 {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  * Create an api instance of the module
163 163
  *
164 164
  * @param string $module_name The module name to get a api instance
165
- * @return mixed Module api class instance
165
+ * @return ModuleObject Module api class instance
166 166
  */
167 167
 function getAPI($module_name)
168 168
 {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * Create a wap instance of the module
174 174
  *
175 175
  * @param string $module_name The module name to get a wap instance
176
- * @return mixed Module wap class instance
176
+ * @return ModuleObject Module wap class instance
177 177
  */
178 178
 function getWAP($module_name)
179 179
 {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
  * Create a class instance of the module
185 185
  *
186 186
  * @param string $module_name The module name to get a class instance
187
- * @return mixed Module class instance
187
+ * @return ModuleObject Module class instance
188 188
  */
189 189
 function getClass($module_name)
190 190
 {
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
  * Return if domain of the virtual site is url type or id type
491 491
  *
492 492
  * @param string $domain
493
- * @return bool
493
+ * @return integer
494 494
  */
495 495
 function isSiteID($domain)
496 496
 {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 /**
560 560
  * Get a time gap between server's timezone and XE's timezone
561 561
  *
562
- * @return int
562
+ * @return double
563 563
  */
564 564
 function zgap()
565 565
 {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
  * Display $buff contents into the file ./files/_debug_message.php.
798 798
  * You can see the file on your prompt by command: tail-f./files/_debug_message.php
799 799
  *
800
- * @param mixed $debug_output Target object to be printed
800
+ * @param string $debug_output Target object to be printed
801 801
  * @param bool $display_option boolean Flag whether to print seperator (default:true)
802 802
  * @param string $file Target file name
803 803
  * @return void
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 /**
905 905
  * @param string $type query, trigger
906 906
  * @param float $elapsed_time
907
- * @param object $obj
907
+ * @param stdClass $obj
908 908
  */
909 909
 function writeSlowlog($type, $elapsed_time, $obj)
910 910
 {
@@ -1685,6 +1685,9 @@  discard block
 block discarded – undo
1685 1685
 	}
1686 1686
 }
1687 1687
 
1688
+/**
1689
+ * @param string $key
1690
+ */
1688 1691
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1689 1692
 {
1690 1693
 	if($requestKey != $dbKey)
@@ -1781,6 +1784,9 @@  discard block
 block discarded – undo
1781 1784
 }
1782 1785
 
1783 1786
 
1787
+/**
1788
+ * @param string $str
1789
+ */
1784 1790
 function isDefinedLangCode($str)
1785 1791
 {
1786 1792
 	return preg_match('!^\$user_lang->([a-z0-9\_]+)$!is', trim($str));
Please login to merge, or discard this patch.
classes/security/UploadFileFilter.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			return false;
43 43
 		}
44 44
 
45
-		if($mimetype)
45
+		if ($mimetype)
46 46
 		{
47 47
 			if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif')) && $mimetype !== 'image')
48 48
 			{
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 	protected static function _getMimetype($file, $trim_subtype = false)
168 168
 	{
169
-		if(!extension_loaded('fileinfo'))
169
+		if (!extension_loaded('fileinfo'))
170 170
 		{
171 171
 			return false;
172 172
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$mime_type = finfo_file($finfo, $file);
176 176
 		finfo_close($finfo);
177 177
 
178
-		if($trim_subtype)
178
+		if ($trim_subtype)
179 179
 		{
180 180
 			$mime_type = strstr($mime_type, '/', true);
181 181
 		}
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Spacing   +314 added lines, -314 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 			);
343 343
 		}
344 344
 
345
-		if($sess = $_POST[session_name()]) session_id($sess);
345
+		if ($sess = $_POST[session_name()]) session_id($sess);
346 346
 		session_start();
347 347
 
348 348
 		// set authentication information in Context and session
349
-		if(self::isInstalled())
349
+		if (self::isInstalled())
350 350
 		{
351 351
 			$oModuleModel = getModel('module');
352 352
 			$oModuleModel->loadModuleExtends();
@@ -354,15 +354,15 @@  discard block
 block discarded – undo
354 354
 			$oMemberModel = getModel('member');
355 355
 			$oMemberController = getController('member');
356 356
 
357
-			if($oMemberController && $oMemberModel)
357
+			if ($oMemberController && $oMemberModel)
358 358
 			{
359 359
 				// if signed in, validate it.
360
-				if($oMemberModel->isLogged())
360
+				if ($oMemberModel->isLogged())
361 361
 				{
362 362
 					$oMemberController->setSessionInfo();
363 363
 				}
364 364
 				// check auto sign-in
365
-				elseif($_COOKIE['xeak'])
365
+				elseif ($_COOKIE['xeak'])
366 366
 				{
367 367
 					$oMemberController->doAutologin();
368 368
 				}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
 		// load common language file
376 376
 		$this->lang = &$GLOBALS['lang'];
377
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
377
+		$this->loadLang(_XE_PATH_.'common/lang/');
378 378
 
379 379
 		// check if using rewrite module
380 380
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -382,28 +382,28 @@  discard block
 block discarded – undo
382 382
 		// set locations for javascript use
383 383
 		$url = array();
384 384
 		$current_url = self::getRequestUri();
385
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
385
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
386 386
 		{
387
-			if($this->get_vars)
387
+			if ($this->get_vars)
388 388
 			{
389 389
 				$url = array();
390
-				foreach($this->get_vars as $key => $val)
390
+				foreach ($this->get_vars as $key => $val)
391 391
 				{
392
-					if(is_array($val) && count($val) > 0)
392
+					if (is_array($val) && count($val) > 0)
393 393
 					{
394
-						foreach($val as $k => $v)
394
+						foreach ($val as $k => $v)
395 395
 						{
396
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396
+							$url[] = $key.'['.$k.']='.urlencode($v);
397 397
 						}
398 398
 					}
399
-					elseif($val)
399
+					elseif ($val)
400 400
 					{
401
-						$url[] = $key . '=' . urlencode($val);
401
+						$url[] = $key.'='.urlencode($val);
402 402
 					}
403 403
 				}
404 404
 
405 405
 				$current_url = self::getRequestUri();
406
-				if($url) $current_url .= '?' . join('&', $url);
406
+				if ($url) $current_url .= '?'.join('&', $url);
407 407
 			}
408 408
 			else
409 409
 			{
@@ -418,12 +418,12 @@  discard block
 block discarded – undo
418 418
 		$this->set('current_url', $current_url);
419 419
 		$this->set('request_uri', self::getRequestUri());
420 420
 
421
-		if(strpos($current_url, 'xn--') !== FALSE)
421
+		if (strpos($current_url, 'xn--') !== FALSE)
422 422
 		{
423 423
 			$this->set('current_url', self::decodeIdna($current_url));
424 424
 		}
425 425
 
426
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
426
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
427 427
 		{
428 428
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
429 429
 		}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	{
449 449
 		$self = self::getInstance();
450 450
 
451
-		if(!$self->isInstalled())
451
+		if (!$self->isInstalled())
452 452
 		{
453 453
 			return;
454 454
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		ob_end_clean();
459 459
 
460 460
 		// If master_db information does not exist, the config file needs to be updated
461
-		if(!isset($db_info->master_db))
461
+		if (!isset($db_info->master_db))
462 462
 		{
463 463
 			$db_info->master_db = array();
464 464
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
477 477
 			unset($db_info->db_table_prefix);
478 478
 
479
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
479
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
480 480
 			{
481 481
 				$db_info->master_db["db_table_prefix"] .= '_';
482 482
 			}
@@ -488,42 +488,42 @@  discard block
 block discarded – undo
488 488
 			$oInstallController->makeConfigFile();
489 489
 		}
490 490
 
491
-		if(version_compare(PHP_VERSION, '7.0', '>='))
491
+		if (version_compare(PHP_VERSION, '7.0', '>='))
492 492
 		{
493 493
 			$db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]);
494
-			foreach($db_info->slave_db as &$slave_db_info)
494
+			foreach ($db_info->slave_db as &$slave_db_info)
495 495
 			{
496 496
 				$slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]);
497 497
 			}
498 498
 		}
499 499
 
500
-		if(!$db_info->use_prepared_statements)
500
+		if (!$db_info->use_prepared_statements)
501 501
 		{
502 502
 			$db_info->use_prepared_statements = 'Y';
503 503
 		}
504 504
 
505
-		if(!$db_info->time_zone)
505
+		if (!$db_info->time_zone)
506 506
 			$db_info->time_zone = date('O');
507 507
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
508 508
 
509
-		if($db_info->qmail_compatibility != 'Y')
509
+		if ($db_info->qmail_compatibility != 'Y')
510 510
 			$db_info->qmail_compatibility = 'N';
511 511
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
512 512
 
513
-		if(!$db_info->use_db_session)
513
+		if (!$db_info->use_db_session)
514 514
 			$db_info->use_db_session = 'N';
515
-		if(!$db_info->use_ssl)
515
+		if (!$db_info->use_ssl)
516 516
 			$db_info->use_ssl = 'none';
517 517
 		$this->set('_use_ssl', $db_info->use_ssl);
518 518
 
519 519
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
520 520
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
521 521
 
522
-		if(!$db_info->sitelock_whitelist) {
522
+		if (!$db_info->sitelock_whitelist) {
523 523
 			$db_info->sitelock_whitelist = '127.0.0.1';
524 524
 		}
525 525
 
526
-		if(is_string($db_info->sitelock_whitelist)) {
526
+		if (is_string($db_info->sitelock_whitelist)) {
527 527
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
528 528
 		}
529 529
 
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
 	function loadLangSupported()
595 595
 	{
596 596
 		static $lang_supported = null;
597
-		if(!$lang_supported)
597
+		if (!$lang_supported)
598 598
 		{
599
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
600
-			foreach($langs as $val)
599
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
600
+			foreach ($langs as $val)
601 601
 			{
602 602
 				list($lang_prefix, $lang_text) = explode(',', $val);
603 603
 				$lang_text = trim($lang_text);
@@ -615,17 +615,17 @@  discard block
 block discarded – undo
615 615
 	function loadLangSelected()
616 616
 	{
617 617
 		static $lang_selected = null;
618
-		if(!$lang_selected)
618
+		if (!$lang_selected)
619 619
 		{
620
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
621
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
622
-			if(!FileHandler::hasContent($selected_lang_file))
620
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
621
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
622
+			if (!FileHandler::hasContent($selected_lang_file))
623 623
 			{
624
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
624
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
625 625
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
626 626
 			}
627 627
 
628
-			if(!FileHandler::hasContent($selected_lang_file))
628
+			if (!FileHandler::hasContent($selected_lang_file))
629 629
 			{
630 630
 				$buff = FileHandler::readFile($orig_lang_file);
631 631
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 			else
635 635
 			{
636 636
 				$langs = file($selected_lang_file);
637
-				foreach($langs as $val)
637
+				foreach ($langs as $val)
638 638
 				{
639 639
 					list($lang_prefix, $lang_text) = explode(',', $val);
640 640
 					$lang_text = trim($lang_text);
@@ -653,56 +653,56 @@  discard block
 block discarded – undo
653 653
 	function checkSSO()
654 654
 	{
655 655
 		// pass if it's not GET request or XE is not yet installed
656
-		if($this->db_info->use_sso != 'Y' || isCrawler())
656
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
657 657
 		{
658 658
 			return TRUE;
659 659
 		}
660 660
 		$checkActList = array('rss' => 1, 'atom' => 1);
661
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
661
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
662 662
 		{
663 663
 			return TRUE;
664 664
 		}
665 665
 
666 666
 		// pass if default URL is not set
667 667
 		$default_url = trim($this->db_info->default_url);
668
-		if(!$default_url)
668
+		if (!$default_url)
669 669
 		{
670 670
 			return TRUE;
671 671
 		}
672 672
 
673
-		if(substr_compare($default_url, '/', -1) !== 0)
673
+		if (substr_compare($default_url, '/', -1) !== 0)
674 674
 		{
675 675
 			$default_url .= '/';
676 676
 		}
677 677
 
678 678
 		// for sites recieving SSO valdiation
679
-		if($default_url == self::getRequestUri())
679
+		if ($default_url == self::getRequestUri())
680 680
 		{
681
-			if(self::get('url'))
681
+			if (self::get('url'))
682 682
 			{
683 683
 				$url = base64_decode(self::get('url'));
684 684
 				$url_info = parse_url($url);
685
-				if(!Password::checkSignature($url, self::get('sig')))
685
+				if (!Password::checkSignature($url, self::get('sig')))
686 686
 				{
687 687
 					echo self::get('lang')->msg_invalid_request;
688 688
 					return false;
689 689
 				}
690 690
 
691 691
 				$oModuleModel = getModel('module');
692
-				$domain = $url_info['host'] . $url_info['path'];
693
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
692
+				$domain = $url_info['host'].$url_info['path'];
693
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
694 694
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
695 695
 
696
-				if($site_info->site_srl)
696
+				if ($site_info->site_srl)
697 697
 				{
698
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
699
-				$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']);
698
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
699
+				$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']);
700 700
 				}
701 701
 				else
702 702
 				{
703 703
 					$redirect_url = $url;
704 704
 				}
705
-				header('location:' . $redirect_url);
705
+				header('location:'.$redirect_url);
706 706
 
707 707
 				return FALSE;
708 708
 			}
@@ -711,9 +711,9 @@  discard block
 block discarded – undo
711 711
 		else
712 712
 		{
713 713
 			// result handling : set session_name()
714
-			if($session_name = self::get('SSOID'))
714
+			if ($session_name = self::get('SSOID'))
715 715
 			{
716
-				if(!Password::checkSignature($session_name, self::get('sig')))
716
+				if (!Password::checkSignature($session_name, self::get('sig')))
717 717
 				{
718 718
 					echo self::get('lang')->msg_invalid_request;
719 719
 					return false;
@@ -722,17 +722,17 @@  discard block
 block discarded – undo
722 722
 				setcookie(session_name(), $session_name);
723 723
 
724 724
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
725
-				header('location:' . $url);
725
+				header('location:'.$url);
726 726
 				return FALSE;
727 727
 				// send SSO request
728 728
 			}
729
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
729
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
730 730
 			{
731 731
 				setcookie('sso', md5(self::getRequestUri()));
732 732
 				$origin_url = self::getRequestUrl();
733 733
 				$origin_sig = Password::createSignature($origin_url);
734 734
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
735
-				header('location:' . $url);
735
+				header('location:'.$url);
736 736
 				return FALSE;
737 737
 			}
738 738
 		}
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	{
760 760
 		$self = self::getInstance();
761 761
 
762
-		if(!$self->isFTPRegisted())
762
+		if (!$self->isFTPRegisted())
763 763
 		{
764 764
 			return null;
765 765
 		}
@@ -777,15 +777,15 @@  discard block
 block discarded – undo
777 777
 	 */
778 778
 	function addBrowserTitle($site_title)
779 779
 	{
780
-		if(!$site_title)
780
+		if (!$site_title)
781 781
 		{
782 782
 			return;
783 783
 		}
784 784
 		$self = self::getInstance();
785 785
 
786
-		if($self->site_title)
786
+		if ($self->site_title)
787 787
 		{
788
-			$self->site_title .= ' - ' . $site_title;
788
+			$self->site_title .= ' - '.$site_title;
789 789
 		}
790 790
 		else
791 791
 		{
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 */
802 802
 	function setBrowserTitle($site_title)
803 803
 	{
804
-		if(!$site_title)
804
+		if (!$site_title)
805 805
 		{
806 806
 			return;
807 807
 		}
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		$oModuleModel = getModel('module');
834 834
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
835 835
 
836
-		if(isset($moduleConfig->siteTitle))
836
+		if (isset($moduleConfig->siteTitle))
837 837
 		{
838 838
 			return $moduleConfig->siteTitle;
839 839
 		}
@@ -860,30 +860,30 @@  discard block
 block discarded – undo
860 860
 		global $lang;
861 861
 
862 862
 		$self = self::getInstance();
863
-		if(!$self->lang_type)
863
+		if (!$self->lang_type)
864 864
 		{
865 865
 			return;
866 866
 		}
867
-		if(!is_object($lang))
867
+		if (!is_object($lang))
868 868
 		{
869 869
 			$lang = new stdClass;
870 870
 		}
871 871
 
872
-		if(!($filename = $self->_loadXmlLang($path)))
872
+		if (!($filename = $self->_loadXmlLang($path)))
873 873
 		{
874 874
 			$filename = $self->_loadPhpLang($path);
875 875
 		}
876 876
 
877
-		if(!is_array($self->loaded_lang_files))
877
+		if (!is_array($self->loaded_lang_files))
878 878
 		{
879 879
 			$self->loaded_lang_files = array();
880 880
 		}
881
-		if(in_array($filename, $self->loaded_lang_files))
881
+		if (in_array($filename, $self->loaded_lang_files))
882 882
 		{
883 883
 			return;
884 884
 		}
885 885
 
886
-		if($filename && is_readable($filename))
886
+		if ($filename && is_readable($filename))
887 887
 		{
888 888
 			$self->loaded_lang_files[] = $filename;
889 889
 			include($filename);
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
 	{
905 905
 		global $lang;
906 906
 
907
-		if(!$path) return;
907
+		if (!$path) return;
908 908
 
909
-		$_path = 'eval://' . $path;
909
+		$_path = 'eval://'.$path;
910 910
 
911
-		if(in_array($_path, $this->loaded_lang_files))
911
+		if (in_array($_path, $this->loaded_lang_files))
912 912
 		{
913 913
 			return;
914 914
 		}
915 915
 
916
-		if(substr_compare($path, '/', -1) !== 0)
916
+		if (substr_compare($path, '/', -1) !== 0)
917 917
 		{
918 918
 			$path .= '/';
919 919
 		}
920 920
 
921
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
921
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
922 922
 		$content = $oXmlLangParser->getCompileContent();
923 923
 
924
-		if($content)
924
+		if ($content)
925 925
 		{
926 926
 			$this->loaded_lang_files[] = $_path;
927 927
 			eval($content);
@@ -936,9 +936,9 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	function _loadXmlLang($path)
938 938
 	{
939
-		if(!$path) return;
939
+		if (!$path) return;
940 940
 
941
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
941
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
942 942
 		return $oXmlLangParser->compile();
943 943
 	}
944 944
 
@@ -950,22 +950,22 @@  discard block
 block discarded – undo
950 950
 	 */
951 951
 	function _loadPhpLang($path)
952 952
 	{
953
-		if(!$path) return;
953
+		if (!$path) return;
954 954
 
955
-		if(substr_compare($path, '/', -1) !== 0)
955
+		if (substr_compare($path, '/', -1) !== 0)
956 956
 		{
957 957
 			$path .= '/';
958 958
 		}
959
-		$path_tpl = $path . '%s.lang.php';
959
+		$path_tpl = $path.'%s.lang.php';
960 960
 		$file = sprintf($path_tpl, $this->lang_type);
961 961
 
962 962
 		$langs = array('ko', 'en'); // this will be configurable.
963
-		while(!is_readable($file) && $langs[0])
963
+		while (!is_readable($file) && $langs[0])
964 964
 		{
965 965
 			$file = sprintf($path_tpl, array_shift($langs));
966 966
 		}
967 967
 
968
-		if(!is_readable($file))
968
+		if (!is_readable($file))
969 969
 		{
970 970
 			return FALSE;
971 971
 		}
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
 	 */
1008 1008
 	function getLang($code)
1009 1009
 	{
1010
-		if(!$code)
1010
+		if (!$code)
1011 1011
 		{
1012 1012
 			return;
1013 1013
 		}
1014
-		if($GLOBALS['lang']->{$code})
1014
+		if ($GLOBALS['lang']->{$code})
1015 1015
 		{
1016 1016
 			return $GLOBALS['lang']->{$code};
1017 1017
 		}
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	 */
1028 1028
 	function setLang($code, $val)
1029 1029
 	{
1030
-		if(!isset($GLOBALS['lang']))
1030
+		if (!isset($GLOBALS['lang']))
1031 1031
 		{
1032 1032
 			$GLOBALS['lang'] = new stdClass();
1033 1033
 		}
@@ -1052,17 +1052,17 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		$obj = clone $source_obj;
1054 1054
 
1055
-		foreach($charset_list as $charset)
1055
+		foreach ($charset_list as $charset)
1056 1056
 		{
1057
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1057
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1058 1058
 			$flag = self::checkConvertFlag($flag = TRUE);
1059
-			if($flag)
1059
+			if ($flag)
1060 1060
 			{
1061
-				if($charset == 'UTF-8')
1061
+				if ($charset == 'UTF-8')
1062 1062
 				{
1063 1063
 					return $obj;
1064 1064
 				}
1065
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1065
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1066 1066
 				return $obj;
1067 1067
 			}
1068 1068
 		}
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1082 1082
 	{
1083 1083
 		static $flag = TRUE;
1084
-		if($charset)
1084
+		if ($charset)
1085 1085
 		{
1086
-			if(is_array($val))
1087
-				array_walk($val,'Context::checkConvertFlag',$charset);
1088
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1086
+			if (is_array($val))
1087
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1088
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1089 1089
 			else $flag = FALSE;
1090 1090
 		}
1091 1091
 		else
@@ -1109,9 +1109,9 @@  discard block
 block discarded – undo
1109 1109
 	{
1110 1110
 		if (is_array($val))
1111 1111
 		{
1112
-			array_walk($val,'Context::doConvertEncoding',$charset);
1112
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1113 1113
 		}
1114
-		else $val = iconv($charset,'UTF-8',$val);
1114
+		else $val = iconv($charset, 'UTF-8', $val);
1115 1115
 	}
1116 1116
 
1117 1117
 	/**
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	 */
1123 1123
 	function convertEncodingStr($str)
1124 1124
 	{
1125
-        if(!$str) return null;
1125
+        if (!$str) return null;
1126 1126
 		$obj = new stdClass();
1127 1127
 		$obj->str = $str;
1128 1128
 		$obj = self::convertEncoding($obj);
@@ -1131,9 +1131,9 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 	function decodeIdna($domain)
1133 1133
 	{
1134
-		if(strpos($domain, 'xn--') !== FALSE)
1134
+		if (strpos($domain, 'xn--') !== FALSE)
1135 1135
 		{
1136
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1136
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1137 1137
 			$IDN = new idna_convert(array('idn_version' => 2008));
1138 1138
 			$domain = $IDN->decode($domain);
1139 1139
 		}
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 	{
1165 1165
 		$self = self::getInstance();
1166 1166
 
1167
-		if($self->response_method)
1167
+		if ($self->response_method)
1168 1168
 		{
1169 1169
 			return $self->response_method;
1170 1170
 		}
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1205 1205
 
1206 1206
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1207
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1207
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1208 1208
 		{
1209 1209
 			$this->isSuccessInit = FALSE;
1210 1210
 		}
@@ -1217,30 +1217,30 @@  discard block
 block discarded – undo
1217 1217
 	 */
1218 1218
 	function _setRequestArgument()
1219 1219
 	{
1220
-		if(!count($_REQUEST))
1220
+		if (!count($_REQUEST))
1221 1221
 		{
1222 1222
 			return;
1223 1223
 		}
1224 1224
 
1225 1225
 		$requestMethod = $this->getRequestMethod();
1226
-		foreach($_REQUEST as $key => $val)
1226
+		foreach ($_REQUEST as $key => $val)
1227 1227
 		{
1228
-			if($val === '' || self::get($key))
1228
+			if ($val === '' || self::get($key))
1229 1229
 			{
1230 1230
 				continue;
1231 1231
 			}
1232 1232
 			$key = htmlentities($key);
1233 1233
 			$val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET'));
1234 1234
 
1235
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1235
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1236 1236
 			{
1237 1237
 				$set_to_vars = TRUE;
1238 1238
 			}
1239
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1239
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1240 1240
 			{
1241 1241
 				$set_to_vars = TRUE;
1242 1242
 			}
1243
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1243
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244 1244
 			{
1245 1245
 				$set_to_vars = TRUE;
1246 1246
 			}
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 				$set_to_vars = FALSE;
1250 1250
 			}
1251 1251
 
1252
-			if($set_to_vars)
1252
+			if ($set_to_vars)
1253 1253
 			{
1254 1254
 				$this->_recursiveCheckVar($val);
1255 1255
 			}
@@ -1260,20 +1260,20 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
 	function _recursiveCheckVar($val)
1262 1262
 	{
1263
-		if(is_string($val))
1263
+		if (is_string($val))
1264 1264
 		{
1265
-			foreach($this->patterns as $pattern)
1265
+			foreach ($this->patterns as $pattern)
1266 1266
 			{
1267
-				if(preg_match($pattern, $val))
1267
+				if (preg_match($pattern, $val))
1268 1268
 				{
1269 1269
 					$this->isSuccessInit = FALSE;
1270 1270
 					return;
1271 1271
 				}
1272 1272
 			}
1273 1273
 		}
1274
-		else if(is_array($val))
1274
+		else if (is_array($val))
1275 1275
 		{
1276
-			foreach($val as $val2)
1276
+			foreach ($val as $val2)
1277 1277
 			{
1278 1278
 				$this->_recursiveCheckVar($val2);
1279 1279
 			}
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 	 */
1288 1288
 	function _setJSONRequestArgument()
1289 1289
 	{
1290
-		if($this->getRequestMethod() != 'JSON')
1290
+		if ($this->getRequestMethod() != 'JSON')
1291 1291
 		{
1292 1292
 			return;
1293 1293
 		}
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 		$params = array();
1296 1296
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1297 1297
 
1298
-		foreach($params as $key => $val)
1298
+		foreach ($params as $key => $val)
1299 1299
 		{
1300 1300
 			$key = htmlentities($key);
1301 1301
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
@@ -1309,13 +1309,13 @@  discard block
 block discarded – undo
1309 1309
 	 */
1310 1310
 	function _setXmlRpcArgument()
1311 1311
 	{
1312
-		if($this->getRequestMethod() != 'XMLRPC')
1312
+		if ($this->getRequestMethod() != 'XMLRPC')
1313 1313
 		{
1314 1314
 			return;
1315 1315
 		}
1316 1316
 
1317 1317
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1318
-		if(Security::detectingXEE($xml))
1318
+		if (Security::detectingXEE($xml))
1319 1319
 		{
1320 1320
 			header("HTTP/1.0 400 Bad Request");
1321 1321
 			exit;
@@ -1327,12 +1327,12 @@  discard block
 block discarded – undo
1327 1327
 		$params = $xml_obj->methodcall->params;
1328 1328
 		unset($params->node_name, $params->attrs, $params->body);
1329 1329
 
1330
-		if(!count(get_object_vars($params)))
1330
+		if (!count(get_object_vars($params)))
1331 1331
 		{
1332 1332
 			return;
1333 1333
 		}
1334 1334
 
1335
-		foreach($params as $key => $val)
1335
+		foreach ($params as $key => $val)
1336 1336
 		{
1337 1337
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1338 1338
 		}
@@ -1347,10 +1347,10 @@  discard block
 block discarded – undo
1347 1347
 	 */
1348 1348
 	function _filterXmlVars($key, $val)
1349 1349
 	{
1350
-		if(is_array($val))
1350
+		if (is_array($val))
1351 1351
 		{
1352 1352
 			$stack = array();
1353
-			foreach($val as $k => $v)
1353
+			foreach ($val as $k => $v)
1354 1354
 			{
1355 1355
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1356 1356
 			}
@@ -1360,20 +1360,20 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
 		$body = $val->body;
1362 1362
 		unset($val->node_name, $val->attrs, $val->body);
1363
-		if(!count(get_object_vars($val)))
1363
+		if (!count(get_object_vars($val)))
1364 1364
 		{
1365 1365
 			return $this->_filterRequestVar($key, $body, 0);
1366 1366
 		}
1367 1367
 
1368 1368
 		$stack = new stdClass();
1369
-		foreach($val as $k => $v)
1369
+		foreach ($val as $k => $v)
1370 1370
 		{
1371 1371
 			$output = $this->_filterXmlVars($k, $v);
1372
-			if(is_object($v) && $v->attrs->type == 'array')
1372
+			if (is_object($v) && $v->attrs->type == 'array')
1373 1373
 			{
1374 1374
 				$output = array($output);
1375 1375
 			}
1376
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1376
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1377 1377
 			{
1378 1378
 				return $output;
1379 1379
 			}
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 			$stack->{$k} = $output;
1382 1382
 		}
1383 1383
 
1384
-		if(!count(get_object_vars($stack)))
1384
+		if (!count(get_object_vars($stack)))
1385 1385
 		{
1386 1386
 			return NULL;
1387 1387
 		}
@@ -1400,42 +1400,42 @@  discard block
 block discarded – undo
1400 1400
 	 */
1401 1401
 	function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false)
1402 1402
 	{
1403
-		if(!($isArray = is_array($val)))
1403
+		if (!($isArray = is_array($val)))
1404 1404
 		{
1405 1405
 			$val = array($val);
1406 1406
 		}
1407 1407
 
1408 1408
 		$result = array();
1409
-		foreach($val as $k => $v)
1409
+		foreach ($val as $k => $v)
1410 1410
 		{
1411 1411
 			$k = escape($k);
1412 1412
 			$result[$k] = $v;
1413 1413
 
1414
-			if($remove_hack && !is_array($result[$k])) {
1415
-				if(stripos($result[$k], '<script') || stripos($result[$k], 'lt;script') || stripos($result[$k], '%3Cscript'))
1414
+			if ($remove_hack && !is_array($result[$k])) {
1415
+				if (stripos($result[$k], '<script') || stripos($result[$k], 'lt;script') || stripos($result[$k], '%3Cscript'))
1416 1416
 				{
1417 1417
 					$result[$k] = escape($result[$k]);
1418 1418
 				}
1419 1419
 			}
1420 1420
 
1421
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1421
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1422 1422
 			{
1423 1423
 				$result[$k] = !preg_match('/^[0-9,]+$/', $result[$k]) ? (int) $result[$k] : $result[$k];
1424 1424
 			}
1425
-			elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1425
+			elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) {
1426 1426
 				$result[$k] = escape($result[$k], false);
1427 1427
 			}
1428
-			elseif($key === 'vid')
1428
+			elseif ($key === 'vid')
1429 1429
 			{
1430 1430
 				$result[$k] = urlencode($result[$k]);
1431 1431
 			}
1432
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1432
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1433 1433
 			{
1434 1434
 				unset($result[$k]);
1435 1435
 			}
1436 1436
 			else
1437 1437
 			{
1438
-				if(in_array($k, array(
1438
+				if (in_array($k, array(
1439 1439
 					'act',
1440 1440
 					'addon',
1441 1441
 					'cur_mid',
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 					$result[$k] = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', $result[$k]));
1457 1457
 				}
1458 1458
 
1459
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1459
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1460 1460
 				{
1461 1461
 					if (is_array($result[$k]))
1462 1462
 					{
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
 					}
1469 1469
 				}
1470 1470
 
1471
-				if(is_array($result[$k]))
1471
+				if (is_array($result[$k]))
1472 1472
 				{
1473 1473
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1474 1474
 				}
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 					$result[$k] = trim($result[$k]);
1478 1478
 				}
1479 1479
 
1480
-				if($remove_hack)
1480
+				if ($remove_hack)
1481 1481
 				{
1482 1482
 					$result[$k] = escape($result[$k], false);
1483 1483
 				}
@@ -1505,18 +1505,18 @@  discard block
 block discarded – undo
1505 1505
 	 */
1506 1506
 	function _setUploadedArgument()
1507 1507
 	{
1508
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1508
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1509 1509
 		{
1510 1510
 			return;
1511 1511
 		}
1512 1512
 
1513
-		foreach($_FILES as $key => $val)
1513
+		foreach ($_FILES as $key => $val)
1514 1514
 		{
1515 1515
 			$tmp_name = $val['tmp_name'];
1516 1516
 
1517
-			if(!is_array($tmp_name))
1517
+			if (!is_array($tmp_name))
1518 1518
 			{
1519
-				if(!UploadFileFilter::check($tmp_name, $val['name']))
1519
+				if (!UploadFileFilter::check($tmp_name, $val['name']))
1520 1520
 				{
1521 1521
 					unset($_FILES[$key]);
1522 1522
 					continue;
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 				$files = array();
1531 1531
 				foreach ($tmp_name as $i => $j)
1532 1532
 				{
1533
-					if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1533
+					if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1534 1534
 					{
1535 1535
 						$files = array();
1536 1536
 						unset($_FILES[$key]);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 					$file['size'] = $val['size'][$i];
1545 1545
 					$files[] = $file;
1546 1546
 				}
1547
-				if(count($files))
1547
+				if (count($files))
1548 1548
 				{
1549 1549
 					self::set($key, $files, true);
1550 1550
 				}
@@ -1569,16 +1569,16 @@  discard block
 block discarded – undo
1569 1569
 	function getRequestUrl()
1570 1570
 	{
1571 1571
 		static $url = null;
1572
-		if(is_null($url))
1572
+		if (is_null($url))
1573 1573
 		{
1574 1574
 			$url = self::getRequestUri();
1575
-			if(count($_GET) > 0)
1575
+			if (count($_GET) > 0)
1576 1576
 			{
1577
-				foreach($_GET as $key => $val)
1577
+				foreach ($_GET as $key => $val)
1578 1578
 				{
1579
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1579
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1580 1580
 				}
1581
-				$url .= '?' . join('&', $vars);
1581
+				$url .= '?'.join('&', $vars);
1582 1582
 			}
1583 1583
 		}
1584 1584
 		return $url;
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 		$self = self::getInstance();
1594 1594
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1595 1595
 
1596
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1596
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1597 1597
 		{
1598 1598
 			unset($js_callback_func);
1599 1599
 			unset($_GET['xe_js_callback']);
@@ -1621,22 +1621,22 @@  discard block
 block discarded – undo
1621 1621
 		$self = self::getInstance();
1622 1622
 
1623 1623
 		// retrieve virtual site information
1624
-		if(is_null($site_module_info))
1624
+		if (is_null($site_module_info))
1625 1625
 		{
1626 1626
 			$site_module_info = self::get('site_module_info');
1627 1627
 		}
1628 1628
 
1629 1629
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1630
-		if($domain && isSiteID($domain))
1630
+		if ($domain && isSiteID($domain))
1631 1631
 		{
1632 1632
 			$vid = $domain;
1633 1633
 			$domain = '';
1634 1634
 		}
1635 1635
 
1636 1636
 		// If $domain, $vid are not set, use current site information
1637
-		if(!$domain && !$vid)
1637
+		if (!$domain && !$vid)
1638 1638
 		{
1639
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1639
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1640 1640
 			{
1641 1641
 				$vid = $site_module_info->domain;
1642 1642
 			}
@@ -1647,21 +1647,21 @@  discard block
 block discarded – undo
1647 1647
 		}
1648 1648
 
1649 1649
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1650
-		if($domain)
1650
+		if ($domain)
1651 1651
 		{
1652 1652
 			$domain_info = parse_url($domain);
1653
-			if(is_null($current_info))
1653
+			if (is_null($current_info))
1654 1654
 			{
1655
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1655
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1656 1656
 			}
1657
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1657
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1658 1658
 			{
1659 1659
 				unset($domain);
1660 1660
 			}
1661 1661
 			else
1662 1662
 			{
1663 1663
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1664
-				if(substr_compare($domain, '/', -1) !== 0)
1664
+				if (substr_compare($domain, '/', -1) !== 0)
1665 1665
 				{
1666 1666
 					$domain .= '/';
1667 1667
 				}
@@ -1671,41 +1671,41 @@  discard block
 block discarded – undo
1671 1671
 		$get_vars = array();
1672 1672
 
1673 1673
 		// If there is no GET variables or first argument is '' to reset variables
1674
-		if(!$self->get_vars || $args_list[0] == '')
1674
+		if (!$self->get_vars || $args_list[0] == '')
1675 1675
 		{
1676 1676
 			// rearrange args_list
1677
-			if(is_array($args_list) && $args_list[0] == '')
1677
+			if (is_array($args_list) && $args_list[0] == '')
1678 1678
 			{
1679 1679
 				array_shift($args_list);
1680 1680
 			}
1681 1681
 		}
1682
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1682
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1683 1683
 		{
1684 1684
 			// Otherwise, make GET variables into array
1685 1685
 			$get_vars = get_object_vars($self->get_vars);
1686 1686
 		}
1687 1687
 		else
1688 1688
 		{
1689
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1690
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1691
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1692
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1693
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1694
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1695
-			if($get_vars['act'] == 'IS')
1689
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1690
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1691
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1692
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1693
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1694
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1695
+			if ($get_vars['act'] == 'IS')
1696 1696
 			{
1697
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1697
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1698 1698
 			}
1699 1699
 		}
1700 1700
 
1701 1701
 		// arrange args_list
1702
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1702
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1703 1703
 		{
1704 1704
 			$key = $args_list[$i];
1705 1705
 			$val = trim($args_list[$i + 1]);
1706 1706
 
1707 1707
 			// If value is not set, remove the key
1708
-			if(!isset($val) || !strlen($val))
1708
+			if (!isset($val) || !strlen($val))
1709 1709
 			{
1710 1710
 				unset($get_vars[$key]);
1711 1711
 				continue;
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 
1717 1717
 		// remove vid, rnd
1718 1718
 		unset($get_vars['rnd']);
1719
-		if($vid)
1719
+		if ($vid)
1720 1720
 		{
1721 1721
 			$get_vars['vid'] = $vid;
1722 1722
 		}
@@ -1733,17 +1733,17 @@  discard block
 block discarded – undo
1733 1733
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1734 1734
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1735 1735
 		);
1736
-		if($act_alias[$act])
1736
+		if ($act_alias[$act])
1737 1737
 		{
1738 1738
 			$get_vars['act'] = $act_alias[$act];
1739 1739
 		}
1740 1740
 
1741 1741
 		// organize URL
1742 1742
 		$query = '';
1743
-		if(count($get_vars) > 0)
1743
+		if (count($get_vars) > 0)
1744 1744
 		{
1745 1745
 			// if using rewrite mod
1746
-			if($self->allow_rewrite)
1746
+			if ($self->allow_rewrite)
1747 1747
 			{
1748 1748
 				$var_keys = array_keys($get_vars);
1749 1749
 				sort($var_keys);
@@ -1763,8 +1763,8 @@  discard block
 block discarded – undo
1763 1763
 					'vid' => $vid,
1764 1764
 					'mid' => $mid,
1765 1765
 					'mid.vid' => "$vid/$mid",
1766
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1767
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1766
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1767
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1768 1768
 					'document_srl' => $srl,
1769 1769
 					'document_srl.mid' => "$mid/$srl",
1770 1770
 					'document_srl.vid' => "$vid/$srl",
@@ -1781,66 +1781,66 @@  discard block
 block discarded – undo
1781 1781
 				$query = $target_map[$target];
1782 1782
 			}
1783 1783
 
1784
-			if(!$query)
1784
+			if (!$query)
1785 1785
 			{
1786 1786
 				$queries = array();
1787
-				foreach($get_vars as $key => $val)
1787
+				foreach ($get_vars as $key => $val)
1788 1788
 				{
1789
-					if(is_array($val) && count($val) > 0)
1789
+					if (is_array($val) && count($val) > 0)
1790 1790
 					{
1791
-						foreach($val as $k => $v)
1791
+						foreach ($val as $k => $v)
1792 1792
 						{
1793
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1793
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1794 1794
 						}
1795 1795
 					}
1796
-					elseif(!is_array($val))
1796
+					elseif (!is_array($val))
1797 1797
 					{
1798
-						$queries[] = $key . '=' . urlencode($val);
1798
+						$queries[] = $key.'='.urlencode($val);
1799 1799
 					}
1800 1800
 				}
1801
-				if(count($queries) > 0)
1801
+				if (count($queries) > 0)
1802 1802
 				{
1803
-					$query = 'index.php?' . join('&', $queries);
1803
+					$query = 'index.php?'.join('&', $queries);
1804 1804
 				}
1805 1805
 			}
1806 1806
 		}
1807 1807
 
1808 1808
 		// If using SSL always
1809 1809
 		$_use_ssl = $self->get('_use_ssl');
1810
-		if($_use_ssl == 'always')
1810
+		if ($_use_ssl == 'always')
1811 1811
 		{
1812
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1812
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1813 1813
 			// optional SSL use
1814 1814
 		}
1815
-		elseif($_use_ssl == 'optional')
1815
+		elseif ($_use_ssl == 'optional')
1816 1816
 		{
1817 1817
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1818
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1818
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1819 1819
 			// no SSL
1820 1820
 		}
1821 1821
 		else
1822 1822
 		{
1823 1823
 			// currently on SSL but target is not based on SSL
1824
-			if($_SERVER['HTTPS'] == 'on')
1824
+			if ($_SERVER['HTTPS'] == 'on')
1825 1825
 			{
1826
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1826
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1827 1827
 			}
1828
-			else if($domain) // if $domain is set
1828
+			else if ($domain) // if $domain is set
1829 1829
 			{
1830
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1830
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1831 1831
 			}
1832 1832
 			else
1833 1833
 			{
1834
-				$query = getScriptPath() . $query;
1834
+				$query = getScriptPath().$query;
1835 1835
 			}
1836 1836
 		}
1837 1837
 
1838
-		if(!$encode)
1838
+		if (!$encode)
1839 1839
 		{
1840 1840
 			return $query;
1841 1841
 		}
1842 1842
 
1843
-		if(!$autoEncode)
1843
+		if (!$autoEncode)
1844 1844
 		{
1845 1845
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1846 1846
 		}
@@ -1849,16 +1849,16 @@  discard block
 block discarded – undo
1849 1849
 		$encode_queries = array();
1850 1850
 		$parsedUrl = parse_url($query);
1851 1851
 		parse_str($parsedUrl['query'], $output);
1852
-		foreach($output as $key => $value)
1852
+		foreach ($output as $key => $value)
1853 1853
 		{
1854
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1854
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1855 1855
 			{
1856 1856
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1857 1857
 			}
1858
-			$encode_queries[] = $key . '=' . $value;
1858
+			$encode_queries[] = $key.'='.$value;
1859 1859
 		}
1860 1860
 
1861
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1861
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1862 1862
 	}
1863 1863
 
1864 1864
 	/**
@@ -1873,17 +1873,17 @@  discard block
 block discarded – undo
1873 1873
 		static $url = array();
1874 1874
 
1875 1875
 		// Check HTTP Request
1876
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1876
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1877 1877
 		{
1878 1878
 			return;
1879 1879
 		}
1880 1880
 
1881
-		if(self::get('_use_ssl') == 'always')
1881
+		if (self::get('_use_ssl') == 'always')
1882 1882
 		{
1883 1883
 			$ssl_mode = ENFORCE_SSL;
1884 1884
 		}
1885 1885
 
1886
-		if($domain)
1886
+		if ($domain)
1887 1887
 		{
1888 1888
 			$domain_key = md5($domain);
1889 1889
 		}
@@ -1892,14 +1892,14 @@  discard block
 block discarded – undo
1892 1892
 			$domain_key = 'default';
1893 1893
 		}
1894 1894
 
1895
-		if(isset($url[$ssl_mode][$domain_key]))
1895
+		if (isset($url[$ssl_mode][$domain_key]))
1896 1896
 		{
1897 1897
 			return $url[$ssl_mode][$domain_key];
1898 1898
 		}
1899 1899
 
1900 1900
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1901 1901
 
1902
-		switch($ssl_mode)
1902
+		switch ($ssl_mode)
1903 1903
 		{
1904 1904
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1905 1905
 				break;
@@ -1909,34 +1909,34 @@  discard block
 block discarded – undo
1909 1909
 				break;
1910 1910
 		}
1911 1911
 
1912
-		if($domain)
1912
+		if ($domain)
1913 1913
 		{
1914 1914
 			$target_url = trim($domain);
1915
-			if(substr_compare($target_url, '/', -1) !== 0)
1915
+			if (substr_compare($target_url, '/', -1) !== 0)
1916 1916
 			{
1917
-				$target_url.= '/';
1917
+				$target_url .= '/';
1918 1918
 			}
1919 1919
 		}
1920 1920
 		else
1921 1921
 		{
1922
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1922
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1923 1923
 		}
1924 1924
 
1925
-		$url_info = parse_url('http://' . $target_url);
1925
+		$url_info = parse_url('http://'.$target_url);
1926 1926
 
1927
-		if($current_use_ssl != $use_ssl)
1927
+		if ($current_use_ssl != $use_ssl)
1928 1928
 		{
1929 1929
 			unset($url_info['port']);
1930 1930
 		}
1931 1931
 
1932
-		if($use_ssl)
1932
+		if ($use_ssl)
1933 1933
 		{
1934 1934
 			$port = self::get('_https_port');
1935
-			if($port && $port != 443)
1935
+			if ($port && $port != 443)
1936 1936
 			{
1937 1937
 				$url_info['port'] = $port;
1938 1938
 			}
1939
-			elseif($url_info['port'] == 443)
1939
+			elseif ($url_info['port'] == 443)
1940 1940
 			{
1941 1941
 				unset($url_info['port']);
1942 1942
 			}
@@ -1944,17 +1944,17 @@  discard block
 block discarded – undo
1944 1944
 		else
1945 1945
 		{
1946 1946
 			$port = self::get('_http_port');
1947
-			if($port && $port != 80)
1947
+			if ($port && $port != 80)
1948 1948
 			{
1949 1949
 				$url_info['port'] = $port;
1950 1950
 			}
1951
-			elseif($url_info['port'] == 80)
1951
+			elseif ($url_info['port'] == 80)
1952 1952
 			{
1953 1953
 				unset($url_info['port']);
1954 1954
 			}
1955 1955
 		}
1956 1956
 
1957
-		$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']);
1957
+		$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']);
1958 1958
 
1959 1959
 		return $url[$ssl_mode][$domain_key];
1960 1960
 	}
@@ -1971,16 +1971,16 @@  discard block
 block discarded – undo
1971 1971
 	{
1972 1972
 		$self = self::getInstance();
1973 1973
 		$self->context->{$key} = $val;
1974
-		if($set_to_get_vars === FALSE)
1974
+		if ($set_to_get_vars === FALSE)
1975 1975
 		{
1976 1976
 			return;
1977 1977
 		}
1978
-		if($val === NULL || $val === '')
1978
+		if ($val === NULL || $val === '')
1979 1979
 		{
1980 1980
 			unset($self->get_vars->{$key});
1981 1981
 			return;
1982 1982
 		}
1983
-		if($set_to_get_vars || $self->get_vars->{$key})
1983
+		if ($set_to_get_vars || $self->get_vars->{$key})
1984 1984
 		{
1985 1985
 			$self->get_vars->{$key} = $val;
1986 1986
 		}
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 	{
1997 1997
 		$self = self::getInstance();
1998 1998
 
1999
-		if(!isset($self->context->{$key}))
1999
+		if (!isset($self->context->{$key}))
2000 2000
 		{
2001 2001
 			return null;
2002 2002
 		}
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 	function gets()
2012 2012
 	{
2013 2013
 		$num_args = func_num_args();
2014
-		if($num_args < 1)
2014
+		if ($num_args < 1)
2015 2015
 		{
2016 2016
 			return;
2017 2017
 		}
@@ -2019,7 +2019,7 @@  discard block
 block discarded – undo
2019 2019
 
2020 2020
 		$args_list = func_get_args();
2021 2021
 		$output = new stdClass();
2022
-		foreach($args_list as $v)
2022
+		foreach ($args_list as $v)
2023 2023
 		{
2024 2024
 			$output->{$v} = $self->get($v);
2025 2025
 		}
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
 	function getRequestVars()
2046 2046
 	{
2047 2047
 		$self = self::getInstance();
2048
-		if($self->get_vars)
2048
+		if ($self->get_vars)
2049 2049
 		{
2050 2050
 			return clone($self->get_vars);
2051 2051
 		}
@@ -2062,13 +2062,13 @@  discard block
 block discarded – undo
2062 2062
 	{
2063 2063
 		$self = self::getInstance();
2064 2064
 
2065
-		if(!is_readable($self->sslActionCacheFile))
2065
+		if (!is_readable($self->sslActionCacheFile))
2066 2066
 		{
2067 2067
 			$buff = '<?php if(!defined("__XE__"))exit;';
2068 2068
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2069 2069
 		}
2070 2070
 
2071
-		if(!isset($self->ssl_actions[$action]))
2071
+		if (!isset($self->ssl_actions[$action]))
2072 2072
 		{
2073 2073
 			$self->ssl_actions[$action] = 1;
2074 2074
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2086,16 +2086,16 @@  discard block
 block discarded – undo
2086 2086
 	{
2087 2087
 		$self = self::getInstance();
2088 2088
 
2089
-		if(!is_readable($self->sslActionCacheFile))
2089
+		if (!is_readable($self->sslActionCacheFile))
2090 2090
 		{
2091 2091
 			unset($self->ssl_actions);
2092 2092
 			$buff = '<?php if(!defined("__XE__"))exit;';
2093 2093
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2094 2094
 		}
2095 2095
 
2096
-		foreach($action_array as $action)
2096
+		foreach ($action_array as $action)
2097 2097
 		{
2098
-			if(!isset($self->ssl_actions[$action]))
2098
+			if (!isset($self->ssl_actions[$action]))
2099 2099
 			{
2100 2100
 				$self->ssl_actions[$action] = 1;
2101 2101
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 	{
2115 2115
 		$self = self::getInstance();
2116 2116
 
2117
-		if($self->isExistsSSLAction($action))
2117
+		if ($self->isExistsSSLAction($action))
2118 2118
 		{
2119 2119
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2120 2120
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 	function getSSLActions()
2132 2132
 	{
2133 2133
 		$self = self::getInstance();
2134
-		if($self->getSslStatus() == 'optional')
2134
+		if ($self->getSslStatus() == 'optional')
2135 2135
 		{
2136 2136
 			return $self->ssl_actions;
2137 2137
 		}
@@ -2158,12 +2158,12 @@  discard block
 block discarded – undo
2158 2158
 	 */
2159 2159
 	function normalizeFilePath($file)
2160 2160
 	{
2161
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2161
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2162 2162
 		{
2163
-			$file = './' . $file;
2163
+			$file = './'.$file;
2164 2164
 		}
2165 2165
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2166
-		while(strpos($file, '/../') !== FALSE)
2166
+		while (strpos($file, '/../') !== FALSE)
2167 2167
 		{
2168 2168
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2169 2169
 		}
@@ -2182,13 +2182,13 @@  discard block
 block discarded – undo
2182 2182
 	{
2183 2183
 		$file = self::normalizeFilePath($file);
2184 2184
 		$script_path = getScriptPath();
2185
-		if(strpos($file, './') === 0)
2185
+		if (strpos($file, './') === 0)
2186 2186
 		{
2187
-			$file = $script_path . substr($file, 2);
2187
+			$file = $script_path.substr($file, 2);
2188 2188
 		}
2189
-		elseif(strpos($file, '../') === 0)
2189
+		elseif (strpos($file, '../') === 0)
2190 2190
 		{
2191
-			$file = self::normalizeFilePath($script_path . $file);
2191
+			$file = self::normalizeFilePath($script_path.$file);
2192 2192
 		}
2193 2193
 
2194 2194
 		return $file;
@@ -2258,12 +2258,12 @@  discard block
 block discarded – undo
2258 2258
 	 */
2259 2259
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2260 2260
 	{
2261
-		if($isRuleset)
2261
+		if ($isRuleset)
2262 2262
 		{
2263
-			if(strpos($file, '#') !== FALSE)
2263
+			if (strpos($file, '#') !== FALSE)
2264 2264
 			{
2265 2265
 				$file = str_replace('#', '', $file);
2266
-				if(!is_readable($file))
2266
+				if (!is_readable($file))
2267 2267
 				{
2268 2268
 					$file = $autoPath;
2269 2269
 				}
@@ -2328,9 +2328,9 @@  discard block
 block discarded – undo
2328 2328
 		ksort($files);
2329 2329
 		$files = array_values($files);
2330 2330
 		$filenames = array();
2331
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2331
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2332 2332
 		{
2333
-			if(in_array($files[$i]['file'], $filenames))
2333
+			if (in_array($files[$i]['file'], $filenames))
2334 2334
 			{
2335 2335
 				unset($files[$i]);
2336 2336
 			}
@@ -2415,14 +2415,14 @@  discard block
 block discarded – undo
2415 2415
 	 */
2416 2416
 	function getJavascriptPluginInfo($pluginName)
2417 2417
 	{
2418
-		if($plugin_name == 'ui.datepicker')
2418
+		if ($plugin_name == 'ui.datepicker')
2419 2419
 		{
2420 2420
 			$plugin_name = 'ui';
2421 2421
 		}
2422 2422
 
2423
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2424
-		$info_file = $plugin_path . 'plugin.load';
2425
-		if(!is_readable($info_file))
2423
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2424
+		$info_file = $plugin_path.'plugin.load';
2425
+		if (!is_readable($info_file))
2426 2426
 		{
2427 2427
 			return;
2428 2428
 		}
@@ -2432,32 +2432,32 @@  discard block
 block discarded – undo
2432 2432
 		$result->jsList = array();
2433 2433
 		$result->cssList = array();
2434 2434
 
2435
-		foreach($list as $filename)
2435
+		foreach ($list as $filename)
2436 2436
 		{
2437 2437
 			$filename = trim($filename);
2438
-			if(!$filename)
2438
+			if (!$filename)
2439 2439
 			{
2440 2440
 				continue;
2441 2441
 			}
2442 2442
 
2443
-			if(strncasecmp('./', $filename, 2) === 0)
2443
+			if (strncasecmp('./', $filename, 2) === 0)
2444 2444
 			{
2445 2445
 				$filename = substr($filename, 2);
2446 2446
 			}
2447 2447
 
2448
-			if(substr_compare($filename, '.js', -3) === 0)
2448
+			if (substr_compare($filename, '.js', -3) === 0)
2449 2449
 			{
2450
-				$result->jsList[] = $plugin_path . $filename;
2450
+				$result->jsList[] = $plugin_path.$filename;
2451 2451
 			}
2452
-			elseif(substr_compare($filename, '.css', -4) === 0)
2452
+			elseif (substr_compare($filename, '.css', -4) === 0)
2453 2453
 			{
2454
-				$result->cssList[] = $plugin_path . $filename;
2454
+				$result->cssList[] = $plugin_path.$filename;
2455 2455
 			}
2456 2456
 		}
2457 2457
 
2458
-		if(is_dir($plugin_path . 'lang'))
2458
+		if (is_dir($plugin_path.'lang'))
2459 2459
 		{
2460
-			$result->langPath = $plugin_path . 'lang';
2460
+			$result->langPath = $plugin_path.'lang';
2461 2461
 		}
2462 2462
 
2463 2463
 		return $result;
@@ -2473,50 +2473,50 @@  discard block
 block discarded – undo
2473 2473
 		static $loaded_plugins = array();
2474 2474
 
2475 2475
 		$self = self::getInstance();
2476
-		if($plugin_name == 'ui.datepicker')
2476
+		if ($plugin_name == 'ui.datepicker')
2477 2477
 		{
2478 2478
 			$plugin_name = 'ui';
2479 2479
 		}
2480 2480
 
2481
-		if($loaded_plugins[$plugin_name])
2481
+		if ($loaded_plugins[$plugin_name])
2482 2482
 		{
2483 2483
 			return;
2484 2484
 		}
2485 2485
 		$loaded_plugins[$plugin_name] = TRUE;
2486 2486
 
2487
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2488
-		$info_file = $plugin_path . 'plugin.load';
2489
-		if(!is_readable($info_file))
2487
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2488
+		$info_file = $plugin_path.'plugin.load';
2489
+		if (!is_readable($info_file))
2490 2490
 		{
2491 2491
 			return;
2492 2492
 		}
2493 2493
 
2494 2494
 		$list = file($info_file);
2495
-		foreach($list as $filename)
2495
+		foreach ($list as $filename)
2496 2496
 		{
2497 2497
 			$filename = trim($filename);
2498
-			if(!$filename)
2498
+			if (!$filename)
2499 2499
 			{
2500 2500
 				continue;
2501 2501
 			}
2502 2502
 
2503
-			if(strncasecmp('./', $filename, 2) === 0)
2503
+			if (strncasecmp('./', $filename, 2) === 0)
2504 2504
 			{
2505 2505
 				$filename = substr($filename, 2);
2506 2506
 			}
2507
-			if(substr_compare($filename, '.js', -3) === 0)
2507
+			if (substr_compare($filename, '.js', -3) === 0)
2508 2508
 			{
2509
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2509
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2510 2510
 			}
2511
-			if(substr_compare($filename, '.css', -4) === 0)
2511
+			if (substr_compare($filename, '.css', -4) === 0)
2512 2512
 			{
2513
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2513
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2514 2514
 			}
2515 2515
 		}
2516 2516
 
2517
-		if(is_dir($plugin_path . 'lang'))
2517
+		if (is_dir($plugin_path.'lang'))
2518 2518
 		{
2519
-			$self->loadLang($plugin_path . 'lang');
2519
+			$self->loadLang($plugin_path.'lang');
2520 2520
 		}
2521 2521
 	}
2522 2522
 
@@ -2529,7 +2529,7 @@  discard block
 block discarded – undo
2529 2529
 	function addHtmlHeader($header)
2530 2530
 	{
2531 2531
 		$self = self::getInstance();
2532
-		$self->html_header .= "\n" . $header;
2532
+		$self->html_header .= "\n".$header;
2533 2533
 	}
2534 2534
 
2535 2535
 	function clearHtmlHeader()
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
 	function addBodyHeader($header)
2582 2582
 	{
2583 2583
 		$self = self::getInstance();
2584
-		$self->body_header .= "\n" . $header;
2584
+		$self->body_header .= "\n".$header;
2585 2585
 	}
2586 2586
 
2587 2587
 	/**
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 	function addHtmlFooter($footer)
2604 2604
 	{
2605 2605
 		$self = self::getInstance();
2606
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2606
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2607 2607
 	}
2608 2608
 
2609 2609
 	/**
@@ -2624,7 +2624,7 @@  discard block
 block discarded – undo
2624 2624
 	 */
2625 2625
 	function getConfigFile()
2626 2626
 	{
2627
-		return _XE_PATH_ . 'files/config/db.config.php';
2627
+		return _XE_PATH_.'files/config/db.config.php';
2628 2628
 	}
2629 2629
 
2630 2630
 	/**
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
 	 */
2635 2635
 	function getFTPConfigFile()
2636 2636
 	{
2637
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2637
+		return _XE_PATH_.'files/config/ftp.config.php';
2638 2638
 	}
2639 2639
 
2640 2640
 	/**
@@ -2686,14 +2686,14 @@  discard block
 block discarded – undo
2686 2686
 		$_path = explode('/', $path);
2687 2687
 		$_base = explode('/', $base_url);
2688 2688
 
2689
-		if(!$_base[count($_base) - 1])
2689
+		if (!$_base[count($_base) - 1])
2690 2690
 		{
2691 2691
 			array_pop($_base);
2692 2692
 		}
2693 2693
 
2694
-		foreach($_xe as $idx => $dir)
2694
+		foreach ($_xe as $idx => $dir)
2695 2695
 		{
2696
-			if($_path[0] != $dir)
2696
+			if ($_path[0] != $dir)
2697 2697
 			{
2698 2698
 				break;
2699 2699
 			}
@@ -2701,9 +2701,9 @@  discard block
 block discarded – undo
2701 2701
 		}
2702 2702
 
2703 2703
 		$idx = count($_xe) - $idx - 1;
2704
-		while($idx--)
2704
+		while ($idx--)
2705 2705
 		{
2706
-			if(count($_base) > 0)
2706
+			if (count($_base) > 0)
2707 2707
 			{
2708 2708
 				array_shift($_base);
2709 2709
 			}
@@ -2713,13 +2713,13 @@  discard block
 block discarded – undo
2713 2713
 			}
2714 2714
 		}
2715 2715
 
2716
-		if(count($_base) > 0)
2716
+		if (count($_base) > 0)
2717 2717
 		{
2718 2718
 			array_unshift($_path, join('/', $_base));
2719 2719
 		}
2720 2720
 
2721
-		$path = '/' . join('/', $_path);
2722
-		if(substr_compare($path, '/', -1) !== 0)
2721
+		$path = '/'.join('/', $_path);
2722
+		if (substr_compare($path, '/', -1) !== 0)
2723 2723
 		{
2724 2724
 			$path .= '/';
2725 2725
 		}
@@ -2734,13 +2734,13 @@  discard block
 block discarded – undo
2734 2734
 	{
2735 2735
 		$self = self::getInstance();
2736 2736
 
2737
-		if(!is_array($self->meta_tags))
2737
+		if (!is_array($self->meta_tags))
2738 2738
 		{
2739 2739
 			$self->meta_tags = array();
2740 2740
 		}
2741 2741
 
2742 2742
 		$ret = array();
2743
-		foreach($self->meta_tags as $key => $val)
2743
+		foreach ($self->meta_tags as $key => $val)
2744 2744
 		{
2745 2745
 			list($name, $is_http_equiv) = explode("\t", $key);
2746 2746
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2761 2761
 	{
2762 2762
 		$self = self::getInstance();
2763
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2763
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2764 2764
 	}
2765 2765
 
2766 2766
 }
Please login to merge, or discard this patch.
Braces   +108 added lines, -109 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
 		}
@@ -342,7 +342,9 @@  discard block
 block discarded – undo
342 342
 			);
343 343
 		}
344 344
 
345
-		if($sess = $_POST[session_name()]) session_id($sess);
345
+		if($sess = $_POST[session_name()]) {
346
+			session_id($sess);
347
+		}
346 348
 		session_start();
347 349
 
348 350
 		// set authentication information in Context and session
@@ -395,22 +397,21 @@  discard block
 block discarded – undo
395 397
 						{
396 398
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
397 399
 						}
398
-					}
399
-					elseif($val)
400
+					} elseif($val)
400 401
 					{
401 402
 						$url[] = $key . '=' . urlencode($val);
402 403
 					}
403 404
 				}
404 405
 
405 406
 				$current_url = self::getRequestUri();
406
-				if($url) $current_url .= '?' . join('&', $url);
407
-			}
408
-			else
407
+				if($url) {
408
+					$current_url .= '?' . join('&', $url);
409
+				}
410
+			} else
409 411
 			{
410 412
 				$current_url = $this->getUrl();
411 413
 			}
412
-		}
413
-		else
414
+		} else
414 415
 		{
415 416
 			$current_url = self::getRequestUri();
416 417
 		}
@@ -502,18 +503,22 @@  discard block
 block discarded – undo
502 503
 			$db_info->use_prepared_statements = 'Y';
503 504
 		}
504 505
 
505
-		if(!$db_info->time_zone)
506
-			$db_info->time_zone = date('O');
506
+		if(!$db_info->time_zone) {
507
+					$db_info->time_zone = date('O');
508
+		}
507 509
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
508 510
 
509
-		if($db_info->qmail_compatibility != 'Y')
510
-			$db_info->qmail_compatibility = 'N';
511
+		if($db_info->qmail_compatibility != 'Y') {
512
+					$db_info->qmail_compatibility = 'N';
513
+		}
511 514
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
512 515
 
513
-		if(!$db_info->use_db_session)
514
-			$db_info->use_db_session = 'N';
515
-		if(!$db_info->use_ssl)
516
-			$db_info->use_ssl = 'none';
516
+		if(!$db_info->use_db_session) {
517
+					$db_info->use_db_session = 'N';
518
+		}
519
+		if(!$db_info->use_ssl) {
520
+					$db_info->use_ssl = 'none';
521
+		}
517 522
 		$this->set('_use_ssl', $db_info->use_ssl);
518 523
 
519 524
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -630,8 +635,7 @@  discard block
 block discarded – undo
630 635
 				$buff = FileHandler::readFile($orig_lang_file);
631 636
 				FileHandler::writeFile($selected_lang_file, $buff);
632 637
 				$lang_selected = self::loadLangSupported();
633
-			}
634
-			else
638
+			} else
635 639
 			{
636 640
 				$langs = file($selected_lang_file);
637 641
 				foreach($langs as $val)
@@ -690,15 +694,16 @@  discard block
 block discarded – undo
690 694
 
691 695
 				$oModuleModel = getModel('module');
692 696
 				$domain = $url_info['host'] . $url_info['path'];
693
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
697
+				if(substr_compare($domain, '/', -1) === 0) {
698
+					$domain = substr($domain, 0, -1);
699
+				}
694 700
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
695 701
 
696 702
 				if($site_info->site_srl)
697 703
 				{
698 704
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
699 705
 				$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']);
700
-				}
701
-				else
706
+				} else
702 707
 				{
703 708
 					$redirect_url = $url;
704 709
 				}
@@ -707,8 +712,7 @@  discard block
 block discarded – undo
707 712
 				return FALSE;
708 713
 			}
709 714
 			// for sites requesting SSO validation
710
-		}
711
-		else
715
+		} else
712 716
 		{
713 717
 			// result handling : set session_name()
714 718
 			if($session_name = self::get('SSOID'))
@@ -725,8 +729,7 @@  discard block
 block discarded – undo
725 729
 				header('location:' . $url);
726 730
 				return FALSE;
727 731
 				// send SSO request
728
-			}
729
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
732
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
730 733
 			{
731 734
 				setcookie('sso', md5(self::getRequestUri()));
732 735
 				$origin_url = self::getRequestUrl();
@@ -786,8 +789,7 @@  discard block
 block discarded – undo
786 789
 		if($self->site_title)
787 790
 		{
788 791
 			$self->site_title .= ' - ' . $site_title;
789
-		}
790
-		else
792
+		} else
791 793
 		{
792 794
 			$self->site_title = $site_title;
793 795
 		}
@@ -887,8 +889,7 @@  discard block
 block discarded – undo
887 889
 		{
888 890
 			$self->loaded_lang_files[] = $filename;
889 891
 			include($filename);
890
-		}
891
-		else
892
+		} else
892 893
 		{
893 894
 			$self->_evalxmlLang($path);
894 895
 		}
@@ -904,7 +905,9 @@  discard block
 block discarded – undo
904 905
 	{
905 906
 		global $lang;
906 907
 
907
-		if(!$path) return;
908
+		if(!$path) {
909
+			return;
910
+		}
908 911
 
909 912
 		$_path = 'eval://' . $path;
910 913
 
@@ -936,7 +939,9 @@  discard block
 block discarded – undo
936 939
 	 */
937 940
 	function _loadXmlLang($path)
938 941
 	{
939
-		if(!$path) return;
942
+		if(!$path) {
943
+			return;
944
+		}
940 945
 
941 946
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
942 947
 		return $oXmlLangParser->compile();
@@ -950,7 +955,9 @@  discard block
 block discarded – undo
950 955
 	 */
951 956
 	function _loadPhpLang($path)
952 957
 	{
953
-		if(!$path) return;
958
+		if(!$path) {
959
+			return;
960
+		}
954 961
 
955 962
 		if(substr_compare($path, '/', -1) !== 0)
956 963
 		{
@@ -1083,12 +1090,14 @@  discard block
 block discarded – undo
1083 1090
 		static $flag = TRUE;
1084 1091
 		if($charset)
1085 1092
 		{
1086
-			if(is_array($val))
1087
-				array_walk($val,'Context::checkConvertFlag',$charset);
1088
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1089
-			else $flag = FALSE;
1090
-		}
1091
-		else
1093
+			if(is_array($val)) {
1094
+							array_walk($val,'Context::checkConvertFlag',$charset);
1095
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1096
+				$flag = FALSE;
1097
+			} else {
1098
+				$flag = FALSE;
1099
+			}
1100
+		} else
1092 1101
 		{
1093 1102
 			$return = $flag;
1094 1103
 			$flag = TRUE;
@@ -1110,8 +1119,9 @@  discard block
 block discarded – undo
1110 1119
 		if (is_array($val))
1111 1120
 		{
1112 1121
 			array_walk($val,'Context::doConvertEncoding',$charset);
1122
+		} else {
1123
+			$val = iconv($charset,'UTF-8',$val);
1113 1124
 		}
1114
-		else $val = iconv($charset,'UTF-8',$val);
1115 1125
 	}
1116 1126
 
1117 1127
 	/**
@@ -1122,7 +1132,9 @@  discard block
 block discarded – undo
1122 1132
 	 */
1123 1133
 	function convertEncodingStr($str)
1124 1134
 	{
1125
-        if(!$str) return null;
1135
+        if(!$str) {
1136
+        	return null;
1137
+        }
1126 1138
 		$obj = new stdClass();
1127 1139
 		$obj->str = $str;
1128 1140
 		$obj = self::convertEncoding($obj);
@@ -1235,16 +1247,13 @@  discard block
 block discarded – undo
1235 1247
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1236 1248
 			{
1237 1249
 				$set_to_vars = TRUE;
1238
-			}
1239
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1250
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1240 1251
 			{
1241 1252
 				$set_to_vars = TRUE;
1242
-			}
1243
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1253
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244 1254
 			{
1245 1255
 				$set_to_vars = TRUE;
1246
-			}
1247
-			else
1256
+			} else
1248 1257
 			{
1249 1258
 				$set_to_vars = FALSE;
1250 1259
 			}
@@ -1270,8 +1279,7 @@  discard block
 block discarded – undo
1270 1279
 					return;
1271 1280
 				}
1272 1281
 			}
1273
-		}
1274
-		else if(is_array($val))
1282
+		} else if(is_array($val))
1275 1283
 		{
1276 1284
 			foreach($val as $val2)
1277 1285
 			{
@@ -1421,19 +1429,15 @@  discard block
 block discarded – undo
1421 1429
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1422 1430
 			{
1423 1431
 				$result[$k] = !preg_match('/^[0-9,]+$/', $result[$k]) ? (int) $result[$k] : $result[$k];
1424
-			}
1425
-			elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1432
+			} elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1426 1433
 				$result[$k] = escape($result[$k], false);
1427
-			}
1428
-			elseif($key === 'vid')
1434
+			} elseif($key === 'vid')
1429 1435
 			{
1430 1436
 				$result[$k] = urlencode($result[$k]);
1431
-			}
1432
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1437
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1433 1438
 			{
1434 1439
 				unset($result[$k]);
1435
-			}
1436
-			else
1440
+			} else
1437 1441
 			{
1438 1442
 				if(in_array($k, array(
1439 1443
 					'act',
@@ -1461,8 +1465,7 @@  discard block
 block discarded – undo
1461 1465
 					if (is_array($result[$k]))
1462 1466
 					{
1463 1467
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1464
-					}
1465
-					else
1468
+					} else
1466 1469
 					{
1467 1470
 						$result[$k] = stripslashes($result[$k]);
1468 1471
 					}
@@ -1471,8 +1474,7 @@  discard block
 block discarded – undo
1471 1474
 				if(is_array($result[$k]))
1472 1475
 				{
1473 1476
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1474
-				}
1475
-				else
1477
+				} else
1476 1478
 				{
1477 1479
 					$result[$k] = trim($result[$k]);
1478 1480
 				}
@@ -1524,8 +1526,7 @@  discard block
 block discarded – undo
1524 1526
 				$val['name'] = escape($val['name'], FALSE);
1525 1527
 				$this->set($key, $val, TRUE);
1526 1528
 				$this->is_uploaded = TRUE;
1527
-			}
1528
-			else
1529
+			} else
1529 1530
 			{
1530 1531
 				$files = array();
1531 1532
 				foreach ($tmp_name as $i => $j)
@@ -1639,8 +1640,7 @@  discard block
 block discarded – undo
1639 1640
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1640 1641
 			{
1641 1642
 				$vid = $site_module_info->domain;
1642
-			}
1643
-			else
1643
+			} else
1644 1644
 			{
1645 1645
 				$domain = $site_module_info->domain;
1646 1646
 			}
@@ -1657,8 +1657,7 @@  discard block
 block discarded – undo
1657 1657
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1658 1658
 			{
1659 1659
 				unset($domain);
1660
-			}
1661
-			else
1660
+			} else
1662 1661
 			{
1663 1662
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1664 1663
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1678,23 +1677,35 @@  discard block
 block discarded – undo
1678 1677
 			{
1679 1678
 				array_shift($args_list);
1680 1679
 			}
1681
-		}
1682
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1680
+		} elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1683 1681
 		{
1684 1682
 			// Otherwise, make GET variables into array
1685 1683
 			$get_vars = get_object_vars($self->get_vars);
1686
-		}
1687
-		else
1684
+		} else
1688 1685
 		{
1689
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1690
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1691
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1692
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1693
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1694
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1686
+			if(!!$self->get_vars->module) {
1687
+				$get_vars['module'] = $self->get_vars->module;
1688
+			}
1689
+			if(!!$self->get_vars->mid) {
1690
+				$get_vars['mid'] = $self->get_vars->mid;
1691
+			}
1692
+			if(!!$self->get_vars->act) {
1693
+				$get_vars['act'] = $self->get_vars->act;
1694
+			}
1695
+			if(!!$self->get_vars->page) {
1696
+				$get_vars['page'] = $self->get_vars->page;
1697
+			}
1698
+			if(!!$self->get_vars->search_target) {
1699
+				$get_vars['search_target'] = $self->get_vars->search_target;
1700
+			}
1701
+			if(!!$self->get_vars->search_keyword) {
1702
+				$get_vars['search_keyword'] = $self->get_vars->search_keyword;
1703
+			}
1695 1704
 			if($get_vars['act'] == 'IS')
1696 1705
 			{
1697
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1706
+				if(!!$self->get_vars->is_keyword) {
1707
+					$get_vars['is_keyword'] = $self->get_vars->is_keyword;
1708
+				}
1698 1709
 			}
1699 1710
 		}
1700 1711
 
@@ -1719,8 +1730,7 @@  discard block
 block discarded – undo
1719 1730
 		if($vid)
1720 1731
 		{
1721 1732
 			$get_vars['vid'] = $vid;
1722
-		}
1723
-		else
1733
+		} else
1724 1734
 		{
1725 1735
 			unset($get_vars['vid']);
1726 1736
 		}
@@ -1792,8 +1802,7 @@  discard block
 block discarded – undo
1792 1802
 						{
1793 1803
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1794 1804
 						}
1795
-					}
1796
-					elseif(!is_array($val))
1805
+					} elseif(!is_array($val))
1797 1806
 					{
1798 1807
 						$queries[] = $key . '=' . urlencode($val);
1799 1808
 					}
@@ -1811,25 +1820,23 @@  discard block
 block discarded – undo
1811 1820
 		{
1812 1821
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1813 1822
 			// optional SSL use
1814
-		}
1815
-		elseif($_use_ssl == 'optional')
1823
+		} elseif($_use_ssl == 'optional')
1816 1824
 		{
1817 1825
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1818 1826
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1819 1827
 			// no SSL
1820
-		}
1821
-		else
1828
+		} else
1822 1829
 		{
1823 1830
 			// currently on SSL but target is not based on SSL
1824 1831
 			if($_SERVER['HTTPS'] == 'on')
1825 1832
 			{
1826 1833
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1827
-			}
1828
-			else if($domain) // if $domain is set
1834
+			} else if($domain) {
1835
+				// if $domain is set
1829 1836
 			{
1830 1837
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1831 1838
 			}
1832
-			else
1839
+			} else
1833 1840
 			{
1834 1841
 				$query = getScriptPath() . $query;
1835 1842
 			}
@@ -1886,8 +1893,7 @@  discard block
 block discarded – undo
1886 1893
 		if($domain)
1887 1894
 		{
1888 1895
 			$domain_key = md5($domain);
1889
-		}
1890
-		else
1896
+		} else
1891 1897
 		{
1892 1898
 			$domain_key = 'default';
1893 1899
 		}
@@ -1916,8 +1922,7 @@  discard block
 block discarded – undo
1916 1922
 			{
1917 1923
 				$target_url.= '/';
1918 1924
 			}
1919
-		}
1920
-		else
1925
+		} else
1921 1926
 		{
1922 1927
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1923 1928
 		}
@@ -1935,20 +1940,17 @@  discard block
 block discarded – undo
1935 1940
 			if($port && $port != 443)
1936 1941
 			{
1937 1942
 				$url_info['port'] = $port;
1938
-			}
1939
-			elseif($url_info['port'] == 443)
1943
+			} elseif($url_info['port'] == 443)
1940 1944
 			{
1941 1945
 				unset($url_info['port']);
1942 1946
 			}
1943
-		}
1944
-		else
1947
+		} else
1945 1948
 		{
1946 1949
 			$port = self::get('_http_port');
1947 1950
 			if($port && $port != 80)
1948 1951
 			{
1949 1952
 				$url_info['port'] = $port;
1950
-			}
1951
-			elseif($url_info['port'] == 80)
1953
+			} elseif($url_info['port'] == 80)
1952 1954
 			{
1953 1955
 				unset($url_info['port']);
1954 1956
 			}
@@ -2185,8 +2187,7 @@  discard block
 block discarded – undo
2185 2187
 		if(strpos($file, './') === 0)
2186 2188
 		{
2187 2189
 			$file = $script_path . substr($file, 2);
2188
-		}
2189
-		elseif(strpos($file, '../') === 0)
2190
+		} elseif(strpos($file, '../') === 0)
2190 2191
 		{
2191 2192
 			$file = self::normalizeFilePath($script_path . $file);
2192 2193
 		}
@@ -2448,8 +2449,7 @@  discard block
 block discarded – undo
2448 2449
 			if(substr_compare($filename, '.js', -3) === 0)
2449 2450
 			{
2450 2451
 				$result->jsList[] = $plugin_path . $filename;
2451
-			}
2452
-			elseif(substr_compare($filename, '.css', -4) === 0)
2452
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2453 2453
 			{
2454 2454
 				$result->cssList[] = $plugin_path . $filename;
2455 2455
 			}
@@ -2706,8 +2706,7 @@  discard block
 block discarded – undo
2706 2706
 			if(count($_base) > 0)
2707 2707
 			{
2708 2708
 				array_shift($_base);
2709
-			}
2710
-			else
2709
+			} else
2711 2710
 			{
2712 2711
 				array_unshift($_base, '..');
2713 2712
 			}
Please login to merge, or discard this patch.
classes/cache/CacheFile.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getInstance()
25 25
 	{
26
-		if(!$GLOBALS['__CacheFile__'])
26
+		if (!$GLOBALS['__CacheFile__'])
27 27
 		{
28 28
 			$GLOBALS['__CacheFile__'] = new CacheFile();
29 29
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	function __construct()
39 39
 	{
40
-		$this->cache_dir = _XE_PATH_ . $this->cache_dir;
40
+		$this->cache_dir = _XE_PATH_.$this->cache_dir;
41 41
 		FileHandler::makeDir($this->cache_dir);
42 42
 	}
43 43
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function getCacheFileName($key)
51 51
 	{
52 52
 		$path_string = preg_replace("/[^a-z0-9-_:\.]+/i", '_', $key);
53
-		return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $path_string) . '.php';
53
+		return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $path_string).'.php';
54 54
 	}
55 55
 
56 56
 	/**
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 		$content = array();
81 81
 		$content[] = '<?php';
82 82
 		$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
83
-		$content[] = 'return \'' . $data . '\';';
83
+		$content[] = 'return \''.$data.'\';';
84 84
 		FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
85
-		if(function_exists('opcache_invalidate'))
85
+		if (function_exists('opcache_invalidate'))
86 86
 		{
87 87
 			@opcache_invalidate($cache_file, true);
88 88
 		}
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		$cache_file = $this->getCacheFileName($key);
101 101
 
102
-		if(file_exists($cache_file))
102
+		if (file_exists($cache_file))
103 103
 		{
104
-			if($modified_time > 0 && filemtime($cache_file) < $modified_time)
104
+			if ($modified_time > 0 && filemtime($cache_file) < $modified_time)
105 105
 			{
106 106
 				FileHandler::removeFile($cache_file);
107 107
 				return false;
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	function get($key, $modified_time = 0)
124 124
 	{
125
-		if(!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
125
+		if (!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
126 126
 		{
127 127
 			return false;
128 128
 		}
129 129
 
130
-		if($modified_time > 0 && filemtime($cache_file) < $modified_time)
130
+		if ($modified_time > 0 && filemtime($cache_file) < $modified_time)
131 131
 		{
132 132
 			FileHandler::removeFile($cache_file);
133 133
 			return false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	function _delete($_key)
148 148
 	{
149 149
 		$cache_file = $this->getCacheFileName($_key);
150
-		if(function_exists('opcache_invalidate'))
150
+		if (function_exists('opcache_invalidate'))
151 151
 		{
152 152
 			@opcache_invalidate($cache_file, true);
153 153
 		}
Please login to merge, or discard this patch.
classes/file/FileHandler.class.php 1 patch
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 		self::clearStatCache($filename);
160 160
 		self::invalidateOpcache($filename);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	function moveFile($source, $target)
196 196
 	{
197
-		if(($source = self::exists($source)) !== FALSE)
197
+		if (($source = self::exists($source)) !== FALSE)
198 198
 		{
199 199
 			self::removeFile($target);
200 200
 			return self::rename($source, $target);
@@ -232,35 +232,35 @@  discard block
 block discarded – undo
232 232
 		$path = self::getRealPath($path);
233 233
 		$output = array();
234 234
 
235
-		if(substr($path, -1) != '/')
235
+		if (substr($path, -1) != '/')
236 236
 		{
237 237
 			$path .= '/';
238 238
 		}
239 239
 
240
-		if(!is_dir($path))
240
+		if (!is_dir($path))
241 241
 		{
242 242
 			return $output;
243 243
 		}
244 244
 
245 245
 		$files = scandir($path);
246
-		foreach($files as $file)
246
+		foreach ($files as $file)
247 247
 		{
248
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
248
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
249 249
 			{
250 250
 				continue;
251 251
 			}
252 252
 
253
-			if($to_lower)
253
+			if ($to_lower)
254 254
 			{
255 255
 				$file = strtolower($file);
256 256
 			}
257 257
 
258
-			if($filter)
258
+			if ($filter)
259 259
 			{
260 260
 				$file = preg_replace($filter, '$1', $file);
261 261
 			}
262 262
 
263
-			if($concat_prefix)
263
+			if ($concat_prefix)
264 264
 			{
265 265
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
266 266
 			}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	{
284 284
 		$path_string = preg_replace("/[^a-z0-9-_\\\\\/\.]+/i", '', $path_string);
285 285
 		$path_string = self::getRealPath($path_string);
286
-		if(self::exists($path_string) !== FALSE)
286
+		if (self::exists($path_string) !== FALSE)
287 287
 		{
288 288
 			return TRUE;
289 289
 		}
290 290
 
291
-		if(!ini_get('safe_mode'))
291
+		if (!ini_get('safe_mode'))
292 292
 		{
293 293
 			@mkdir($path_string, 0755, TRUE);
294 294
 			@chmod($path_string, 0755);
@@ -299,35 +299,35 @@  discard block
 block discarded – undo
299 299
 			static $oFtp = NULL;
300 300
 
301 301
 			$ftp_info = Context::getFTPInfo();
302
-			if($oFtp == NULL)
302
+			if ($oFtp == NULL)
303 303
 			{
304
-				if(!Context::isFTPRegisted())
304
+				if (!Context::isFTPRegisted())
305 305
 				{
306 306
 					return;
307 307
 				}
308 308
 
309
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
309
+				require_once(_XE_PATH_.'libs/ftp.class.php');
310 310
 				$oFtp = new ftp();
311
-				if(!$ftp_info->ftp_host)
311
+				if (!$ftp_info->ftp_host)
312 312
 				{
313 313
 					$ftp_info->ftp_host = "127.0.0.1";
314 314
 				}
315
-				if(!$ftp_info->ftp_port)
315
+				if (!$ftp_info->ftp_port)
316 316
 				{
317 317
 					$ftp_info->ftp_port = 21;
318 318
 				}
319
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
319
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
320 320
 				{
321 321
 					return;
322 322
 				}
323
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
323
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
324 324
 				{
325 325
 					$oFtp->ftp_quit();
326 326
 					return;
327 327
 				}
328 328
 			}
329 329
 
330
-			if(!($ftp_path = $ftp_info->ftp_root_path))
330
+			if (!($ftp_path = $ftp_info->ftp_root_path))
331 331
 			{
332 332
 				$ftp_path = DIRECTORY_SEPARATOR;
333 333
 			}
@@ -336,19 +336,19 @@  discard block
 block discarded – undo
336 336
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
337 337
 
338 338
 			$path = _XE_PATH_;
339
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
339
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
340 340
 			{
341
-				if(!$path_list[$i])
341
+				if (!$path_list[$i])
342 342
 				{
343 343
 					continue;
344 344
 				}
345 345
 
346
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
347
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
348
-				if(!is_dir($path))
346
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
347
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
348
+				if (!is_dir($path))
349 349
 				{
350 350
 					$oFtp->ftp_mkdir($ftp_path);
351
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
351
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
352 352
 				}
353 353
 			}
354 354
 		}
@@ -364,23 +364,23 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	function removeDir($path)
366 366
 	{
367
-		if(($path = self::isDir($path)) === FALSE)
367
+		if (($path = self::isDir($path)) === FALSE)
368 368
 		{
369 369
 			return;
370 370
 		}
371 371
 
372
-		if(self::isDir($path))
372
+		if (self::isDir($path))
373 373
 		{
374 374
 			$files = array_diff(scandir($path), array('..', '.'));
375 375
 
376
-			foreach($files as $file)
376
+			foreach ($files as $file)
377 377
 			{
378
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
378
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
379 379
 				{
380 380
 					continue;
381 381
 				}
382 382
 
383
-				if(is_dir($target))
383
+				if (is_dir($target))
384 384
 				{
385 385
 					self::removeDir($target);
386 386
 				}
@@ -405,22 +405,22 @@  discard block
 block discarded – undo
405 405
 	 */
406 406
 	function removeBlankDir($path)
407 407
 	{
408
-		if(($path = self::isDir($path)) === FALSE)
408
+		if (($path = self::isDir($path)) === FALSE)
409 409
 		{
410 410
 			return;
411 411
 		}
412 412
 
413 413
 		$files = array_diff(scandir($path), array('..', '.'));
414 414
 
415
-		if(count($files) < 1)
415
+		if (count($files) < 1)
416 416
 		{
417 417
 			rmdir($path);
418 418
 			return;
419 419
 		}
420 420
 
421
-		foreach($files as $file)
421
+		foreach ($files as $file)
422 422
 		{
423
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
423
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
424 424
 			{
425 425
 				continue;
426 426
 			}
@@ -439,23 +439,23 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	function removeFilesInDir($path)
441 441
 	{
442
-		if(($path = self::getRealPath($path)) === FALSE)
442
+		if (($path = self::getRealPath($path)) === FALSE)
443 443
 		{
444 444
 			return;
445 445
 		}
446 446
 
447
-		if(is_dir($path))
447
+		if (is_dir($path))
448 448
 		{
449 449
 			$files = array_diff(scandir($path), array('..', '.'));
450 450
 
451
-			foreach($files as $file)
451
+			foreach ($files as $file)
452 452
 			{
453
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
453
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
454 454
 				{
455 455
 					continue;
456 456
 				}
457 457
 
458
-				if(is_dir($target))
458
+				if (is_dir($target))
459 459
 				{
460 460
 					self::removeFilesInDir($target);
461 461
 				}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 		else
469 469
 		{
470
-			if(self::exists($path)) unlink($path);
470
+			if (self::exists($path)) unlink($path);
471 471
 		}
472 472
 
473 473
 	}
@@ -481,22 +481,22 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	function filesize($size)
483 483
 	{
484
-		if(!$size)
484
+		if (!$size)
485 485
 		{
486 486
 			return '0Byte';
487 487
 		}
488 488
 
489
-		if($size === 1)
489
+		if ($size === 1)
490 490
 		{
491 491
 			return '1Byte';
492 492
 		}
493 493
 
494
-		if($size < 1024)
494
+		if ($size < 1024)
495 495
 		{
496
-			return $size . 'Bytes';
496
+			return $size.'Bytes';
497 497
 		}
498 498
 
499
-		if($size >= 1024 && $size < 1024 * 1024)
499
+		if ($size >= 1024 && $size < 1024 * 1024)
500 500
 		{
501 501
 			return sprintf("%0.1fKB", $size / 1024);
502 502
 		}
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	 */
522 522
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
523 523
 	{
524
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
524
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
525 525
 		$IDN = new idna_convert(array('idn_version' => 2008));
526 526
 		$url = $IDN->encode($url);
527 527
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 			require_once('HTTP/Request.php');
532 532
 
533 533
 			$parsed_url = parse_url(__PROXY_SERVER__);
534
-			if($parsed_url["host"] && $parsed_url["path"])
534
+			if ($parsed_url["host"] && $parsed_url["path"])
535 535
 			{
536 536
 				// Old style proxy server support (POST payload to proxy script)
537 537
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 				$oRequest = new HTTP_Request($url);
544 544
 
545 545
 				// New style proxy server support (Use HTTP_Request2 native config format)
546
-				if($parsed_url['host'])
546
+				if ($parsed_url['host'])
547 547
 				{
548 548
 					$request_config['proxy_host'] = $parsed_url['host'];
549 549
 					$request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : '';
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
 					$request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http';
553 553
 				}
554 554
 
555
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
555
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
556 556
 				{
557
-					foreach($request_config as $key=>$val)
557
+					foreach ($request_config as $key=>$val)
558 558
 					{
559
-						if($key === 'observers')
559
+						if ($key === 'observers')
560 560
 						{
561
-							foreach($val as $observer)
561
+							foreach ($val as $observer)
562 562
 							{
563 563
 								$oRequest->attach($observer);
564 564
 							}
@@ -569,58 +569,58 @@  discard block
 block discarded – undo
569 569
 						}
570 570
 					}
571 571
 				}
572
-				if(method_exists($oRequest, 'setConfig'))
572
+				if (method_exists($oRequest, 'setConfig'))
573 573
 				{
574
-					if(extension_loaded('curl'))
574
+					if (extension_loaded('curl'))
575 575
 					{
576 576
 						$oRequest->setConfig('adapter', 'curl');
577 577
 					}
578
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
578
+					elseif (version_compare(PHP_VERSION, '5.6', '<'))
579 579
 					{
580 580
 						$oRequest->setConfig('ssl_verify_host', false);
581 581
 					}
582
-					if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem'))
582
+					if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem'))
583 583
 					{
584
-						$oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem');
584
+						$oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem');
585 585
 					}
586 586
 				}
587 587
 
588
-				if(count($headers) > 0)
588
+				if (count($headers) > 0)
589 589
 				{
590
-					foreach($headers as $key => $val)
590
+					foreach ($headers as $key => $val)
591 591
 					{
592 592
 						$oRequest->addHeader($key, $val);
593 593
 					}
594 594
 				}
595 595
 				$host = parse_url($url, PHP_URL_HOST);
596
-				if($cookies[$host])
596
+				if ($cookies[$host])
597 597
 				{
598
-					foreach($cookies[$host] as $key => $val)
598
+					foreach ($cookies[$host] as $key => $val)
599 599
 					{
600 600
 						$oRequest->addCookie($key, $val);
601 601
 					}
602 602
 				}
603
-				if(count($post_data) > 0)
603
+				if (count($post_data) > 0)
604 604
 				{
605
-					foreach($post_data as $key => $val)
605
+					foreach ($post_data as $key => $val)
606 606
 					{
607 607
 						$oRequest->addPostData($key, $val);
608 608
 					}
609 609
 				}
610
-				if(!$content_type)
610
+				if (!$content_type)
611 611
 					$oRequest->addHeader('Content-Type', 'text/html');
612 612
 				else
613 613
 					$oRequest->addHeader('Content-Type', $content_type);
614 614
 				$oRequest->setMethod($method);
615
-				if($body)
615
+				if ($body)
616 616
 					$oRequest->setBody($body);
617 617
 			}
618 618
 			
619
-			if(method_exists($oRequest, 'setConfig'))
619
+			if (method_exists($oRequest, 'setConfig'))
620 620
 			{
621 621
 				$oRequest->setConfig('timeout', $timeout);
622 622
 			}
623
-			elseif(property_exists($oRequest, '_timeout'))
623
+			elseif (property_exists($oRequest, '_timeout'))
624 624
 			{
625 625
 				$oRequest->_timeout = $timeout;
626 626
 			}
@@ -630,25 +630,25 @@  discard block
 block discarded – undo
630 630
 			$code = $oRequest->getResponseCode();
631 631
 			$header = $oRequest->getResponseHeader();
632 632
 			$response = $oRequest->getResponseBody();
633
-			if($c = $oRequest->getResponseCookies())
633
+			if ($c = $oRequest->getResponseCookies())
634 634
 			{
635
-				foreach($c as $k => $v)
635
+				foreach ($c as $k => $v)
636 636
 				{
637 637
 					$cookies[$host][$v['name']] = $v['value'];
638 638
 				}
639 639
 			}
640 640
 
641
-			if($code > 300 && $code < 399 && $header['location'])
641
+			if ($code > 300 && $code < 399 && $header['location'])
642 642
 			{
643 643
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
644 644
 			}
645 645
 
646
-			if($code != 200)
646
+			if ($code != 200)
647 647
 			{
648 648
 				return;
649 649
 			}
650 650
 
651
-			if(isset($request_config['store_body']) && !$request_config['store_body'])
651
+			if (isset($request_config['store_body']) && !$request_config['store_body'])
652 652
 			{
653 653
 				return TRUE;
654 654
 			}
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 				return $response;
658 658
 			}
659 659
 		}
660
-		catch(Exception $e)
660
+		catch (Exception $e)
661 661
 		{
662 662
 			return NULL;
663 663
 		}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 			self::clearStatCache($target_filename);
692 692
 			self::invalidateOpcache($target_filename);
693 693
 		}
694
-		catch(Exception $e)
694
+		catch (Exception $e)
695 695
 		{
696 696
 			return FALSE;
697 697
 		}
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	function returnBytes($val)
709 709
 	{
710 710
 		$unit = strtoupper(substr($val, -1));
711
-		$val = (float)$val;
711
+		$val = (float) $val;
712 712
 
713 713
 		switch ($unit)
714 714
 		{
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 	function checkMemoryLoadImage(&$imageInfo)
730 730
 	{
731 731
 		$memoryLimit = self::returnBytes(ini_get('memory_limit'));
732
-		if($memoryLimit == -1)
732
+		if ($memoryLimit == -1)
733 733
 		{
734 734
 			return true;
735 735
 		}
@@ -737,14 +737,14 @@  discard block
 block discarded – undo
737 737
 		$K64 = 65536;
738 738
 		$TWEAKFACTOR = 2.0;
739 739
 		$channels = $imageInfo['channels'];
740
-		if(!$channels)
740
+		if (!$channels)
741 741
 		{
742 742
 			$channels = 6; //for png
743 743
 		}
744 744
 
745
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
745
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
746 746
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
747
-		if($availableMemory < $memoryNeeded)
747
+		if ($availableMemory < $memoryNeeded)
748 748
 		{
749 749
 			return FALSE;
750 750
 		}
@@ -773,30 +773,30 @@  discard block
 block discarded – undo
773 773
 		}
774 774
 
775 775
 		$target_file = self::getRealPath($target_file);
776
-		if(!$resize_width)
776
+		if (!$resize_width)
777 777
 		{
778 778
 			$resize_width = 100;
779 779
 		}
780 780
 
781
-		if(!$resize_height)
781
+		if (!$resize_height)
782 782
 		{
783 783
 			$resize_height = $resize_width;
784 784
 		}
785 785
 
786 786
 		// retrieve source image's information
787 787
 		$imageInfo = getimagesize($source_file);
788
-		if(!self::checkMemoryLoadImage($imageInfo))
788
+		if (!self::checkMemoryLoadImage($imageInfo))
789 789
 		{
790 790
 			return FALSE;
791 791
 		}
792 792
 
793 793
 		list($width, $height, $type, $attrs) = $imageInfo;
794
-		if($width < 1 || $height < 1)
794
+		if ($width < 1 || $height < 1)
795 795
 		{
796 796
 			return;
797 797
 		}
798 798
 
799
-		switch($type)
799
+		switch ($type)
800 800
 		{
801 801
 			case '1' :
802 802
 				$type = 'gif';
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 				return;
815 815
 		}
816 816
 
817
-		if(!$target_type)
817
+		if (!$target_type)
818 818
 		{
819 819
 			$target_type = $type;
820 820
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
826 826
 
827 827
 		$per = NULL;
828
-		if($thumbnail_type == 'ratio')
828
+		if ($thumbnail_type == 'ratio')
829 829
 		{
830 830
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
831 831
 			$resize_width = $width * $per;
@@ -838,30 +838,30 @@  discard block
 block discarded – undo
838 838
 
839 839
 		// create temporary image with target size
840 840
 		$thumb = NULL;
841
-		if(function_exists('imagecreateTRUEcolor'))
841
+		if (function_exists('imagecreateTRUEcolor'))
842 842
 		{
843 843
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
844 844
 		}
845
-		else if(function_exists('imagecreate'))
845
+		else if (function_exists('imagecreate'))
846 846
 		{
847 847
 			$thumb = imagecreate($resize_width, $resize_height);
848 848
 		}
849 849
 
850
-		if(!$thumb)
850
+		if (!$thumb)
851 851
 		{
852 852
 			return FALSE;
853 853
 		}
854 854
 
855
-		if(function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent)
855
+		if (function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent)
856 856
 		{
857 857
 			imagefill($thumb, 0, 0, imagecolorallocatealpha($thumb, 0, 0, 0, 127));
858 858
 			
859
-			if(function_exists('imagesavealpha'))
859
+			if (function_exists('imagesavealpha'))
860 860
 			{
861 861
 				imagesavealpha($thumb, TRUE);
862 862
 			}
863 863
 
864
-			if(function_exists('imagealphablending'))
864
+			if (function_exists('imagealphablending'))
865 865
 			{
866 866
 				imagealphablending($thumb, TRUE);
867 867
 			}
@@ -873,37 +873,37 @@  discard block
 block discarded – undo
873 873
 
874 874
 		// create temporary image having original type
875 875
 		$source = NULL;
876
-		switch($type)
876
+		switch ($type)
877 877
 		{
878 878
 			case 'gif' :
879
-				if(function_exists('imagecreatefromgif'))
879
+				if (function_exists('imagecreatefromgif'))
880 880
 				{
881 881
 					$source = @imagecreatefromgif($source_file);
882 882
 				}
883 883
 				break;
884 884
 			case 'jpeg' :
885 885
 			case 'jpg' :
886
-				if(function_exists('imagecreatefromjpeg'))
886
+				if (function_exists('imagecreatefromjpeg'))
887 887
 				{
888 888
 					$source = @imagecreatefromjpeg($source_file);
889 889
 				}
890 890
 				break;
891 891
 			case 'png' :
892
-				if(function_exists('imagecreatefrompng'))
892
+				if (function_exists('imagecreatefrompng'))
893 893
 				{
894 894
 					$source = @imagecreatefrompng($source_file);
895 895
 				}
896 896
 				break;
897 897
 			case 'wbmp' :
898 898
 			case 'bmp' :
899
-				if(function_exists('imagecreatefromwbmp'))
899
+				if (function_exists('imagecreatefromwbmp'))
900 900
 				{
901 901
 					$source = @imagecreatefromwbmp($source_file);
902 902
 				}
903 903
 				break;
904 904
 		}
905 905
 
906
-		if(!$source)
906
+		if (!$source)
907 907
 		{
908 908
 			imagedestroy($thumb);
909 909
 			return FALSE;
@@ -915,13 +915,13 @@  discard block
 block discarded – undo
915 915
 
916 916
 		$x = 0;
917 917
 		$y = 0;
918
-		if($thumbnail_type == 'crop')
918
+		if ($thumbnail_type == 'crop')
919 919
 		{
920 920
 			$x = (int) ($resize_width / 2 - $new_width / 2);
921 921
 			$y = (int) ($resize_height / 2 - $new_height / 2);
922 922
 		}
923 923
 
924
-		if(function_exists('imagecopyresampled'))
924
+		if (function_exists('imagecopyresampled'))
925 925
 		{
926 926
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
927 927
 		}
@@ -935,30 +935,30 @@  discard block
 block discarded – undo
935 935
 
936 936
 		// write into the file
937 937
 		$output = NULL;
938
-		switch($target_type)
938
+		switch ($target_type)
939 939
 		{
940 940
 			case 'gif' :
941
-				if(function_exists('imagegif'))
941
+				if (function_exists('imagegif'))
942 942
 				{
943 943
 					$output = imagegif($thumb, $target_file);
944 944
 				}
945 945
 				break;
946 946
 			case 'jpeg' :
947 947
 			case 'jpg' :
948
-				if(function_exists('imagejpeg'))
948
+				if (function_exists('imagejpeg'))
949 949
 				{
950 950
 					$output = imagejpeg($thumb, $target_file, 100);
951 951
 				}
952 952
 				break;
953 953
 			case 'png' :
954
-				if(function_exists('imagepng'))
954
+				if (function_exists('imagepng'))
955 955
 				{
956 956
 					$output = imagepng($thumb, $target_file, 9);
957 957
 				}
958 958
 				break;
959 959
 			case 'wbmp' :
960 960
 			case 'bmp' :
961
-				if(function_exists('imagewbmp'))
961
+				if (function_exists('imagewbmp'))
962 962
 				{
963 963
 					$output = imagewbmp($thumb, $target_file, 100);
964 964
 				}
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 		imagedestroy($thumb);
969 969
 		imagedestroy($source);
970 970
 
971
-		if(!$output)
971
+		if (!$output)
972 972
 		{
973 973
 			return FALSE;
974 974
 		}
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
 	 */
987 987
 	function readIniFile($filename)
988 988
 	{
989
-		if(($filename = self::exists($filename)) === FALSE)
989
+		if (($filename = self::exists($filename)) === FALSE)
990 990
 		{
991 991
 			return FALSE;
992 992
 		}
993 993
 		$arr = parse_ini_file($filename, TRUE);
994
-		if(is_array($arr) && count($arr) > 0)
994
+		if (is_array($arr) && count($arr) > 0)
995 995
 		{
996 996
 			return $arr;
997 997
 		}
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	 */
1018 1018
 	function writeIniFile($filename, $arr)
1019 1019
 	{
1020
-		if(!is_array($arr) || count($arr) == 0)
1020
+		if (!is_array($arr) || count($arr) == 0)
1021 1021
 		{
1022 1022
 			return FALSE;
1023 1023
 		}
@@ -1034,19 +1034,19 @@  discard block
 block discarded – undo
1034 1034
 	function _makeIniBuff($arr)
1035 1035
 	{
1036 1036
 		$return = array();
1037
-		foreach($arr as $key => $val)
1037
+		foreach ($arr as $key => $val)
1038 1038
 		{
1039 1039
 			// section
1040
-			if(is_array($val))
1040
+			if (is_array($val))
1041 1041
 			{
1042 1042
 				$return[] = sprintf("[%s]", $key);
1043
-				foreach($val as $k => $v)
1043
+				foreach ($val as $k => $v)
1044 1044
 				{
1045 1045
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1046 1046
 				}
1047 1047
 				// value
1048 1048
 			}
1049
-			else if(is_object($val))
1049
+			else if (is_object($val))
1050 1050
 			{
1051 1051
 				continue;
1052 1052
 			}
@@ -1121,15 +1121,15 @@  discard block
 block discarded – undo
1121 1121
 	function isWritableDir($path)
1122 1122
 	{
1123 1123
 		$path = self::getRealPath($path);
1124
-		if(is_dir($path)==FALSE)
1124
+		if (is_dir($path) == FALSE)
1125 1125
 		{
1126 1126
 			return FALSE;
1127 1127
 		}
1128 1128
 
1129
-		$checkFile = $path . '/_CheckWritableDir';
1129
+		$checkFile = $path.'/_CheckWritableDir';
1130 1130
 
1131 1131
 		$fp = fopen($checkFile, 'w');
1132
-		if(!is_resource($fp))
1132
+		if (!is_resource($fp))
1133 1133
 		{
1134 1134
 			return FALSE;
1135 1135
 		}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	 **/
1148 1148
 	static public function clearStatCache($target, $include = false)
1149 1149
 	{
1150
-		if(is_array($target))
1150
+		if (is_array($target))
1151 1151
 		{
1152 1152
 			array_map('self::clearStatCache', $target);
1153 1153
 			return;
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$target = self::getRealPath($target);
1157 1157
 
1158
-		if($include && self::isDir($target))
1158
+		if ($include && self::isDir($target))
1159 1159
 		{
1160 1160
 			self::clearStatCache(self::readDir($target, '', false, true), $include);
1161 1161
 		}
@@ -1173,27 +1173,27 @@  discard block
 block discarded – undo
1173 1173
 	{
1174 1174
 		static $opcache = null;
1175 1175
 
1176
-		if($opcache === null)
1176
+		if ($opcache === null)
1177 1177
 		{
1178 1178
 			$opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate'));
1179 1179
 		}
1180 1180
 
1181
-		if($opcache === false)
1181
+		if ($opcache === false)
1182 1182
 		{
1183 1183
 			return;
1184 1184
 		}
1185 1185
 
1186
-		if(is_array($target))
1186
+		if (is_array($target))
1187 1187
 		{
1188 1188
 			array_map('self::invalidateOpcache', $target);
1189 1189
 			return;
1190 1190
 		}
1191 1191
 
1192
-		if(substr($target, -4) === '.php')
1192
+		if (substr($target, -4) === '.php')
1193 1193
 		{
1194 1194
 			opcache_invalidate(self::getRealPath($target), $force);
1195 1195
 		}
1196
-		else if($path = self::isDir($target))
1196
+		else if ($path = self::isDir($target))
1197 1197
 		{
1198 1198
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1199 1199
 		}
Please login to merge, or discard this patch.
modules/widget/widget.model.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	function getWidgetPath($widget_name)
22 22
 	{
23 23
 		$path = sprintf('./widgets/%s/', $widget_name);
24
-		if(is_dir($path)) return $path;
24
+		if (is_dir($path)) return $path;
25 25
 
26 26
 		return "";
27 27
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	function getWidgetStylePath($widgetStyle_name)
33 33
 	{
34 34
 		$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
35
-		if(is_dir($path)) return $path;
35
+		if (is_dir($path)) return $path;
36 36
 
37 37
 		return "";
38 38
 	}
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
 		// 've Downloaded the widget and the widget's list of installed Wanted
59 59
 		$searched_list = FileHandler::readDir('./widgets');
60 60
 		$searched_count = count($searched_list);
61
-		if(!$searched_count) return;
61
+		if (!$searched_count) return;
62 62
 		sort($searched_list);
63 63
 		// D which pertain to the list of widgets loop spins return statement review the information you need
64
-		for($i=0;$i<$searched_count;$i++)
64
+		for ($i = 0; $i < $searched_count; $i++)
65 65
 		{
66 66
 			// The name of the widget
67 67
 			$widget = $searched_list[$i];
68 68
 			// Wanted information on the Widget
69 69
 			$widget_info = $this->getWidgetInfo($widget);
70 70
 
71
-			if(!$widget_info)
71
+			if (!$widget_info)
72 72
 			{
73 73
 				$widget_info = new stdClass();
74 74
 			}
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 		// 've Downloaded the widget and the widget's list of installed Wanted
102 102
 		$searched_list = FileHandler::readDir('./widgetstyles');
103 103
 		$searched_count = count($searched_list);
104
-		if(!$searched_count) return;
104
+		if (!$searched_count) return;
105 105
 		sort($searched_list);
106 106
 		// D which pertain to the list of widgets loop spins return statement review the information you need
107
-		for($i=0;$i<$searched_count;$i++)
107
+		for ($i = 0; $i < $searched_count; $i++)
108 108
 		{
109 109
 			// The name of the widget
110 110
 			$widgetStyle = $searched_list[$i];
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 	{
125 125
 		// Get a path of the requested module. Return if not exists.
126 126
 		$widget_path = $this->getWidgetPath($widget);
127
-		if(!$widget_path) return;
127
+		if (!$widget_path) return;
128 128
 		// Read the xml file for module skin information
129 129
 		$xml_file = sprintf("%sconf/info.xml", $widget_path);
130
-		if(!file_exists($xml_file)) return;
130
+		if (!file_exists($xml_file)) return;
131 131
 		// If the problem by comparing the cache file and include the return variable $widget_info
132
-		$cache_file = sprintf(_XE_PATH_ . 'files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
132
+		$cache_file = sprintf(_XE_PATH_.'files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
133 133
 
134
-		if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
134
+		if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file))
135 135
 		{
136 136
 			@include($cache_file);
137 137
 			return $widget_info;
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
 		$oXmlParser = new XmlParser();
141 141
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
142 142
 		$xml_obj = $tmp_xml_obj->widget;
143
-		if(!$xml_obj) return;
143
+		if (!$xml_obj) return;
144 144
 
145 145
 		$buff = '$widget_info = new stdClass;';
146 146
 
147
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
147
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
148 148
 		{
149 149
 			// Title of the widget, version
150 150
 			$buff .= sprintf('$widget_info->widget = %s;', var_export($widget, true));
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 			$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
162 162
 			$buff .= sprintf('$widget_info->widget_title = $widget_title;');
163 163
 			// Author information
164
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
164
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
165 165
 			else $author_list = $xml_obj->author;
166 166
 
167
-			for($i=0; $i < count($author_list); $i++)
167
+			for ($i = 0; $i < count($author_list); $i++)
168 168
 			{
169 169
 				$buff .= '$widget_info->author['.$i.'] = new stdClass;';
170 170
 				$buff .= sprintf('$widget_info->author['.$i.']->name = %s;', var_export($author_list[$i]->name->body, true));
@@ -193,29 +193,29 @@  discard block
 block discarded – undo
193 193
 		}
194 194
 		// Extra vars (user defined variables to use in a template)
195 195
 		$extra_var_groups = $xml_obj->extra_vars->group;
196
-		if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
197
-		if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
198
-		foreach($extra_var_groups as $group)
196
+		if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
197
+		if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
198
+		foreach ($extra_var_groups as $group)
199 199
 		{
200 200
 			$extra_vars = $group->var;
201
-			if(!is_array($group->var)) $extra_vars = array($group->var);
201
+			if (!is_array($group->var)) $extra_vars = array($group->var);
202 202
 
203
-			if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
203
+			if ($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
204 204
 			{
205 205
 				$extra_var_count = count($extra_vars);
206 206
 
207 207
 				$buff .= sprintf('$widget_info->extra_var_count = %s;', var_export($extra_var_count, true));
208
-				for($i=0;$i<$extra_var_count;$i++)
208
+				for ($i = 0; $i < $extra_var_count; $i++)
209 209
 				{
210 210
 					unset($var);
211 211
 					unset($options);
212 212
 					$var = $extra_vars[$i];
213 213
 
214
-					$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
215
-					$name = $var->name->body?$var->name->body:$var->title->body;
216
-					$type = $var->attrs->type?$var->attrs->type:$var->type->body;
214
+					$id = $var->attrs->id ? $var->attrs->id : $var->attrs->name;
215
+					$name = $var->name->body ? $var->name->body : $var->title->body;
216
+					$type = $var->attrs->type ? $var->attrs->type : $var->type->body;
217 217
 					$buff .= sprintf('$widget_info->extra_var->%s = new stdClass;', $id);
218
-					if($type =='filebox')
218
+					if ($type == 'filebox')
219 219
 					{
220 220
 						$buff .= sprintf('$widget_info->extra_var->%s->filter = %s;', $id, var_export($var->type->attrs->filter, true));
221 221
 						$buff .= sprintf('$widget_info->extra_var->%s->allow_multiple = %s;', $id, var_export($var->type->attrs->allow_multiple, true));
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
 					$buff .= sprintf('$widget_info->extra_var->%s->description = %s;', $id, var_export($var->description->body, true));
229 229
 
230 230
 					$options = $var->options;
231
-					if(!$options) continue;
231
+					if (!$options) continue;
232 232
 
233
-					if(!is_array($options)) $options = array($options);
233
+					if (!is_array($options)) $options = array($options);
234 234
 					$options_count = count($options);
235
-					for($j=0;$j<$options_count;$j++)
235
+					for ($j = 0; $j < $options_count; $j++)
236 236
 					{
237 237
 						$buff .= sprintf('$widget_info->extra_var->%s->options[%s] = %s;', $id, var_export($options[$j]->value->body, true), var_export($options[$j]->name->body, true));
238 238
 
239
-						if($options[$j]->attrs->default && $options[$j]->attrs->default=='true')
239
+						if ($options[$j]->attrs->default && $options[$j]->attrs->default == 'true')
240 240
 						{
241 241
 							$buff .= sprintf('$widget_info->extra_var->%s->default_options[%s] = true;', var_export($id, $options[$j]->value->body, true));
242 242
 						}
243 243
 
244
-						if($options[$j]->attrs->init && $options[$j]->attrs->init=='true')
244
+						if ($options[$j]->attrs->init && $options[$j]->attrs->init == 'true')
245 245
 						{
246 246
 							$buff .= sprintf('$widget_info->extra_var->%s->init_options[%s] = true;', $id, var_export($options[$j]->value->body, true));
247 247
 						}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$buff = '<?php if(!defined("__XE__")) exit(); '.$buff.' ?>';
254 254
 		FileHandler::writeFile($cache_file, $buff);
255 255
 
256
-		if(file_exists($cache_file)) @include($cache_file);
256
+		if (file_exists($cache_file)) @include($cache_file);
257 257
 		return $widget_info;
258 258
 	}
259 259
 
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 	{
266 266
 		$widget = escape($widgetStyle);
267 267
 		$widgetStyle_path = $this->getWidgetStylePath($widgetStyle);
268
-		if(!$widgetStyle_path) return;
268
+		if (!$widgetStyle_path) return;
269 269
 		$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
270
-		if(!file_exists($xml_file)) return;
270
+		if (!file_exists($xml_file)) return;
271 271
 		// If the problem by comparing the cache file and include the return variable $widgetStyle_info
272
-		$cache_file = sprintf(_XE_PATH_ . 'files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
272
+		$cache_file = sprintf(_XE_PATH_.'files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
273 273
 
274
-		if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
274
+		if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file))
275 275
 		{
276 276
 			@include($cache_file);
277 277
 			return $widgetStyle_info;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		$oXmlParser = new XmlParser();
281 281
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
282 282
 		$xml_obj = $tmp_xml_obj->widgetstyle;
283
-		if(!$xml_obj) return;
283
+		if (!$xml_obj) return;
284 284
 
285 285
 		$buff = array();
286 286
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 		$buff[] = sprintf('$widgetStyle_info->license_link = %s;', var_export($xml_obj->license->attrs->link, true));
301 301
 
302 302
 		// preview
303
-		if(!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
304
-		$preview_file = sprintf("%s%s", $widgetStyle_path,$xml_obj->preview->body);
305
-		if(file_exists($preview_file)) $buff[] = sprintf('$widgetStyle_info->preview = %s;', var_export($preview_file, true));
303
+		if (!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
304
+		$preview_file = sprintf("%s%s", $widgetStyle_path, $xml_obj->preview->body);
305
+		if (file_exists($preview_file)) $buff[] = sprintf('$widgetStyle_info->preview = %s;', var_export($preview_file, true));
306 306
 
307 307
 		// Author information
308
-		if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
308
+		if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
309 309
 		else $author_list = $xml_obj->author;
310 310
 
311
-		foreach($author_list as $idx => $author)
311
+		foreach ($author_list as $idx => $author)
312 312
 		{
313 313
 			$buff[] = sprintf('$widgetStyle_info->author[%d] = new stdClass();', $idx);
314 314
 			$buff[] = sprintf('$widgetStyle_info->author[%d]->name = %s;', $idx, var_export($author->name->body, true));
@@ -318,18 +318,18 @@  discard block
 block discarded – undo
318 318
 
319 319
 		// Extra vars (user defined variables to use in a template)
320 320
 		$extra_var_groups = $xml_obj->extra_vars->group;
321
-		if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
322
-		if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
321
+		if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
322
+		if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
323 323
 
324 324
 		$extra_var_count = 0;
325 325
 		$buff[] = sprintf('$widgetStyle_info->extra_var = new stdClass();', $extra_var_count);
326
-		foreach($extra_var_groups as $group)
326
+		foreach ($extra_var_groups as $group)
327 327
 		{
328 328
 			$extra_vars = (!is_array($group->var)) ? array($group->var) : $group->var;
329 329
 
330
-			if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
330
+			if ($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
331 331
 			{
332
-				foreach($extra_vars as $var)
332
+				foreach ($extra_vars as $var)
333 333
 				{
334 334
 					$extra_var_count++;
335 335
 					$id = ($var->attrs->id) ? $var->attrs->id : $var->attrs->name;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 					$buff[] = sprintf('$widgetStyle_info->extra_var->%s->group = %s;', $id, var_export($group->title->body, true));
341 341
 					$buff[] = sprintf('$widgetStyle_info->extra_var->%s->name = %s;', $id, var_export($name, true));
342 342
 					$buff[] = sprintf('$widgetStyle_info->extra_var->%s->type = %s;', $id, var_export($type, true));
343
-					if($type =='filebox')
343
+					if ($type == 'filebox')
344 344
 					{
345 345
 						$buff[] = sprintf('$widgetStyle_info->extra_var->%s->filter = %s;', $id, var_export($var->attrs->filter, true));
346 346
 						$buff[] = sprintf('$widgetStyle_info->extra_var->%s->allow_multiple = %s;', $id, var_export($var->attrs->allow_multiple, true));
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 					$buff[] = sprintf('$widgetStyle_info->extra_var->%s->value = $vars->%s;', $id, $id);
349 349
 					$buff[] = sprintf('$widgetStyle_info->extra_var->%s->description = %s;', $id, var_export($var->description->body, true));
350 350
 
351
-					if($var->options)
351
+					if ($var->options)
352 352
 					{
353 353
 						$var_options = (!is_array($var->options)) ? array($var->options) : $var->options;
354
-						foreach($var_options as $option_item)
354
+						foreach ($var_options as $option_item)
355 355
 						{
356 356
 							$buff[] = sprintf('$widgetStyle_info->extra_var->%s->options[%s] = %s;', $id, var_export($option_item->value->body, true), var_export($option_item->name->body, true));
357 357
 						}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 		FileHandler::writeFile($cache_file, implode(PHP_EOL, $buff));
365 365
 
366
-		if(file_exists($cache_file)) @include($cache_file);
366
+		if (file_exists($cache_file)) @include($cache_file);
367 367
 
368 368
 		return $widgetStyle_info;
369 369
 	}
Please login to merge, or discard this patch.
Braces   +74 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	function getWidgetPath($widget_name)
22 22
 	{
23 23
 		$path = sprintf('./widgets/%s/', $widget_name);
24
-		if(is_dir($path)) return $path;
24
+		if(is_dir($path)) {
25
+			return $path;
26
+		}
25 27
 
26 28
 		return "";
27 29
 	}
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 	function getWidgetStylePath($widgetStyle_name)
33 35
 	{
34 36
 		$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
35
-		if(is_dir($path)) return $path;
37
+		if(is_dir($path)) {
38
+			return $path;
39
+		}
36 40
 
37 41
 		return "";
38 42
 	}
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 		// 've Downloaded the widget and the widget's list of installed Wanted
59 63
 		$searched_list = FileHandler::readDir('./widgets');
60 64
 		$searched_count = count($searched_list);
61
-		if(!$searched_count) return;
65
+		if(!$searched_count) {
66
+			return;
67
+		}
62 68
 		sort($searched_list);
63 69
 		// D which pertain to the list of widgets loop spins return statement review the information you need
64 70
 		for($i=0;$i<$searched_count;$i++)
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
 		// 've Downloaded the widget and the widget's list of installed Wanted
102 108
 		$searched_list = FileHandler::readDir('./widgetstyles');
103 109
 		$searched_count = count($searched_list);
104
-		if(!$searched_count) return;
110
+		if(!$searched_count) {
111
+			return;
112
+		}
105 113
 		sort($searched_list);
106 114
 		// D which pertain to the list of widgets loop spins return statement review the information you need
107 115
 		for($i=0;$i<$searched_count;$i++)
@@ -124,10 +132,14 @@  discard block
 block discarded – undo
124 132
 	{
125 133
 		// Get a path of the requested module. Return if not exists.
126 134
 		$widget_path = $this->getWidgetPath($widget);
127
-		if(!$widget_path) return;
135
+		if(!$widget_path) {
136
+			return;
137
+		}
128 138
 		// Read the xml file for module skin information
129 139
 		$xml_file = sprintf("%sconf/info.xml", $widget_path);
130
-		if(!file_exists($xml_file)) return;
140
+		if(!file_exists($xml_file)) {
141
+			return;
142
+		}
131 143
 		// If the problem by comparing the cache file and include the return variable $widget_info
132 144
 		$cache_file = sprintf(_XE_PATH_ . 'files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
133 145
 
@@ -140,7 +152,9 @@  discard block
 block discarded – undo
140 152
 		$oXmlParser = new XmlParser();
141 153
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
142 154
 		$xml_obj = $tmp_xml_obj->widget;
143
-		if(!$xml_obj) return;
155
+		if(!$xml_obj) {
156
+			return;
157
+		}
144 158
 
145 159
 		$buff = '$widget_info = new stdClass;';
146 160
 
@@ -161,8 +175,11 @@  discard block
 block discarded – undo
161 175
 			$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
162 176
 			$buff .= sprintf('$widget_info->widget_title = $widget_title;');
163 177
 			// Author information
164
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
165
-			else $author_list = $xml_obj->author;
178
+			if(!is_array($xml_obj->author)) {
179
+				$author_list[] = $xml_obj->author;
180
+			} else {
181
+				$author_list = $xml_obj->author;
182
+			}
166 183
 
167 184
 			for($i=0; $i < count($author_list); $i++)
168 185
 			{
@@ -171,8 +188,7 @@  discard block
 block discarded – undo
171 188
 				$buff .= sprintf('$widget_info->author['.$i.']->email_address = %s;', var_export($author_list[$i]->attrs->email_address, true));
172 189
 				$buff .= sprintf('$widget_info->author['.$i.']->homepage = %s;', var_export($author_list[$i]->attrs->link, true));
173 190
 			}
174
-		}
175
-		else
191
+		} else
176 192
 		{
177 193
 			// Title of the widget, version
178 194
 			$buff .= sprintf('$widget_info->widget = %s;', var_export($widget, true));
@@ -193,12 +209,18 @@  discard block
 block discarded – undo
193 209
 		}
194 210
 		// Extra vars (user defined variables to use in a template)
195 211
 		$extra_var_groups = $xml_obj->extra_vars->group;
196
-		if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
197
-		if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
212
+		if(!$extra_var_groups) {
213
+			$extra_var_groups = $xml_obj->extra_vars;
214
+		}
215
+		if(!is_array($extra_var_groups)) {
216
+			$extra_var_groups = array($extra_var_groups);
217
+		}
198 218
 		foreach($extra_var_groups as $group)
199 219
 		{
200 220
 			$extra_vars = $group->var;
201
-			if(!is_array($group->var)) $extra_vars = array($group->var);
221
+			if(!is_array($group->var)) {
222
+				$extra_vars = array($group->var);
223
+			}
202 224
 
203 225
 			if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
204 226
 			{
@@ -228,9 +250,13 @@  discard block
 block discarded – undo
228 250
 					$buff .= sprintf('$widget_info->extra_var->%s->description = %s;', $id, var_export($var->description->body, true));
229 251
 
230 252
 					$options = $var->options;
231
-					if(!$options) continue;
253
+					if(!$options) {
254
+						continue;
255
+					}
232 256
 
233
-					if(!is_array($options)) $options = array($options);
257
+					if(!is_array($options)) {
258
+						$options = array($options);
259
+					}
234 260
 					$options_count = count($options);
235 261
 					for($j=0;$j<$options_count;$j++)
236 262
 					{
@@ -253,7 +279,9 @@  discard block
 block discarded – undo
253 279
 		$buff = '<?php if(!defined("__XE__")) exit(); '.$buff.' ?>';
254 280
 		FileHandler::writeFile($cache_file, $buff);
255 281
 
256
-		if(file_exists($cache_file)) @include($cache_file);
282
+		if(file_exists($cache_file)) {
283
+			@include($cache_file);
284
+		}
257 285
 		return $widget_info;
258 286
 	}
259 287
 
@@ -265,9 +293,13 @@  discard block
 block discarded – undo
265 293
 	{
266 294
 		$widget = escape($widgetStyle);
267 295
 		$widgetStyle_path = $this->getWidgetStylePath($widgetStyle);
268
-		if(!$widgetStyle_path) return;
296
+		if(!$widgetStyle_path) {
297
+			return;
298
+		}
269 299
 		$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
270
-		if(!file_exists($xml_file)) return;
300
+		if(!file_exists($xml_file)) {
301
+			return;
302
+		}
271 303
 		// If the problem by comparing the cache file and include the return variable $widgetStyle_info
272 304
 		$cache_file = sprintf(_XE_PATH_ . 'files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
273 305
 
@@ -280,7 +312,9 @@  discard block
 block discarded – undo
280 312
 		$oXmlParser = new XmlParser();
281 313
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
282 314
 		$xml_obj = $tmp_xml_obj->widgetstyle;
283
-		if(!$xml_obj) return;
315
+		if(!$xml_obj) {
316
+			return;
317
+		}
284 318
 
285 319
 		$buff = array();
286 320
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
@@ -300,13 +334,20 @@  discard block
 block discarded – undo
300 334
 		$buff[] = sprintf('$widgetStyle_info->license_link = %s;', var_export($xml_obj->license->attrs->link, true));
301 335
 
302 336
 		// preview
303
-		if(!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
337
+		if(!$xml_obj->preview->body) {
338
+			$xml_obj->preview->body = 'preview.jpg';
339
+		}
304 340
 		$preview_file = sprintf("%s%s", $widgetStyle_path,$xml_obj->preview->body);
305
-		if(file_exists($preview_file)) $buff[] = sprintf('$widgetStyle_info->preview = %s;', var_export($preview_file, true));
341
+		if(file_exists($preview_file)) {
342
+			$buff[] = sprintf('$widgetStyle_info->preview = %s;', var_export($preview_file, true));
343
+		}
306 344
 
307 345
 		// Author information
308
-		if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
309
-		else $author_list = $xml_obj->author;
346
+		if(!is_array($xml_obj->author)) {
347
+			$author_list[] = $xml_obj->author;
348
+		} else {
349
+			$author_list = $xml_obj->author;
350
+		}
310 351
 
311 352
 		foreach($author_list as $idx => $author)
312 353
 		{
@@ -318,8 +359,12 @@  discard block
 block discarded – undo
318 359
 
319 360
 		// Extra vars (user defined variables to use in a template)
320 361
 		$extra_var_groups = $xml_obj->extra_vars->group;
321
-		if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
322
-		if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
362
+		if(!$extra_var_groups) {
363
+			$extra_var_groups = $xml_obj->extra_vars;
364
+		}
365
+		if(!is_array($extra_var_groups)) {
366
+			$extra_var_groups = array($extra_var_groups);
367
+		}
323 368
 
324 369
 		$extra_var_count = 0;
325 370
 		$buff[] = sprintf('$widgetStyle_info->extra_var = new stdClass();', $extra_var_count);
@@ -363,7 +408,9 @@  discard block
 block discarded – undo
363 408
 
364 409
 		FileHandler::writeFile($cache_file, implode(PHP_EOL, $buff));
365 410
 
366
-		if(file_exists($cache_file)) @include($cache_file);
411
+		if(file_exists($cache_file)) {
412
+			@include($cache_file);
413
+		}
367 414
 
368 415
 		return $widgetStyle_info;
369 416
 	}
Please login to merge, or discard this patch.
modules/board/board.view.php 1 patch
Spacing   +153 added lines, -153 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(abs($oDocument->get('member_srl')) != $logged_info->member_srl)
274
+					if (abs($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
 
@@ -482,23 +482,23 @@  discard block
 block discarded – undo
482 482
 		$args->page_count = $this->page_count;
483 483
 
484 484
 		// get the search target and keyword
485
-		if($this->grant->view) {
485
+		if ($this->grant->view) {
486 486
 			$args->search_target = Context::get('search_target');
487 487
 			$args->search_keyword = Context::get('search_keyword');
488 488
 		}
489 489
 
490 490
 		$search_option = Context::get('search_option');
491
-		if($search_option==FALSE)
491
+		if ($search_option == FALSE)
492 492
 		{
493 493
 			$search_option = $this->search_option;
494 494
 		}
495
-		if(isset($search_option[$args->search_target])==FALSE)
495
+		if (isset($search_option[$args->search_target]) == FALSE)
496 496
 		{
497 497
 			$args->search_target = '';
498 498
 		}
499 499
 
500 500
 		// if the category is enabled, then get the category
501
-		if($this->module_info->use_category=='Y')
501
+		if ($this->module_info->use_category == 'Y')
502 502
 		{
503 503
 			$args->category_srl = Context::get('category');
504 504
 		}
@@ -506,21 +506,21 @@  discard block
 block discarded – undo
506 506
 		// setup the sort index and order index
507 507
 		$args->sort_index = Context::get('sort_index');
508 508
 		$args->order_type = Context::get('order_type');
509
-		if(!in_array($args->sort_index, $this->order_target))
509
+		if (!in_array($args->sort_index, $this->order_target))
510 510
 		{
511
-			$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
511
+			$args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order';
512 512
 		}
513
-		if(!in_array($args->order_type, array('asc','desc')))
513
+		if (!in_array($args->order_type, array('asc', 'desc')))
514 514
 		{
515
-			$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
515
+			$args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc';
516 516
 		}
517 517
 
518 518
 		// set the current page of documents
519 519
 		$document_srl = Context::get('document_srl');
520
-		if(!$args->page && $document_srl)
520
+		if (!$args->page && $document_srl)
521 521
 		{
522 522
 			$oDocument = $oDocumentModel->getDocument($document_srl);
523
-			if($oDocument->isExists() && !$oDocument->isNotice())
523
+			if ($oDocument->isExists() && !$oDocument->isNotice())
524 524
 			{
525 525
 				$page = $oDocumentModel->getDocumentPage($oDocument, $args);
526 526
 				Context::set('page', $page);
@@ -529,21 +529,21 @@  discard block
 block discarded – undo
529 529
 		}
530 530
 
531 531
 		// setup the list count to be serach list count, if the category or search keyword has been set
532
-		if($args->category_srl || $args->search_keyword)
532
+		if ($args->category_srl || $args->search_keyword)
533 533
 		{
534 534
 			$args->list_count = $this->search_list_count;
535 535
 		}
536 536
 
537 537
 		// if the consultation function is enabled,  the get the logged user information
538
-		if($this->consultation)
538
+		if ($this->consultation)
539 539
 		{
540 540
 			$logged_info = Context::get('logged_info');
541 541
 			$args->member_srl = $logged_info->member_srl;
542 542
 
543
-			if($this->module_info->use_anonymous === 'Y')
543
+			if ($this->module_info->use_anonymous === 'Y')
544 544
 			{
545 545
 				unset($args->member_srl);
546
-				$args->member_srls = $logged_info->member_srl . ',' . $logged_info->member_srl * -1;
546
+				$args->member_srls = $logged_info->member_srl.','.$logged_info->member_srl * -1;
547 547
 			}
548 548
 		}
549 549
 
@@ -569,18 +569,18 @@  discard block
 block discarded – undo
569 569
 				'allow_trackback', 'notify_message', 'status', 'comment_status');
570 570
 		$this->columnList = array_intersect($configColumList, $tableColumnList);
571 571
 
572
-		if(in_array('summary', $configColumList)) array_push($this->columnList, 'content');
572
+		if (in_array('summary', $configColumList)) array_push($this->columnList, 'content');
573 573
 
574 574
 		// default column list add
575 575
 		$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');
576 576
 
577 577
 		//TODO guestbook, blog style supports legacy codes.
578
-		if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
578
+		if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
579 579
 		{
580 580
 			$defaultColumn = $tableColumnList;
581 581
 		}
582 582
 
583
-		if (in_array('last_post', $configColumList)){
583
+		if (in_array('last_post', $configColumList)) {
584 584
 			array_push($this->columnList, 'last_updater');
585 585
 		}
586 586
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 		$this->columnList = array_unique(array_merge($this->columnList, $defaultColumn));
593 593
 
594 594
 		// add table name
595
-		foreach($this->columnList as $no => $value)
595
+		foreach ($this->columnList as $no => $value)
596 596
 		{
597
-			$this->columnList[$no] = 'documents.' . $value;
597
+			$this->columnList[$no] = 'documents.'.$value;
598 598
 		}
599 599
 	}
600 600
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	function dispBoardTagList()
605 605
 	{
606 606
 		// check if there is not grant fot view list, then alert an warning message
607
-		if(!$this->grant->list)
607
+		if (!$this->grant->list)
608 608
 		{
609 609
 			return $this->dispBoardMessage('msg_not_permitted');
610 610
 		}
@@ -618,14 +618,14 @@  discard block
 block discarded – undo
618 618
 		$output = $oTagModel->getTagList($obj);
619 619
 
620 620
 		// automatically order
621
-		if(count($output->data))
621
+		if (count($output->data))
622 622
 		{
623 623
 			$numbers = array_keys($output->data);
624 624
 			shuffle($numbers);
625 625
 
626
-			if(count($output->data))
626
+			if (count($output->data))
627 627
 			{
628
-				foreach($numbers as $k => $v)
628
+				foreach ($numbers as $k => $v)
629 629
 				{
630 630
 					$tag_list[] = $output->data[$v];
631 631
 				}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	function dispBoardWrite()
647 647
 	{
648 648
 		// check grant
649
-		if(!$this->grant->write_document)
649
+		if (!$this->grant->write_document)
650 650
 		{
651 651
 			return $this->dispBoardMessage('msg_not_permitted');
652 652
 		}
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
 		/**
657 657
 		 * check if the category option is enabled not not
658 658
 		 **/
659
-		if($this->module_info->use_category=='Y')
659
+		if ($this->module_info->use_category == 'Y')
660 660
 		{
661 661
 			// get the user group information
662
-			if(Context::get('is_logged'))
662
+			if (Context::get('is_logged'))
663 663
 			{
664 664
 				$logged_info = Context::get('logged_info');
665 665
 				$group_srls = array_keys($logged_info->group_list);
@@ -672,19 +672,19 @@  discard block
 block discarded – undo
672 672
 
673 673
 			// check the grant after obtained the category list
674 674
 			$normal_category_list = $oDocumentModel->getCategoryList($this->module_srl);
675
-			if(count($normal_category_list))
675
+			if (count($normal_category_list))
676 676
 			{
677
-				foreach($normal_category_list as $category_srl => $category)
677
+				foreach ($normal_category_list as $category_srl => $category)
678 678
 				{
679 679
 					$is_granted = TRUE;
680
-					if($category->group_srls)
680
+					if ($category->group_srls)
681 681
 					{
682
-						$category_group_srls = explode(',',$category->group_srls);
682
+						$category_group_srls = explode(',', $category->group_srls);
683 683
 						$is_granted = FALSE;
684
-						if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE;
684
+						if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE;
685 685
 
686 686
 					}
687
-					if($is_granted) $category_list[$category_srl] = $category;
687
+					if ($is_granted) $category_list[$category_srl] = $category;
688 688
 				}
689 689
 			}
690 690
 			Context::set('category_list', $category_list);
@@ -695,46 +695,46 @@  discard block
 block discarded – undo
695 695
 		$oDocument = $oDocumentModel->getDocument(0, $this->grant->manager);
696 696
 		$oDocument->setDocument($document_srl);
697 697
 
698
-		if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
698
+		if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
699 699
 		$oDocument->add('module_srl', $this->module_srl);
700 700
 
701
-		if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
701
+		if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
702 702
 		{
703 703
 			return new BaseObject(-1, 'msg_protect_content');
704 704
 		}
705 705
 
706 706
 		// if the document is not granted, then back to the password input form
707 707
 		$oModuleModel = getModel('module');
708
-		if($oDocument->isExists()&&!$oDocument->isGranted())
708
+		if ($oDocument->isExists() && !$oDocument->isGranted())
709 709
 		{
710 710
 			return $this->setTemplateFile('input_password_form');
711 711
 		}
712 712
 
713
-		if(!$oDocument->isExists())
713
+		if (!$oDocument->isExists())
714 714
 		{
715
-			$point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl);
715
+			$point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl);
716 716
 			$logged_info = Context::get('logged_info');
717 717
 			$oPointModel = getModel('point');
718 718
 			$pointForInsert = $point_config["insert_document"];
719
-			if($pointForInsert < 0)
719
+			if ($pointForInsert < 0)
720 720
 			{
721
-				if( !$logged_info )
721
+				if (!$logged_info)
722 722
 				{
723 723
 					return $this->dispBoardMessage('msg_not_permitted');
724 724
 				}
725
-				else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 )
725
+				else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0)
726 726
 				{
727 727
 					return $this->dispBoardMessage('msg_not_enough_point');
728 728
 				}
729 729
 			}
730 730
 		}
731
-		if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus());
731
+		if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus());
732 732
 
733 733
 		$statusList = $this->_getStatusNameList($oDocumentModel);
734
-		if(count($statusList) > 0) Context::set('status_list', $statusList);
734
+		if (count($statusList) > 0) Context::set('status_list', $statusList);
735 735
 
736 736
 		// get Document status config value
737
-		Context::set('document_srl',$document_srl);
737
+		Context::set('document_srl', $document_srl);
738 738
 		Context::set('oDocument', $oDocument);
739 739
 
740 740
 		// apply xml_js_filter on header
@@ -742,12 +742,12 @@  discard block
 block discarded – undo
742 742
 		$oDocumentController->addXmlJsFilter($this->module_info->module_srl);
743 743
 
744 744
 		// if the document exists, then setup extra variabels on context
745
-		if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars());
745
+		if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars());
746 746
 
747 747
 		/**
748 748
 		 * add JS filters
749 749
 		 **/
750
-		if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
750
+		if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
751 751
 		else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml');
752 752
 
753 753
 		$oSecurity = new Security();
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 	function _getStatusNameList(&$oDocumentModel)
760 760
 	{
761 761
 		$resultList = array();
762
-		if(!empty($this->module_info->use_status))
762
+		if (!empty($this->module_info->use_status))
763 763
 		{
764 764
 			$statusNameList = $oDocumentModel->getStatusNameList();
765 765
 			$statusList = explode('|@|', $this->module_info->use_status);
766 766
 
767
-			if(is_array($statusList))
767
+			if (is_array($statusList))
768 768
 			{
769
-				foreach($statusList as $key => $value)
769
+				foreach ($statusList as $key => $value)
770 770
 				{
771 771
 					$resultList[$value] = $statusNameList[$value];
772 772
 				}
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	function dispBoardDelete()
782 782
 	{
783 783
 		// check grant
784
-		if(!$this->grant->write_document)
784
+		if (!$this->grant->write_document)
785 785
 		{
786 786
 			return $this->dispBoardMessage('msg_not_permitted');
787 787
 		}
@@ -790,30 +790,30 @@  discard block
 block discarded – undo
790 790
 		$document_srl = Context::get('document_srl');
791 791
 
792 792
 		// if document exists, get the document information
793
-		if($document_srl)
793
+		if ($document_srl)
794 794
 		{
795 795
 			$oDocumentModel = getModel('document');
796 796
 			$oDocument = $oDocumentModel->getDocument($document_srl);
797 797
 		}
798 798
 
799 799
 		// if the document is not existed, then back to the board content page
800
-		if(!$oDocument || !$oDocument->isExists())
800
+		if (!$oDocument || !$oDocument->isExists())
801 801
 		{
802 802
 			return $this->dispBoardContent();
803 803
 		}
804 804
 
805 805
 		// if the document is not granted, then back to the password input form
806
-		if(!$oDocument->isGranted())
806
+		if (!$oDocument->isGranted())
807 807
 		{
808 808
 			return $this->setTemplateFile('input_password_form');
809 809
 		}
810 810
 
811
-		if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
811
+		if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
812 812
 		{
813 813
 			return $this->dispBoardMessage('msg_protect_content');
814 814
 		}
815 815
 
816
-		Context::set('oDocument',$oDocument);
816
+		Context::set('oDocument', $oDocument);
817 817
 
818 818
 		/**
819 819
 		 * add JS filters
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 		$document_srl = Context::get('document_srl');
832 832
 
833 833
 		// check grant
834
-		if(!$this->grant->write_comment)
834
+		if (!$this->grant->write_comment)
835 835
 		{
836 836
 			return $this->dispBoardMessage('msg_not_permitted');
837 837
 		}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 		// get the document information
840 840
 		$oDocumentModel = getModel('document');
841 841
 		$oDocument = $oDocumentModel->getDocument($document_srl);
842
-		if(!$oDocument->isExists())
842
+		if (!$oDocument->isExists())
843 843
 		{
844 844
 			return $this->dispBoardMessage('msg_invalid_request');
845 845
 		}
846 846
 
847 847
 		// Check allow comment
848
-		if(!$oDocument->allowComment())
848
+		if (!$oDocument->allowComment())
849 849
 		{
850 850
 			return $this->dispBoardMessage('msg_not_allow_comment');
851 851
 		}
@@ -857,9 +857,9 @@  discard block
 block discarded – undo
857 857
 		$oComment->add('module_srl', $this->module_srl);
858 858
 
859 859
 		// setup document variables on context
860
-		Context::set('oDocument',$oDocument);
861
-		Context::set('oSourceComment',$oSourceComment);
862
-		Context::set('oComment',$oComment);
860
+		Context::set('oDocument', $oDocument);
861
+		Context::set('oSourceComment', $oSourceComment);
862
+		Context::set('oComment', $oComment);
863 863
 
864 864
 		/**
865 865
 		 * add JS filter
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	function dispBoardReplyComment()
876 876
 	{
877 877
 		// check grant
878
-		if(!$this->grant->write_comment)
878
+		if (!$this->grant->write_comment)
879 879
 		{
880 880
 			return $this->dispBoardMessage('msg_not_permitted');
881 881
 		}
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 		$parent_srl = Context::get('comment_srl');
885 885
 
886 886
 		// if the parent comment is not existed
887
-		if(!$parent_srl)
887
+		if (!$parent_srl)
888 888
 		{
889 889
 			return new BaseObject(-1, 'msg_invalid_request');
890 890
 		}
@@ -894,11 +894,11 @@  discard block
 block discarded – undo
894 894
 		$oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager);
895 895
 
896 896
 		// if the comment is not existed, opoup an error message
897
-		if(!$oSourceComment->isExists())
897
+		if (!$oSourceComment->isExists())
898 898
 		{
899 899
 			return $this->dispBoardMessage('msg_invalid_request');
900 900
 		}
901
-		if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl'))
901
+		if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl'))
902 902
 		{
903 903
 			return $this->dispBoardMessage('msg_invalid_request');
904 904
 		}
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 		// Check allow comment
907 907
 		$oDocumentModel = getModel('document');
908 908
 		$oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl'));
909
-		if(!$oDocument->allowComment())
909
+		if (!$oDocument->allowComment())
910 910
 		{
911 911
 			return $this->dispBoardMessage('msg_not_allow_comment');
912 912
 		}
@@ -917,9 +917,9 @@  discard block
 block discarded – undo
917 917
 		$oComment->add('document_srl', $oSourceComment->get('document_srl'));
918 918
 
919 919
 		// setup comment variables
920
-		Context::set('oSourceComment',$oSourceComment);
921
-		Context::set('oComment',$oComment);
922
-		Context::set('module_srl',$this->module_info->module_srl);
920
+		Context::set('oSourceComment', $oSourceComment);
921
+		Context::set('oComment', $oComment);
922
+		Context::set('module_srl', $this->module_info->module_srl);
923 923
 
924 924
 		/**
925 925
 		 * add JS filters
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	function dispBoardModifyComment()
936 936
 	{
937 937
 		// check grant
938
-		if(!$this->grant->write_comment)
938
+		if (!$this->grant->write_comment)
939 939
 		{
940 940
 			return $this->dispBoardMessage('msg_not_permitted');
941 941
 		}
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 		$comment_srl = Context::get('comment_srl');
946 946
 
947 947
 		// if the comment is not existed
948
-		if(!$comment_srl)
948
+		if (!$comment_srl)
949 949
 		{
950 950
 			return new BaseObject(-1, 'msg_invalid_request');
951 951
 		}
@@ -955,13 +955,13 @@  discard block
 block discarded – undo
955 955
 		$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
956 956
 
957 957
 		// if the comment is not exited, alert an error message
958
-		if(!$oComment->isExists())
958
+		if (!$oComment->isExists())
959 959
 		{
960 960
 			return $this->dispBoardMessage('msg_invalid_request');
961 961
 		}
962 962
 
963 963
 		// if the comment is not granted, then back to the password input form
964
-		if(!$oComment->isGranted())
964
+		if (!$oComment->isGranted())
965 965
 		{
966 966
 			return $this->setTemplateFile('input_password_form');
967 967
 		}
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	function dispBoardDeleteComment()
985 985
 	{
986 986
 		// check grant
987
-		if(!$this->grant->write_comment)
987
+		if (!$this->grant->write_comment)
988 988
 		{
989 989
 			return $this->dispBoardMessage('msg_not_permitted');
990 990
 		}
@@ -993,25 +993,25 @@  discard block
 block discarded – undo
993 993
 		$comment_srl = Context::get('comment_srl');
994 994
 
995 995
 		// if the comment exists, then get the comment information
996
-		if($comment_srl)
996
+		if ($comment_srl)
997 997
 		{
998 998
 			$oCommentModel = getModel('comment');
999 999
 			$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
1000 1000
 		}
1001 1001
 
1002 1002
 		// if the comment is not existed, then back to the board content page
1003
-		if(!$oComment->isExists() )
1003
+		if (!$oComment->isExists())
1004 1004
 		{
1005 1005
 			return $this->dispBoardContent();
1006 1006
 		}
1007 1007
 
1008 1008
 		// if the comment is not granted, then back to the password input form
1009
-		if(!$oComment->isGranted())
1009
+		if (!$oComment->isGranted())
1010 1010
 		{
1011 1011
 			return $this->setTemplateFile('input_password_form');
1012 1012
 		}
1013 1013
 
1014
-		Context::set('oComment',$oComment);
1014
+		Context::set('oComment', $oComment);
1015 1015
 
1016 1016
 		/**
1017 1017
 		 * add JS filters
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	{
1029 1029
 		$oTrackbackModel = getModel('trackback');
1030 1030
 
1031
-		if(!$oTrackbackModel)
1031
+		if (!$oTrackbackModel)
1032 1032
 		{
1033 1033
 			return;
1034 1034
 		}
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 		$trackback = $output->data;
1043 1043
 
1044 1044
 		// if no trackback, then display the board content
1045
-		if(!$trackback)
1045
+		if (!$trackback)
1046 1046
 		{
1047 1047
 			return $this->dispBoardContent();
1048 1048
 		}
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 	function dispBoardMessage($msg_code)
1064 1064
 	{
1065 1065
 		$msg = Context::getLang($msg_code);
1066
-		if(!$msg) $msg = $msg_code;
1066
+		if (!$msg) $msg = $msg_code;
1067 1067
 		Context::set('message', $msg);
1068 1068
 		$this->setTemplateFile('message');
1069 1069
 	}
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 	 **/
1075 1075
 	function alertMessage($message)
1076 1076
 	{
1077
-		$script =  sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message));
1078
-		Context::addHtmlFooter( $script );
1077
+		$script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message));
1078
+		Context::addHtmlFooter($script);
1079 1079
 	}
1080 1080
 
1081 1081
 }
Please login to merge, or discard this patch.
modules/addon/addon.admin.model.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	function getAddonPath($addon_name)
28 28
 	{
29 29
 		$class_path = sprintf('./addons/%s/', $addon_name);
30
-		if(is_dir($class_path))
30
+		if (is_dir($class_path))
31 31
 		{
32 32
 			return $class_path;
33 33
 		}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		$addonList = $this->getAddonList(0, 'site');
45 45
 
46 46
 		$oAutoinstallModel = getModel('autoinstall');
47
-		foreach($addonList as $key => $addon)
47
+		foreach ($addonList as $key => $addon)
48 48
 		{
49 49
 			// get easyinstall remove url
50 50
 			$packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			$addonList[$key]->need_update = $package[$packageSrl]->need_update;
56 56
 
57 57
 			// get easyinstall update url
58
-			if($addonList[$key]->need_update == 'Y')
58
+			if ($addonList[$key]->need_update == 'Y')
59 59
 			{
60 60
 				$addonList[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
61 61
 			}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		// Downloaded and installed add-on to the list of Wanted
79 79
 		$searched_list = FileHandler::readDir('./addons', '/^([a-zA-Z0-9_]+)$/');
80 80
 		$searched_count = count($searched_list);
81
-		if(!$searched_count)
81
+		if (!$searched_count)
82 82
 		{
83 83
 			return;
84 84
 		}
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$oAddonAdminController = getAdminController('addon');
89 89
 
90
-		for($i = 0; $i < $searched_count; $i++)
90
+		for ($i = 0; $i < $searched_count; $i++)
91 91
 		{
92 92
 			// Add the name of
93 93
 			$addon_name = $searched_list[$i];
94
-			if($addon_name == "smartphone")
94
+			if ($addon_name == "smartphone")
95 95
 			{
96 96
 				continue;
97 97
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			// Wanted information on the add-on
101 101
 			$info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype);
102 102
 			
103
-			if(!$info) $info = new stdClass();
103
+			if (!$info) $info = new stdClass();
104 104
 
105 105
 			$info->addon = $addon_name;
106 106
 			$info->path = $path;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			$info->mactivated = FALSE;
109 109
 			$info->fixed = FALSE;
110 110
 			// Check if a permossion is granted entered in DB
111
-			if(!in_array($addon_name, array_keys($inserted_addons)))
111
+			if (!in_array($addon_name, array_keys($inserted_addons)))
112 112
 			{
113 113
 				// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
114 114
 				$oAddonAdminController->doInsert($addon_name, $site_srl, $type);
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 			}
117 117
 			else
118 118
 			{
119
-				if($inserted_addons[$addon_name]->is_used == 'Y')
119
+				if ($inserted_addons[$addon_name]->is_used == 'Y')
120 120
 				{
121 121
 					$info->activated = TRUE;
122 122
 				}
123
-				if($inserted_addons[$addon_name]->is_used_m == 'Y')
123
+				if ($inserted_addons[$addon_name]->is_used_m == 'Y')
124 124
 				{
125 125
 					$info->mactivated = TRUE;
126 126
 				}
127
-				if($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y')
127
+				if ($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y')
128 128
 				{
129 129
 					$info->fixed = TRUE;
130 130
 				}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		// Get a path of the requested module. Return if not exists.
149 149
 		$addon_path = $this->getAddonPath($addon);
150
-		if(!$addon_path)
150
+		if (!$addon_path)
151 151
 		{
152 152
 			return;
153 153
 		}
154 154
 
155 155
 		// Read the xml file for module skin information
156 156
 		$xml_file = sprintf("%sconf/info.xml", FileHandler::getRealpath($addon_path));
157
-		if(!file_exists($xml_file))
157
+		if (!file_exists($xml_file))
158 158
 		{
159 159
 			return;
160 160
 		}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
164 164
 		$xml_obj = $tmp_xml_obj->addon;
165 165
 
166
-		if(!$xml_obj)
166
+		if (!$xml_obj)
167 167
 		{
168 168
 			return;
169 169
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		// DB is set to bring history
172 172
 		$db_args = new stdClass();
173 173
 		$db_args->addon = $addon;
174
-		if($gtype == 'global')
174
+		if ($gtype == 'global')
175 175
 		{
176 176
 			$output = executeQuery('addon.getAddonInfo', $db_args);
177 177
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		$extra_vals = unserialize($output->data->extra_vars);
184 184
 
185 185
 		$addon_info = new stdClass();
186
-		if($extra_vals->mid_list)
186
+		if ($extra_vals->mid_list)
187 187
 		{
188 188
 			$addon_info->mid_list = $extra_vals->mid_list;
189 189
 		}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 			$addon_info->mid_list = array();
193 193
 		}
194 194
 
195
-		if($extra_vals->xe_run_method)
195
+		if ($extra_vals->xe_run_method)
196 196
 		{
197 197
 			$addon_info->xe_run_method = $extra_vals->xe_run_method;
198 198
 		}
199 199
 
200 200
 		// Add information
201
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
201
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
202 202
 		{
203 203
 			// addon format v0.2
204 204
 			$date_obj = new stdClass();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			$addon_info->license = $xml_obj->license->body;
214 214
 			$addon_info->license_link = $xml_obj->license->attrs->link;
215 215
 
216
-			if(!is_array($xml_obj->author))
216
+			if (!is_array($xml_obj->author))
217 217
 			{
218 218
 				$author_list = array();
219 219
 				$author_list[] = $xml_obj->author;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			}
225 225
 
226 226
 			$addon_info->author = array();
227
-			foreach($author_list as $author)
227
+			foreach ($author_list as $author)
228 228
 			{
229 229
 				$author_obj = new stdClass();
230 230
 				$author_obj->name = $author->name->body;
@@ -234,39 +234,39 @@  discard block
 block discarded – undo
234 234
 			}
235 235
 
236 236
 			// Expand the variable order
237
-			if($xml_obj->extra_vars)
237
+			if ($xml_obj->extra_vars)
238 238
 			{
239 239
 				$extra_var_groups = $xml_obj->extra_vars->group;
240
-				if(!$extra_var_groups)
240
+				if (!$extra_var_groups)
241 241
 				{
242 242
 					$extra_var_groups = $xml_obj->extra_vars;
243 243
 				}
244
-				if(!is_array($extra_var_groups))
244
+				if (!is_array($extra_var_groups))
245 245
 				{
246 246
 					$extra_var_groups = array($extra_var_groups);
247 247
 				}
248 248
 
249
-				foreach($extra_var_groups as $group)
249
+				foreach ($extra_var_groups as $group)
250 250
 				{
251 251
 					$extra_vars = $group->var;
252
-					if(!is_array($group->var))
252
+					if (!is_array($group->var))
253 253
 					{
254 254
 						$extra_vars = array($group->var);
255 255
 					}
256 256
 
257
-					foreach($extra_vars as $key => $val)
257
+					foreach ($extra_vars as $key => $val)
258 258
 					{
259
-						if(!$val)
259
+						if (!$val)
260 260
 						{
261 261
 							continue;
262 262
 						}
263 263
 
264 264
 						$obj = new stdClass();
265
-						if(!$val->attrs)
265
+						if (!$val->attrs)
266 266
 						{
267 267
 							$val->attrs = new stdClass();
268 268
 						}
269
-						if(!$val->attrs->type)
269
+						if (!$val->attrs->type)
270 270
 						{
271 271
 							$val->attrs->type = 'text';
272 272
 						}
@@ -276,26 +276,26 @@  discard block
 block discarded – undo
276 276
 						$obj->title = $val->title->body;
277 277
 						$obj->type = $val->attrs->type;
278 278
 						$obj->description = $val->description->body;
279
-						if($obj->name)
279
+						if ($obj->name)
280 280
 						{
281 281
 							$obj->value = $extra_vals->{$obj->name};
282 282
 						}
283
-						if(strpos($obj->value, '|@|') != FALSE)
283
+						if (strpos($obj->value, '|@|') != FALSE)
284 284
 						{
285 285
 							$obj->value = explode('|@|', $obj->value);
286 286
 						}
287
-						if($obj->type == 'mid_list' && !is_array($obj->value))
287
+						if ($obj->type == 'mid_list' && !is_array($obj->value))
288 288
 						{
289 289
 							$obj->value = array($obj->value);
290 290
 						}
291 291
 
292 292
 						// 'Select'type obtained from the option list.
293
-						if($val->options && !is_array($val->options))
293
+						if ($val->options && !is_array($val->options))
294 294
 						{
295 295
 							$val->options = array($val->options);
296 296
 						}
297 297
 
298
-						for($i = 0, $c = count($val->options); $i < $c; $i++)
298
+						for ($i = 0, $c = count($val->options); $i < $c; $i++)
299 299
 						{
300 300
 							$obj->options[$i] = new stdClass();
301 301
 							$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -328,30 +328,30 @@  discard block
 block discarded – undo
328 328
 			$addon_info->author = array();
329 329
 			$addon_info->author[] = $author_obj;
330 330
 
331
-			if($xml_obj->extra_vars)
331
+			if ($xml_obj->extra_vars)
332 332
 			{
333 333
 				// Expand the variable order
334 334
 				$extra_var_groups = $xml_obj->extra_vars->group;
335
-				if(!$extra_var_groups)
335
+				if (!$extra_var_groups)
336 336
 				{
337 337
 					$extra_var_groups = $xml_obj->extra_vars;
338 338
 				}
339
-				if(!is_array($extra_var_groups))
339
+				if (!is_array($extra_var_groups))
340 340
 				{
341 341
 					$extra_var_groups = array($extra_var_groups);
342 342
 				}
343
-				foreach($extra_var_groups as $group)
343
+				foreach ($extra_var_groups as $group)
344 344
 				{
345 345
 					$extra_vars = $group->var;
346
-					if(!is_array($group->var))
346
+					if (!is_array($group->var))
347 347
 					{
348 348
 						$extra_vars = array($group->var);
349 349
 					}
350 350
 
351 351
 					$addon_info->extra_vars = array();
352
-					foreach($extra_vars as $key => $val)
352
+					foreach ($extra_vars as $key => $val)
353 353
 					{
354
-						if(!$val)
354
+						if (!$val)
355 355
 						{
356 356
 							continue;
357 357
 						}
@@ -363,26 +363,26 @@  discard block
 block discarded – undo
363 363
 						$obj->title = $val->title->body;
364 364
 						$obj->type = $val->type->body ? $val->type->body : 'text';
365 365
 						$obj->description = $val->description->body;
366
-						if($obj->name)
366
+						if ($obj->name)
367 367
 						{
368 368
 							$obj->value = $extra_vals->{$obj->name};
369 369
 						}
370
-						if(strpos($obj->value, '|@|') != false)
370
+						if (strpos($obj->value, '|@|') != false)
371 371
 						{
372 372
 							$obj->value = explode('|@|', $obj->value);
373 373
 						}
374
-						if($obj->type == 'mid_list' && !is_array($obj->value))
374
+						if ($obj->type == 'mid_list' && !is_array($obj->value))
375 375
 						{
376 376
 							$obj->value = array($obj->value);
377 377
 						}
378 378
 						// 'Select'type obtained from the option list.
379
-						if($val->options && !is_array($val->options))
379
+						if ($val->options && !is_array($val->options))
380 380
 						{
381 381
 							$val->options = array($val->options);
382 382
 						}
383 383
 
384 384
 						$obj->options = array();
385
-						for($i = 0, $c = count($val->options); $i < $c; $i++)
385
+						for ($i = 0, $c = count($val->options); $i < $c; $i++)
386 386
 						{
387 387
 							$obj->options[$i]->title = $val->options[$i]->title->body;
388 388
 							$obj->options[$i]->value = $val->options[$i]->value->body;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	{
407 407
 		$args = new stdClass();
408 408
 		$args->list_order = 'addon';
409
-		if($gtype == 'global')
409
+		if ($gtype == 'global')
410 410
 		{
411 411
 			$output = executeQueryArray('addon.getAddons', $args);
412 412
 		}
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
 			$args->site_srl = $site_srl;
416 416
 			$output = executeQueryArray('addon.getSiteAddons', $args);
417 417
 		}
418
-		if(!$output->data)
418
+		if (!$output->data)
419 419
 		{
420 420
 			return array();
421 421
 		}
422 422
 
423 423
 		$activated_count = count($output->data);
424 424
 		$addon_list = array();
425
-		for($i = 0; $i < $activated_count; $i++)
425
+		for ($i = 0; $i < $activated_count; $i++)
426 426
 		{
427 427
 			$addon = $output->data[$i];
428 428
 			$addon_list[$addon->addon] = $addon;
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 	{
444 444
 		$args = new stdClass();
445 445
 		$args->addon = $addon;
446
-		if($gtype == 'global')
446
+		if ($gtype == 'global')
447 447
 		{
448
-			if($type == "pc")
448
+			if ($type == "pc")
449 449
 			{
450 450
 				$output = executeQuery('addon.getAddonIsActivated', $args);
451 451
 			}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		else
458 458
 		{
459 459
 			$args->site_srl = $site_srl;
460
-			if($type == "pc")
460
+			if ($type == "pc")
461 461
 			{
462 462
 				$output = executeQuery('addon.getSiteAddonIsActivated', $args);
463 463
 			}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 				$output = executeQuery('addon.getSiteMAddonIsActivated', $args);
467 467
 			}
468 468
 		}
469
-		if($output->data->count > 0)
469
+		if ($output->data->count > 0)
470 470
 		{
471 471
 			return TRUE;
472 472
 		}
Please login to merge, or discard this patch.
modules/layout/layout.model.php 2 patches
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
 	 * @param array $columnList
32 32
 	 * @return array layout lists in site
33 33
 	 */
34
-	function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array())
34
+	function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array())
35 35
 	{
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_module_info = Context::get('site_module_info');
39
-			$site_srl = (int)$site_module_info->site_srl;
39
+			$site_srl = (int) $site_module_info->site_srl;
40 40
 		}
41 41
 		$args = new stdClass();
42 42
 		$args->site_srl = $site_srl;
43 43
 		$args->layout_type = $layout_type;
44 44
 		$output = executeQueryArray('layout.getLayoutList', $args, $columnList);
45 45
 
46
-		foreach($output->data as $no => &$val)
46
+		foreach ($output->data as $no => &$val)
47 47
 		{
48
-			if(!$this->isExistsLayoutFile($val->layout, $layout_type))
48
+			if (!$this->isExistsLayoutFile($val->layout, $layout_type))
49 49
 			{
50 50
 				unset($output->data[$no]);
51 51
 			}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$oLayoutAdminModel = getAdminModel('layout');
55 55
 		$siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl);
56
-		if($siteDefaultLayoutSrl)
56
+		if ($siteDefaultLayoutSrl)
57 57
 		{
58 58
 			$siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl);
59 59
 			$newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout);
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 		$layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType);
81 81
 		$thumbs = array();
82 82
 
83
-		foreach($layoutList as $key => $val)
83
+		foreach ($layoutList as $key => $val)
84 84
 		{
85
-			if($thumbs[$val->layouts])
85
+			if ($thumbs[$val->layouts])
86 86
 			{
87 87
 				$val->thumbnail = $thumbs[$val->layouts];
88 88
 				continue;
89 89
 			}
90 90
 
91 91
 			$token = explode('|@|', $val->layout);
92
-			if(count($token) == 2)
92
+			if (count($token) == 2)
93 93
 			{
94
-				$thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]);
94
+				$thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]);
95 95
 			}
96 96
 			else
97 97
 			{
98
-				$thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout);
98
+				$thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout);
99 99
 			}
100
-			if(is_readable($thumbnailPath))
100
+			if (is_readable($thumbnailPath))
101 101
 			{
102 102
 				$val->thumbnail = $thumbnailPath;
103 103
 			}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		if (!$siteSrl)
124 124
 		{
125 125
 			$siteModuleInfo = Context::get('site_module_info');
126
-			$siteSrl = (int)$siteModuleInfo->site_srl;
126
+			$siteSrl = (int) $siteModuleInfo->site_srl;
127 127
 		}
128 128
 		$args = new stdClass();
129 129
 		$args->site_srl = $siteSrl;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Create instance name list
135 135
 		$instanceList = array();
136
-		if(is_array($output->data))
136
+		if (is_array($output->data))
137 137
 		{
138
-			foreach($output->data as $no => $iInfo)
138
+			foreach ($output->data as $no => $iInfo)
139 139
 			{
140
-				if($this->isExistsLayoutFile($iInfo->layout, $layoutType))
140
+				if ($this->isExistsLayoutFile($iInfo->layout, $layoutType))
141 141
 				{
142 142
 					$instanceList[] = $iInfo->layout;
143 143
 				}
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		$downloadedList = array();
153 153
 		$titleList = array();
154 154
 		$_downloadedList = $this->getDownloadedLayoutList($layoutType);
155
-		if(is_array($_downloadedList))
155
+		if (is_array($_downloadedList))
156 156
 		{
157
-			foreach($_downloadedList as $dLayoutInfo)
157
+			foreach ($_downloadedList as $dLayoutInfo)
158 158
 			{
159 159
 				$downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout;
160 160
 				$titleList[$dLayoutInfo->layout] = $dLayoutInfo->title;
161 161
 			}
162 162
 		}
163 163
 
164
-		if($layout)
164
+		if ($layout)
165 165
 		{
166
-			if(count($instanceList) < 1 && $downloadedList[$layout])
166
+			if (count($instanceList) < 1 && $downloadedList[$layout])
167 167
 			{
168 168
 				$insertArgs = new stdClass();
169 169
 				$insertArgs->site_srl = $siteSrl;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		{
182 182
 			// Get downloaded name list have no instance
183 183
 			$noInstanceList = array_diff($downloadedList, $instanceList);
184
-			foreach($noInstanceList as $layoutName)
184
+			foreach ($noInstanceList as $layoutName)
185 185
 			{
186 186
 				$insertArgs = new stdClass();
187 187
 				$insertArgs->site_srl = $siteSrl;
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 		}
198 198
 
199 199
 		// If create layout instance, reload instance list
200
-		if($isCreateInstance)
200
+		if ($isCreateInstance)
201 201
 		{
202 202
 			$output = executeQueryArray('layout.getLayoutList', $args, $columnList);
203 203
 
204
-			if(is_array($output->data))
204
+			if (is_array($output->data))
205 205
 			{
206
-				foreach($output->data as $no => $iInfo)
206
+				foreach ($output->data as $no => $iInfo)
207 207
 				{
208
-					if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType))
208
+					if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType))
209 209
 					{
210 210
 						unset($output->data[$no]);
211 211
 					}
@@ -226,28 +226,28 @@  discard block
 block discarded – undo
226 226
 	function isExistsLayoutFile($layout, $layoutType)
227 227
 	{
228 228
 		//TODO If remove a support themes, remove this codes also.
229
-		if($layoutType == 'P')
229
+		if ($layoutType == 'P')
230 230
 		{
231
-			$pathPrefix = _XE_PATH_ . 'layouts/';
232
-			$themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s';
231
+			$pathPrefix = _XE_PATH_.'layouts/';
232
+			$themePathFormat = _XE_PATH_.'themes/%s/layouts/%s';
233 233
 		}
234 234
 		else
235 235
 		{
236
-			$pathPrefix = _XE_PATH_ . 'm.layouts/';
237
-			$themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s';
236
+			$pathPrefix = _XE_PATH_.'m.layouts/';
237
+			$themePathFormat = _XE_PATH_.'themes/%s/m.layouts/%s';
238 238
 		}
239 239
 
240
-		if(strpos($layout, '|@|') !== FALSE)
240
+		if (strpos($layout, '|@|') !== FALSE)
241 241
 		{
242 242
 			list($themeName, $layoutName) = explode('|@|', $layout);
243 243
 			$path = sprintf($themePathFormat, $themeName, $layoutName);
244 244
 		}
245 245
 		else
246 246
 		{
247
-			$path = $pathPrefix . $layout;
247
+			$path = $pathPrefix.$layout;
248 248
 		}
249 249
 
250
-		return is_readable($path . '/layout.html');
250
+		return is_readable($path.'/layout.html');
251 251
 	}
252 252
 
253 253
 	/**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		$args = new stdClass();
263 263
 		$args->layout_srl = $layout_srl;
264 264
 		$output = executeQuery('layout.getLayout', $args);
265
-		if(!$output->data) return;
265
+		if (!$output->data) return;
266 266
 
267 267
 		// Return xml file informaton after listing up the layout and extra_vars
268 268
 		$layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$args = new stdClass();
276 276
 		$args->layout_srl = $layout_srl;
277 277
 		$output = executeQuery('layout.getLayout', $args, $columnList);
278
-		if(!$output->toBool())
278
+		if (!$output->toBool())
279 279
 		{
280 280
 			return;
281 281
 		}
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 	function getLayoutPath($layout_name = "", $layout_type = "P")
293 293
 	{
294 294
 		$layout_parse = explode('|@|', $layout_name);
295
-		if(count($layout_parse) > 1)
295
+		if (count($layout_parse) > 1)
296 296
 		{
297 297
 			$class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/';
298 298
 		}
299
-		else if($layout_name == 'faceoff')
299
+		else if ($layout_name == 'faceoff')
300 300
 		{
301 301
 			$class_path = './modules/layout/faceoff/';
302 302
 		}
303
-		else if($layout_type == "M")
303
+		else if ($layout_type == "M")
304 304
 		{
305 305
 			$class_path = sprintf("./m.layouts/%s/", $layout_name);
306 306
 		}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		{
309 309
 			$class_path = sprintf('./layouts/%s/', $layout_name);
310 310
 		}
311
-		if(is_dir($class_path)) return $class_path;
311
+		if (is_dir($class_path)) return $class_path;
312 312
 		return "";
313 313
 	}
314 314
 
@@ -326,24 +326,24 @@  discard block
 block discarded – undo
326 326
 		// Get a list of downloaded layout and installed layout
327 327
 		$searched_list = $this->_getInstalledLayoutDirectories($layout_type);
328 328
 		$searched_count = count($searched_list);
329
-		if(!$searched_count) return;
329
+		if (!$searched_count) return;
330 330
 
331 331
 		// natcasesort($searched_list);
332 332
 		// Return information for looping searched list of layouts
333 333
 		$list = array();
334
-		for($i=0;$i<$searched_count;$i++)
334
+		for ($i = 0; $i < $searched_count; $i++)
335 335
 		{
336 336
 			// Name of the layout
337 337
 			$layout = $searched_list[$i];
338 338
 			// Get information of the layout
339 339
 			$layout_info = $this->getLayoutInfo($layout, null, $layout_type);
340 340
 
341
-			if(!$layout_info)
341
+			if (!$layout_info)
342 342
 			{
343 343
 				continue;
344 344
 			}
345 345
 
346
-			if($withAutoinstallInfo)
346
+			if ($withAutoinstallInfo)
347 347
 			{
348 348
 				// get easyinstall remove url
349 349
 				$packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path);
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				$layout_info->need_update = $package[$packageSrl]->need_update;
355 355
 
356 356
 				// get easyinstall update url
357
-				if($layout_info->need_update)
357
+				if ($layout_info->need_update)
358 358
 				{
359 359
 					$layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
360 360
 				}
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	function sortLayoutByTitle($a, $b)
373 373
 	{
374
-		if(!$a->title)
374
+		if (!$a->title)
375 375
 		{
376 376
 			$a->title = $a->layout;
377 377
 		}
378 378
 
379
-		if(!$b->title)
379
+		if (!$b->title)
380 380
 		{
381 381
 			$b->title = $b->layout;
382 382
 		}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		$aTitle = strtolower($a->title);
385 385
 		$bTitle = strtolower($b->title);
386 386
 
387
-		if($aTitle == $bTitle)
387
+		if ($aTitle == $bTitle)
388 388
 		{
389 389
 			return 0;
390 390
 		}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 */
411 411
 	function _getInstalledLayoutDirectories($layoutType = 'P')
412 412
 	{
413
-		if($layoutType == 'M')
413
+		if ($layoutType == 'M')
414 414
 		{
415 415
 			$directory = './m.layouts';
416 416
 			$globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES';
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			$globalValueKey = 'PC_LAYOUT_DIRECTORIES';
422 422
 		}
423 423
 
424
-		if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey];
424
+		if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey];
425 425
 
426 426
 		$searchedList = FileHandler::readDir($directory);
427 427
 		if (!$searchedList) $searchedList = array();
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	function getLayoutInfo($layout, $info = null, $layout_type = "P")
442 442
 	{
443
-		if($info)
443
+		if ($info)
444 444
 		{
445 445
 			$layout_title = $info->title;
446 446
 			$layout = $info->layout;
@@ -448,35 +448,35 @@  discard block
 block discarded – undo
448 448
 			$site_srl = $info->site_srl;
449 449
 			$vars = unserialize($info->extra_vars);
450 450
 
451
-			if($info->module_srl)
451
+			if ($info->module_srl)
452 452
 			{
453
-				$layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path);
453
+				$layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path);
454 454
 				$xml_file = sprintf('%sskin.xml', $layout_path);
455 455
 			}
456 456
 		}
457 457
 
458 458
 		// Get a path of the requested module. Return if not exists.
459
-		if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);
460
-		if(!is_dir($layout_path)) return;
459
+		if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);
460
+		if (!is_dir($layout_path)) return;
461 461
 
462 462
 		// Read the xml file for module skin information
463
-		if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
464
-		if(!file_exists($xml_file))
463
+		if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
464
+		if (!file_exists($xml_file))
465 465
 		{
466 466
 			$layout_info = new stdClass;
467 467
 			$layout_info->title = $layout;
468 468
 			$layout_info->layout = $layout;
469 469
 			$layout_info->path = $layout_path;
470 470
 			$layout_info->layout_title = $layout_title;
471
-			if(!$layout_info->layout_type)
471
+			if (!$layout_info->layout_type)
472 472
 			{
473
-				$layout_info->layout_type =  $layout_type;
473
+				$layout_info->layout_type = $layout_type;
474 474
 			}
475 475
 			return $layout_info;
476 476
 		}
477 477
 
478 478
 		// Include the cache file if it is valid and then return $layout_info variable
479
-		if(!$layout_srl)
479
+		if (!$layout_srl)
480 480
 		{
481 481
 			$cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type);
482 482
 		}
@@ -485,22 +485,22 @@  discard block
 block discarded – undo
485 485
 			$cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType());
486 486
 		}
487 487
 
488
-		if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
488
+		if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file))
489 489
 		{
490 490
 			include($cache_file);
491 491
 
492
-			if($layout_info->extra_var && $vars)
492
+			if ($layout_info->extra_var && $vars)
493 493
 			{
494
-				foreach($vars as $key => $value)
494
+				foreach ($vars as $key => $value)
495 495
 				{
496
-					if(!$layout_info->extra_var->{$key} && !$layout_info->{$key})
496
+					if (!$layout_info->extra_var->{$key} && !$layout_info->{$key})
497 497
 					{
498 498
 						$layout_info->{$key} = $value;
499 499
 					}
500 500
 				}
501 501
 			}
502 502
 
503
-			if(!$layout_info->title)
503
+			if (!$layout_info->title)
504 504
 			{
505 505
 				$layout_info->title = $layout;
506 506
 			}
@@ -511,16 +511,16 @@  discard block
 block discarded – undo
511 511
 		$oXmlParser = new XmlParser();
512 512
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
513 513
 
514
-		if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
515
-		elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin;
514
+		if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
515
+		elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin;
516 516
 
517
-		if(!$xml_obj) return;
517
+		if (!$xml_obj) return;
518 518
 
519 519
 		$buff = array();
520 520
 		$buff[] = '$layout_info = new stdClass;';
521 521
 		$buff[] = sprintf('$layout_info->site_srl = %d;', $site_srl);
522 522
 
523
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
523
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
524 524
 		{
525 525
 			// Layout title, version and other information
526 526
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -540,11 +540,11 @@  discard block
 block discarded – undo
540 540
 			$buff[] = sprintf('$layout_info->layout_type = %s;', var_export($layout_type, true));
541 541
 
542 542
 			// Author information
543
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
543
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
544 544
 			else $author_list = $xml_obj->author;
545 545
 
546 546
 			$buff[] = '$layout_info->author = array();';
547
-			for($i=0, $c=count($author_list); $i<$c; $i++)
547
+			for ($i = 0, $c = count($author_list); $i < $c; $i++)
548 548
 			{
549 549
 				$buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i);
550 550
 				$buff[] = sprintf('$layout_info->author[%d]->name = %s;', $i, var_export($author_list[$i]->name->body, true));
@@ -554,22 +554,22 @@  discard block
 block discarded – undo
554 554
 
555 555
 			// Extra vars (user defined variables to use in a template)
556 556
 			$extra_var_groups = $xml_obj->extra_vars->group;
557
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
558
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
557
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
558
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
559 559
 
560 560
 			$buff[] = '$layout_info->extra_var = new stdClass;';
561 561
 			$extra_var_count = 0;
562
-			foreach($extra_var_groups as $group)
562
+			foreach ($extra_var_groups as $group)
563 563
 			{
564 564
 				$extra_vars = $group->var;
565
-				if($extra_vars)
565
+				if ($extra_vars)
566 566
 				{
567
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
567
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
568 568
 
569 569
 					$count = count($extra_vars);
570 570
 					$extra_var_count += $count;
571 571
 					
572
-					for($i=0;$i<$count;$i++)
572
+					for ($i = 0; $i < $count; $i++)
573 573
 					{
574 574
 						unset($var, $options);
575 575
 						$var = $extra_vars[$i];
@@ -583,23 +583,23 @@  discard block
 block discarded – undo
583 583
 						$buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true));
584 584
 
585 585
 						$options = $var->options;
586
-						if(!$options) continue;
587
-						if(!is_array($options)) $options = array($options);
586
+						if (!$options) continue;
587
+						if (!is_array($options)) $options = array($options);
588 588
 
589 589
 						$buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name);
590 590
 						$options_count = count($options);
591 591
 						$thumbnail_exist = false;
592
-						for($j=0; $j < $options_count; $j++)
592
+						for ($j = 0; $j < $options_count; $j++)
593 593
 						{
594 594
 							$buff[] = sprintf('$layout_info->extra_var->%s->options[%s] = new stdClass;', $var->attrs->name, var_export($options[$j]->attrs->value, true));
595 595
 							$thumbnail = $options[$j]->attrs->src;
596
-							if($thumbnail)
596
+							if ($thumbnail)
597 597
 							{
598 598
 								$thumbnail = $layout_path.$thumbnail;
599
-								if(file_exists($thumbnail))
599
+								if (file_exists($thumbnail))
600 600
 								{
601 601
 									$buff[] = sprintf('$layout_info->extra_var->%s->options[%s]->thumbnail = %s;', $var->attrs->name, var_export($options[$j]->attrs->value, true), var_export($thumbnail, true));
602
-									if(!$thumbnail_exist)
602
+									if (!$thumbnail_exist)
603 603
 									{
604 604
 										$buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name);
605 605
 										$thumbnail_exist = true;
@@ -613,26 +613,26 @@  discard block
 block discarded – undo
613 613
 			}
614 614
 			$buff[] = sprintf('$layout_info->extra_var_count = %d;', $extra_var_count);
615 615
 			// Menu
616
-			if($xml_obj->menus->menu)
616
+			if ($xml_obj->menus->menu)
617 617
 			{
618 618
 				$menus = $xml_obj->menus->menu;
619
-				if(!is_array($menus)) $menus = array($menus);
619
+				if (!is_array($menus)) $menus = array($menus);
620 620
 
621 621
 				$menu_count = count($menus);
622 622
 				$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
623 623
 				$buff[] = '$layout_info->menu = new stdClass;';
624
-				for($i=0;$i<$menu_count;$i++)
624
+				for ($i = 0; $i < $menu_count; $i++)
625 625
 				{
626 626
 					$name = $menus[$i]->attrs->name;
627
-					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
627
+					if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
628 628
 					$buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name);
629
-					$buff[] = sprintf('$layout_info->menu->%s->name = %s;',$name, var_export($menus[$i]->attrs->name, true));
630
-					$buff[] = sprintf('$layout_info->menu->%s->title = %s;',$name, var_export($menus[$i]->title->body, true));
631
-					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;',$name, var_export($menus[$i]->attrs->maxdepth, true));
629
+					$buff[] = sprintf('$layout_info->menu->%s->name = %s;', $name, var_export($menus[$i]->attrs->name, true));
630
+					$buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body, true));
631
+					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->attrs->maxdepth, true));
632 632
 
633 633
 					$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
634
-					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
635
-					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
634
+					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name);
635
+					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name);
636 636
 				}
637 637
 			}
638 638
 		}
@@ -655,19 +655,19 @@  discard block
 block discarded – undo
655 655
 			$buff[] = sprintf('$layout_info->author[0]->homepage = %s;', var_export($xml_obj->author->attrs->link, true));
656 656
 			// Extra vars (user defined variables to use in a template)
657 657
 			$extra_var_groups = $xml_obj->extra_vars->group;
658
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
659
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
660
-			foreach($extra_var_groups as $group)
658
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
659
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
660
+			foreach ($extra_var_groups as $group)
661 661
 			{
662 662
 				$extra_vars = $group->var;
663
-				if($extra_vars)
663
+				if ($extra_vars)
664 664
 				{
665
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
665
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
666 666
 
667 667
 					$extra_var_count = count($extra_vars);
668 668
 
669 669
 					$buff[] = sprintf('$layout_info->extra_var_count = %d;', $extra_var_count);
670
-					for($i=0;$i<$extra_var_count;$i++)
670
+					for ($i = 0; $i < $extra_var_count; $i++)
671 671
 					{
672 672
 						unset($var, $options);
673 673
 						$var = $extra_vars[$i];
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
 						$buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true));
681 681
 
682 682
 						$options = $var->options;
683
-						if(!$options) continue;
683
+						if (!$options) continue;
684 684
 
685
-						if(!is_array($options)) $options = array($options);
685
+						if (!is_array($options)) $options = array($options);
686 686
 						$options_count = count($options);
687
-						for($j=0;$j<$options_count;$j++)
687
+						for ($j = 0; $j < $options_count; $j++)
688 688
 						{
689 689
 							$buff[] = sprintf('$layout_info->extra_var->%s->options[%s]->val = %s;', $var->attrs->name, var_export($options[$j]->value->body, true), var_export($options[$j]->title->body, true));
690 690
 						}
@@ -692,23 +692,23 @@  discard block
 block discarded – undo
692 692
 				}
693 693
 			}
694 694
 			// Menu
695
-			if($xml_obj->menus->menu)
695
+			if ($xml_obj->menus->menu)
696 696
 			{
697 697
 				$menus = $xml_obj->menus->menu;
698
-				if(!is_array($menus)) $menus = array($menus);
698
+				if (!is_array($menus)) $menus = array($menus);
699 699
 
700 700
 				$menu_count = count($menus);
701 701
 				$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
702
-				for($i=0;$i<$menu_count;$i++)
702
+				for ($i = 0; $i < $menu_count; $i++)
703 703
 				{
704 704
 					$name = $menus[$i]->attrs->name;
705
-					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
706
-					$buff[] = sprintf('$layout_info->menu->%s->name = %s;',$name, var_export($name, true));
707
-					$buff[] = sprintf('$layout_info->menu->%s->title = %s;',$name, var_export($menus[$i]->title->body, true));
708
-					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;',$name, var_export($menus[$i]->maxdepth->body, true));
705
+					if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
706
+					$buff[] = sprintf('$layout_info->menu->%s->name = %s;', $name, var_export($name, true));
707
+					$buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body, true));
708
+					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->maxdepth->body, true));
709 709
 					$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
710
-					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
711
-					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
710
+					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name);
711
+					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name);
712 712
 				}
713 713
 			}
714 714
 		}
@@ -718,15 +718,15 @@  discard block
 block discarded – undo
718 718
 		$layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl);
719 719
 		$header_script = trim($layout_config->header_script);
720 720
 
721
-		if($header_script)
721
+		if ($header_script)
722 722
 		{
723 723
 			$buff[] = sprintf(' $layout_info->header_script = %s; ', var_export($header_script, true));
724 724
 		}
725 725
 
726
-		FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff));
727
-		if(FileHandler::exists($cache_file)) include($cache_file);
726
+		FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); '.join(PHP_EOL, $buff));
727
+		if (FileHandler::exists($cache_file)) include($cache_file);
728 728
 
729
-		if(!$layout_info->title)
729
+		if (!$layout_info->title)
730 730
 		{
731 731
 			$layout_info->title = $layout;
732 732
 		}
@@ -750,12 +750,12 @@  discard block
 block discarded – undo
750 750
 	 * @param string $layout_name
751 751
 	 * @return array
752 752
 	 */
753
-	function getUserLayoutIniConfig($layout_srl, $layout_name=null)
753
+	function getUserLayoutIniConfig($layout_srl, $layout_name = null)
754 754
 	{
755 755
 		$file = $this->getUserLayoutIni($layout_srl);
756
-		if($layout_name && FileHandler::exists($file) === FALSE)
756
+		if ($layout_name && FileHandler::exists($file) === FALSE)
757 757
 		{
758
-			FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl));
758
+			FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl));
759 759
 		}
760 760
 
761 761
 		return FileHandler::readIniFile($file);
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	function getUserLayoutPath($layout_srl)
770 770
 	{
771
-		return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3));
771
+		return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3));
772 772
 	}
773 773
 
774 774
 	/**
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	 */
779 779
 	function getUserLayoutImagePath($layout_srl)
780 780
 	{
781
-		return $this->getUserLayoutPath($layout_srl). 'images/';
781
+		return $this->getUserLayoutPath($layout_srl).'images/';
782 782
 	}
783 783
 
784 784
 	/**
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 */
789 789
 	function getUserLayoutCss($layout_srl)
790 790
 	{
791
-		return $this->getUserLayoutPath($layout_srl). 'layout.css';
791
+		return $this->getUserLayoutPath($layout_srl).'layout.css';
792 792
 	}
793 793
 
794 794
 	/**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	 */
799 799
 	function getUserLayoutFaceOffCss($layout_srl)
800 800
 	{
801
-		if($this->useUserLayoutTemp == 'temp') return;
801
+		if ($this->useUserLayoutTemp == 'temp') return;
802 802
 		return $this->_getUserLayoutFaceOffCss($layout_srl);
803 803
 	}
804 804
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 */
810 810
 	function _getUserLayoutFaceOffCss($layout_srl)
811 811
 	{
812
-		return $this->getUserLayoutPath($layout_srl). 'faceoff.css';
812
+		return $this->getUserLayoutPath($layout_srl).'faceoff.css';
813 813
 	}
814 814
 
815 815
 	/**
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 */
820 820
 	function getUserLayoutTempFaceOffCss($layout_srl)
821 821
 	{
822
-		return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css';
822
+		return $this->getUserLayoutPath($layout_srl).'tmp.faceoff.css';
823 823
 	}
824 824
 
825 825
 	/**
@@ -829,11 +829,11 @@  discard block
 block discarded – undo
829 829
 	 */
830 830
 	function getUserLayoutHtml($layout_srl)
831 831
 	{
832
-		$src = $this->getUserLayoutPath($layout_srl). 'layout.html';
833
-		if($this->useUserLayoutTemp == 'temp')
832
+		$src = $this->getUserLayoutPath($layout_srl).'layout.html';
833
+		if ($this->useUserLayoutTemp == 'temp')
834 834
 		{
835 835
 			$temp = $this->getUserLayoutTempHtml($layout_srl);
836
-			if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp);
836
+			if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp);
837 837
 			return $temp;
838 838
 		}
839 839
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	 */
848 848
 	function getUserLayoutTempHtml($layout_srl)
849 849
 	{
850
-		return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html';
850
+		return $this->getUserLayoutPath($layout_srl).'tmp.layout.html';
851 851
 	}
852 852
 
853 853
 	/**
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
 	 */
858 858
 	function getUserLayoutIni($layout_srl)
859 859
 	{
860
-		$src = $this->getUserLayoutPath($layout_srl). 'layout.ini';
861
-		if($this->useUserLayoutTemp == 'temp')
860
+		$src = $this->getUserLayoutPath($layout_srl).'layout.ini';
861
+		if ($this->useUserLayoutTemp == 'temp')
862 862
 		{
863 863
 			$temp = $this->getUserLayoutTempIni($layout_srl);
864
-			if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp);
864
+			if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp);
865 865
 			return $temp;
866 866
 		}
867 867
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	 */
876 876
 	function getUserLayoutTempIni($layout_srl)
877 877
 	{
878
-		return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini';
878
+		return $this->getUserLayoutPath($layout_srl).'tmp.layout.ini';
879 879
 	}
880 880
 
881 881
 	/**
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 	 * @param string $lang_type
886 886
 	 * @return string
887 887
 	 */
888
-	function getUserLayoutCache($layout_srl,$lang_type)
888
+	function getUserLayoutCache($layout_srl, $lang_type)
889 889
 	{
890
-		return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php";
890
+		return $this->getUserLayoutPath($layout_srl)."{$lang_type}.cache.php";
891 891
 	}
892 892
 
893 893
 	/**
@@ -896,15 +896,15 @@  discard block
 block discarded – undo
896 896
 	 * @param string $lang_type
897 897
 	 * @return string
898 898
 	 */
899
-	function getLayoutCache($layout_name,$lang_type,$layout_type='P')
899
+	function getLayoutCache($layout_name, $lang_type, $layout_type = 'P')
900 900
 	{
901
-		if($layout_type=='P')
901
+		if ($layout_type == 'P')
902 902
 		{
903
-			return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type);
903
+			return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type);
904 904
 		}
905 905
 		else
906 906
 		{
907
-			return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type);
907
+			return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type);
908 908
 		}
909 909
 	}
910 910
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 	 */
916 916
 	function getDefaultLayoutIni($layout_name)
917 917
 	{
918
-		return $this->getDefaultLayoutPath($layout_name). 'layout.ini';
918
+		return $this->getDefaultLayoutPath($layout_name).'layout.ini';
919 919
 	}
920 920
 
921 921
 	/**
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	 */
926 926
 	function getDefaultLayoutHtml($layout_name)
927 927
 	{
928
-		return $this->getDefaultLayoutPath($layout_name). 'layout.html';
928
+		return $this->getDefaultLayoutPath($layout_name).'layout.html';
929 929
 	}
930 930
 
931 931
 	/**
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	 */
936 936
 	function getDefaultLayoutCss($layout_name)
937 937
 	{
938
-		return $this->getDefaultLayoutPath($layout_name). 'css/layout.css';
938
+		return $this->getDefaultLayoutPath($layout_name).'css/layout.css';
939 939
 	}
940 940
 
941 941
 	/**
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 	 * @param string $flag (default 'temp')
965 965
 	 * @return void
966 966
 	 */
967
-	function setUseUserLayoutTemp($flag='temp')
967
+	function setUseUserLayoutTemp($flag = 'temp')
968 968
 	{
969 969
 		$this->useUserLayoutTemp = $flag;
970 970
 	}
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
 		);
999 999
 
1000 1000
 		$image_path = $this->getUserLayoutImagePath($layout_srl);
1001
-		$image_list = FileHandler::readDir($image_path,'/(.*(?:jpg|jpeg|gif|bmp|png)$)/i');
1001
+		$image_list = FileHandler::readDir($image_path, '/(.*(?:jpg|jpeg|gif|bmp|png)$)/i');
1002 1002
 
1003
-		foreach($image_list as $image)
1003
+		foreach ($image_list as $image)
1004 1004
 		{
1005
-			$file_list[] = 'images/' . $image;
1005
+			$file_list[] = 'images/'.$image;
1006 1006
 		}
1007 1007
 		return $file_list;
1008 1008
 	}
@@ -1020,20 +1020,20 @@  discard block
 block discarded – undo
1020 1020
 		Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
1021 1021
 		// CSS generated in the layout manager
1022 1022
 		$faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
1023
-		if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);
1023
+		if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);
1024 1024
 		// CSS output for the widget
1025 1025
 		Context::loadFile($this->module_path.'/tpl/css/widget.css', true);
1026
-		if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1026
+		if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1027 1027
 		else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1028 1028
 		// Different page displayed upon user's permission
1029 1029
 		$logged_info = Context::get('logged_info');
1030 1030
 		// Display edit button for faceoff layout
1031
-		if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin))
1031
+		if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin))
1032 1032
 		{
1033
-			Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>');
1033
+			Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>');
1034 1034
 		}
1035 1035
 		// Display menu when editing the faceOff page
1036
-		if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin))
1036
+		if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin))
1037 1037
 		{
1038 1038
 			$oTemplate = &TemplateHandler::getInstance();
1039 1039
 			Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu'));
Please login to merge, or discard this patch.
Braces   +115 added lines, -61 removed lines patch added patch discarded remove patch
@@ -92,16 +92,14 @@  discard block
 block discarded – undo
92 92
 			if(count($token) == 2)
93 93
 			{
94 94
 				$thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]);
95
-			}
96
-			else
95
+			} else
97 96
 			{
98 97
 				$thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout);
99 98
 			}
100 99
 			if(is_readable($thumbnailPath))
101 100
 			{
102 101
 				$val->thumbnail = $thumbnailPath;
103
-			}
104
-			else
102
+			} else
105 103
 			{
106 104
 				$val->thumbnail = sprintf('./modules/layout/tpl/img/noThumbnail.png');
107 105
 			}
@@ -140,8 +138,7 @@  discard block
 block discarded – undo
140 138
 				if($this->isExistsLayoutFile($iInfo->layout, $layoutType))
141 139
 				{
142 140
 					$instanceList[] = $iInfo->layout;
143
-				}
144
-				else
141
+				} else
145 142
 				{
146 143
 					unset($output->data[$no]);
147 144
 				}
@@ -176,8 +173,7 @@  discard block
 block discarded – undo
176 173
 				$oLayoutAdminController->insertLayout($insertArgs);
177 174
 				$isCreateInstance = TRUE;
178 175
 			}
179
-		}
180
-		else
176
+		} else
181 177
 		{
182 178
 			// Get downloaded name list have no instance
183 179
 			$noInstanceList = array_diff($downloadedList, $instanceList);
@@ -230,8 +226,7 @@  discard block
 block discarded – undo
230 226
 		{
231 227
 			$pathPrefix = _XE_PATH_ . 'layouts/';
232 228
 			$themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s';
233
-		}
234
-		else
229
+		} else
235 230
 		{
236 231
 			$pathPrefix = _XE_PATH_ . 'm.layouts/';
237 232
 			$themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s';
@@ -241,8 +236,7 @@  discard block
 block discarded – undo
241 236
 		{
242 237
 			list($themeName, $layoutName) = explode('|@|', $layout);
243 238
 			$path = sprintf($themePathFormat, $themeName, $layoutName);
244
-		}
245
-		else
239
+		} else
246 240
 		{
247 241
 			$path = $pathPrefix . $layout;
248 242
 		}
@@ -262,7 +256,9 @@  discard block
 block discarded – undo
262 256
 		$args = new stdClass();
263 257
 		$args->layout_srl = $layout_srl;
264 258
 		$output = executeQuery('layout.getLayout', $args);
265
-		if(!$output->data) return;
259
+		if(!$output->data) {
260
+			return;
261
+		}
266 262
 
267 263
 		// Return xml file informaton after listing up the layout and extra_vars
268 264
 		$layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);
@@ -295,20 +291,19 @@  discard block
 block discarded – undo
295 291
 		if(count($layout_parse) > 1)
296 292
 		{
297 293
 			$class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/';
298
-		}
299
-		else if($layout_name == 'faceoff')
294
+		} else if($layout_name == 'faceoff')
300 295
 		{
301 296
 			$class_path = './modules/layout/faceoff/';
302
-		}
303
-		else if($layout_type == "M")
297
+		} else if($layout_type == "M")
304 298
 		{
305 299
 			$class_path = sprintf("./m.layouts/%s/", $layout_name);
306
-		}
307
-		else
300
+		} else
308 301
 		{
309 302
 			$class_path = sprintf('./layouts/%s/', $layout_name);
310 303
 		}
311
-		if(is_dir($class_path)) return $class_path;
304
+		if(is_dir($class_path)) {
305
+			return $class_path;
306
+		}
312 307
 		return "";
313 308
 	}
314 309
 
@@ -321,12 +316,16 @@  discard block
 block discarded – undo
321 316
 	 */
322 317
 	function getDownloadedLayoutList($layout_type = "P", $withAutoinstallInfo = false)
323 318
 	{
324
-		if ($withAutoinstallInfo) $oAutoinstallModel = getModel('autoinstall');
319
+		if ($withAutoinstallInfo) {
320
+			$oAutoinstallModel = getModel('autoinstall');
321
+		}
325 322
 
326 323
 		// Get a list of downloaded layout and installed layout
327 324
 		$searched_list = $this->_getInstalledLayoutDirectories($layout_type);
328 325
 		$searched_count = count($searched_list);
329
-		if(!$searched_count) return;
326
+		if(!$searched_count) {
327
+			return;
328
+		}
330 329
 
331 330
 		// natcasesort($searched_list);
332 331
 		// Return information for looping searched list of layouts
@@ -414,17 +413,20 @@  discard block
 block discarded – undo
414 413
 		{
415 414
 			$directory = './m.layouts';
416 415
 			$globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES';
417
-		}
418
-		else
416
+		} else
419 417
 		{
420 418
 			$directory = './layouts';
421 419
 			$globalValueKey = 'PC_LAYOUT_DIRECTORIES';
422 420
 		}
423 421
 
424
-		if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey];
422
+		if($GLOBALS[$globalValueKey]) {
423
+			return $GLOBALS[$globalValueKey];
424
+		}
425 425
 
426 426
 		$searchedList = FileHandler::readDir($directory);
427
-		if (!$searchedList) $searchedList = array();
427
+		if (!$searchedList) {
428
+			$searchedList = array();
429
+		}
428 430
 		$GLOBALS[$globalValueKey] = $searchedList;
429 431
 
430 432
 		return $searchedList;
@@ -456,11 +458,17 @@  discard block
 block discarded – undo
456 458
 		}
457 459
 
458 460
 		// Get a path of the requested module. Return if not exists.
459
-		if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);
460
-		if(!is_dir($layout_path)) return;
461
+		if(!$layout_path) {
462
+			$layout_path = $this->getLayoutPath($layout, $layout_type);
463
+		}
464
+		if(!is_dir($layout_path)) {
465
+			return;
466
+		}
461 467
 
462 468
 		// Read the xml file for module skin information
463
-		if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
469
+		if(!$xml_file) {
470
+			$xml_file = sprintf("%sconf/info.xml", $layout_path);
471
+		}
464 472
 		if(!file_exists($xml_file))
465 473
 		{
466 474
 			$layout_info = new stdClass;
@@ -479,8 +487,7 @@  discard block
 block discarded – undo
479 487
 		if(!$layout_srl)
480 488
 		{
481 489
 			$cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type);
482
-		}
483
-		else
490
+		} else
484 491
 		{
485 492
 			$cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType());
486 493
 		}
@@ -511,10 +518,15 @@  discard block
 block discarded – undo
511 518
 		$oXmlParser = new XmlParser();
512 519
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
513 520
 
514
-		if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
515
-		elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin;
521
+		if($tmp_xml_obj->layout) {
522
+			$xml_obj = $tmp_xml_obj->layout;
523
+		} elseif($tmp_xml_obj->skin) {
524
+			$xml_obj = $tmp_xml_obj->skin;
525
+		}
516 526
 
517
-		if(!$xml_obj) return;
527
+		if(!$xml_obj) {
528
+			return;
529
+		}
518 530
 
519 531
 		$buff = array();
520 532
 		$buff[] = '$layout_info = new stdClass;';
@@ -540,8 +552,11 @@  discard block
 block discarded – undo
540 552
 			$buff[] = sprintf('$layout_info->layout_type = %s;', var_export($layout_type, true));
541 553
 
542 554
 			// Author information
543
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
544
-			else $author_list = $xml_obj->author;
555
+			if(!is_array($xml_obj->author)) {
556
+				$author_list[] = $xml_obj->author;
557
+			} else {
558
+				$author_list = $xml_obj->author;
559
+			}
545 560
 
546 561
 			$buff[] = '$layout_info->author = array();';
547 562
 			for($i=0, $c=count($author_list); $i<$c; $i++)
@@ -554,8 +569,12 @@  discard block
 block discarded – undo
554 569
 
555 570
 			// Extra vars (user defined variables to use in a template)
556 571
 			$extra_var_groups = $xml_obj->extra_vars->group;
557
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
558
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
572
+			if(!$extra_var_groups) {
573
+				$extra_var_groups = $xml_obj->extra_vars;
574
+			}
575
+			if(!is_array($extra_var_groups)) {
576
+				$extra_var_groups = array($extra_var_groups);
577
+			}
559 578
 
560 579
 			$buff[] = '$layout_info->extra_var = new stdClass;';
561 580
 			$extra_var_count = 0;
@@ -564,7 +583,9 @@  discard block
 block discarded – undo
564 583
 				$extra_vars = $group->var;
565 584
 				if($extra_vars)
566 585
 				{
567
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
586
+					if(!is_array($extra_vars)) {
587
+						$extra_vars = array($extra_vars);
588
+					}
568 589
 
569 590
 					$count = count($extra_vars);
570 591
 					$extra_var_count += $count;
@@ -583,8 +604,12 @@  discard block
 block discarded – undo
583 604
 						$buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true));
584 605
 
585 606
 						$options = $var->options;
586
-						if(!$options) continue;
587
-						if(!is_array($options)) $options = array($options);
607
+						if(!$options) {
608
+							continue;
609
+						}
610
+						if(!is_array($options)) {
611
+							$options = array($options);
612
+						}
588 613
 
589 614
 						$buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name);
590 615
 						$options_count = count($options);
@@ -616,7 +641,9 @@  discard block
 block discarded – undo
616 641
 			if($xml_obj->menus->menu)
617 642
 			{
618 643
 				$menus = $xml_obj->menus->menu;
619
-				if(!is_array($menus)) $menus = array($menus);
644
+				if(!is_array($menus)) {
645
+					$menus = array($menus);
646
+				}
620 647
 
621 648
 				$menu_count = count($menus);
622 649
 				$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
@@ -624,7 +651,9 @@  discard block
 block discarded – undo
624 651
 				for($i=0;$i<$menu_count;$i++)
625 652
 				{
626 653
 					$name = $menus[$i]->attrs->name;
627
-					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
654
+					if($menus[$i]->attrs->default == "true") {
655
+						$buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
656
+					}
628 657
 					$buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name);
629 658
 					$buff[] = sprintf('$layout_info->menu->%s->name = %s;',$name, var_export($menus[$i]->attrs->name, true));
630 659
 					$buff[] = sprintf('$layout_info->menu->%s->title = %s;',$name, var_export($menus[$i]->title->body, true));
@@ -635,8 +664,7 @@  discard block
 block discarded – undo
635 664
 					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
636 665
 				}
637 666
 			}
638
-		}
639
-		else
667
+		} else
640 668
 		{
641 669
 			// Layout title, version and other information
642 670
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -655,14 +683,20 @@  discard block
 block discarded – undo
655 683
 			$buff[] = sprintf('$layout_info->author[0]->homepage = %s;', var_export($xml_obj->author->attrs->link, true));
656 684
 			// Extra vars (user defined variables to use in a template)
657 685
 			$extra_var_groups = $xml_obj->extra_vars->group;
658
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
659
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
686
+			if(!$extra_var_groups) {
687
+				$extra_var_groups = $xml_obj->extra_vars;
688
+			}
689
+			if(!is_array($extra_var_groups)) {
690
+				$extra_var_groups = array($extra_var_groups);
691
+			}
660 692
 			foreach($extra_var_groups as $group)
661 693
 			{
662 694
 				$extra_vars = $group->var;
663 695
 				if($extra_vars)
664 696
 				{
665
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
697
+					if(!is_array($extra_vars)) {
698
+						$extra_vars = array($extra_vars);
699
+					}
666 700
 
667 701
 					$extra_var_count = count($extra_vars);
668 702
 
@@ -680,9 +714,13 @@  discard block
 block discarded – undo
680 714
 						$buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true));
681 715
 
682 716
 						$options = $var->options;
683
-						if(!$options) continue;
717
+						if(!$options) {
718
+							continue;
719
+						}
684 720
 
685
-						if(!is_array($options)) $options = array($options);
721
+						if(!is_array($options)) {
722
+							$options = array($options);
723
+						}
686 724
 						$options_count = count($options);
687 725
 						for($j=0;$j<$options_count;$j++)
688 726
 						{
@@ -695,14 +733,18 @@  discard block
 block discarded – undo
695 733
 			if($xml_obj->menus->menu)
696 734
 			{
697 735
 				$menus = $xml_obj->menus->menu;
698
-				if(!is_array($menus)) $menus = array($menus);
736
+				if(!is_array($menus)) {
737
+					$menus = array($menus);
738
+				}
699 739
 
700 740
 				$menu_count = count($menus);
701 741
 				$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
702 742
 				for($i=0;$i<$menu_count;$i++)
703 743
 				{
704 744
 					$name = $menus[$i]->attrs->name;
705
-					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
745
+					if($menus[$i]->attrs->default == "true") {
746
+						$buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
747
+					}
706 748
 					$buff[] = sprintf('$layout_info->menu->%s->name = %s;',$name, var_export($name, true));
707 749
 					$buff[] = sprintf('$layout_info->menu->%s->title = %s;',$name, var_export($menus[$i]->title->body, true));
708 750
 					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;',$name, var_export($menus[$i]->maxdepth->body, true));
@@ -724,7 +766,9 @@  discard block
 block discarded – undo
724 766
 		}
725 767
 
726 768
 		FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff));
727
-		if(FileHandler::exists($cache_file)) include($cache_file);
769
+		if(FileHandler::exists($cache_file)) {
770
+			include($cache_file);
771
+		}
728 772
 
729 773
 		if(!$layout_info->title)
730 774
 		{
@@ -798,7 +842,9 @@  discard block
 block discarded – undo
798 842
 	 */
799 843
 	function getUserLayoutFaceOffCss($layout_srl)
800 844
 	{
801
-		if($this->useUserLayoutTemp == 'temp') return;
845
+		if($this->useUserLayoutTemp == 'temp') {
846
+			return;
847
+		}
802 848
 		return $this->_getUserLayoutFaceOffCss($layout_srl);
803 849
 	}
804 850
 
@@ -833,7 +879,9 @@  discard block
 block discarded – undo
833 879
 		if($this->useUserLayoutTemp == 'temp')
834 880
 		{
835 881
 			$temp = $this->getUserLayoutTempHtml($layout_srl);
836
-			if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp);
882
+			if(FileHandler::exists($temp) === FALSE) {
883
+				FileHandler::copyFile($src,$temp);
884
+			}
837 885
 			return $temp;
838 886
 		}
839 887
 
@@ -861,7 +909,9 @@  discard block
 block discarded – undo
861 909
 		if($this->useUserLayoutTemp == 'temp')
862 910
 		{
863 911
 			$temp = $this->getUserLayoutTempIni($layout_srl);
864
-			if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp);
912
+			if(!file_exists(FileHandler::getRealPath($temp))) {
913
+				FileHandler::copyFile($src,$temp);
914
+			}
865 915
 			return $temp;
866 916
 		}
867 917
 
@@ -901,8 +951,7 @@  discard block
 block discarded – undo
901 951
 		if($layout_type=='P')
902 952
 		{
903 953
 			return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type);
904
-		}
905
-		else
954
+		} else
906 955
 		{
907 956
 			return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type);
908 957
 		}
@@ -1020,11 +1069,16 @@  discard block
 block discarded – undo
1020 1069
 		Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
1021 1070
 		// CSS generated in the layout manager
1022 1071
 		$faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
1023
-		if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);
1072
+		if($faceoff_layout_css) {
1073
+			Context::addCSSFile($faceoff_layout_css);
1074
+		}
1024 1075
 		// CSS output for the widget
1025 1076
 		Context::loadFile($this->module_path.'/tpl/css/widget.css', true);
1026
-		if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1027
-		else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1077
+		if($layout_info->extra_var->colorset->value == 'black') {
1078
+			Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1079
+		} else {
1080
+			Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);
1081
+		}
1028 1082
 		// Different page displayed upon user's permission
1029 1083
 		$logged_info = Context::get('logged_info');
1030 1084
 		// Display edit button for faceoff layout
Please login to merge, or discard this patch.