GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b119a5...2262ef )
by gyeong-won
19:32 queued 13:26
created
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.
modules/install/install.controller.php 2 patches
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	function init()
18 18
 	{
19 19
 		// Error occurs if already installed
20
-		if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
20
+		if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
21 21
 		{
22 22
 			$this->stop('msg_already_installed');
23 23
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	function _procDBSetting()
87 87
 	{
88 88
 		// Get DB-related variables
89
-		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
89
+		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix');
90 90
 
91 91
 		$db_info = new stdClass();
92 92
 		$db_info->master_db = get_object_vars($con_string);
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if (!$output->toBool()) return $output;
105
+		if (!$oDB->isConnected()) return $oDB->getError();
106 106
 
107 107
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
108
+		if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
109 109
 
110
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
110
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
111 111
 		{
112 112
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm');
113 113
 			header('location:'.$returnUrl);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	function procConfigSetting()
122 122
 	{
123 123
 		// Get variables
124
-		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
124
+		$config_info = Context::gets('use_rewrite', 'time_zone');
125
+		if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N';
126 126
 
127 127
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
128
+		if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
129 129
 
130
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
130
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
131 131
 		{
132 132
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm');
133 133
 			header('location:'.$returnUrl);
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	function procInstall()
142 142
 	{
143 143
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
144
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
145 145
 
146 146
 		Context::loadLang('modules/member/lang');
147 147
 		$oMemberModel = getModel('member');
148 148
 		$vars = Context::getRequestVars();
149 149
 
150
-		if(!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
150
+		if (!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
151 151
 		{
152 152
 			Context::loadLang('modules/member/lang');
153 153
 			$message = Context::getLang('about_password_strength');
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 		Context::set('logged_info', $logged_info);
161 161
 
162 162
 		// check install config
163
-		if(Context::get('install_config'))
163
+		if (Context::get('install_config'))
164 164
 		{
165 165
 			$db_info = $this->_makeDbInfoByInstallConfig();
166 166
 		}
167 167
 		// install by default XE UI
168 168
 		else
169 169
 		{
170
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
170
+			if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
+			if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
172 172
 		}
173 173
 
174 174
 		// Set DB type and information
@@ -176,30 +176,30 @@  discard block
 block discarded – undo
176 176
 		// Create DB Instance
177 177
 		$oDB = &DB::getInstance();
178 178
 		// Check if available to connect to the DB
179
-		if(!$oDB->isConnected()) return $oDB->getError();
179
+		if (!$oDB->isConnected()) return $oDB->getError();
180 180
 
181 181
 		// Install all the modules
182 182
 		try {
183 183
 			$oDB->begin();
184 184
 			$this->installDownloadedModule();
185 185
 			$oDB->commit();
186
-		} catch(Exception $e) {
186
+		} catch (Exception $e) {
187 187
 			$oDB->rollback();
188 188
 			return new BaseObject(-1, $e->getMessage());
189 189
 		}
190 190
 
191 191
 		// Create a config file
192
-		if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
192
+		if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
193 193
 
194 194
 		// load script
195
-		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
196
-		if(count($scripts)>0)
195
+		$scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');
196
+		if (count($scripts) > 0)
197 197
 		{
198 198
 			sort($scripts);
199
-			foreach($scripts as $script)
199
+			foreach ($scripts as $script)
200 200
 			{
201 201
 				$script_path = FileHandler::getRealPath('./modules/install/script/');
202
-				$output = include($script_path . $script);
202
+				$output = include($script_path.$script);
203 203
 			}
204 204
 		}
205 205
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		unset($_SESSION['use_rewrite']);
214 214
 
215
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
215
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
216 216
 		{
217 217
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
218 218
 			header('location:'.$returnUrl);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$db_info->use_rewrite = Context::get('use_rewrite');
243 243
 		$db_info->time_zone = Context::get('time_zone');
244 244
 
245
-		if($_SERVER['HTTPS'] == 'on')
245
+		if ($_SERVER['HTTPS'] == 'on')
246 246
 		{
247 247
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
248 248
 			$https_port = (!$https_port != 443) ? $https_port : null;
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
253 253
 			$http_port = (!$http_port != 80) ? $http_port : null;
254 254
 		}
255
-		if($http_port) $db_info->http_port = $http_port;
256
-		if($https_port) $db_info->https_port = $https_port;
255
+		if ($http_port) $db_info->http_port = $http_port;
256
+		if ($https_port) $db_info->https_port = $https_port;
257 257
 
258 258
 		return $db_info;
259 259
 	}
@@ -263,57 +263,57 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	function procInstallFTP()
265 265
 	{
266
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
267
-		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
268
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
269
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
266
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
267
+		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
268
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
269
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
+		if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
+		if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
272 272
 
273 273
 		$buff = array('<?php if(!defined("__XE__")) exit();');
274 274
 		$buff[] = "\$ftp_info = new stdClass();";
275
-		foreach($ftp_info as $key => $val)
275
+		foreach ($ftp_info as $key => $val)
276 276
 		{
277
-			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
277
+			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
278 278
 		}
279 279
 
280 280
 		// If safe_mode
281
-		if(ini_get('safe_mode'))
281
+		if (ini_get('safe_mode'))
282 282
 		{
283
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
283
+			if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
284 284
 
285 285
 			require_once(_XE_PATH_.'libs/ftp.class.php');
286 286
 			$oFtp = new ftp();
287
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
287
+			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
288 288
 
289
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
289
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
290 290
 			{
291 291
 				$oFtp->ftp_quit();
292
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
292
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
293 293
 			}
294 294
 
295
-			if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
295
+			if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
296 296
 			{
297 297
 				$oFtp->ftp_quit();
298
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
298
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
299 299
 			}
300 300
 
301
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
301
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
302 302
 			{
303 303
 				$oFtp->ftp_quit();
304
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
304
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
305 305
 			}
306 306
 
307
-			if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
307
+			if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
308 308
 			{
309 309
 				$oFtp->ftp_quit();
310
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
310
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
311 311
 			}
312 312
 
313
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
313
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
314 314
 			{
315 315
 				$oFtp->ftp_quit();
316
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
316
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
317 317
 			}
318 318
 
319 319
 			$oFtp->ftp_quit();
@@ -324,31 +324,31 @@  discard block
 block discarded – undo
324 324
 
325 325
 	function procInstallCheckFtp()
326 326
 	{
327
-		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
328
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
329
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
327
+		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp');
328
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
329
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
+		if (!$ftp_info->sftp) $ftp_info->sftp = 'N';
331 331
 
332
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
332
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
333 333
 
334
-		if($ftp_info->sftp == 'Y')
334
+		if ($ftp_info->sftp == 'Y')
335 335
 		{
336 336
 			$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
337
-			if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
337
+			if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
338 338
 			{
339
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
339
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
340 340
 			}
341 341
 		}
342 342
 		else
343 343
 		{
344 344
 			require_once(_XE_PATH_.'libs/ftp.class.php');
345 345
 			$oFtp = new ftp();
346
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
346
+			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
347 347
 
348
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
348
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
349 349
 			{
350 350
 				$oFtp->ftp_quit();
351
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
351
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
352 352
 			}
353 353
 			$oFtp->ftp_quit();
354 354
 		}
@@ -365,38 +365,38 @@  discard block
 block discarded – undo
365 365
 		$checklist = array();
366 366
 		// 0. check your version of php (5.2.4 or higher)
367 367
 		$checklist['php_version'] = true;
368
-		if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
368
+		if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
369 369
 		{
370 370
 			$checklist['php_version'] = false;
371 371
 		}
372 372
 
373
-		if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
373
+		if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
374 374
 		{
375 375
 			Context::set('phpversion_warning', true);
376 376
 		}
377 377
 
378 378
 		// 1. Check permission
379
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
379
+		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true;
380 380
 		else $checklist['permission'] = false;
381 381
 		// 2. Check if xml_parser_create exists
382
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
382
+		if (function_exists('xml_parser_create')) $checklist['xml'] = true;
383 383
 		else $checklist['xml'] = false;
384 384
 		// 3. Check if ini_get (session.auto_start) == 1
385
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
385
+		if (ini_get('session.auto_start') != 1) $checklist['session'] = true;
386 386
 		else $checklist['session'] = false;
387 387
 		// 4. Check if iconv exists
388
-		if(function_exists('iconv')) $checklist['iconv'] = true;
388
+		if (function_exists('iconv')) $checklist['iconv'] = true;
389 389
 		else $checklist['iconv'] = false;
390 390
 		// 5. Check gd(imagecreatefromgif function)
391
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
391
+		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true;
392 392
 		else $checklist['gd'] = false;
393 393
 		// extension: fileinfo
394 394
 		$checklist['fileinfo'] = extension_loaded('fileinfo');
395 395
 		// 6. Check DB
396
-		if(DB::getEnableList()) $checklist['db'] = true;
396
+		if (DB::getEnableList()) $checklist['db'] = true;
397 397
 		else $checklist['db'] = false;
398 398
 
399
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
399
+		if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
400 400
 		else $install_enable = true;
401 401
 
402 402
 		// Save the checked result to the Context
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 
417 417
 		$license_agreement = ($vars->license_agreement == 'Y') ? true : false;
418 418
 
419
-		if($license_agreement)
419
+		if ($license_agreement)
420 420
 		{
421 421
 			$currentTime = $_SERVER['REQUEST_TIME'];
422 422
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			return new BaseObject(-1, 'msg_must_accept_license_agreement');
428 428
 		}
429 429
 
430
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
430
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
431 431
 		{
432 432
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
433 433
 			$this->setRedirectUrl($returnUrl);
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
 		$hostname = $_SERVER['SERVER_NAME'];
451 451
 		$port = $_SERVER['SERVER_PORT'];
452 452
 		$str_port = '';
453
-		if($port)
453
+		if ($port)
454 454
 		{
455
-			$str_port = ':' . $port;
455
+			$str_port = ':'.$port;
456 456
 		}
457 457
 
458 458
 		$tmpPath = $_SERVER['DOCUMENT_ROOT'];
459 459
 
460 460
 		//if DIRECTORY_SEPARATOR is not /(IIS)
461
-		if(DIRECTORY_SEPARATOR !== '/')
461
+		if (DIRECTORY_SEPARATOR !== '/')
462 462
 		{
463 463
 			//change to slash for compare
464 464
 			$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
465 465
 		}
466 466
 
467
-		$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
467
+		$query = "/JUST/CHECK/REWRITE/".$checkFilePath;
468 468
 		$currentPath = str_replace($tmpPath, "", _XE_PATH_);
469
-		if($currentPath != "")
469
+		if ($currentPath != "")
470 470
 		{
471
-			$query = $currentPath . $query;
471
+			$query = $currentPath.$query;
472 472
 		}
473 473
 		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
474 474
 		$requestConfig = array();
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 			'./files/cache/template_compiled',
494 494
 		);
495 495
 
496
-		foreach($directory_list as $dir)
496
+		foreach ($directory_list as $dir)
497 497
 		{
498 498
 			FileHandler::makeDir($dir);
499 499
 		}
@@ -509,57 +509,57 @@  discard block
 block discarded – undo
509 509
 		$oModuleModel = getModel('module');
510 510
 		// Create a table ny finding schemas/*.xml file in each module
511 511
 		$module_list = FileHandler::readDir('./modules/', NULL, false, true);
512
-		foreach($module_list as $module_path)
512
+		foreach ($module_list as $module_path)
513 513
 		{
514 514
 			// Get module name
515
-			$tmp_arr = explode('/',$module_path);
516
-			$module = $tmp_arr[count($tmp_arr)-1];
515
+			$tmp_arr = explode('/', $module_path);
516
+			$module = $tmp_arr[count($tmp_arr) - 1];
517 517
 
518 518
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
519
-			if(!$xml_info) continue;
519
+			if (!$xml_info) continue;
520 520
 			$modules[$xml_info->category][] = $module;
521 521
 		}
522 522
 		// Install "module" module in advance
523
-		$this->installModule('module','./modules/module');
523
+		$this->installModule('module', './modules/module');
524 524
 		$oModule = getClass('module');
525
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
525
+		if ($oModule->checkUpdate()) $oModule->moduleUpdate();
526 526
 		// Determine the order of module installation depending on category
527
-		$install_step = array('system','content','member');
527
+		$install_step = array('system', 'content', 'member');
528 528
 		// Install all the remaining modules
529
-		foreach($install_step as $category)
529
+		foreach ($install_step as $category)
530 530
 		{
531
-			if(count($modules[$category]))
531
+			if (count($modules[$category]))
532 532
 			{
533
-				foreach($modules[$category] as $module)
533
+				foreach ($modules[$category] as $module)
534 534
 				{
535
-					if($module == 'module') continue;
535
+					if ($module == 'module') continue;
536 536
 					$this->installModule($module, sprintf('./modules/%s', $module));
537 537
 
538 538
 					$oModule = getClass($module);
539
-					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
539
+					if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))
540 540
 					{
541
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
541
+						if ($oModule->checkUpdate()) $oModule->moduleUpdate();
542 542
 					}
543 543
 				}
544 544
 				unset($modules[$category]);
545 545
 			}
546 546
 		}
547 547
 		// Install all the remaining modules
548
-		if(count($modules))
548
+		if (count($modules))
549 549
 		{
550
-			foreach($modules as $category => $module_list)
550
+			foreach ($modules as $category => $module_list)
551 551
 			{
552
-				if(count($module_list))
552
+				if (count($module_list))
553 553
 				{
554
-					foreach($module_list as $module)
554
+					foreach ($module_list as $module)
555 555
 					{
556
-						if($module == 'module') continue;
556
+						if ($module == 'module') continue;
557 557
 						$this->installModule($module, sprintf('./modules/%s', $module));
558 558
 
559 559
 						$oModule = getClass($module);
560
-						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
560
+						if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
561 561
 						{
562
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
562
+							if ($oModule->checkUpdate()) $oModule->moduleUpdate();
563 563
 						}
564 564
 					}
565 565
 				}
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 		$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
582 582
 
583 583
 		$file_cnt = count($schema_files);
584
-		for($i=0;$i<$file_cnt;$i++)
584
+		for ($i = 0; $i < $file_cnt; $i++)
585 585
 		{
586 586
 			$file = trim($schema_files[$i]);
587
-			if(!$file || substr($file,-4)!='.xml') continue;
587
+			if (!$file || substr($file, -4) != '.xml') continue;
588 588
 			$output = $oDB->createTableByXmlFile($file);
589
-			if($output === false)
589
+			if ($output === false)
590 590
 				throw new Exception('msg_create_table_failed');
591 591
 		}
592 592
 		// Create a table and module instance and then execute install() method
593 593
 		unset($oModule);
594 594
 		$oModule = getClass($module);
595
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
595
+		if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
596 596
 		return new BaseObject();
597 597
 	}
598 598
 
599 599
 	function _getDBConfigFileContents($db_info)
600 600
 	{
601
-		if(substr($db_info->master_db['db_table_prefix'], -1) != '_')
601
+		if (substr($db_info->master_db['db_table_prefix'], -1) != '_')
602 602
 		{
603 603
 			$db_info->master_db['db_table_prefix'] .= '_';
604 604
 		}
605 605
 
606
-		foreach($db_info->slave_db as &$slave)
606
+		foreach ($db_info->slave_db as &$slave)
607 607
 		{
608
-			if(substr($slave['db_table_prefix'], -1) != '_')
608
+			if (substr($slave['db_table_prefix'], -1) != '_')
609 609
 			{
610 610
 				$slave['db_table_prefix'] .= '_';
611 611
 			}
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 		$buff = array();
615 615
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
616
-		$buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';
616
+		$buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';
617 617
 
618 618
 		return implode(PHP_EOL, $buff);
619 619
 	}
@@ -627,13 +627,13 @@  discard block
 block discarded – undo
627 627
 		$db_tmp_config_file = $this->db_tmp_config_file;
628 628
 
629 629
 		$db_info = Context::getDBInfo();
630
-		if(!$db_info) return;
630
+		if (!$db_info) return;
631 631
 
632 632
 		$buff = $this->_getDBConfigFileContents($db_info);
633 633
 
634 634
 		FileHandler::writeFile($db_tmp_config_file, $buff);
635 635
 
636
-		if(@file_exists($db_tmp_config_file)) return true;
636
+		if (@file_exists($db_tmp_config_file)) return true;
637 637
 		return false;
638 638
 	}
639 639
 
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 		$etc_tmp_config_file = $this->etc_tmp_config_file;
647 647
 
648 648
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n";
649
-		foreach($config_info as $key => $val)
649
+		foreach ($config_info as $key => $val)
650 650
 		{
651
-			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
651
+			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
652 652
 		}
653 653
 
654 654
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
655 655
 
656
-		if(@file_exists($etc_tmp_config_file)) return true;
656
+		if (@file_exists($etc_tmp_config_file)) return true;
657 657
 		return false;
658 658
 	}
659 659
 
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 			//if(file_exists($config_file)) return;
669 669
 
670 670
 			$db_info = Context::getDBInfo();
671
-			if(!$db_info) return;
671
+			if (!$db_info) return;
672 672
 
673 673
 			$buff = $this->_getDBConfigFileContents($db_info);
674 674
 
675 675
 			FileHandler::writeFile($config_file, $buff);
676 676
 
677
-			if(@file_exists($config_file))
677
+			if (@file_exists($config_file))
678 678
 			{
679 679
 				FileHandler::removeFile($this->db_tmp_config_file);
680 680
 				FileHandler::removeFile($this->etc_tmp_config_file);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	function installByConfig($install_config_file)
690 690
 	{
691 691
 		include $install_config_file;
692
-		if(!is_array($auto_config)) return false;
692
+		if (!is_array($auto_config)) return false;
693 693
 
694 694
 		$auto_config['module'] = 'install';
695 695
 		$auto_config['act'] = 'procInstall';
@@ -697,22 +697,22 @@  discard block
 block discarded – undo
697 697
 		$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
698 698
 		$fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
699 699
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
700
-		foreach($auto_config as $k => $v)
700
+		foreach ($auto_config as $k => $v)
701 701
 		{
702
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
702
+			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k);
703 703
 		}
704 704
 		$body .= "</params>\r\n</methodCall>";
705 705
 
706
-		$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
706
+		$header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);
707 707
 		$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
708 708
 
709
-		if($fp)
709
+		if ($fp)
710 710
 		{
711 711
 			fputs($fp, $header);
712
-			while(!feof($fp))
712
+			while (!feof($fp))
713 713
 			{
714 714
 				$line = trim(fgets($fp, 4096));
715
-				if(strncmp('<error>', $line, 7) === 0)
715
+				if (strncmp('<error>', $line, 7) === 0)
716 716
 				{
717 717
 					fclose($fp);
718 718
 					return false;
Please login to merge, or discard this patch.
Braces   +149 added lines, -58 removed lines patch added patch discarded remove patch
@@ -101,11 +101,17 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if(!$output->toBool()) {
105
+			return $output;
106
+		}
107
+		if(!$oDB->isConnected()) {
108
+			return $oDB->getError();
109
+		}
106 110
 
107 111
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
112
+		if(!$this->makeDBConfigFile()) {
113
+			return new BaseObject(-1, 'msg_install_failed');
114
+		}
109 115
 
110 116
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
111 117
 		{
@@ -122,10 +128,14 @@  discard block
 block discarded – undo
122 128
 	{
123 129
 		// Get variables
124 130
 		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
131
+		if($config_info->use_rewrite!='Y') {
132
+			$config_info->use_rewrite = 'N';
133
+		}
126 134
 
127 135
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
136
+		if(!$this->makeEtcConfigFile($config_info)) {
137
+			return new BaseObject(-1, 'msg_install_failed');
138
+		}
129 139
 
130 140
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
131 141
 		{
@@ -141,7 +151,9 @@  discard block
 block discarded – undo
141 151
 	function procInstall()
142 152
 	{
143 153
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
154
+		if(Context::isInstalled()) {
155
+			return new BaseObject(-1, 'msg_already_installed');
156
+		}
145 157
 
146 158
 		Context::loadLang('modules/member/lang');
147 159
 		$oMemberModel = getModel('member');
@@ -167,8 +179,12 @@  discard block
 block discarded – undo
167 179
 		// install by default XE UI
168 180
 		else
169 181
 		{
170
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
182
+			if(FileHandler::exists($this->db_tmp_config_file)) {
183
+				include $this->db_tmp_config_file;
184
+			}
185
+			if(FileHandler::exists($this->etc_tmp_config_file)) {
186
+				include $this->etc_tmp_config_file;
187
+			}
172 188
 		}
173 189
 
174 190
 		// Set DB type and information
@@ -176,7 +192,9 @@  discard block
 block discarded – undo
176 192
 		// Create DB Instance
177 193
 		$oDB = &DB::getInstance();
178 194
 		// Check if available to connect to the DB
179
-		if(!$oDB->isConnected()) return $oDB->getError();
195
+		if(!$oDB->isConnected()) {
196
+			return $oDB->getError();
197
+		}
180 198
 
181 199
 		// Install all the modules
182 200
 		try {
@@ -189,7 +207,9 @@  discard block
 block discarded – undo
189 207
 		}
190 208
 
191 209
 		// Create a config file
192
-		if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
210
+		if(!$this->makeConfigFile()) {
211
+			return new BaseObject(-1, 'msg_install_failed');
212
+		}
193 213
 
194 214
 		// load script
195 215
 		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
@@ -246,14 +266,17 @@  discard block
 block discarded – undo
246 266
 		{
247 267
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
248 268
 			$https_port = (!$https_port != 443) ? $https_port : null;
249
-		}
250
-		else
269
+		} else
251 270
 		{
252 271
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
253 272
 			$http_port = (!$http_port != 80) ? $http_port : null;
254 273
 		}
255
-		if($http_port) $db_info->http_port = $http_port;
256
-		if($https_port) $db_info->https_port = $https_port;
274
+		if($http_port) {
275
+			$db_info->http_port = $http_port;
276
+		}
277
+		if($https_port) {
278
+			$db_info->https_port = $https_port;
279
+		}
257 280
 
258 281
 		return $db_info;
259 282
 	}
@@ -263,12 +286,20 @@  discard block
 block discarded – undo
263 286
 	 */
264 287
 	function procInstallFTP()
265 288
 	{
266
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
289
+		if(Context::isInstalled()) {
290
+			return new BaseObject(-1, 'msg_already_installed');
291
+		}
267 292
 		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
268 293
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
269
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
294
+		if(!$ftp_info->ftp_port) {
295
+			$ftp_info->ftp_port = 21;
296
+		}
297
+		if(!$ftp_info->ftp_host) {
298
+			$ftp_info->ftp_host = '127.0.0.1';
299
+		}
300
+		if(!$ftp_info->ftp_root_path) {
301
+			$ftp_info->ftp_root_path = '/';
302
+		}
272 303
 
273 304
 		$buff = array('<?php if(!defined("__XE__")) exit();');
274 305
 		$buff[] = "\$ftp_info = new stdClass();";
@@ -280,11 +311,15 @@  discard block
 block discarded – undo
280 311
 		// If safe_mode
281 312
 		if(ini_get('safe_mode'))
282 313
 		{
283
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
314
+			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
315
+				return new BaseObject(-1,'msg_safe_mode_ftp_needed');
316
+			}
284 317
 
285 318
 			require_once(_XE_PATH_.'libs/ftp.class.php');
286 319
 			$oFtp = new ftp();
287
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
320
+			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
321
+				return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
322
+			}
288 323
 
289 324
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
290 325
 			{
@@ -326,10 +361,16 @@  discard block
 block discarded – undo
326 361
 	{
327 362
 		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
328 363
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
329
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
364
+		if(!$ftp_info->ftp_port) {
365
+			$ftp_info->ftp_port = 21;
366
+		}
367
+		if(!$ftp_info->sftp) {
368
+			$ftp_info->sftp = 'N';
369
+		}
331 370
 
332
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
371
+		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
372
+			return new BaseObject(-1,'msg_safe_mode_ftp_needed');
373
+		}
333 374
 
334 375
 		if($ftp_info->sftp == 'Y')
335 376
 		{
@@ -338,12 +379,13 @@  discard block
 block discarded – undo
338 379
 			{
339 380
 				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
340 381
 			}
341
-		}
342
-		else
382
+		} else
343 383
 		{
344 384
 			require_once(_XE_PATH_.'libs/ftp.class.php');
345 385
 			$oFtp = new ftp();
346
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
386
+			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) {
387
+				return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
388
+			}
347 389
 
348 390
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
349 391
 			{
@@ -376,28 +418,49 @@  discard block
 block discarded – undo
376 418
 		}
377 419
 
378 420
 		// 1. Check permission
379
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
380
-		else $checklist['permission'] = false;
421
+		if(is_writable('./')||is_writable('./files')) {
422
+			$checklist['permission'] = true;
423
+		} else {
424
+			$checklist['permission'] = false;
425
+		}
381 426
 		// 2. Check if xml_parser_create exists
382
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
383
-		else $checklist['xml'] = false;
427
+		if(function_exists('xml_parser_create')) {
428
+			$checklist['xml'] = true;
429
+		} else {
430
+			$checklist['xml'] = false;
431
+		}
384 432
 		// 3. Check if ini_get (session.auto_start) == 1
385
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
386
-		else $checklist['session'] = false;
433
+		if(ini_get('session.auto_start')!=1) {
434
+			$checklist['session'] = true;
435
+		} else {
436
+			$checklist['session'] = false;
437
+		}
387 438
 		// 4. Check if iconv exists
388
-		if(function_exists('iconv')) $checklist['iconv'] = true;
389
-		else $checklist['iconv'] = false;
439
+		if(function_exists('iconv')) {
440
+			$checklist['iconv'] = true;
441
+		} else {
442
+			$checklist['iconv'] = false;
443
+		}
390 444
 		// 5. Check gd(imagecreatefromgif function)
391
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
392
-		else $checklist['gd'] = false;
445
+		if(function_exists('imagecreatefromgif')) {
446
+			$checklist['gd'] = true;
447
+		} else {
448
+			$checklist['gd'] = false;
449
+		}
393 450
 		// extension: fileinfo
394 451
 		$checklist['fileinfo'] = extension_loaded('fileinfo');
395 452
 		// 6. Check DB
396
-		if(DB::getEnableList()) $checklist['db'] = true;
397
-		else $checklist['db'] = false;
453
+		if(DB::getEnableList()) {
454
+			$checklist['db'] = true;
455
+		} else {
456
+			$checklist['db'] = false;
457
+		}
398 458
 
399
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
400
-		else $install_enable = true;
459
+		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) {
460
+			$install_enable = false;
461
+		} else {
462
+			$install_enable = true;
463
+		}
401 464
 
402 465
 		// Save the checked result to the Context
403 466
 		Context::set('checklist', $checklist);
@@ -420,8 +483,7 @@  discard block
 block discarded – undo
420 483
 		{
421 484
 			$currentTime = $_SERVER['REQUEST_TIME'];
422 485
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
423
-		}
424
-		else
486
+		} else
425 487
 		{
426 488
 			FileHandler::removeFile($this->flagLicenseAgreement);
427 489
 			return new BaseObject(-1, 'msg_must_accept_license_agreement');
@@ -516,13 +578,17 @@  discard block
 block discarded – undo
516 578
 			$module = $tmp_arr[count($tmp_arr)-1];
517 579
 
518 580
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
519
-			if(!$xml_info) continue;
581
+			if(!$xml_info) {
582
+				continue;
583
+			}
520 584
 			$modules[$xml_info->category][] = $module;
521 585
 		}
522 586
 		// Install "module" module in advance
523 587
 		$this->installModule('module','./modules/module');
524 588
 		$oModule = getClass('module');
525
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
589
+		if($oModule->checkUpdate()) {
590
+			$oModule->moduleUpdate();
591
+		}
526 592
 		// Determine the order of module installation depending on category
527 593
 		$install_step = array('system','content','member');
528 594
 		// Install all the remaining modules
@@ -532,13 +598,17 @@  discard block
 block discarded – undo
532 598
 			{
533 599
 				foreach($modules[$category] as $module)
534 600
 				{
535
-					if($module == 'module') continue;
601
+					if($module == 'module') {
602
+						continue;
603
+					}
536 604
 					$this->installModule($module, sprintf('./modules/%s', $module));
537 605
 
538 606
 					$oModule = getClass($module);
539 607
 					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
540 608
 					{
541
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
609
+						if($oModule->checkUpdate()) {
610
+							$oModule->moduleUpdate();
611
+						}
542 612
 					}
543 613
 				}
544 614
 				unset($modules[$category]);
@@ -553,13 +623,17 @@  discard block
 block discarded – undo
553 623
 				{
554 624
 					foreach($module_list as $module)
555 625
 					{
556
-						if($module == 'module') continue;
626
+						if($module == 'module') {
627
+							continue;
628
+						}
557 629
 						$this->installModule($module, sprintf('./modules/%s', $module));
558 630
 
559 631
 						$oModule = getClass($module);
560 632
 						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
561 633
 						{
562
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
634
+							if($oModule->checkUpdate()) {
635
+								$oModule->moduleUpdate();
636
+							}
563 637
 						}
564 638
 					}
565 639
 				}
@@ -584,15 +658,20 @@  discard block
 block discarded – undo
584 658
 		for($i=0;$i<$file_cnt;$i++)
585 659
 		{
586 660
 			$file = trim($schema_files[$i]);
587
-			if(!$file || substr($file,-4)!='.xml') continue;
661
+			if(!$file || substr($file,-4)!='.xml') {
662
+				continue;
663
+			}
588 664
 			$output = $oDB->createTableByXmlFile($file);
589
-			if($output === false)
590
-				throw new Exception('msg_create_table_failed');
665
+			if($output === false) {
666
+							throw new Exception('msg_create_table_failed');
667
+			}
591 668
 		}
592 669
 		// Create a table and module instance and then execute install() method
593 670
 		unset($oModule);
594 671
 		$oModule = getClass($module);
595
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
672
+		if(method_exists($oModule, 'moduleInstall')) {
673
+			$oModule->moduleInstall();
674
+		}
596 675
 		return new BaseObject();
597 676
 	}
598 677
 
@@ -627,13 +706,17 @@  discard block
 block discarded – undo
627 706
 		$db_tmp_config_file = $this->db_tmp_config_file;
628 707
 
629 708
 		$db_info = Context::getDBInfo();
630
-		if(!$db_info) return;
709
+		if(!$db_info) {
710
+			return;
711
+		}
631 712
 
632 713
 		$buff = $this->_getDBConfigFileContents($db_info);
633 714
 
634 715
 		FileHandler::writeFile($db_tmp_config_file, $buff);
635 716
 
636
-		if(@file_exists($db_tmp_config_file)) return true;
717
+		if(@file_exists($db_tmp_config_file)) {
718
+			return true;
719
+		}
637 720
 		return false;
638 721
 	}
639 722
 
@@ -653,7 +736,9 @@  discard block
 block discarded – undo
653 736
 
654 737
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
655 738
 
656
-		if(@file_exists($etc_tmp_config_file)) return true;
739
+		if(@file_exists($etc_tmp_config_file)) {
740
+			return true;
741
+		}
657 742
 		return false;
658 743
 	}
659 744
 
@@ -668,7 +753,9 @@  discard block
 block discarded – undo
668 753
 			//if(file_exists($config_file)) return;
669 754
 
670 755
 			$db_info = Context::getDBInfo();
671
-			if(!$db_info) return;
756
+			if(!$db_info) {
757
+				return;
758
+			}
672 759
 
673 760
 			$buff = $this->_getDBConfigFileContents($db_info);
674 761
 
@@ -689,7 +776,9 @@  discard block
 block discarded – undo
689 776
 	function installByConfig($install_config_file)
690 777
 	{
691 778
 		include $install_config_file;
692
-		if(!is_array($auto_config)) return false;
779
+		if(!is_array($auto_config)) {
780
+			return false;
781
+		}
693 782
 
694 783
 		$auto_config['module'] = 'install';
695 784
 		$auto_config['act'] = 'procInstall';
@@ -699,7 +788,9 @@  discard block
 block discarded – undo
699 788
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
700 789
 		foreach($auto_config as $k => $v)
701 790
 		{
702
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
791
+			if(!in_array($k,array('host','port','path'))) {
792
+				$body .= sprintf($fstr,$k,$v,$k);
793
+			}
703 794
 		}
704 795
 		$body .= "</params>\r\n</methodCall>";
705 796
 
Please login to merge, or discard this patch.
modules/editor/editor.model.php 2 patches
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getEditorConfig($module_srl = null)
25 25
 	{
26
-		if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
26
+		if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
27 27
 		{
28 28
 			// Get trackback settings of the selected module
29 29
 			$oModuleModel = getModel('module');
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
37
+		if (!is_object($editor_config)) $editor_config = new stdClass();
38 38
 
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
39
+		if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
+		if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
+		if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
+		if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
+		if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
+		if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
+		if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
+		if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
+		if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array();
48 48
 
49
-		if(!$editor_config->editor_height)
49
+		if (!$editor_config->editor_height)
50 50
 		{
51 51
 			$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
52 52
 		}
53
-		if(!$editor_config->comment_editor_height)
53
+		if (!$editor_config->comment_editor_height)
54 54
 		{
55 55
 			$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
56 56
 		}
57
-		if(!$editor_config->editor_skin)
57
+		if (!$editor_config->editor_skin)
58 58
 		{
59 59
 			$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
60 60
 		}
61
-		if(!$editor_config->comment_editor_skin)
61
+		if (!$editor_config->comment_editor_skin)
62 62
 		{
63 63
 			$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
64 64
 		}
65
-		if(!$editor_config->content_style)
65
+		if (!$editor_config->content_style)
66 66
 		{
67 67
 			$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
68 68
 		}
69
-		if(!$editor_config->content_font && $editor_default_config->content_font)
69
+		if (!$editor_config->content_font && $editor_default_config->content_font)
70 70
 		{
71 71
 			$editor_config->content_font = $editor_default_config->content_font;
72 72
 		}
73
-		if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
73
+		if (!$editor_config->content_font_size && $editor_default_config->content_font_size)
74 74
 		{
75 75
 			$editor_config->content_font_size = $editor_default_config->content_font_size;
76 76
 		}
77
-		if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
77
+		if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
78 78
 		{
79 79
 			$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
80 80
 		}
81
-		if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
81
+		if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
82 82
 		{
83 83
 			$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
84 84
 		}
85
-		if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
85
+		if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
86 86
 		{
87 87
 			$editor_config->comment_content_style = $editor_default_config->comment_content_style;
88 88
 		}
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 
93 93
 	function loadDrComponents()
94 94
 	{
95
-		$drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/';
95
+		$drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/';
96 96
 		$drComponentList = FileHandler::readDir($drComponentPath);
97 97
 
98 98
 		$oTemplate = &TemplateHandler::getInstance();
99 99
 
100 100
 		$drComponentInfo = array();
101
-		if($drComponentList)
101
+		if ($drComponentList)
102 102
 		{
103
-			foreach($drComponentList as $i => $drComponent)
103
+			foreach ($drComponentList as $i => $drComponent)
104 104
 			{
105 105
 				unset($obj);
106 106
 				$obj = $this->getDrComponentXmlInfo($drComponent);
107
-				Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
108
-				$path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent);
109
-				$obj->html = $oTemplate->compile($path,$drComponent);
107
+				Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent));
108
+				$path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent);
109
+				$obj->html = $oTemplate->compile($path, $drComponent);
110 110
 				$drComponentInfo[$drComponent] = $obj;
111 111
 			}
112 112
 		}
113
-		Context::set('drComponentList',$drComponentInfo);
113
+		Context::set('drComponentList', $drComponentInfo);
114 114
 	}
115 115
 
116 116
 	function getDrComponentXmlInfo($drComponentName)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$xml_file = sprintf('%sinfo.xml', $component_path);
123 123
 		$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
124 124
 		// Return information after including it after cached xml file exists
125
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
125
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
126 126
 		{
127 127
 			include($cache_file);
128 128
 			return $xml_info;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		$buff .= sprintf('$xml_info->license_link = %s;', var_export($component_info->license_link, true));
152 152
 
153 153
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
154
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155 155
 		else $author_list = $xml_doc->component->author;
156 156
 
157
-		for($i=0; $i < count($author_list); $i++)
157
+		for ($i = 0; $i < count($author_list); $i++)
158 158
 		{
159 159
 			$buff .= sprintf('$xml_info->author['.$i.']->name = %s;', var_export($author_list[$i]->name->body, true));
160 160
 			$buff .= sprintf('$xml_info->author['.$i.']->email_address = %s;', var_export($author_list[$i]->attrs->email_address, true));
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// List extra variables (text type only in the editor component)
165 165
 		$extra_vars = $xml_doc->component->extra_vars->var;
166
-		if($extra_vars)
166
+		if ($extra_vars)
167 167
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
-			foreach($extra_vars as $key => $val)
168
+			if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
+			foreach ($extra_vars as $key => $val)
170 170
 			{
171 171
 				unset($obj);
172 172
 				$key = $val->attrs->name;
@@ -198,50 +198,50 @@  discard block
 block discarded – undo
198 198
 		 * Editor's default options
199 199
 		 */
200 200
 		// Option setting to allow file upload
201
-		if($upload_target_srl)
201
+		if ($upload_target_srl)
202 202
 		{
203 203
 			$option->editor_sequence = $upload_target_srl;
204 204
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
205
+		if (!$option->allow_fileupload) $allow_fileupload = false;
206 206
 		else $allow_fileupload = true;
207 207
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
208
+		if (!$option->content_style) $option->content_style = 'ckeditor_light';
209 209
 		Context::set('content_style', $option->content_style);
210
-		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
210
+		Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style);
211 211
 		// Default font setting
212 212
 		Context::set('content_font', addslashes($option->content_font));
213 213
 		Context::set('content_font_size', $option->content_font_size);
214 214
 
215 215
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
216
+		if (!$option->enable_autosave) $enable_autosave = false;
217
+		elseif (Context::get($option->primary_key_name)) $enable_autosave = false;
218 218
 		else $enable_autosave = true;
219 219
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
220
+		if (!$option->enable_default_component) $enable_default_component = false;
221 221
 		else $enable_default_component = true;
222 222
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
223
+		if (!$option->enable_component) $enable_component = false;
224 224
 		else $enable_component = true;
225 225
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
226
+		if ($option->disable_html) $html_mode = false;
227 227
 		else $html_mode = true;
228 228
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
229
+		if (!$option->height) $editor_height = 300;
230 230
 		else $editor_height = $option->height;
231
-		if(Mobile::isFromMobilePhone()) {
231
+		if (Mobile::isFromMobilePhone()) {
232 232
 			$editor_height = 150;
233 233
 		}
234 234
 		// Skin Setting
235 235
 		$skin = $option->skin;
236
-		if(!$skin) $skin = 'ckeditor';
236
+		if (!$skin) $skin = 'ckeditor';
237 237
 
238 238
 		$colorset = $option->colorset;
239
-		if(!$colorset) $colorset = 'moono';
239
+		if (!$colorset) $colorset = 'moono';
240 240
 		Context::set('colorset', $colorset);
241 241
 		Context::set('skin', $skin);
242 242
 		Context::set('module_type', $option->module_type);
243 243
 
244
-		if($skin=='dreditor')
244
+		if ($skin == 'dreditor')
245 245
 		{
246 246
 			$this->loadDrComponents();
247 247
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		/**
250 250
 		 * Check the automatic backup feature (do not use if the post is edited)
251 251
 		 */
252
-		if($enable_autosave)
252
+		if ($enable_autosave)
253 253
 		{
254 254
 			// Extract auto-saved data
255 255
 			$saved_doc = $this->getSavedDoc($upload_target_srl);
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 		/**
262 262
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
263 263
 		 */
264
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
264
+		if ($option->editor_sequence) $editor_sequence = $option->editor_sequence;
265 265
 		else
266 266
 		{
267
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
268
-			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
267
+			if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
268
+			$editor_sequence = $_SESSION['_editor_sequence_']++;
269 269
 		}
270 270
 
271 271
 		/**
272 272
 		 * Upload setting by using configuration of the file module internally
273 273
 		 */
274 274
 		$files_count = 0;
275
-		if($allow_fileupload)
275
+		if ($allow_fileupload)
276 276
 		{
277 277
 			$oFileModel = getModel('file');
278 278
 			// Get upload configuration to set on SWFUploader
279 279
 			$file_config = $oFileModel->getUploadConfig();
280
-			$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
281
-			$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
280
+			$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
281
+			$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
282 282
 
283
-			Context::set('file_config',$file_config);
283
+			Context::set('file_config', $file_config);
284 284
 			// Configure upload status such as file size
285 285
 			$upload_status = $oFileModel->getUploadStatus();
286 286
 			Context::set('upload_status', $upload_status);
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 			$oFileController = getController('file');
289 289
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
290 290
 			// Check if the file already exists
291
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
291
+			if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
292 292
 		}
293
-		Context::set('files_count', (int)$files_count);
293
+		Context::set('files_count', (int) $files_count);
294 294
 
295 295
 		Context::set('allow_fileupload', $allow_fileupload);
296 296
 		// Set editor_sequence value
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 		 * Check editor component
308 308
 		 */
309 309
 		$site_module_info = Context::get('site_module_info');
310
-		$site_srl = (int)$site_module_info->site_srl;
311
-		if($enable_component)
310
+		$site_srl = (int) $site_module_info->site_srl;
311
+		if ($enable_component)
312 312
 		{
313
-			if(!Context::get('component_list'))
313
+			if (!Context::get('component_list'))
314 314
 			{
315 315
 				$component_list = $this->getComponentList(true, $site_srl);
316 316
 				Context::set('component_list', $component_list);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
338 338
 		$tpl_file = 'editor.html';
339 339
 
340
-		if(!file_exists($tpl_path.$tpl_file))
340
+		if (!file_exists($tpl_path.$tpl_file))
341 341
 		{
342 342
 			$skin = 'ckeditor';
343 343
 			$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		$config->module_type = $type;
368 368
 
369 369
 		// Configurations listed according to a type
370
-		if($type == 'document')
370
+		if ($type == 'document')
371 371
 		{
372 372
 			$config->editor_skin = $editor_config->editor_skin;
373 373
 			$config->content_style = $editor_config->content_style;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			$config->enable_autosave = 'N';
397 397
 		}
398 398
 		// Check a group_list of the currently logged-in user for permission check
399
-		if(Context::get('is_logged'))
399
+		if (Context::get('is_logged'))
400 400
 		{
401 401
 			$logged_info = Context::get('logged_info');
402 402
 			$group_list = $logged_info->group_list;
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 		$option->colorset = $config->sel_editor_colorset;
416 416
 		// Permission check for file upload
417 417
 		$option->allow_fileupload = false;
418
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
419
-		elseif(count($config->upload_file_grant))
418
+		if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true;
419
+		elseif (count($config->upload_file_grant))
420 420
 		{
421
-			foreach($group_list as $group_srl => $group_info)
421
+			foreach ($group_list as $group_srl => $group_info)
422 422
 			{
423
-				if(in_array($group_srl, $config->upload_file_grant))
423
+				if (in_array($group_srl, $config->upload_file_grant))
424 424
 				{
425 425
 					$option->allow_fileupload = true;
426 426
 					break;
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
 		else $option->allow_fileupload = true;
431 431
 		// Permission check for using default components
432 432
 		$option->enable_default_component = false;
433
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
434
-		elseif(count($config->enable_default_component_grant))
433
+		if ($logged_info->is_admin == 'Y') $option->enable_default_component = true;
434
+		elseif (count($config->enable_default_component_grant))
435 435
 		{
436
-			foreach($group_list as $group_srl => $group_info)
436
+			foreach ($group_list as $group_srl => $group_info)
437 437
 			{
438
-				if(in_array($group_srl, $config->enable_default_component_grant))
438
+				if (in_array($group_srl, $config->enable_default_component_grant))
439 439
 				{
440 440
 					$option->enable_default_component = true;
441 441
 					break;
@@ -445,12 +445,12 @@  discard block
 block discarded – undo
445 445
 		else $option->enable_default_component = true;
446 446
 		// Permisshion check for using extended components
447 447
 		$option->enable_component = false;
448
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
449
-		elseif(count($config->enable_component_grant))
448
+		if ($logged_info->is_admin == 'Y') $option->enable_component = true;
449
+		elseif (count($config->enable_component_grant))
450 450
 		{
451
-			foreach($group_list as $group_srl => $group_info)
451
+			foreach ($group_list as $group_srl => $group_info)
452 452
 			{
453
-				if(in_array($group_srl, $config->enable_component_grant))
453
+				if (in_array($group_srl, $config->enable_component_grant))
454 454
 				{
455 455
 					$option->enable_component = true;
456 456
 					break;
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 		else $option->enable_component = true;
461 461
 		// HTML editing privileges
462 462
 		$enable_html = false;
463
-		if($logged_info->is_admin=='Y') $enable_html = true;
464
-		elseif(count($config->enable_html_grant))
463
+		if ($logged_info->is_admin == 'Y') $enable_html = true;
464
+		elseif (count($config->enable_html_grant))
465 465
 		{
466
-			foreach($group_list as $group_srl => $group_info)
466
+			foreach ($group_list as $group_srl => $group_info)
467 467
 			{
468
-				if(in_array($group_srl, $config->enable_html_grant))
468
+				if (in_array($group_srl, $config->enable_html_grant))
469 469
 				{
470 470
 					$enable_html = true;
471 471
 					break;
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 		}
475 475
 		else $enable_html = true;
476 476
 
477
-		if($enable_html) $option->disable_html = false;
477
+		if ($enable_html) $option->disable_html = false;
478 478
 		else $option->disable_html = true;
479 479
 		// Set Height
480 480
 		$option->height = $config->editor_height;
481 481
 		// Set an option for Auto-save
482
-		$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
482
+		$option->enable_autosave = $config->enable_autosave == 'Y' ?true:false;
483 483
 		// Other settings
484 484
 		$option->primary_key_name = $primary_key_name;
485 485
 		$option->content_key_name = $content_key_name;
@@ -495,31 +495,31 @@  discard block
 block discarded – undo
495 495
 		$auto_save_args = new stdClass();
496 496
 		$auto_save_args->module_srl = Context::get('module_srl');
497 497
 		// Get the current module if module_srl doesn't exist
498
-		if(!$auto_save_args->module_srl)
498
+		if (!$auto_save_args->module_srl)
499 499
 		{
500 500
 			$current_module_info = Context::get('current_module_info');
501 501
 			$auto_save_args->module_srl = $current_module_info->module_srl;
502 502
 		}
503 503
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
504
-		if(Context::get('is_logged'))
504
+		if (Context::get('is_logged'))
505 505
 		{
506 506
 			$logged_info = Context::get('logged_info');
507 507
 			$auto_save_args->member_srl = $logged_info->member_srl;
508 508
 		}
509 509
 		else
510 510
 		{
511
-			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
511
+			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_'.$auto_save_args->module_srl];
512 512
 			// @see https://github.com/xpressengine/xe-core/issues/2208
513 513
 			// 변경 이전에 작성된 게시물 호환성 유지
514
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
514
+			if (!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
515 515
 		}
516 516
 		// Extract auto-saved data from the DB
517 517
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
518 518
 		$saved_doc = $output->data;
519 519
 		// Return null if no result is auto-saved
520
-		if(!$saved_doc) return;
520
+		if (!$saved_doc) return;
521 521
 
522
-		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
522
+		if ($saved_doc->certify_key && !isset($auto_save_args->certify_key))
523 523
 		{
524 524
 			return;
525 525
 		}
@@ -527,16 +527,16 @@  discard block
 block discarded – undo
527 527
 		// Check if the auto-saved document already exists
528 528
 		$oDocumentModel = getModel('document');
529 529
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
530
-		if($oSaved->isExists()) return;
530
+		if ($oSaved->isExists()) return;
531 531
 		// Move all the files if the auto-saved data contains document_srl and file
532 532
 		// Then set document_srl to editor_sequence
533
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
533
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
534 534
 		{
535 535
 			$saved_doc->module_srl = $auto_save_args->module_srl;
536 536
 			$oFileController = getController('file');
537 537
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
538 538
 		}
539
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
539
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
540 540
 		// Change auto-saved data
541 541
 		$saved_doc->certify_key = $auto_save_args->certify_key;
542 542
 		$oEditorController = getController('editor');
@@ -553,18 +553,18 @@  discard block
 block discarded – undo
553 553
 	 */
554 554
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
555 555
 	{
556
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
556
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return;
557 557
 
558
-		if(!$this->loaded_component_list[$component][$editor_sequence])
558
+		if (!$this->loaded_component_list[$component][$editor_sequence])
559 559
 		{
560 560
 			// Create an object of the component and execute
561 561
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
562 562
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
563
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
563
+			if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
564 564
 			// Create an object after loading the class file
565 565
 			require_once($class_file);
566 566
 			$oComponent = new $component($editor_sequence, $class_path);
567
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
567
+			if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
568 568
 			// Add configuration information
569 569
 			$component_info = $this->getComponent($component, $site_srl);
570 570
 			$oComponent->setInfo($component_info);
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 	/**
586 586
 	 * @brief Return the cache file name of editor component list
587 587
 	 */
588
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
588
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
589 589
 	{
590 590
 		$lang = Context::getLangType();
591 591
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
592 592
 		FileHandler::makeDir($cache_path);
593
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
594
-		if($filter_enabled) $cache_file .= 'filter.';
595
-		if($site_srl) $cache_file .= $site_srl.'.';
593
+		$cache_file = $cache_path.'component_list.'.$lang.'.';
594
+		if ($filter_enabled) $cache_file .= 'filter.';
595
+		if ($site_srl) $cache_file .= $site_srl.'.';
596 596
 		$cache_file .= 'php';
597 597
 		return $cache_file;
598 598
 	}
@@ -604,33 +604,33 @@  discard block
 block discarded – undo
604 604
 		if ($filter_enabled) $cache_key[] = 'filter';
605 605
 		if ($site_srl) $cache_key[] = $site_srl;
606 606
 
607
-		return 'editor.component_list:' . implode('.', $cache_key);
607
+		return 'editor.component_list:'.implode('.', $cache_key);
608 608
 	}
609 609
 
610 610
 	/**
611 611
 	 * @brief Return a component list (DB Information included)
612 612
 	 */
613
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
613
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
614 614
 	{
615 615
 		$component_list = false;
616 616
 
617 617
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
618
-		if($oCacheHandler->isSupport()) {
618
+		if ($oCacheHandler->isSupport()) {
619 619
 			$cache_key = $this->getComponentListCacheKey(false, $site_srl);
620 620
 			$component_list = $oCacheHandler->get($cache_key);
621 621
 		}
622 622
 
623
-		if($from_db || $component_list === false)
623
+		if ($from_db || $component_list === false)
624 624
 		{
625 625
 			$oEditorController = getController('editor');
626 626
 			$component_list = $oEditorController->makeCache(false, $site_srl);
627 627
 
628 628
 		}
629 629
 
630
-		if(!$component_list) return array();
630
+		if (!$component_list) return array();
631 631
 
632 632
 		$logged_info = Context::get('logged_info');
633
-		if($logged_info && is_array($logged_info->group_list))
633
+		if ($logged_info && is_array($logged_info->group_list))
634 634
 		{
635 635
 			$group_list = array_keys($logged_info->group_list);
636 636
 		}
@@ -639,45 +639,45 @@  discard block
 block discarded – undo
639 639
 			$group_list = array();
640 640
 		}
641 641
 
642
-		if(count($component_list))
642
+		if (count($component_list))
643 643
 		{
644
-			foreach($component_list as $key => $val)
644
+			foreach ($component_list as $key => $val)
645 645
 			{
646
-				if(!trim($key)) continue;
647
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
646
+				if (!trim($key)) continue;
647
+				if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
648 648
 				{
649 649
 					FileHandler::removeFile($cache_file);
650 650
 					return $this->getComponentList($filter_enabled, $site_srl);
651 651
 				}
652
-				if(!$filter_enabled) continue;
653
-				if($val->enabled == "N")
652
+				if (!$filter_enabled) continue;
653
+				if ($val->enabled == "N")
654 654
 				{
655 655
 					unset($component_list->{$key});
656 656
 					continue;
657 657
 				}
658
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
659
-				if($val->target_group)
658
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
659
+				if ($val->target_group)
660 660
 				{
661
-					if(!$logged_info)
661
+					if (!$logged_info)
662 662
 					{
663 663
 						$val->enabled = "N";
664 664
 					}
665 665
 					else
666 666
 					{
667 667
 						$is_granted = false;
668
-						foreach($group_list as $group_srl)
668
+						foreach ($group_list as $group_srl)
669 669
 						{
670
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
670
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
671 671
 						}
672
-						if(!$is_granted) $val->enabled = "N";
672
+						if (!$is_granted) $val->enabled = "N";
673 673
 					}
674 674
 				}
675
-				if($val->enabled != "N" && $val->mid_list)
675
+				if ($val->enabled != "N" && $val->mid_list)
676 676
 				{
677 677
 					$mid = Context::get('mid');
678
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
678
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
679 679
 				}
680
-				if($val->enabled == "N")
680
+				if ($val->enabled == "N")
681 681
 				{
682 682
 					unset($component_list->{$key});
683 683
 					continue;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 		$args = new stdClass();
696 696
 		$args->component_name = $component_name;
697 697
 
698
-		if($site_srl)
698
+		if ($site_srl)
699 699
 		{
700 700
 			$args->site_srl = $site_srl;
701 701
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 		$component = $output->data;
708 708
 
709
-		if(!$output->data) return false;
709
+		if (!$output->data) return false;
710 710
 
711 711
 		$component_name = $component->component_name;
712 712
 
@@ -718,25 +718,25 @@  discard block
 block discarded – undo
718 718
 
719 719
 		$xml_info->mid_list = array();
720 720
 
721
-		if($component->extra_vars)
721
+		if ($component->extra_vars)
722 722
 		{
723 723
 			$extra_vars = unserialize($component->extra_vars);
724 724
 
725
-			if($extra_vars->target_group)
725
+			if ($extra_vars->target_group)
726 726
 			{
727 727
 				$xml_info->target_group = $extra_vars->target_group;
728 728
 				unset($extra_vars->target_group);
729 729
 			}
730 730
 
731
-			if($extra_vars->mid_list)
731
+			if ($extra_vars->mid_list)
732 732
 			{
733 733
 				$xml_info->mid_list = $extra_vars->mid_list;
734 734
 				unset($extra_vars->mid_list);
735 735
 			}
736 736
 
737
-			if($xml_info->extra_vars)
737
+			if ($xml_info->extra_vars)
738 738
 			{
739
-				foreach($xml_info->extra_vars as $key => $val)
739
+				foreach ($xml_info->extra_vars as $key => $val)
740 740
 				{
741 741
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
742 742
 				}
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
761 761
 
762 762
 		// Include and return xml file information if cached file exists
763
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
763
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
764 764
 		{
765 765
 			include($cache_file);
766 766
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		$component_info->component_name = $component;
778 778
 		$component_info->title = $xml_doc->component->title->body;
779 779
 
780
-		if($xml_doc->component->version)
780
+		if ($xml_doc->component->version)
781 781
 		{
782 782
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
783 783
 			$component_info->version = $xml_doc->component->version->body;
@@ -803,10 +803,10 @@  discard block
 block discarded – undo
803 803
 
804 804
 		// Author information
805 805
 		$author_list = array();
806
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
806
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
807 807
 		else $author_list = $xml_doc->component->author;
808 808
 
809
-		for($i = 0; $i < count($author_list); $i++)
809
+		for ($i = 0; $i < count($author_list); $i++)
810 810
 		{
811 811
 			$author = new stdClass;
812 812
 			$author->name = $author_list[$i]->name->body;
@@ -817,39 +817,39 @@  discard block
 block discarded – undo
817 817
 
818 818
 		// List extra variables (text type only for editor component)
819 819
 		$extra_vars = $xml_doc->component->extra_vars;
820
-		if($extra_vars)
820
+		if ($extra_vars)
821 821
 		{
822 822
 			$extra_var_groups = $extra_vars->group;
823
-			if(!$extra_var_groups)
823
+			if (!$extra_var_groups)
824 824
 			{
825 825
 				$extra_var_groups = $extra_vars;
826 826
 			}
827
-			if(!is_array($extra_var_groups))
827
+			if (!is_array($extra_var_groups))
828 828
 			{
829 829
 				$extra_var_groups = array($extra_var_groups);
830 830
 			}
831 831
 
832
-			foreach($extra_var_groups as $group)
832
+			foreach ($extra_var_groups as $group)
833 833
 			{
834 834
 				$extra_vars = $group->var;
835
-				if(!is_array($group->var))
835
+				if (!is_array($group->var))
836 836
 				{
837 837
 					$extra_vars = array($group->var);
838 838
 				}
839 839
 
840
-				foreach($extra_vars as $key => $val)
840
+				foreach ($extra_vars as $key => $val)
841 841
 				{
842
-					if(!$val)
842
+					if (!$val)
843 843
 					{
844 844
 						continue;
845 845
 					}
846 846
 
847 847
 					$obj = new stdClass();
848
-					if(!$val->attrs)
848
+					if (!$val->attrs)
849 849
 					{
850 850
 						$val->attrs = new stdClass();
851 851
 					}
852
-					if(!$val->attrs->type)
852
+					if (!$val->attrs->type)
853 853
 					{
854 854
 						$val->attrs->type = 'text';
855 855
 					}
@@ -859,26 +859,26 @@  discard block
 block discarded – undo
859 859
 					$obj->title = $val->title->body;
860 860
 					$obj->type = $val->attrs->type;
861 861
 					$obj->description = $val->description->body;
862
-					if($obj->name)
862
+					if ($obj->name)
863 863
 					{
864 864
 						$obj->value = $extra_vals->{$obj->name};
865 865
 					}
866
-					if(strpos($obj->value, '|@|') != FALSE)
866
+					if (strpos($obj->value, '|@|') != FALSE)
867 867
 					{
868 868
 						$obj->value = explode('|@|', $obj->value);
869 869
 					}
870
-					if($obj->type == 'mid_list' && !is_array($obj->value))
870
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
871 871
 					{
872 872
 						$obj->value = array($obj->value);
873 873
 					}
874 874
 
875 875
 					// 'Select'type obtained from the option list.
876
-					if($val->options && !is_array($val->options))
876
+					if ($val->options && !is_array($val->options))
877 877
 					{
878 878
 						$val->options = array($val->options);
879 879
 					}
880 880
 
881
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
881
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
882 882
 					{
883 883
 						$obj->options[$i] = new stdClass();
884 884
 						$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 
893 893
 		$buff = array();
894 894
 		$buff[] = '<?php if(!defined(\'__XE__\')) exit();';
895
-		$buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';';
895
+		$buff[] = '$xml_info = '.var_export($component_info, TRUE).';';
896 896
 		$buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff));
897 897
 
898 898
 		FileHandler::writeFile($cache_file, $buff, 'w');
Please login to merge, or discard this patch.
Braces   +182 added lines, -83 removed lines patch added patch discarded remove patch
@@ -34,17 +34,37 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
38
-
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
37
+		if(!is_object($editor_config)) {
38
+			$editor_config = new stdClass();
39
+		}
40
+
41
+		if($editor_config->enable_autosave != 'N') {
42
+			$editor_config->enable_autosave = 'Y';
43
+		}
44
+		if(!is_array($editor_config->enable_html_grant)) {
45
+			$editor_config->enable_html_grant = array();
46
+		}
47
+		if(!is_array($editor_config->enable_comment_html_grant)) {
48
+			$editor_config->enable_comment_html_grant = array();
49
+		}
50
+		if(!is_array($editor_config->upload_file_grant)) {
51
+			$editor_config->upload_file_grant = array();
52
+		}
53
+		if(!is_array($editor_config->comment_upload_file_grant)) {
54
+			$editor_config->comment_upload_file_grant = array();
55
+		}
56
+		if(!is_array($editor_config->enable_default_component_grant)) {
57
+			$editor_config->enable_default_component_grant = array();
58
+		}
59
+		if(!is_array($editor_config->enable_comment_default_component_grant)) {
60
+			$editor_config->enable_comment_default_component_grant = array();
61
+		}
62
+		if(!is_array($editor_config->enable_component_grant)) {
63
+			$editor_config->enable_component_grant = array();
64
+		}
65
+		if(!is_array($editor_config->enable_comment_component_grant)) {
66
+			$editor_config->enable_comment_component_grant= array();
67
+		}
48 68
 
49 69
 		if(!$editor_config->editor_height)
50 70
 		{
@@ -151,8 +171,11 @@  discard block
 block discarded – undo
151 171
 		$buff .= sprintf('$xml_info->license_link = %s;', var_export($component_info->license_link, true));
152 172
 
153 173
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155
-		else $author_list = $xml_doc->component->author;
174
+		if(!is_array($xml_doc->component->author)) {
175
+			$author_list[] = $xml_doc->component->author;
176
+		} else {
177
+			$author_list = $xml_doc->component->author;
178
+		}
156 179
 
157 180
 		for($i=0; $i < count($author_list); $i++)
158 181
 		{
@@ -165,7 +188,9 @@  discard block
 block discarded – undo
165 188
 		$extra_vars = $xml_doc->component->extra_vars->var;
166 189
 		if($extra_vars)
167 190
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
191
+			if(!is_array($extra_vars)) {
192
+				$extra_vars = array($extra_vars);
193
+			}
169 194
 			foreach($extra_vars as $key => $val)
170 195
 			{
171 196
 				unset($obj);
@@ -202,10 +227,15 @@  discard block
 block discarded – undo
202 227
 		{
203 228
 			$option->editor_sequence = $upload_target_srl;
204 229
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
206
-		else $allow_fileupload = true;
230
+		if(!$option->allow_fileupload) {
231
+			$allow_fileupload = false;
232
+		} else {
233
+			$allow_fileupload = true;
234
+		}
207 235
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
236
+		if(!$option->content_style) {
237
+			$option->content_style = 'ckeditor_light';
238
+		}
209 239
 		Context::set('content_style', $option->content_style);
210 240
 		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
211 241
 		// Default font setting
@@ -213,30 +243,50 @@  discard block
 block discarded – undo
213 243
 		Context::set('content_font_size', $option->content_font_size);
214 244
 
215 245
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
218
-		else $enable_autosave = true;
246
+		if(!$option->enable_autosave) {
247
+			$enable_autosave = false;
248
+		} elseif(Context::get($option->primary_key_name)) {
249
+			$enable_autosave = false;
250
+		} else {
251
+			$enable_autosave = true;
252
+		}
219 253
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
221
-		else $enable_default_component = true;
254
+		if(!$option->enable_default_component) {
255
+			$enable_default_component = false;
256
+		} else {
257
+			$enable_default_component = true;
258
+		}
222 259
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
224
-		else $enable_component = true;
260
+		if(!$option->enable_component) {
261
+			$enable_component = false;
262
+		} else {
263
+			$enable_component = true;
264
+		}
225 265
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
227
-		else $html_mode = true;
266
+		if($option->disable_html) {
267
+			$html_mode = false;
268
+		} else {
269
+			$html_mode = true;
270
+		}
228 271
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
230
-		else $editor_height = $option->height;
272
+		if(!$option->height) {
273
+			$editor_height = 300;
274
+		} else {
275
+			$editor_height = $option->height;
276
+		}
231 277
 		if(Mobile::isFromMobilePhone()) {
232 278
 			$editor_height = 150;
233 279
 		}
234 280
 		// Skin Setting
235 281
 		$skin = $option->skin;
236
-		if(!$skin) $skin = 'ckeditor';
282
+		if(!$skin) {
283
+			$skin = 'ckeditor';
284
+		}
237 285
 
238 286
 		$colorset = $option->colorset;
239
-		if(!$colorset) $colorset = 'moono';
287
+		if(!$colorset) {
288
+			$colorset = 'moono';
289
+		}
240 290
 		Context::set('colorset', $colorset);
241 291
 		Context::set('skin', $skin);
242 292
 		Context::set('module_type', $option->module_type);
@@ -261,10 +311,13 @@  discard block
 block discarded – undo
261 311
 		/**
262 312
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
263 313
 		 */
264
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
265
-		else
314
+		if($option->editor_sequence) {
315
+			$editor_sequence = $option->editor_sequence;
316
+		} else
266 317
 		{
267
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
318
+			if(!$_SESSION['_editor_sequence_']) {
319
+				$_SESSION['_editor_sequence_'] = 1;
320
+			}
268 321
 			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
269 322
 		}
270 323
 
@@ -288,7 +341,9 @@  discard block
 block discarded – undo
288 341
 			$oFileController = getController('file');
289 342
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
290 343
 			// Check if the file already exists
291
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
344
+			if($upload_target_srl) {
345
+				$files_count = $oFileModel->getFilesCount($upload_target_srl);
346
+			}
292 347
 		}
293 348
 		Context::set('files_count', (int)$files_count);
294 349
 
@@ -380,8 +435,7 @@  discard block
 block discarded – undo
380 435
 			$config->enable_html_grant = $editor_config->enable_html_grant;
381 436
 			$config->editor_height = $editor_config->editor_height;
382 437
 			$config->enable_autosave = $editor_config->enable_autosave;
383
-		}
384
-		else
438
+		} else
385 439
 		{
386 440
 			$config->editor_skin = $editor_config->comment_editor_skin;
387 441
 			$config->content_style = $editor_config->comment_content_style;
@@ -400,8 +454,7 @@  discard block
 block discarded – undo
400 454
 		{
401 455
 			$logged_info = Context::get('logged_info');
402 456
 			$group_list = $logged_info->group_list;
403
-		}
404
-		else
457
+		} else
405 458
 		{
406 459
 			$group_list = array();
407 460
 		}
@@ -415,8 +468,9 @@  discard block
 block discarded – undo
415 468
 		$option->colorset = $config->sel_editor_colorset;
416 469
 		// Permission check for file upload
417 470
 		$option->allow_fileupload = false;
418
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
419
-		elseif(count($config->upload_file_grant))
471
+		if($logged_info->is_admin=='Y') {
472
+			$option->allow_fileupload = true;
473
+		} elseif(count($config->upload_file_grant))
420 474
 		{
421 475
 			foreach($group_list as $group_srl => $group_info)
422 476
 			{
@@ -426,12 +480,14 @@  discard block
 block discarded – undo
426 480
 					break;
427 481
 				}
428 482
 			}
483
+		} else {
484
+			$option->allow_fileupload = true;
429 485
 		}
430
-		else $option->allow_fileupload = true;
431 486
 		// Permission check for using default components
432 487
 		$option->enable_default_component = false;
433
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
434
-		elseif(count($config->enable_default_component_grant))
488
+		if($logged_info->is_admin=='Y') {
489
+			$option->enable_default_component = true;
490
+		} elseif(count($config->enable_default_component_grant))
435 491
 		{
436 492
 			foreach($group_list as $group_srl => $group_info)
437 493
 			{
@@ -441,12 +497,14 @@  discard block
 block discarded – undo
441 497
 					break;
442 498
 				}
443 499
 			}
500
+		} else {
501
+			$option->enable_default_component = true;
444 502
 		}
445
-		else $option->enable_default_component = true;
446 503
 		// Permisshion check for using extended components
447 504
 		$option->enable_component = false;
448
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
449
-		elseif(count($config->enable_component_grant))
505
+		if($logged_info->is_admin=='Y') {
506
+			$option->enable_component = true;
507
+		} elseif(count($config->enable_component_grant))
450 508
 		{
451 509
 			foreach($group_list as $group_srl => $group_info)
452 510
 			{
@@ -456,12 +514,14 @@  discard block
 block discarded – undo
456 514
 					break;
457 515
 				}
458 516
 			}
517
+		} else {
518
+			$option->enable_component = true;
459 519
 		}
460
-		else $option->enable_component = true;
461 520
 		// HTML editing privileges
462 521
 		$enable_html = false;
463
-		if($logged_info->is_admin=='Y') $enable_html = true;
464
-		elseif(count($config->enable_html_grant))
522
+		if($logged_info->is_admin=='Y') {
523
+			$enable_html = true;
524
+		} elseif(count($config->enable_html_grant))
465 525
 		{
466 526
 			foreach($group_list as $group_srl => $group_info)
467 527
 			{
@@ -471,11 +531,15 @@  discard block
 block discarded – undo
471 531
 					break;
472 532
 				}
473 533
 			}
534
+		} else {
535
+			$enable_html = true;
474 536
 		}
475
-		else $enable_html = true;
476 537
 
477
-		if($enable_html) $option->disable_html = false;
478
-		else $option->disable_html = true;
538
+		if($enable_html) {
539
+			$option->disable_html = false;
540
+		} else {
541
+			$option->disable_html = true;
542
+		}
479 543
 		// Set Height
480 544
 		$option->height = $config->editor_height;
481 545
 		// Set an option for Auto-save
@@ -505,19 +569,22 @@  discard block
 block discarded – undo
505 569
 		{
506 570
 			$logged_info = Context::get('logged_info');
507 571
 			$auto_save_args->member_srl = $logged_info->member_srl;
508
-		}
509
-		else
572
+		} else
510 573
 		{
511 574
 			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
512 575
 			// @see https://github.com/xpressengine/xe-core/issues/2208
513 576
 			// 변경 이전에 작성된 게시물 호환성 유지
514
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
577
+			if(!$auto_save_args->certify_key) {
578
+				$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
579
+			}
515 580
 		}
516 581
 		// Extract auto-saved data from the DB
517 582
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
518 583
 		$saved_doc = $output->data;
519 584
 		// Return null if no result is auto-saved
520
-		if(!$saved_doc) return;
585
+		if(!$saved_doc) {
586
+			return;
587
+		}
521 588
 
522 589
 		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
523 590
 		{
@@ -527,7 +594,9 @@  discard block
 block discarded – undo
527 594
 		// Check if the auto-saved document already exists
528 595
 		$oDocumentModel = getModel('document');
529 596
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
530
-		if($oSaved->isExists()) return;
597
+		if($oSaved->isExists()) {
598
+			return;
599
+		}
531 600
 		// Move all the files if the auto-saved data contains document_srl and file
532 601
 		// Then set document_srl to editor_sequence
533 602
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -535,8 +604,9 @@  discard block
 block discarded – undo
535 604
 			$saved_doc->module_srl = $auto_save_args->module_srl;
536 605
 			$oFileController = getController('file');
537 606
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
607
+		} else if($upload_target_srl) {
608
+			$saved_doc->document_srl = $upload_target_srl;
538 609
 		}
539
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
540 610
 		// Change auto-saved data
541 611
 		$saved_doc->certify_key = $auto_save_args->certify_key;
542 612
 		$oEditorController = getController('editor');
@@ -553,18 +623,24 @@  discard block
 block discarded – undo
553 623
 	 */
554 624
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
555 625
 	{
556
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
626
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
627
+			return;
628
+		}
557 629
 
558 630
 		if(!$this->loaded_component_list[$component][$editor_sequence])
559 631
 		{
560 632
 			// Create an object of the component and execute
561 633
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
562 634
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
563
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
635
+			if(!file_exists($class_file)) {
636
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
637
+			}
564 638
 			// Create an object after loading the class file
565 639
 			require_once($class_file);
566 640
 			$oComponent = new $component($editor_sequence, $class_path);
567
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
641
+			if(!$oComponent) {
642
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
643
+			}
568 644
 			// Add configuration information
569 645
 			$component_info = $this->getComponent($component, $site_srl);
570 646
 			$oComponent->setInfo($component_info);
@@ -591,8 +667,12 @@  discard block
 block discarded – undo
591 667
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
592 668
 		FileHandler::makeDir($cache_path);
593 669
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
594
-		if($filter_enabled) $cache_file .= 'filter.';
595
-		if($site_srl) $cache_file .= $site_srl.'.';
670
+		if($filter_enabled) {
671
+			$cache_file .= 'filter.';
672
+		}
673
+		if($site_srl) {
674
+			$cache_file .= $site_srl.'.';
675
+		}
596 676
 		$cache_file .= 'php';
597 677
 		return $cache_file;
598 678
 	}
@@ -601,8 +681,12 @@  discard block
 block discarded – undo
601 681
 	{
602 682
 		$cache_key = array();
603 683
 		$cache_key[] = Context::getLangType();
604
-		if ($filter_enabled) $cache_key[] = 'filter';
605
-		if ($site_srl) $cache_key[] = $site_srl;
684
+		if ($filter_enabled) {
685
+			$cache_key[] = 'filter';
686
+		}
687
+		if ($site_srl) {
688
+			$cache_key[] = $site_srl;
689
+		}
606 690
 
607 691
 		return 'editor.component_list:' . implode('.', $cache_key);
608 692
 	}
@@ -627,14 +711,15 @@  discard block
 block discarded – undo
627 711
 
628 712
 		}
629 713
 
630
-		if(!$component_list) return array();
714
+		if(!$component_list) {
715
+			return array();
716
+		}
631 717
 
632 718
 		$logged_info = Context::get('logged_info');
633 719
 		if($logged_info && is_array($logged_info->group_list))
634 720
 		{
635 721
 			$group_list = array_keys($logged_info->group_list);
636
-		}
637
-		else
722
+		} else
638 723
 		{
639 724
 			$group_list = array();
640 725
 		}
@@ -643,39 +728,50 @@  discard block
 block discarded – undo
643 728
 		{
644 729
 			foreach($component_list as $key => $val)
645 730
 			{
646
-				if(!trim($key)) continue;
731
+				if(!trim($key)) {
732
+					continue;
733
+				}
647 734
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
648 735
 				{
649 736
 					FileHandler::removeFile($cache_file);
650 737
 					return $this->getComponentList($filter_enabled, $site_srl);
651 738
 				}
652
-				if(!$filter_enabled) continue;
739
+				if(!$filter_enabled) {
740
+					continue;
741
+				}
653 742
 				if($val->enabled == "N")
654 743
 				{
655 744
 					unset($component_list->{$key});
656 745
 					continue;
657 746
 				}
658
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
747
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
748
+					continue;
749
+				}
659 750
 				if($val->target_group)
660 751
 				{
661 752
 					if(!$logged_info)
662 753
 					{
663 754
 						$val->enabled = "N";
664
-					}
665
-					else
755
+					} else
666 756
 					{
667 757
 						$is_granted = false;
668 758
 						foreach($group_list as $group_srl)
669 759
 						{
670
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
760
+							if(in_array($group_srl, $val->target_group)) {
761
+								$is_granted = true;
762
+							}
763
+						}
764
+						if(!$is_granted) {
765
+							$val->enabled = "N";
671 766
 						}
672
-						if(!$is_granted) $val->enabled = "N";
673 767
 					}
674 768
 				}
675 769
 				if($val->enabled != "N" && $val->mid_list)
676 770
 				{
677 771
 					$mid = Context::get('mid');
678
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
772
+					if(!in_array($mid, $val->mid_list)) {
773
+						$val->enabled = "N";
774
+					}
679 775
 				}
680 776
 				if($val->enabled == "N")
681 777
 				{
@@ -699,14 +795,15 @@  discard block
 block discarded – undo
699 795
 		{
700 796
 			$args->site_srl = $site_srl;
701 797
 			$output = executeQuery('editor.getSiteComponent', $args);
702
-		}
703
-		else
798
+		} else
704 799
 		{
705 800
 			$output = executeQuery('editor.getComponent', $args);
706 801
 		}
707 802
 		$component = $output->data;
708 803
 
709
-		if(!$output->data) return false;
804
+		if(!$output->data) {
805
+			return false;
806
+		}
710 807
 
711 808
 		$component_name = $component->component_name;
712 809
 
@@ -785,8 +882,7 @@  discard block
 block discarded – undo
785 882
 			$component_info->homepage = $xml_doc->component->link->body;
786 883
 			$component_info->license = $xml_doc->component->license->body;
787 884
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
788
-		}
789
-		else
885
+		} else
790 886
 		{
791 887
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
792 888
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -803,8 +899,11 @@  discard block
 block discarded – undo
803 899
 
804 900
 		// Author information
805 901
 		$author_list = array();
806
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
807
-		else $author_list = $xml_doc->component->author;
902
+		if(!is_array($xml_doc->component->author)) {
903
+			$author_list[] = $xml_doc->component->author;
904
+		} else {
905
+			$author_list = $xml_doc->component->author;
906
+		}
808 907
 
809 908
 		for($i = 0; $i < count($author_list); $i++)
810 909
 		{
Please login to merge, or discard this patch.
modules/module/module.view.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 		$skin = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', Context::get('skin')));
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if (!is_dir($module_path)) $this->stop("msg_invalid_request");
29 29
 
30 30
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
31
+		if (!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
32 32
 
33 33
 		$oModuleModel = getModel('module');
34 34
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	function dispModuleSelectList()
45 45
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
46
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
47 47
 
48 48
 		$oModuleModel = getModel('module');
49 49
 		$logged_info = Context::get('logged_info');
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 
58 58
 		$args = new stdClass();
59 59
 		$module_category_exists = false;
60
-		if($logged_info->is_admin == 'Y' && $site_keyword)
60
+		if ($logged_info->is_admin == 'Y' && $site_keyword)
61 61
 		{
62 62
 			$args->site_keyword = $site_keyword;
63 63
 		}
64 64
 		else
65 65
 		{
66
-			$args->site_srl = (int)$site_module_info->site_srl;
66
+			$args->site_srl = (int) $site_module_info->site_srl;
67 67
 			Context::set('site_keyword', null);
68 68
 		}
69 69
 
70
-		if($logged_info->is_admin == 'Y')
70
+		if ($logged_info->is_admin == 'Y')
71 71
 		{
72 72
 			$module_category_exists = true;
73 73
 		}
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 		// Get a list of modules at the site
76 76
 		$mid_list = array();
77 77
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
78
+		if (!$output->data) $output->data = array();
79 79
 
80
-		foreach($output->data as $key => $val)
80
+		foreach ($output->data as $key => $val)
81 81
 		{
82 82
 			$module = trim($val->module);
83
-			if(!$module) continue;
83
+			if (!$module) continue;
84 84
 
85
-			if(!$oModuleModel->getGrant($val, $logged_info)->access)
85
+			if (!$oModuleModel->getGrant($val, $logged_info)->access)
86 86
 			{
87 87
 				continue;
88 88
 			}
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 			$obj->browser_title = $val->browser_title;
94 94
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 95
 
96
-			if(!$selected_module) $selected_module = $module;
97
-			if(!$mid_list[$module]->title)
96
+			if (!$selected_module) $selected_module = $module;
97
+			if (!$mid_list[$module]->title)
98 98
 			{
99 99
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
100 100
 				$mid_list[$module]->title = $xml_info->title;
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	function dispModuleFileBox()
118 118
 	{
119 119
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
120
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
121 121
 
122 122
 		$input_name = Context::get('input');
123
-		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
123
+		if (!preg_match('/^[a-z0-9_]+$/i', $input_name))
124 124
 		{
125 125
 			return new BaseObject(-1, 'msg_invalid_request');
126 126
 		}
127 127
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
128
+		if (!$input_name) return new BaseObject(-1, 'msg_not_permitted');
129 129
 
130 130
 		$addscript = sprintf('<script>//<![CDATA[
131 131
 				var selected_filebox_input_name = "%s";
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		Context::set('filebox_list', $output->data);
138 138
 
139 139
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
140
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
141 141
 
142 142
 		Context::set('page_navigation', $output->page_navigation);
143 143
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	function dispModuleFileBoxAdd()
149 149
 	{
150 150
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
151
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
152 152
 
153 153
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
154
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
155 155
 
156 156
 		$this->setLayoutFile('popup_layout');
157 157
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,10 +25,14 @@  discard block
 block discarded – undo
25 25
 		$skin = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', Context::get('skin')));
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if(!is_dir($module_path)) {
29
+			$this->stop("msg_invalid_request");
30
+		}
29 31
 
30 32
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
33
+		if(!file_exists($skin_info_xml)) {
34
+			$this->stop("msg_invalid_request");
35
+		}
32 36
 
33 37
 		$oModuleModel = getModel('module');
34 38
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
@@ -43,7 +47,9 @@  discard block
 block discarded – undo
43 47
 	 */
44 48
 	function dispModuleSelectList()
45 49
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
50
+		if(!Context::get('is_logged')) {
51
+			return new BaseObject(-1, 'msg_not_permitted');
52
+		}
47 53
 
48 54
 		$oModuleModel = getModel('module');
49 55
 		$logged_info = Context::get('logged_info');
@@ -60,8 +66,7 @@  discard block
 block discarded – undo
60 66
 		if($logged_info->is_admin == 'Y' && $site_keyword)
61 67
 		{
62 68
 			$args->site_keyword = $site_keyword;
63
-		}
64
-		else
69
+		} else
65 70
 		{
66 71
 			$args->site_srl = (int)$site_module_info->site_srl;
67 72
 			Context::set('site_keyword', null);
@@ -75,12 +80,16 @@  discard block
 block discarded – undo
75 80
 		// Get a list of modules at the site
76 81
 		$mid_list = array();
77 82
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
83
+		if(!$output->data) {
84
+			$output->data = array();
85
+		}
79 86
 
80 87
 		foreach($output->data as $key => $val)
81 88
 		{
82 89
 			$module = trim($val->module);
83
-			if(!$module) continue;
90
+			if(!$module) {
91
+				continue;
92
+			}
84 93
 
85 94
 			if(!$oModuleModel->getGrant($val, $logged_info)->access)
86 95
 			{
@@ -93,7 +102,9 @@  discard block
 block discarded – undo
93 102
 			$obj->browser_title = $val->browser_title;
94 103
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 104
 
96
-			if(!$selected_module) $selected_module = $module;
105
+			if(!$selected_module) {
106
+				$selected_module = $module;
107
+			}
97 108
 			if(!$mid_list[$module]->title)
98 109
 			{
99 110
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
@@ -117,7 +128,9 @@  discard block
 block discarded – undo
117 128
 	function dispModuleFileBox()
118 129
 	{
119 130
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
131
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
132
+			return new BaseObject(-1, 'msg_not_permitted');
133
+		}
121 134
 
122 135
 		$input_name = Context::get('input');
123 136
 		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
@@ -125,7 +138,9 @@  discard block
 block discarded – undo
125 138
 			return new BaseObject(-1, 'msg_invalid_request');
126 139
 		}
127 140
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
141
+		if(!$input_name) {
142
+			return new BaseObject(-1, 'msg_not_permitted');
143
+		}
129 144
 
130 145
 		$addscript = sprintf('<script>//<![CDATA[
131 146
 				var selected_filebox_input_name = "%s";
@@ -137,7 +152,9 @@  discard block
 block discarded – undo
137 152
 		Context::set('filebox_list', $output->data);
138 153
 
139 154
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
155
+		if($filter) {
156
+			Context::set('arrfilter',explode(',',$filter));
157
+		}
141 158
 
142 159
 		Context::set('page_navigation', $output->page_navigation);
143 160
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +165,14 @@  discard block
 block discarded – undo
148 165
 	function dispModuleFileBoxAdd()
149 166
 	{
150 167
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
168
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
169
+			return new BaseObject(-1, 'msg_not_permitted');
170
+		}
152 171
 
153 172
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
173
+		if($filter) {
174
+			Context::set('arrfilter',explode(',',$filter));
175
+		}
155 176
 
156 177
 		$this->setLayoutFile('popup_layout');
157 178
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.