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/security/EmbedFilter.class.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-include _XE_PATH_ . 'classes/security/phphtmlparser/src/htmlparser.inc';
4
+include _XE_PATH_.'classes/security/phphtmlparser/src/htmlparser.inc';
5 5
 
6 6
 class EmbedFilter
7 7
 {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	function getInstance()
278 278
 	{
279
-		if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__']))
279
+		if (!isset($GLOBALS['__EMBEDFILTER_INSTANCE__']))
280 280
 		{
281 281
 			$GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter();
282 282
 		}
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 	{
317 317
 		preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m);
318 318
 		$objectTagList = $m[0];
319
-		if($objectTagList)
319
+		if ($objectTagList)
320 320
 		{
321
-			foreach($objectTagList AS $key => $objectTag)
321
+			foreach ($objectTagList AS $key => $objectTag)
322 322
 			{
323 323
 				$isWhiteDomain = true;
324 324
 				$isWhiteMimetype = true;
@@ -326,21 +326,21 @@  discard block
 block discarded – undo
326 326
 				$ext = '';
327 327
 
328 328
 				$parser = new HtmlParser($objectTag);
329
-				while($parser->parse())
329
+				while ($parser->parse())
330 330
 				{
331
-					if(is_array($parser->iNodeAttributes))
331
+					if (is_array($parser->iNodeAttributes))
332 332
 					{
333
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
333
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
334 334
 						{
335 335
 							// data url check
336
-							if($attrValue && strtolower($attrName) == 'data')
336
+							if ($attrValue && strtolower($attrName) == 'data')
337 337
 							{
338 338
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
339 339
 								$isWhiteDomain = $this->isWhiteDomain($attrValue);
340 340
 							}
341 341
 
342 342
 							// mime type check
343
-							if(strtolower($attrName) == 'type' && $attrValue)
343
+							if (strtolower($attrName) == 'type' && $attrValue)
344 344
 							{
345 345
 								$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
346 346
 							}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 					}
349 349
 				}
350 350
 
351
-				if(!$isWhiteDomain || !$isWhiteMimetype)
351
+				if (!$isWhiteDomain || !$isWhiteMimetype)
352 352
 				{
353 353
 					$content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
354 354
 				}
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 	{
365 365
 		preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m);
366 366
 		$embedTagList = $m[0];
367
-		if($embedTagList)
367
+		if ($embedTagList)
368 368
 		{
369
-			foreach($embedTagList AS $key => $embedTag)
369
+			foreach ($embedTagList AS $key => $embedTag)
370 370
 			{
371 371
 				$isWhiteDomain = TRUE;
372 372
 				$isWhiteMimetype = TRUE;
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 				$ext = '';
375 375
 
376 376
 				$parser = new HtmlParser($embedTag);
377
-				while($parser->parse())
377
+				while ($parser->parse())
378 378
 				{
379
-					if(is_array($parser->iNodeAttributes))
379
+					if (is_array($parser->iNodeAttributes))
380 380
 					{
381
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
381
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
382 382
 						{
383 383
 							// src url check
384
-							if($attrValue && strtolower($attrName) == 'src')
384
+							if ($attrValue && strtolower($attrName) == 'src')
385 385
 							{
386 386
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
387 387
 								$isWhiteDomain = $this->isWhiteDomain($attrValue);
388 388
 							}
389 389
 
390 390
 							// mime type check
391
-							if(strtolower($attrName) == 'type' && $attrValue)
391
+							if (strtolower($attrName) == 'type' && $attrValue)
392 392
 							{
393 393
 								$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
394 394
 							}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					}
397 397
 				}
398 398
 
399
-				if(!$isWhiteDomain || !$isWhiteMimetype)
399
+				if (!$isWhiteDomain || !$isWhiteMimetype)
400 400
 				{
401 401
 					$content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
402 402
 				}
@@ -415,22 +415,22 @@  discard block
 block discarded – undo
415 415
 
416 416
 		preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m);
417 417
 		$iframeTagList = $m[0];
418
-		if($iframeTagList)
418
+		if ($iframeTagList)
419 419
 		{
420
-			foreach($iframeTagList AS $key => $iframeTag)
420
+			foreach ($iframeTagList AS $key => $iframeTag)
421 421
 			{
422 422
 				$isWhiteDomain = TRUE;
423 423
 				$ext = '';
424 424
 
425 425
 				$parser = new HtmlParser($iframeTag);
426
-				while($parser->parse())
426
+				while ($parser->parse())
427 427
 				{
428
-					if(is_array($parser->iNodeAttributes))
428
+					if (is_array($parser->iNodeAttributes))
429 429
 					{
430
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
430
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
431 431
 						{
432 432
 							// src url check
433
-							if(strtolower($attrName) == 'src' && $attrValue)
433
+							if (strtolower($attrName) == 'src' && $attrValue)
434 434
 							{
435 435
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
436 436
 								$isWhiteDomain = $this->isWhiteIframeDomain($attrValue);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 					}
440 440
 				}
441 441
 
442
-				if(!$isWhiteDomain)
442
+				if (!$isWhiteDomain)
443 443
 				{
444 444
 					$content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
445 445
 				}
@@ -455,26 +455,26 @@  discard block
 block discarded – undo
455 455
 	{
456 456
 		preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m);
457 457
 		$paramTagList = $m[0];
458
-		if($paramTagList)
458
+		if ($paramTagList)
459 459
 		{
460
-			foreach($paramTagList AS $key => $paramTag)
460
+			foreach ($paramTagList AS $key => $paramTag)
461 461
 			{
462 462
 				$isWhiteDomain = TRUE;
463 463
 				$isWhiteExt = TRUE;
464 464
 				$ext = '';
465 465
 
466 466
 				$parser = new HtmlParser($paramTag);
467
-				while($parser->parse())
467
+				while ($parser->parse())
468 468
 				{
469
-					if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value'])
469
+					if ($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value'])
470 470
 					{
471 471
 						$name = strtolower($parser->iNodeAttributes['name']);
472
-						if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source')
472
+						if ($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source')
473 473
 						{
474 474
 							$ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1));
475 475
 							$isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']);
476 476
 
477
-							if(!$isWhiteDomain)
477
+							if (!$isWhiteDomain)
478 478
 							{
479 479
 								$content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
480 480
 							}
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 	 */
492 492
 	function isWhiteDomain($urlAttribute)
493 493
 	{
494
-		if(is_array($this->whiteUrlList))
494
+		if (is_array($this->whiteUrlList))
495 495
 		{
496
-			foreach($this->whiteUrlList AS $key => $value)
496
+			foreach ($this->whiteUrlList AS $key => $value)
497 497
 			{
498
-				if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute))
498
+				if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute))
499 499
 				{
500 500
 					return TRUE;
501 501
 				}
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 */
511 511
 	function isWhiteIframeDomain($urlAttribute)
512 512
 	{
513
-		if(is_array($this->whiteIframeUrlList))
513
+		if (is_array($this->whiteIframeUrlList))
514 514
 		{
515
-			foreach($this->whiteIframeUrlList AS $key => $value)
515
+			foreach ($this->whiteIframeUrlList AS $key => $value)
516 516
 			{
517
-				if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute))
517
+				if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute))
518 518
 				{
519 519
 					return TRUE;
520 520
 				}
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 */
530 530
 	function isWhiteMimetype($mimeType)
531 531
 	{
532
-		if(isset($this->mimeTypeList[$mimeType]))
532
+		if (isset($this->mimeTypeList[$mimeType]))
533 533
 		{
534 534
 			return TRUE;
535 535
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 	function isWhiteExt($ext)
540 540
 	{
541
-		if(isset($this->extList[$ext]))
541
+		if (isset($this->extList[$ext]))
542 542
 		{
543 543
 			return TRUE;
544 544
 		}
@@ -547,26 +547,26 @@  discard block
 block discarded – undo
547 547
 
548 548
 	function _checkAllowScriptAccess($m)
549 549
 	{
550
-		if($m[1] == 'object')
550
+		if ($m[1] == 'object')
551 551
 		{
552 552
 			$this->allowscriptaccessList[] = 1;
553 553
 		}
554 554
 
555
-		if($m[1] == 'param')
555
+		if ($m[1] == 'param')
556 556
 		{
557
-			if(stripos($m[0], 'allowscriptaccess'))
557
+			if (stripos($m[0], 'allowscriptaccess'))
558 558
 			{
559 559
 				$m[0] = '<param name="allowscriptaccess" value="never"';
560
-				if(substr($m[0], -1) == '/')
560
+				if (substr($m[0], -1) == '/')
561 561
 				{
562 562
 					$m[0] .= '/';
563 563
 				}
564 564
 				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
565 565
 			}
566 566
 		}
567
-		else if($m[1] == 'embed')
567
+		else if ($m[1] == 'embed')
568 568
 		{
569
-			if(stripos($m[0], 'allowscriptaccess'))
569
+			if (stripos($m[0], 'allowscriptaccess'))
570 570
 			{
571 571
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
572 572
 			}
@@ -580,9 +580,9 @@  discard block
 block discarded – undo
580 580
 
581 581
 	function _addAllowScriptAccess($m)
582 582
 	{
583
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
583
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
584 584
 		{
585
-			$m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>';
585
+			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
586 586
 		}
587 587
 		$this->allowscriptaccessKey++;
588 588
 		return $m[0];
@@ -599,31 +599,31 @@  discard block
 block discarded – undo
599 599
 		$whiteUrlCacheFile = FileHandler::getRealPath($this->whiteUrlCacheFile);
600 600
 
601 601
 		$isMake = FALSE;
602
-		if(!file_exists($whiteUrlCacheFile))
602
+		if (!file_exists($whiteUrlCacheFile))
603 603
 		{
604 604
 			$isMake = TRUE;
605 605
 		}
606
-		if(file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile))
606
+		if (file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile))
607 607
 		{
608 608
 			$isMake = TRUE;
609 609
 		}
610 610
 
611
-		if(gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array')
611
+		if (gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array')
612 612
 		{
613 613
 			$isMake = FALSE;
614 614
 		}
615 615
 
616
-		if(isset($whitelist) && gettype($whitelist) == 'object')
616
+		if (isset($whitelist) && gettype($whitelist) == 'object')
617 617
 		{
618 618
 			$isMake = TRUE;
619 619
 		}
620 620
 
621
-		if($isMake)
621
+		if ($isMake)
622 622
 		{
623 623
 			$whiteUrlList = array();
624 624
 			$whiteIframeUrlList = array();
625 625
 
626
-			if(gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array')
626
+			if (gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array')
627 627
 			{
628 628
 				$whiteUrlList = $whitelist->object;
629 629
 				$whiteIframeUrlList = $whitelist->iframe;
@@ -636,15 +636,15 @@  discard block
 block discarded – undo
636 636
 				$domainListObj = $xmlParser->parse($xmlBuff);
637 637
 				$embedDomainList = $domainListObj->whiteurl->embed->domain;
638 638
 				$iframeDomainList = $domainListObj->whiteurl->iframe->domain;
639
-				if(!is_array($embedDomainList)) $embedDomainList = array();
640
-				if(!is_array($iframeDomainList)) $iframeDomainList = array();
639
+				if (!is_array($embedDomainList)) $embedDomainList = array();
640
+				if (!is_array($iframeDomainList)) $iframeDomainList = array();
641 641
 
642
-				foreach($embedDomainList AS $key => $value)
642
+				foreach ($embedDomainList AS $key => $value)
643 643
 				{
644 644
 					$patternList = $value->pattern;
645
-					if(is_array($patternList))
645
+					if (is_array($patternList))
646 646
 					{
647
-						foreach($patternList AS $key => $value)
647
+						foreach ($patternList AS $key => $value)
648 648
 						{
649 649
 							$whiteUrlList[] = $value->body;
650 650
 						}
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 					}
656 656
 				}
657 657
 
658
-				foreach($iframeDomainList AS $key => $value)
658
+				foreach ($iframeDomainList AS $key => $value)
659 659
 				{
660 660
 					$patternList = $value->pattern;
661
-					if(is_array($patternList))
661
+					if (is_array($patternList))
662 662
 					{
663
-						foreach($patternList AS $key => $value)
663
+						foreach ($patternList AS $key => $value)
664 664
 						{
665 665
 							$whiteIframeUrlList[] = $value->body;
666 666
 						}
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
 
675 675
 			$db_info = Context::getDBInfo();
676 676
 
677
-			if($db_info->embed_white_object)
677
+			if ($db_info->embed_white_object)
678 678
 			{
679 679
 				$whiteUrlList = array_merge($whiteUrlList, $db_info->embed_white_object);
680 680
 			}
681 681
 
682
-			if($db_info->embed_white_iframe)
682
+			if ($db_info->embed_white_iframe)
683 683
 			{
684 684
 				$whiteIframeUrlList = array_merge($whiteIframeUrlList, $db_info->embed_white_iframe);
685 685
 			}
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 
692 692
 			$buff = array();
693 693
 			$buff[] = '<?php if(!defined("__XE__")) exit();';
694
-			$buff[] = '$whiteUrlList = ' . var_export($whiteUrlList, TRUE) . ';';
695
-			$buff[] = '$whiteIframeUrlList = ' . var_export($whiteIframeUrlList, TRUE) . ';';
694
+			$buff[] = '$whiteUrlList = '.var_export($whiteUrlList, TRUE).';';
695
+			$buff[] = '$whiteIframeUrlList = '.var_export($whiteIframeUrlList, TRUE).';';
696 696
 
697 697
 			FileHandler::writeFile($this->whiteUrlCacheFile, implode(PHP_EOL, $buff));
698 698
 		}
Please login to merge, or discard this patch.
modules/addon/addon.admin.controller.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/addon/addon.controller.php');
4
+require_once(_XE_PATH_.'modules/addon/addon.controller.php');
5 5
 
6 6
 /**
7 7
  * Admin controller class of addon modules
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$site_module_info = Context::get('site_module_info');
35 35
 
36
-		if($site_module_info->site_srl)
36
+		if ($site_module_info->site_srl)
37 37
 		{
38 38
 			$site_srl = $site_module_info->site_srl;
39 39
 		}
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 			$site_srl = 0;
43 43
 		}
44 44
 
45
-		if(!$pcOnList)
45
+		if (!$pcOnList)
46 46
 		{
47 47
 			$pcOnList = array();
48 48
 		}
49
-		if(!$mobileOnList)
49
+		if (!$mobileOnList)
50 50
 		{
51 51
 			$mobileOnList = array();
52 52
 		}
53
-		if(!$fixed)
53
+		if (!$fixed)
54 54
 		{
55 55
 			$fixed = array();
56 56
 		}
57 57
 
58
-		if(!is_array($pcOnList))
58
+		if (!is_array($pcOnList))
59 59
 		{
60 60
 			$pcOnList = array($pcOnList);
61 61
 		}
62
-		if(!is_array($mobileOnList))
62
+		if (!is_array($mobileOnList))
63 63
 		{
64 64
 			$pcOnList = array($mobileOnList);
65 65
 		}
66
-		if(!is_array($fixed))
66
+		if (!is_array($fixed))
67 67
 		{
68 68
 			$pcOnList = array($fixed);
69 69
 		}
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// get need update addon list
76 76
 		$updateList = array();
77
-		foreach($currentAddonList as $addon)
77
+		foreach ($currentAddonList as $addon)
78 78
 		{
79
-			if($addon->activated !== in_array($addon->addon_name, $pcOnList))
79
+			if ($addon->activated !== in_array($addon->addon_name, $pcOnList))
80 80
 			{
81 81
 				$updateList[] = $addon->addon_name;
82 82
 				continue;
83 83
 			}
84 84
 
85
-			if($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
85
+			if ($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
86 86
 			{
87 87
 				$updateList[] = $addon->addon_name;
88 88
 				continue;
89 89
 			}
90 90
 
91
-			if($addon->fixed !== in_array($addon->addon_name, $fixed))
91
+			if ($addon->fixed !== in_array($addon->addon_name, $fixed))
92 92
 			{
93 93
 				$updateList[] = $addon->addon_name;
94 94
 				continue;
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 		}
97 97
 
98 98
 		// update
99
-		foreach($updateList as $targetAddon)
99
+		foreach ($updateList as $targetAddon)
100 100
 		{
101 101
 			$args = new stdClass();
102 102
 
103
-			if(in_array($targetAddon, $pcOnList))
103
+			if (in_array($targetAddon, $pcOnList))
104 104
 			{
105 105
 				$args->is_used = 'Y';
106 106
 			}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				$args->is_used = 'N';
110 110
 			}
111 111
 
112
-			if(in_array($targetAddon, $mobileOnList))
112
+			if (in_array($targetAddon, $mobileOnList))
113 113
 			{
114 114
 				$args->is_used_m = 'Y';
115 115
 			}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				$args->is_used_m = 'N';
119 119
 			}
120 120
 
121
-			if(in_array($targetAddon, $fixed))
121
+			if (in_array($targetAddon, $fixed))
122 122
 			{
123 123
 				$args->fixed = 'Y';
124 124
 			}
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
 			$args->site_srl = $site_srl;
132 132
 
133 133
 			$output = executeQuery('addon.updateSiteAddon', $args);
134
-			if(!$output->toBool())
134
+			if (!$output->toBool())
135 135
 			{
136 136
 				return $output;
137 137
 			}
138 138
 		}
139 139
 
140
-		if(count($updateList))
140
+		if (count($updateList))
141 141
 		{
142 142
 			$this->makeCacheFile($site_srl, 'pc', 'site');
143 143
 			$this->makeCacheFile($site_srl, 'mobile', 'site');
144 144
 		}
145 145
 
146 146
 		$this->setMessage('success_updated', 'info');
147
-		if(Context::get('success_return_url'))
147
+		if (Context::get('success_return_url'))
148 148
 		{
149 149
 			$this->setRedirectUrl(Context::get('success_return_url'));
150 150
 		}
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 		// batahom addon values
168 168
 		$addon = Context::get('addon');
169 169
 		$type = Context::get('type');
170
-		if(!$type)
170
+		if (!$type)
171 171
 		{
172 172
 			$type = "pc";
173 173
 		}
174
-		if($addon)
174
+		if ($addon)
175 175
 		{
176 176
 			// If enabled Disables
177
-			if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type))
177
+			if ($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type))
178 178
 			{
179 179
 				$this->doDeactivate($addon, $site_module_info->site_srl, $type);
180 180
 			}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$site_module_info = Context::get('site_module_info');
208 208
 
209 209
 		$output = $this->doSetup($addon_name, $args, $site_module_info->site_srl, 'site');
210
-		if(!$output->toBool())
210
+		if (!$output->toBool())
211 211
 		{
212 212
 			return $output;
213 213
 		}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$args = new stdClass;
233 233
 		$args->addon = $addon;
234 234
 		$args->is_used = $isUsed;
235
-		if($gtype == 'global')
235
+		if ($gtype == 'global')
236 236
 		{
237 237
 			return executeQuery('addon.insertAddon', $args);
238 238
 		}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	{
254 254
 		$args = new stdClass();
255 255
 		$args->addon = $addon;
256
-		if($type == "pc")
256
+		if ($type == "pc")
257 257
 		{
258 258
 			$args->is_used = 'Y';
259 259
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		{
262 262
 			$args->is_used_m = "Y";
263 263
 		}
264
-		if($gtype == 'global')
264
+		if ($gtype == 'global')
265 265
 		{
266 266
 			return executeQuery('addon.updateAddon', $args);
267 267
 		}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	{
282 282
 		$args = new stdClass();
283 283
 		$args->addon = $addon;
284
-		if($type == "pc")
284
+		if ($type == "pc")
285 285
 		{
286 286
 			$args->is_used = 'N';
287 287
 		}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		{
290 290
 			$args->is_used_m = 'N';
291 291
 		}
292
-		if($gtype == 'global')
292
+		if ($gtype == 'global')
293 293
 		{
294 294
 			return executeQuery('addon.updateAddon', $args);
295 295
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.admin.controller.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/autoinstall/autoinstall.lib.php');
4
+require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
5 5
 
6 6
 /**
7 7
  * autoinstall module admin controller class
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		$oModel = getModel('autoinstall');
66 66
 		$item = $oModel->getLatestPackage();
67
-		if($item)
67
+		if ($item)
68 68
 		{
69 69
 			$params["updatedate"] = $item->updatedate;
70 70
 		}
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 		executeQuery("autoinstall.deleteInstalledPackage");
93 93
 		$oModel = getModel('autoinstall');
94 94
 		$packages = $oModel->getPackages();
95
-		foreach($packages as $package)
95
+		foreach ($packages as $package)
96 96
 		{
97 97
 			$real_path = FileHandler::getRealPath($package->path);
98
-			if(!file_exists($real_path))
98
+			if (!file_exists($real_path))
99 99
 			{
100 100
 				continue;
101 101
 			}
102 102
 
103 103
 			$type = $oModel->getTypeFromPath($package->path);
104
-			if($type == "core")
104
+			if ($type == "core")
105 105
 			{
106 106
 				$version = __XE_VERSION__;
107 107
 			}
108 108
 			else
109 109
 			{
110 110
 				$config_file = NULL;
111
-				switch($type)
111
+				switch ($type)
112 112
 				{
113 113
 					case "m.layout":
114 114
 						$type = "layout";
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 						break;
139 139
 				}
140 140
 
141
-				if(!$config_file)
141
+				if (!$config_file)
142 142
 				{
143 143
 					continue;
144 144
 				}
145 145
 
146 146
 				$xml = new XmlParser();
147
-				$xmlDoc = $xml->loadXmlFile($real_path . $config_file);
147
+				$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
148 148
 
149
-				if(!$xmlDoc)
149
+				if (!$xmlDoc)
150 150
 				{
151 151
 					continue;
152 152
 				}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			$args->package_srl = $package->package_srl;
159 159
 			$args->version = $package->version;
160 160
 			$args->current_version = $version;
161
-			if(version_compare($args->version, $args->current_version, ">"))
161
+			if (version_compare($args->version, $args->current_version, ">"))
162 162
 			{
163 163
 				$args->need_update = "Y";
164 164
 			}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		$oAdminModel = getAdminModel('autoinstall');
185 185
 		$packages = explode(',', $package_srls);
186 186
 		$ftp_info = Context::getFTPInfo();
187
-		if(!$_SESSION['ftp_password'])
187
+		if (!$_SESSION['ftp_password'])
188 188
 		{
189 189
 			$ftp_password = Context::get('ftp_password');
190 190
 		}
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		$isSftpSupported = function_exists(ssh2_sftp);
197
-		foreach($packages as $package_srl)
197
+		foreach ($packages as $package_srl)
198 198
 		{
199 199
 			$package = $oModel->getPackage($package_srl);
200
-			if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
200
+			if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
201 201
 			{
202 202
 				$oModuleInstaller = new DirectModuleInstaller($package);
203 203
 			}
204
-			else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
204
+			else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
205 205
 			{
206 206
 				$oModuleInstaller = new SFTPModuleInstaller($package);
207 207
 			}
208
-			else if(function_exists(ftp_connect))
208
+			else if (function_exists(ftp_connect))
209 209
 			{
210 210
 				$oModuleInstaller = new PHPFTPModuleInstaller($package);
211 211
 			}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
218 218
 			$oModuleInstaller->setPassword($ftp_password);
219 219
 			$output = $oModuleInstaller->install();
220
-			if(!$output->toBool())
220
+			if (!$output->toBool())
221 221
 			{
222 222
 				return $output;
223 223
 			}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$this->setMessage('success_installed', 'update');
229 229
 
230
-		if(Context::get('return_url'))
230
+		if (Context::get('return_url'))
231 231
 		{
232 232
 			$this->setRedirectUrl(Context::get('return_url'));
233 233
 		}
@@ -246,30 +246,30 @@  discard block
 block discarded – undo
246 246
 	function updatePackages(&$xmlDoc)
247 247
 	{
248 248
 		$oModel = getModel('autoinstall');
249
-		if(!$xmlDoc->response->packages->item)
249
+		if (!$xmlDoc->response->packages->item)
250 250
 		{
251 251
 			return;
252 252
 		}
253
-		if(!is_array($xmlDoc->response->packages->item))
253
+		if (!is_array($xmlDoc->response->packages->item))
254 254
 		{
255 255
 			$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
256 256
 		}
257 257
 		$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance');
258
-		foreach($xmlDoc->response->packages->item as $item)
258
+		foreach ($xmlDoc->response->packages->item as $item)
259 259
 		{
260 260
 			$args = new stdClass();
261
-			foreach($targets as $target)
261
+			foreach ($targets as $target)
262 262
 			{
263 263
 				$args->{$target} = $item->{$target}->body;
264 264
 			}
265
-			if($oModel->getPackage($args->package_srl))
265
+			if ($oModel->getPackage($args->package_srl))
266 266
 			{
267 267
 				$output = executeQuery("autoinstall.updatePackage", $args);
268 268
 			}
269 269
 			else
270 270
 			{
271 271
 				$output = executeQuery("autoinstall.insertPackage", $args);
272
-				if(!$output->toBool())
272
+				if (!$output->toBool())
273 273
 				{
274 274
 					$output = executeQuery("autoinstall.deletePackage", $args);
275 275
 					$output = executeQuery("autoinstall.insertPackage", $args);
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	{
289 289
 		executeQuery("autoinstall.deleteCategory");
290 290
 		$oModel = getModel('autoinstall');
291
-		if(!is_array($xmlDoc->response->categorylist->item))
291
+		if (!is_array($xmlDoc->response->categorylist->item))
292 292
 		{
293 293
 			$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
294 294
 		}
295 295
 		$list_order = 0;
296
-		foreach($xmlDoc->response->categorylist->item as $item)
296
+		foreach ($xmlDoc->response->categorylist->item as $item)
297 297
 		{
298 298
 			$args = new stdClass();
299 299
 			$args->category_srl = $item->category_srl->body;
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
 		$package_srl = Context::get('package_srl');
315 315
 
316 316
 		$output = $this->uninstallPackageByPackageSrl($package_srl);
317
-		if($output->toBool()==FALSE)
317
+		if ($output->toBool() == FALSE)
318 318
 		{
319 319
 			return $output;
320 320
 		}
321 321
 
322
-		if(Context::get('return_url'))
322
+		if (Context::get('return_url'))
323 323
 		{
324 324
 			$this->setRedirectUrl(Context::get('return_url'));
325 325
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$oAdminModel = getAdminModel('autoinstall');
361 361
 
362
-		if(!$_SESSION['ftp_password'])
362
+		if (!$_SESSION['ftp_password'])
363 363
 		{
364 364
 			$ftp_password = Context::get('ftp_password');
365 365
 		}
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 		$ftp_info = Context::getFTPInfo();
371 371
 
372 372
 		$isSftpSupported = function_exists(ssh2_sftp);
373
-		if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
373
+		if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
374 374
 		{
375 375
 			$oModuleInstaller = new DirectModuleInstaller($package);
376 376
 		}
377
-		else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
377
+		else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
378 378
 		{
379 379
 			$oModuleInstaller = new SFTPModuleInstaller($package);
380 380
 		}
381
-		else if(function_exists('ftp_connect'))
381
+		else if (function_exists('ftp_connect'))
382 382
 		{
383 383
 			$oModuleInstaller = new PHPFTPModuleInstaller($package);
384 384
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		$oModuleInstaller->setPassword($ftp_password);
393 393
 		$output = $oModuleInstaller->uninstall();
394
-		if(!$output->toBool())
394
+		if (!$output->toBool())
395 395
 		{
396 396
 			return $output;
397 397
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-require_once(_XE_PATH_ . 'libs/ftp.class.php');
4
+require_once(_XE_PATH_.'libs/ftp.class.php');
5 5
 
6 6
 /**
7 7
  * Module installer
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121
-			$this->download_file = $this->temp_dir . "xe.tar";
121
+			$this->download_file = $this->temp_dir."xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124 124
 		}
125 125
 		else
126 126
 		{
127 127
 			$subpath = trim(substr($this->package->path, 2), '/');
128
-			$this->download_file = $this->temp_dir . $subpath . ".tar";
128
+			$this->download_file = $this->temp_dir.$subpath.".tar";
129 129
 			$subpatharr = explode("/", $subpath);
130 130
 			array_pop($subpatharr);
131
-			$this->download_path = $this->temp_dir . implode("/", $subpatharr);
131
+			$this->download_path = $this->temp_dir.implode("/", $subpatharr);
132 132
 			$this->target_path = implode("/", $subpatharr);
133 133
 		}
134 134
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new BaseObject(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new BaseObject(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'BaseObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'BaseObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	function _unPack()
251 251
 	{
252
-		require_once(_XE_PATH_ . 'libs/tar.class.php');
252
+		require_once(_XE_PATH_.'libs/tar.class.php');
253 253
 
254 254
 		$oTar = new tar();
255 255
 		$oTar->openTAR($this->download_file);
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263
-				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
263
+				FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
265 265
 			}
266 266
 		}
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292
-			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
292
+			$file_path = $path."/".$file;
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new BaseObject(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410
-		$target_path = $this->ftp_info->ftp_root_path . $path;
410
+		$target_path = $this->ftp_info->ftp_root_path.$path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431
-		$target_path = $this->ftp_info->ftp_root_path . $path;
431
+		$target_path = $this->ftp_info->ftp_root_path.$path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,37 +445,37 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new BaseObject(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
458
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
459 459
 		$copied = array();
460 460
 
461
-		if(is_array($file_list))
461
+		if (is_array($file_list))
462 462
 		{
463
-			foreach($file_list as $k => $file)
463
+			foreach ($file_list as $k => $file)
464 464
 			{
465 465
 				$org_file = $file;
466
-				if($this->package->path == ".")
466
+				if ($this->package->path == ".")
467 467
 				{
468 468
 					$file = substr($file, 3);
469 469
 				}
470
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
471
-				$pathname = dirname($target_dir . "/" . $file);
470
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
471
+				$pathname = dirname($target_dir."/".$file);
472 472
 
473
-				if(!file_exists(FileHandler::getRealPath($real_path)))
473
+				if (!file_exists(FileHandler::getRealPath($real_path)))
474 474
 				{
475 475
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
476 476
 				}
477 477
 
478
-				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
478
+				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
479 479
 				$copied[] = $path;
480 480
 			}
481 481
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	function _connect()
528 528
 	{
529
-		if($this->ftp_info->ftp_host)
529
+		if ($this->ftp_info->ftp_host)
530 530
 		{
531 531
 			$ftp_host = $this->ftp_info->ftp_host;
532 532
 		}
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
539
-		if(!$this->connection)
539
+		if (!$this->connection)
540 540
 		{
541 541
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
542 542
 		}
543 543
 
544 544
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
545
-		if(!$login_result)
545
+		if (!$login_result)
546 546
 		{
547 547
 			$this->_close();
548 548
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
549 549
 		}
550 550
 
551 551
 		$_SESSION['ftp_password'] = $this->ftp_password;
552
-		if($this->ftp_info->ftp_pasv != "N")
552
+		if ($this->ftp_info->ftp_pasv != "N")
553 553
 		{
554 554
 			ftp_pasv($this->connection, TRUE);
555 555
 		}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	function _removeFile($path)
566 566
 	{
567
-		if(substr($path, 0, 2) == "./")
567
+		if (substr($path, 0, 2) == "./")
568 568
 		{
569 569
 			$path = substr($path, 2);
570 570
 		}
571
-		$target_path = $this->ftp_info->ftp_root_path . $path;
571
+		$target_path = $this->ftp_info->ftp_root_path.$path;
572 572
 
573
-		if(!@ftp_delete($this->connection, $target_path))
573
+		if (!@ftp_delete($this->connection, $target_path))
574 574
 		{
575
-			return new BaseObject(-1, "failed to delete file " . $path);
575
+			return new BaseObject(-1, "failed to delete file ".$path);
576 576
 		}
577 577
 		return new BaseObject();
578 578
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	function _removeDir_real($path)
587 587
 	{
588
-		if(substr($path, 0, 2) == "./")
588
+		if (substr($path, 0, 2) == "./")
589 589
 		{
590 590
 			$path = substr($path, 2);
591 591
 		}
592
-		$target_path = $this->ftp_info->ftp_root_path . $path;
592
+		$target_path = $this->ftp_info->ftp_root_path.$path;
593 593
 
594
-		if(!@ftp_rmdir($this->connection, $target_path))
594
+		if (!@ftp_rmdir($this->connection, $target_path))
595 595
 		{
596
-			return new BaseObject(-1, "failed to delete directory " . $path);
596
+			return new BaseObject(-1, "failed to delete directory ".$path);
597 597
 		}
598 598
 		return new BaseObject();
599 599
 	}
@@ -616,74 +616,74 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function _copyDir(&$file_list)
618 618
 	{
619
-		if(!$this->ftp_password)
619
+		if (!$this->ftp_password)
620 620
 		{
621 621
 			return new BaseObject(-1, 'msg_ftp_password_input');
622 622
 		}
623 623
 
624 624
 		$output = $this->_connect();
625
-		if(!$output->toBool())
625
+		if (!$output->toBool())
626 626
 		{
627 627
 			return $output;
628 628
 		}
629 629
 
630
-		if(!$this->target_path)
630
+		if (!$this->target_path)
631 631
 		{
632 632
 			$this->target_path = '.';
633 633
 		}
634
-		if(substr($this->download_path, -1) == '/')
634
+		if (substr($this->download_path, -1) == '/')
635 635
 		{
636 636
 			$this->download_path = substr($this->download_path, 0, -1);
637 637
 		}
638
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
638
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
639 639
 		$copied = array();
640 640
 
641
-		if(is_array($file_list))
641
+		if (is_array($file_list))
642 642
 		{
643
-			foreach($file_list as $k => $file)
643
+			foreach ($file_list as $k => $file)
644 644
 			{
645
-				if(!$file)
645
+				if (!$file)
646 646
 				{
647 647
 					continue;
648 648
 				}
649 649
 				$org_file = $file;
650
-				if($this->package->path == ".")
650
+				if ($this->package->path == ".")
651 651
 				{
652 652
 					$file = substr($file, 3);
653 653
 				}
654
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
655
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
654
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
655
+				$path_list = explode('/', dirname($this->target_path."/".$file));
656 656
 
657 657
 				$real_path = "./";
658 658
 				$ftp_path = $this->ftp_info->ftp_root_path;
659 659
 
660
-				for($i = 0; $i < count($path_list); $i++)
660
+				for ($i = 0; $i < count($path_list); $i++)
661 661
 				{
662
-					if($path_list == "")
662
+					if ($path_list == "")
663 663
 					{
664 664
 						continue;
665 665
 					}
666
-					$real_path .= $path_list[$i] . "/";
667
-					$ftp_path .= $path_list[$i] . "/";
668
-					if(!file_exists(FileHandler::getRealPath($real_path)))
666
+					$real_path .= $path_list[$i]."/";
667
+					$ftp_path .= $path_list[$i]."/";
668
+					if (!file_exists(FileHandler::getRealPath($real_path)))
669 669
 					{
670
-						if(!@ftp_mkdir($this->connection, $ftp_path))
670
+						if (!@ftp_mkdir($this->connection, $ftp_path))
671 671
 						{
672 672
 							return new BaseObject(-1, "msg_make_directory_failed");
673 673
 						}
674 674
 
675
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
675
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
676 676
 						{
677
-							if(function_exists('ftp_chmod'))
677
+							if (function_exists('ftp_chmod'))
678 678
 							{
679
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
679
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
680 680
 								{
681 681
 									return new BaseObject(-1, "msg_permission_adjust_failed");
682 682
 								}
683 683
 							}
684 684
 							else
685 685
 							{
686
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
686
+								if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
687 687
 								{
688 688
 									return new BaseObject(-1, "msg_permission_adjust_failed");
689 689
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 						}
692 692
 					}
693 693
 				}
694
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
694
+				if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
695 695
 				{
696 696
 					return new BaseObject(-1, "msg_ftp_upload_failed");
697 697
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	function _connect()
747 747
 	{
748
-		if($this->ftp_info->ftp_host)
748
+		if ($this->ftp_info->ftp_host)
749 749
 		{
750 750
 			$ftp_host = $this->ftp_info->ftp_host;
751 751
 		}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 
757 757
 		$this->oFtp = new ftp();
758
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
758
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
759 759
 		{
760 760
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
761 761
 		}
762
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
762
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
763 763
 		{
764 764
 			$this->_close();
765 765
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	function _removeFile($path)
778 778
 	{
779
-		if(substr($path, 0, 2) == "./")
779
+		if (substr($path, 0, 2) == "./")
780 780
 		{
781 781
 			$path = substr($path, 2);
782 782
 		}
783
-		$target_path = $this->ftp_info->ftp_root_path . $path;
783
+		$target_path = $this->ftp_info->ftp_root_path.$path;
784 784
 
785
-		if(!$this->oFtp->ftp_delete($target_path))
785
+		if (!$this->oFtp->ftp_delete($target_path))
786 786
 		{
787 787
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
788 788
 		}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	function _removeDir_real($path)
798 798
 	{
799
-		if(substr($path, 0, 2) == "./")
799
+		if (substr($path, 0, 2) == "./")
800 800
 		{
801 801
 			$path = substr($path, 2);
802 802
 		}
803
-		$target_path = $this->ftp_info->ftp_root_path . $path;
803
+		$target_path = $this->ftp_info->ftp_root_path.$path;
804 804
 
805
-		if(!$this->oFtp->ftp_rmdir($target_path))
805
+		if (!$this->oFtp->ftp_rmdir($target_path))
806 806
 		{
807 807
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
808 808
 		}
@@ -827,52 +827,52 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function _copyDir(&$file_list)
829 829
 	{
830
-		if(!$this->ftp_password)
830
+		if (!$this->ftp_password)
831 831
 		{
832 832
 			return new BaseObject(-1, 'msg_ftp_password_input');
833 833
 		}
834 834
 
835 835
 		$output = $this->_connect();
836
-		if(!$output->toBool())
836
+		if (!$output->toBool())
837 837
 		{
838 838
 			return $output;
839 839
 		}
840 840
 
841 841
 		$oFtp = &$this->oFtp;
842
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
842
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
843 843
 
844 844
 		$copied = array();
845 845
 
846
-		if(is_array($file_list))
846
+		if (is_array($file_list))
847 847
 		{
848
-			foreach($file_list as $k => $file)
848
+			foreach ($file_list as $k => $file)
849 849
 			{
850 850
 				$org_file = $file;
851
-				if($this->package->path == ".")
851
+				if ($this->package->path == ".")
852 852
 				{
853 853
 					$file = substr($file, 3);
854 854
 				}
855
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
856
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
855
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
856
+				$path_list = explode('/', dirname($this->target_path."/".$file));
857 857
 
858 858
 				$real_path = "./";
859 859
 				$ftp_path = $this->ftp_info->ftp_root_path;
860 860
 
861
-				for($i = 0; $i < count($path_list); $i++)
861
+				for ($i = 0; $i < count($path_list); $i++)
862 862
 				{
863
-					if($path_list == "")
863
+					if ($path_list == "")
864 864
 					{
865 865
 						continue;
866 866
 					}
867
-					$real_path .= $path_list[$i] . "/";
868
-					$ftp_path .= $path_list[$i] . "/";
869
-					if(!file_exists(FileHandler::getRealPath($real_path)))
867
+					$real_path .= $path_list[$i]."/";
868
+					$ftp_path .= $path_list[$i]."/";
869
+					if (!file_exists(FileHandler::getRealPath($real_path)))
870 870
 					{
871 871
 						$oFtp->ftp_mkdir($ftp_path);
872
-						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
872
+						$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
873 873
 					}
874 874
 				}
875
-				$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
875
+				$oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file));
876 876
 				$copied[] = $path;
877 877
 			}
878 878
 		}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	function _removeFile($path)
923 923
 	{
924
-		if(substr($path, 0, 2) == "./")
924
+		if (substr($path, 0, 2) == "./")
925 925
 		{
926 926
 			$path = substr($path, 2);
927 927
 		}
928 928
 		$target_path = FileHandler::getRealPath($path);
929 929
 
930
-		if(!FileHandler::removeFile($target_path))
930
+		if (!FileHandler::removeFile($target_path))
931 931
 		{
932 932
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
933 933
 		}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function _removeDir_real($path)
943 943
 	{
944
-		if(substr($path, 0, 2) == "./")
944
+		if (substr($path, 0, 2) == "./")
945 945
 		{
946 946
 			$path = substr($path, 2);
947 947
 		}
@@ -970,39 +970,39 @@  discard block
 block discarded – undo
970 970
 	function _copyDir(&$file_list)
971 971
 	{
972 972
 		$output = $this->_connect();
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			return $output;
976 976
 		}
977 977
 		$target_dir = $this->target_path;
978 978
 		$copied = array();
979 979
 
980
-		if(is_array($file_list))
980
+		if (is_array($file_list))
981 981
 		{
982
-			foreach($file_list as $k => $file)
982
+			foreach ($file_list as $k => $file)
983 983
 			{
984 984
 				$org_file = $file;
985
-				if($this->package->path == ".")
985
+				if ($this->package->path == ".")
986 986
 				{
987 987
 					$file = substr($file, 3);
988 988
 				}
989
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
990
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
989
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
990
+				$path_list = explode('/', dirname($this->target_path."/".$file));
991 991
 				$real_path = "./";
992 992
 
993
-				for($i = 0; $i < count($path_list); $i++)
993
+				for ($i = 0; $i < count($path_list); $i++)
994 994
 				{
995
-					if($path_list == "")
995
+					if ($path_list == "")
996 996
 					{
997 997
 						continue;
998 998
 					}
999
-					$real_path .= $path_list[$i] . "/";
1000
-					if(!file_exists(FileHandler::getRealPath($real_path)))
999
+					$real_path .= $path_list[$i]."/";
1000
+					if (!file_exists(FileHandler::getRealPath($real_path)))
1001 1001
 					{
1002 1002
 						FileHandler::makeDir($real_path);
1003 1003
 					}
1004 1004
 				}
1005
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
1005
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file));
1006 1006
 				$copied[] = $path;
1007 1007
 			}
1008 1008
 		}
Please login to merge, or discard this patch.
modules/communication/communication.mobile.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/communication/communication.view.php');
4
+require_once(_XE_PATH_.'modules/communication/communication.view.php');
5 5
 
6 6
 /**
7 7
  * @class  communicationMobile
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$oLayoutModel = getModel('layout');
27 27
 		$layout_info = $oLayoutModel->getLayout($this->communication_config->mlayout_srl);
28
-		if($layout_info)
28
+		if ($layout_info)
29 29
 		{
30 30
 			$this->module_info->mlayout_srl = $this->communication_config->mlayout_srl;
31 31
 			$this->setLayoutPath($layout_info->path);
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	function dispCommunicationMessages()
40 40
 	{
41 41
 		// Error appears if not logged-in
42
-		if(!Context::get('is_logged'))
42
+		if (!Context::get('is_logged'))
43 43
 		{
44 44
 			return $this->stop('msg_not_logged');
45 45
 		}
46 46
 
47 47
 		$logged_info = Context::get('logged_info');
48
-		if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
48
+		if (!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
49 49
 		{
50 50
 			return $this->stop('msg_invalid_request');
51 51
 		}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		// Set the variables
54 54
 		$message_srl = Context::get('message_srl');
55 55
 		$message_type = Context::get('message_type');
56
-		if(!in_array($message_type, array('R', 'S', 'T')))
56
+		if (!in_array($message_type, array('R', 'S', 'T')))
57 57
 		{
58 58
 			$message_type = 'R';
59 59
 			Context::set('message_type', $message_type);
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
 		$oCommunicationModel = getModel('communication');
62 62
 
63 63
 		// extract contents if message_srl exists
64
-		if($message_srl)
64
+		if ($message_srl)
65 65
 		{
66 66
 			$templateFile = 'read_message';
67 67
 			$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
68 68
 			$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
69 69
 
70
-			switch($message->message_type)
70
+			switch ($message->message_type)
71 71
 			{
72 72
 				case 'R':
73
-					if($message->receiver_srl != $logged_info->member_srl)
73
+					if ($message->receiver_srl != $logged_info->member_srl)
74 74
 					{
75 75
 						return $this->stop('msg_invalid_request');
76 76
 					}
77 77
 					break;
78 78
 
79 79
 				case 'S':
80
-					if($message->sender_srl != $logged_info->member_srl)
80
+					if ($message->sender_srl != $logged_info->member_srl)
81 81
 					{
82 82
 						return $this->stop('msg_invalid_request');
83 83
 					}
84 84
 					break;
85 85
 
86 86
 				case 'T':
87
-					if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
87
+					if ($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
88 88
 					{
89 89
 						return $this->stop('msg_invalid_request');
90 90
 					}
91 91
 					break;
92 92
 			}
93 93
 
94
-			if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
94
+			if ($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
95 95
 			{
96 96
 				stripEmbedTagForAdmin($message->content, $message->sender_srl);
97 97
 				Context::set('message', $message);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		$oMemberModel = getModel('member');
139 139
 
140 140
 		// Error appears if not logged-in
141
-		if(!Context::get('is_logged'))
141
+		if (!Context::get('is_logged'))
142 142
 		{
143 143
 			return $this->stop('msg_not_logged');
144 144
 		}
@@ -148,32 +148,32 @@  discard block
 block discarded – undo
148 148
 		// get receipient's information
149 149
 		// check inalid request
150 150
 		$receiver_srl = Context::get('receiver_srl');
151
-		if(!$receiver_srl)
151
+		if (!$receiver_srl)
152 152
 		{
153 153
 			return $this->stop('msg_invalid_request');
154 154
 		}
155 155
 
156 156
 		// check receiver and sender are same
157
-		if($logged_info->member_srl == $receiver_srl)
157
+		if ($logged_info->member_srl == $receiver_srl)
158 158
 		{
159 159
 			return $this->stop('msg_cannot_send_to_yourself');
160 160
 		}
161 161
 
162 162
 		// get message_srl of the original message if it is a reply
163 163
 		$message_srl = Context::get('message_srl');
164
-		if($message_srl)
164
+		if ($message_srl)
165 165
 		{
166 166
 			$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
167
-			if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
167
+			if ($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
168 168
 			{
169
-				$source_message->title = "[re] " . $source_message->title;
170
-				$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>";
169
+				$source_message->title = "[re] ".$source_message->title;
170
+				$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>";
171 171
 				Context::set('source_message', $source_message);
172 172
 			}
173 173
 		}
174 174
 
175 175
 		$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
176
-		if(!$receiver_info)
176
+		if (!$receiver_info)
177 177
 		{
178 178
 			return $this->stop('msg_invalid_request');
179 179
 		}
Please login to merge, or discard this patch.
modules/comment/comment.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/comment/comment.item.php');
4
+require_once(_XE_PATH_.'modules/comment/comment.item.php');
5 5
 
6 6
 /**
7 7
  * comment
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		// 2008. 02. 22 add comment setting when a new module added
37 37
 		$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
38 38
 
39
-		if(!is_dir('./files/cache/tmp'))
39
+		if (!is_dir('./files/cache/tmp'))
40 40
 		{
41 41
 			FileHandler::makeDir('./files/cache/tmp');
42 42
 		}
@@ -54,63 +54,63 @@  discard block
 block discarded – undo
54 54
 		$oModuleModel = getModel('module');
55 55
 		$oModuleController = getController('module');
56 56
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
57
-		if($oModuleModel->needUpdate($version_update_id))
57
+		if ($oModuleModel->needUpdate($version_update_id))
58 58
 		{
59 59
 			// 2007. 10. 17 add a trigger to delete comments together with posting deleted
60
-			if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
60
+			if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
61 61
 			{
62 62
 				return TRUE;
63 63
 			}
64 64
 			// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
65
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
65
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
66 66
 			{
67 67
 				return TRUE;
68 68
 			}
69 69
 			// 2007. 10. 23 add a column for recommendation votes or notification of the comments
70
-			if(!$oDB->isColumnExists("comments", "voted_count"))
70
+			if (!$oDB->isColumnExists("comments", "voted_count"))
71 71
 			{
72 72
 				return TRUE;
73 73
 			}
74
-			if(!$oDB->isColumnExists("comments", "notify_message"))
74
+			if (!$oDB->isColumnExists("comments", "notify_message"))
75 75
 			{
76 76
 				return TRUE;
77 77
 			}
78 78
 			// 2008. 02. 22 add comment setting when a new module added
79
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
79
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
80 80
 			{
81 81
 				return TRUE;
82 82
 			}
83 83
 			// 2008. 05. 14 add a column for blamed count
84
-			if(!$oDB->isColumnExists("comments", "blamed_count"))
84
+			if (!$oDB->isColumnExists("comments", "blamed_count"))
85 85
 			{
86 86
 				return TRUE;
87 87
 			}
88
-			if(!$oDB->isColumnExists("comment_voted_log", "point"))
88
+			if (!$oDB->isColumnExists("comment_voted_log", "point"))
89 89
 			{
90 90
 				return TRUE;
91 91
 			}
92 92
 
93
-			if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
93
+			if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
94 94
 			{
95 95
 				return TRUE;
96 96
 			}
97 97
 			//2012. 02. 24 add comment published status column and index
98
-			if(!$oDB->isColumnExists("comments", "status"))
98
+			if (!$oDB->isColumnExists("comments", "status"))
99 99
 			{
100 100
 				return TRUE;
101 101
 			}
102
-			if(!$oDB->isIndexExists("comments", "idx_status"))
102
+			if (!$oDB->isIndexExists("comments", "idx_status"))
103 103
 			{
104 104
 				return TRUE;
105 105
 			}
106 106
 
107 107
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
108
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
108
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
109 109
 			{
110 110
 				return TRUE;
111 111
 			}
112 112
 
113
-			if(!$oDB->isIndexExists("comments", "idx_parent_srl"))
113
+			if (!$oDB->isIndexExists("comments", "idx_parent_srl"))
114 114
 			{
115 115
 				return TRUE;
116 116
 			}
@@ -131,46 +131,46 @@  discard block
 block discarded – undo
131 131
 		$oModuleModel = getModel('module');
132 132
 		$oModuleController = getController('module');
133 133
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
134
-		if($oModuleModel->needUpdate($version_update_id))
134
+		if ($oModuleModel->needUpdate($version_update_id))
135 135
 		{
136 136
 			// 2007. 10. 17 add a trigger to delete comments together with posting deleted
137
-			if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
137
+			if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
138 138
 			{
139 139
 				$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
140 140
 			}
141 141
 			// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
142
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
142
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
143 143
 			{
144 144
 				$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
145 145
 			}
146 146
 			// 2007. 10. 23 add a column for recommendation votes or notification of the comments
147
-			if(!$oDB->isColumnExists("comments", "voted_count"))
147
+			if (!$oDB->isColumnExists("comments", "voted_count"))
148 148
 			{
149 149
 				$oDB->addColumn("comments", "voted_count", "number", "11");
150 150
 				$oDB->addIndex("comments", "idx_voted_count", array("voted_count"));
151 151
 			}
152 152
 
153
-			if(!$oDB->isColumnExists("comments", "notify_message"))
153
+			if (!$oDB->isColumnExists("comments", "notify_message"))
154 154
 			{
155 155
 				$oDB->addColumn("comments", "notify_message", "char", "1");
156 156
 			}
157 157
 			// 2008. 02. 22 add comment setting when a new module added
158
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
158
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
159 159
 			{
160 160
 				$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
161 161
 			}
162 162
 			// 2008. 05. 14 add a column for blamed count
163
-			if(!$oDB->isColumnExists("comments", "blamed_count"))
163
+			if (!$oDB->isColumnExists("comments", "blamed_count"))
164 164
 			{
165 165
 				$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE);
166 166
 				$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
167 167
 			}
168
-			if(!$oDB->isColumnExists("comment_voted_log", "point"))
168
+			if (!$oDB->isColumnExists("comment_voted_log", "point"))
169 169
 			{
170 170
 				$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE);
171 171
 			}
172 172
 
173
-			if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
173
+			if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
174 174
 			{
175 175
 				$oDB->addIndex(
176 176
 						"comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 			}
179 179
 
180 180
 			//2012. 02. 24 add comment published status column and index
181
-			if(!$oDB->isColumnExists("comments", "status"))
181
+			if (!$oDB->isColumnExists("comments", "status"))
182 182
 			{
183 183
 				$oDB->addColumn("comments", "status", "number", 1, 1, TRUE);
184 184
 			}
185
-			if(!$oDB->isIndexExists("comments", "idx_status"))
185
+			if (!$oDB->isIndexExists("comments", "idx_status"))
186 186
 			{
187 187
 				$oDB->addIndex(
188 188
 						"comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			}
191 191
 
192 192
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
193
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
193
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
194 194
 			{
195 195
 				$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
196 196
 			}
197 197
 
198
-			if(!$oDB->isIndexExists("comments", "idx_parent_srl"))
198
+			if (!$oDB->isIndexExists("comments", "idx_parent_srl"))
199 199
 			{
200 200
 				$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
201 201
 			}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	function recompileCache()
214 214
 	{
215
-		if(!is_dir('./files/cache/tmp'))
215
+		if (!is_dir('./files/cache/tmp'))
216 216
 		{
217 217
 			FileHandler::makeDir('./files/cache/tmp');
218 218
 		}
Please login to merge, or discard this patch.
modules/message/message.admin.model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3
-class messageAdminModel extends message{
3
+class messageAdminModel extends message {
4 4
 	public function getMessageAdminColorset()
5 5
 	{
6 6
 		$skin = Context::get('skin');
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		Context::set('type', $type);
9 9
 		$dir = $type == 'P' ? 'skins' : 'm.skins';
10 10
 
11
-		if(!$skin)
11
+		if (!$skin)
12 12
 		{
13 13
 			$tpl = '';
14 14
 		}
Please login to merge, or discard this patch.
addons/resize_image/resize_image.addon.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 {
6 6
 	exit();
7 7
 }
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  * @author XEHub ([email protected])
12 12
  * @brief Add-on to resize images in the body
13 13
  */
14
-if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler())
14
+if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler())
15 15
 {
16
-	if(Mobile::isFromMobilePhone())
16
+	if (Mobile::isFromMobilePhone())
17 17
 	{
18 18
 		Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true);
19 19
 	}
Please login to merge, or discard this patch.
addons/captcha/captcha.addon.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-if(!defined("__XE__")) exit();
4
+if (!defined("__XE__")) exit();
5 5
 
6 6
 /**
7 7
  * @file captcha.addon.php
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @brief Captcha for a particular action
10 10
  * English alphabets and voice verification added
11 11
  * */
12
-if(!class_exists('AddonCaptcha', false))
12
+if (!class_exists('AddonCaptcha', false))
13 13
 {
14 14
 	class AddonCaptcha
15 15
 	{
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		function before_module_proc()
26 26
 		{
27
-			if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed'])
27
+			if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed'])
28 28
 			{
29 29
 				unset($_SESSION['captcha_authed']);
30 30
 			}
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 		function before_module_init(&$ModuleHandler)
34 34
 		{
35 35
 			$logged_info = Context::get('logged_info');
36
-			if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
36
+			if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
37 37
 			{
38 38
 				return false;
39 39
 			}
40
-			if($this->addon_info->target != 'all' && Context::get('is_logged'))
40
+			if ($this->addon_info->target != 'all' && Context::get('is_logged'))
41 41
 			{
42 42
 				return false;
43 43
 			}
44
-			if($_SESSION['XE_VALIDATOR_ERROR'] == -1)
44
+			if ($_SESSION['XE_VALIDATOR_ERROR'] == -1)
45 45
 			{
46 46
 				$_SESSION['captcha_authed'] = false;
47 47
 			}
48
-			if($_SESSION['captcha_authed'])
48
+			if ($_SESSION['captcha_authed'])
49 49
 			{
50 50
 				return false;
51 51
 			}
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
 			$this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment');
56 56
 
57
-			if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
57
+			if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
58 58
 			{
59
-				if($type == 'inline')
59
+				if ($type == 'inline')
60 60
 				{
61
-					if(!$this->compareCaptcha())
61
+					if (!$this->compareCaptcha())
62 62
 					{
63
-						Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
63
+						Context::loadLang(_XE_PATH_.'addons/captcha/lang');
64 64
 						$_SESSION['XE_VALIDATOR_ERROR'] = -1;
65 65
 						$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied');
66 66
 						$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 				{
73 73
 					Context::addHtmlHeader('<script>
74 74
 						if(!captchaTargetAct) {var captchaTargetAct = [];}
75
-						captchaTargetAct.push("' . implode('","', $this->target_acts) . '");
75
+						captchaTargetAct.push("' . implode('","', $this->target_acts).'");
76 76
 						</script>');
77 77
 					Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true);
78 78
 				}
79 79
 			}
80 80
 
81 81
 			// compare session when calling actions such as writing a post or a comment on the board/issue tracker module
82
-			if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
82
+			if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
83 83
 			{
84
-				Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
84
+				Context::loadLang(_XE_PATH_.'addons/captcha/lang');
85 85
 				$ModuleHandler->error = "captcha_denied";
86 86
 			}
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		function createKeyword()
92 92
 		{
93 93
 			$type = Context::get('captchaType');
94
-			if($type == 'inline' && $_SESSION['captcha_keyword'])
94
+			if ($type == 'inline' && $_SESSION['captcha_keyword'])
95 95
 			{
96 96
 				return;
97 97
 			}
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 
105 105
 		function before_module_init_setCaptchaSession()
106 106
 		{
107
-			if($_SESSION['captcha_authed'])
107
+			if ($_SESSION['captcha_authed'])
108 108
 			{
109 109
 				return false;
110 110
 			}
111 111
 			// Load language files
112
-			Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
112
+			Context::loadLang(_XE_PATH_.'addons/captcha/lang');
113 113
 			// Generate keywords
114 114
 			$this->createKeyword();
115 115
 
116 116
 			$target = Context::getLang('target_captcha');
117 117
 			header("Content-Type: text/xml; charset=UTF-8");
118 118
 			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
119
-			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
119
+			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
120 120
 			header("Cache-Control: no-store, no-cache, must-revalidate");
121 121
 			header("Cache-Control: post-check=0, pre-check=0", false);
122 122
 			header("Pragma: no-cache");
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		function before_module_init_captchaImage()
135 135
 		{
136
-			if($_SESSION['captcha_authed'])
136
+			if ($_SESSION['captcha_authed'])
137 137
 			{
138 138
 				return false;
139 139
 			}
140
-			if(Context::get('renew'))
140
+			if (Context::get('renew'))
141 141
 			{
142 142
 				$this->createKeyword();
143 143
 			}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		function createCaptchaImage($string)
160 160
 		{
161 161
 			$arr = array();
162
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
162
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
163 163
 			{
164 164
 				$arr[] = $string{$i};
165 165
 			}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			shuffle($deg);
182 182
 
183 183
 			// Create an image for each letter
184
-			foreach($arr as $i => $str)
184
+			foreach ($arr as $i => $str)
185 185
 			{
186 186
 				$im[$i + 1] = @imagecreate($w, $h);
187 187
 				$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				$ran = range(1, 20);
192 192
 				shuffle($ran);
193 193
 
194
-				if(function_exists('imagerotate'))
194
+				if (function_exists('imagerotate'))
195 195
 				{
196 196
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color);
197 197
 					$im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 
208 208
 			// Combine images of each character
209
-			for($i = 1, $c = count($im); $i<$c; $i++)
209
+			for ($i = 1, $c = count($im); $i < $c; $i++)
210 210
 			{
211 211
 				imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h);
212 212
 				imagedestroy($im[$i]);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h);
219 219
 			imagedestroy($im[0]);
220 220
 
221
-			if(function_exists('imageantialias'))
221
+			if (function_exists('imageantialias'))
222 222
 			{
223 223
 				imageantialias($big, true);
224 224
 			}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			$h = $h * $big_count;
231 231
 			$d = array_pop($deg);
232 232
 
233
-			for($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
233
+			for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
234 234
 			{
235 235
 				imageline($big, 0, $i + $d, $w, $i, $line_color);
236 236
 			}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			$x = range(0, ($w - 10));
239 239
 			shuffle($x);
240 240
 
241
-			for($i = 0; $i < 200; $i++)
241
+			for ($i = 0; $i < 200; $i++)
242 242
 			{
243 243
 				imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color);
244 244
 			}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		function before_module_init_captchaAudio()
250 250
 		{
251
-			if($_SESSION['captcha_authed'])
251
+			if ($_SESSION['captcha_authed'])
252 252
 			{
253 253
 				return false;
254 254
 			}
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 			header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\"");
261 261
 			header('Cache-Control: no-store, no-cache, must-revalidate');
262 262
 			header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
263
-			header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
264
-			header('Content-Length: ' . strlen($data));
263
+			header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');
264
+			header('Content-Length: '.strlen($data));
265 265
 
266 266
 			echo $data;
267 267
 			Context::close();
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 		{
273 273
 			$data = '';
274 274
 			$_audio = './addons/captcha/audio/F_%s.mp3';
275
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
275
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
276 276
 			{
277 277
 				$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
278 278
 
279 279
 				$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
280 280
 				$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
281 281
 
282
-				for($j = $start; $j < $datalen; $j+=64)
282
+				for ($j = $start; $j < $datalen; $j += 64)
283 283
 				{
284 284
 					$ch = ord($_data{$j});
285
-					if($ch < 9 || $ch > 119)
285
+					if ($ch < 9 || $ch > 119)
286 286
 					{
287 287
 						continue;
288 288
 					}
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
 
298 298
 		function compareCaptcha()
299 299
 		{
300
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
300
+			if (!in_array(Context::get('act'), $this->target_acts)) return true;
301 301
 
302
-			if($_SESSION['captcha_authed'])
302
+			if ($_SESSION['captcha_authed'])
303 303
 			{
304 304
 				return true;
305 305
 			}
306 306
 
307
-			if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
307
+			if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
308 308
 			{
309 309
 				$_SESSION['captcha_authed'] = true;
310 310
 				return true;
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 
318 318
 		function before_module_init_captchaCompare()
319 319
 		{
320
-			if(!$this->compareCaptcha())
320
+			if (!$this->compareCaptcha())
321 321
 			{
322 322
 				return false;
323 323
 			}
324 324
 
325 325
 			header("Content-Type: text/xml; charset=UTF-8");
326 326
 			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
327
-			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
327
+			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
328 328
 			header("Cache-Control: no-store, no-cache, must-revalidate");
329 329
 			header("Cache-Control: post-check=0, pre-check=0", false);
330 330
 			header("Pragma: no-cache");
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			unset($_SESSION['captcha_authed']);
340 340
 			$this->createKeyword();
341 341
 
342
-			$swfURL = getUrl() . 'addons/captcha/swf/play.swf';
342
+			$swfURL = getUrl().'addons/captcha/swf/play.swf';
343 343
 			Context::unloadFile('./addons/captcha/captcha.min.js');
344 344
 			Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body'));
345 345
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 
378 378
 $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__'];
379 379
 
380
-if(method_exists($oAddonCaptcha, $called_position))
380
+if (method_exists($oAddonCaptcha, $called_position))
381 381
 {
382
-	if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this)))
382
+	if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this)))
383 383
 	{
384 384
 		return false;
385 385
 	}
386 386
 }
387 387
 
388 388
 $addon_act = Context::get('captcha_action');
389
-if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act))
389
+if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act))
390 390
 {
391
-	if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this)))
391
+	if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this)))
392 392
 	{
393 393
 		return false;
394 394
 	}
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-if(!defined("__XE__")) exit();
4
+if(!defined("__XE__")) {
5
+	exit();
6
+}
5 7
 
6 8
 /**
7 9
  * @file captcha.addon.php
@@ -67,8 +69,7 @@  discard block
 block discarded – undo
67 69
 						$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
68 70
 						$ModuleHandler->_setInputValueToSession();
69 71
 					}
70
-				}
71
-				else
72
+				} else
72 73
 				{
73 74
 					Context::addHtmlHeader('<script>
74 75
 						if(!captchaTargetAct) {var captchaTargetAct = [];}
@@ -198,8 +199,7 @@  discard block
 block discarded – undo
198 199
 
199 200
 					$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
200 201
 					imagecolortransparent($im[$i + 1], $background_color);
201
-				}
202
-				else
202
+				} else
203 203
 				{
204 204
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color);
205 205
 				}
@@ -297,7 +297,9 @@  discard block
 block discarded – undo
297 297
 
298 298
 		function compareCaptcha()
299 299
 		{
300
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
300
+			if(!in_array(Context::get('act'), $this->target_acts)) {
301
+				return true;
302
+			}
301 303
 
302 304
 			if($_SESSION['captcha_authed'])
303 305
 			{
Please login to merge, or discard this patch.