GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( eb6166...6c018e )
by gyeong-won
05:11
created
classes/mail/Mail.class.php 1 patch
Spacing   +79 added lines, -79 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/phpmailer/phpmailer.php";
4
+require_once _XE_PATH_."libs/phpmailer/phpmailer.php";
5 5
 
6 6
 /**
7 7
  * Mailing class for XpressEngine
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 		$this->SMTPSecure = "tls";
149 149
 		$this->Host = 'smtp.gmail.com';
150 150
 		$this->Port = '587';
151
-		if($this->isVaildMailAddress($account_name))
151
+		if ($this->isVaildMailAddress($account_name))
152 152
 		{
153 153
 			$this->Username = $account_name;
154 154
 		}
155 155
 		else
156 156
 		{
157
-			$this->Username = $account_name . '@gmail.com';
157
+			$this->Username = $account_name.'@gmail.com';
158 158
 		}
159 159
 		$this->Password = $account_passwd;
160 160
 		$this->IsSMTP();
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 		$this->Password = $pass;
181 181
 		$this->Port = $port;
182 182
 
183
-		if($secure == 'ssl' || $secure == 'tls')
183
+		if ($secure == 'ssl' || $secure == 'tls')
184 184
 		{
185 185
 			$this->SMTPSecure = $secure;
186 186
 		}
187 187
 
188
-		if(($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL))
188
+		if (($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL))
189 189
 		{
190 190
 			$this->IsSMTP();
191 191
 			$this->AltBody = "To view the message, please use an HTML compatible email viewer!";
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	function setSender($name, $email)
244 244
 	{
245
-		if($this->Mailer == "mail")
245
+		if ($this->Mailer == "mail")
246 246
 		{
247 247
 			$this->sender_name = $name;
248 248
 			$this->sender_email = $email;
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	function getSender()
262 262
 	{
263
-		if(!stristr(PHP_OS, 'win') && $this->sender_name)
263
+		if (!stristr(PHP_OS, 'win') && $this->sender_name)
264 264
 		{
265
-			return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->sender_name) . '?=', $this->sender_email);
265
+			return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->sender_name).'?=', $this->sender_email);
266 266
 		}
267 267
 		return $this->sender_email;
268 268
 	}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	function setReceiptor($name, $email)
278 278
 	{
279
-		if($this->Mailer == "mail")
279
+		if ($this->Mailer == "mail")
280 280
 		{
281 281
 			$this->receiptor_name = $name;
282 282
 			$this->receiptor_email = $email;
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	function getReceiptor()
296 296
 	{
297
-		if(!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email)
297
+		if (!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email)
298 298
 		{
299
-			return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->receiptor_name) . '?=', $this->receiptor_email);
299
+			return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->receiptor_name).'?=', $this->receiptor_email);
300 300
 		}
301 301
 		return $this->receiptor_email;
302 302
 	}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	function setTitle($title)
311 311
 	{
312
-		if($this->Mailer == "mail")
312
+		if ($this->Mailer == "mail")
313 313
 		{
314 314
 			$this->title = $title;
315 315
 		}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	function getTitle()
328 328
 	{
329
-		return '=?utf-8?b?' . base64_encode($this->title) . '?=';
329
+		return '=?utf-8?b?'.base64_encode($this->title).'?=';
330 330
 	}
331 331
 
332 332
 	/**
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	function setBCC($bcc)
339 339
 	{
340
-		if($this->Mailer == "mail")
340
+		if ($this->Mailer == "mail")
341 341
 		{
342 342
 			$this->bcc = $bcc;
343 343
 		}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	function setReplyTo($replyTo)
379 379
 	{
380
-		if($this->Mailer == "mail")
380
+		if ($this->Mailer == "mail")
381 381
 		{
382 382
 			$this->replyTo = $replyTo;
383 383
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	function setContent($content)
397 397
 	{
398 398
 		$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
399
-		if($this->Mailer == "mail")
399
+		if ($this->Mailer == "mail")
400 400
 		{
401 401
 			$this->content = $content;
402 402
 		}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	function replaceResourceRealPath($matches)
417 417
 	{
418
-		return preg_replace('/src=(["\']?)files/i', 'src=$1' . Context::getRequestUri() . 'files', $matches[0]);
418
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
419 419
 	}
420 420
 
421 421
 	/**
@@ -456,42 +456,42 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	function procAttachments()
458 458
 	{
459
-		if($this->Mailer == "mail")
459
+		if ($this->Mailer == "mail")
460 460
 		{
461
-			if(count($this->attachments) > 0)
461
+			if (count($this->attachments) > 0)
462 462
 			{
463
-				$this->body = $this->header . $this->body;
464
-				$boundary = '----==' . uniqid(rand(), TRUE);
465
-				$this->header = "Content-Type: multipart/mixed;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
466
-				$this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol;
463
+				$this->body = $this->header.$this->body;
464
+				$boundary = '----=='.uniqid(rand(), TRUE);
465
+				$this->header = "Content-Type: multipart/mixed;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
466
+				$this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol;
467 467
 				$res = array();
468 468
 				$res[] = $this->body;
469
-				foreach($this->attachments as $filename => $attachment)
469
+				foreach ($this->attachments as $filename => $attachment)
470 470
 				{
471 471
 					$type = $this->returnMIMEType($filename);
472 472
 					$file_handler = new FileHandler();
473 473
 					$file_str = $file_handler->readFile($attachment);
474 474
 					$chunks = chunk_split(base64_encode($file_str));
475 475
 					$tempBody = sprintf(
476
-							"--" . $boundary . $this->eol .
477
-							"Content-Type: %s;" . $this->eol .
478
-							"\tname=\"%s\"" . $this->eol .
479
-							"Content-Transfer-Encoding: base64" . $this->eol .
480
-							"Content-Description: %s" . $this->eol .
481
-							"Content-Disposition: attachment;" . $this->eol .
482
-							"\tfilename=\"%s\"" . $this->eol . $this->eol .
483
-							"%s" . $this->eol . $this->eol, $type, $filename, $filename, $filename, $chunks);
476
+							"--".$boundary.$this->eol.
477
+							"Content-Type: %s;".$this->eol.
478
+							"\tname=\"%s\"".$this->eol.
479
+							"Content-Transfer-Encoding: base64".$this->eol.
480
+							"Content-Description: %s".$this->eol.
481
+							"Content-Disposition: attachment;".$this->eol.
482
+							"\tfilename=\"%s\"".$this->eol.$this->eol.
483
+							"%s".$this->eol.$this->eol, $type, $filename, $filename, $filename, $chunks);
484 484
 					$res[] = $tempBody;
485 485
 				}
486 486
 				$this->body = implode("", $res);
487
-				$this->body .= "--" . $boundary . "--";
487
+				$this->body .= "--".$boundary."--";
488 488
 			}
489 489
 		}
490 490
 		else
491 491
 		{
492
-			if(count($this->attachments) > 0)
492
+			if (count($this->attachments) > 0)
493 493
 			{
494
-				foreach($this->attachments as $filename => $attachment)
494
+				foreach ($this->attachments as $filename => $attachment)
495 495
 				{
496 496
 					parent::AddAttachment($attachment);
497 497
 				}
@@ -506,33 +506,33 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	function procCidAttachments()
508 508
 	{
509
-		if(count($this->cidAttachments) > 0)
509
+		if (count($this->cidAttachments) > 0)
510 510
 		{
511
-			$this->body = $this->header . $this->body;
512
-			$boundary = '----==' . uniqid(rand(), TRUE);
513
-			$this->header = "Content-Type: multipart/relative;" . $this->eol . "\ttype=\"multipart/alternative\";" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
514
-			$this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol;
511
+			$this->body = $this->header.$this->body;
512
+			$boundary = '----=='.uniqid(rand(), TRUE);
513
+			$this->header = "Content-Type: multipart/relative;".$this->eol."\ttype=\"multipart/alternative\";".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
514
+			$this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol;
515 515
 			$res = array();
516 516
 			$res[] = $this->body;
517
-			foreach($this->cidAttachments as $cid => $attachment)
517
+			foreach ($this->cidAttachments as $cid => $attachment)
518 518
 			{
519 519
 				$filename = basename($attachment);
520 520
 				$type = $this->returnMIMEType(FileHandler::getRealPath($attachment));
521 521
 				$file_str = FileHandler::readFile($attachment);
522 522
 				$chunks = chunk_split(base64_encode($file_str));
523 523
 				$tempBody = sprintf(
524
-						"--" . $boundary . $this->eol .
525
-						"Content-Type: %s;" . $this->eol .
526
-						"\tname=\"%s\"" . $this->eol .
527
-						"Content-Transfer-Encoding: base64" . $this->eol .
528
-						"Content-ID: <%s>" . $this->eol .
529
-						"Content-Description: %s" . $this->eol .
530
-						"Content-Location: %s" . $this->eol . $this->eol .
531
-						"%s" . $this->eol . $this->eol, $type, $filename, $cid, $filename, $filename, $chunks);
524
+						"--".$boundary.$this->eol.
525
+						"Content-Type: %s;".$this->eol.
526
+						"\tname=\"%s\"".$this->eol.
527
+						"Content-Transfer-Encoding: base64".$this->eol.
528
+						"Content-ID: <%s>".$this->eol.
529
+						"Content-Description: %s".$this->eol.
530
+						"Content-Location: %s".$this->eol.$this->eol.
531
+						"%s".$this->eol.$this->eol, $type, $filename, $cid, $filename, $filename, $chunks);
532 532
 				$res[] = $tempBody;
533 533
 			}
534 534
 			$this->body = implode("", $res);
535
-			$this->body .= "--" . $boundary . "--";
535
+			$this->body .= "--".$boundary."--";
536 536
 		}
537 537
 	}
538 538
 
@@ -543,37 +543,37 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	function send()
545 545
 	{
546
-		if($this->Mailer == "mail")
546
+		if ($this->Mailer == "mail")
547 547
 		{
548
-			$boundary = '----==' . uniqid(rand(), TRUE);
548
+			$boundary = '----=='.uniqid(rand(), TRUE);
549 549
 			$this->eol = $GLOBALS['_qmail_compatibility'] == "Y" ? "\n" : "\r\n";
550
-			$this->header = "Content-Type: multipart/alternative;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
550
+			$this->header = "Content-Type: multipart/alternative;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
551 551
 			$this->body = sprintf(
552
-					"--%s" . $this->eol .
553
-					"Content-Type: text/plain; charset=utf-8; format=flowed" . $this->eol .
554
-					"Content-Transfer-Encoding: base64" . $this->eol .
555
-					"Content-Disposition: inline" . $this->eol . $this->eol .
556
-					"%s" .
557
-					"--%s" . $this->eol .
558
-					"Content-Type: text/html; charset=utf-8" . $this->eol .
559
-					"Content-Transfer-Encoding: base64" . $this->eol .
560
-					"Content-Disposition: inline" . $this->eol . $this->eol .
561
-					"%s" .
562
-					"--%s--" .
552
+					"--%s".$this->eol.
553
+					"Content-Type: text/plain; charset=utf-8; format=flowed".$this->eol.
554
+					"Content-Transfer-Encoding: base64".$this->eol.
555
+					"Content-Disposition: inline".$this->eol.$this->eol.
556
+					"%s".
557
+					"--%s".$this->eol.
558
+					"Content-Type: text/html; charset=utf-8".$this->eol.
559
+					"Content-Transfer-Encoding: base64".$this->eol.
560
+					"Content-Disposition: inline".$this->eol.$this->eol.
561
+					"%s".
562
+					"--%s--".
563 563
 					"", $boundary, $this->getPlainContent(), $boundary, $this->getHTMLContent(), $boundary
564 564
 			);
565 565
 			$this->procCidAttachments();
566 566
 			$this->procAttachments();
567 567
 			$headers = sprintf(
568
-					"From: %s" . $this->eol .
569
-					"%s" .
570
-					"%s" .
571
-					"%s" .
572
-					"%s" .
573
-					"MIME-Version: 1.0" . $this->eol . "", $this->getSender(), $this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol) : "", $this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol) : "", $this->bcc ? ("Bcc: " . $this->bcc . $this->eol) : "", $this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol) : ""
568
+					"From: %s".$this->eol.
569
+					"%s".
570
+					"%s".
571
+					"%s".
572
+					"%s".
573
+					"MIME-Version: 1.0".$this->eol."", $this->getSender(), $this->messageId ? ("Message-ID: <".$this->messageId.">".$this->eol) : "", $this->replyTo ? ("Reply-To: <".$this->replyTo.">".$this->eol) : "", $this->bcc ? ("Bcc: ".$this->bcc.$this->eol) : "", $this->references ? ("References: <".$this->references.">".$this->eol."In-Reply-To: <".$this->references.">".$this->eol) : ""
574 574
 			);
575 575
 			$headers .= $this->header;
576
-			if($this->additional_params)
576
+			if ($this->additional_params)
577 577
 			{
578 578
 				return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params);
579 579
 			}
@@ -594,14 +594,14 @@  discard block
 block discarded – undo
594 594
 	 */
595 595
 	function checkMailMX($email_address)
596 596
 	{
597
-		if(!Mail::isVaildMailAddress($email_address))
597
+		if (!Mail::isVaildMailAddress($email_address))
598 598
 		{
599 599
 			return FALSE;
600 600
 		}
601 601
 		list($user, $host) = explode("@", $email_address);
602
-		if(function_exists('checkdnsrr'))
602
+		if (function_exists('checkdnsrr'))
603 603
 		{
604
-			if(checkdnsrr($host, "MX") || checkdnsrr($host, "A"))
604
+			if (checkdnsrr($host, "MX") || checkdnsrr($host, "A"))
605 605
 			{
606 606
 				return TRUE;
607 607
 			}
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 */
622 622
 	function isVaildMailAddress($email_address)
623 623
 	{
624
-		if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address))
624
+		if (preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address))
625 625
 		{
626 626
 			return $email_address;
627 627
 		}
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	function returnMIMEType($filename)
641 641
 	{
642 642
 		preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix);
643
-		switch(strtolower($fileSuffix[1]))
643
+		switch (strtolower($fileSuffix[1]))
644 644
 		{
645 645
 			case "js" :
646 646
 				return "application/x-javascript";
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			case "gif" :
655 655
 			case "bmp" :
656 656
 			case "tiff" :
657
-				return "image/" . strtolower($fileSuffix[1]);
657
+				return "image/".strtolower($fileSuffix[1]);
658 658
 			case "css" :
659 659
 				return "text/css";
660 660
 			case "xml" :
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 			case "swf" :
709 709
 				return "application/x-shockwave-flash";
710 710
 			default :
711
-				if(function_exists("mime_content_type"))
711
+				if (function_exists("mime_content_type"))
712 712
 				{
713 713
 					$fileSuffix = mime_content_type($filename);
714 714
 				}
715
-				return "unknown/" . trim($fileSuffix[0], ".");
715
+				return "unknown/".trim($fileSuffix[0], ".");
716 716
 		}
717 717
 	}
718 718
 
Please login to merge, or discard this patch.
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.
tools/dbxml_validator/tests/xmlQueriesTest.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -2,33 +2,33 @@  discard block
 block discarded – undo
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4 4
 if (!defined('__DIR__'))
5
-    define('__DIR__', realpath(dirname(__FILE__))); 
5
+	define('__DIR__', realpath(dirname(__FILE__))); 
6 6
 
7 7
 /** The tests here are meant only for the built-in checks in validator.php, 
8 8
     and not for the entire syntax expressed by the .xsd files. */
9 9
 class XmlQueriesTest extends PHPUnit_Framework_TestCase
10 10
 {
11
-    // taken from validator.php
11
+	// taken from validator.php
12 12
 
13
-    const RETCODE_VALIDATOR_INTERNAL = 60;
14
-    const RETCODE_GENERIC_XML_SYNTAX = 50;
15
-    const RETCODE_QUERY_ELEMENT = 40;
16
-    const RETCODE_XSD_VALIDATION = 30;
17
-    const RETCODE_BUILTIN_CHECKS =    20;
18
-    const RETCODE_DB_SCHEMA_MATCH =10;	// no schema match is currently implemented.
19
-    const RETCODE_SUCCESS = 0;
13
+	const RETCODE_VALIDATOR_INTERNAL = 60;
14
+	const RETCODE_GENERIC_XML_SYNTAX = 50;
15
+	const RETCODE_QUERY_ELEMENT = 40;
16
+	const RETCODE_XSD_VALIDATION = 30;
17
+	const RETCODE_BUILTIN_CHECKS =    20;
18
+	const RETCODE_DB_SCHEMA_MATCH =10;	// no schema match is currently implemented.
19
+	const RETCODE_SUCCESS = 0;
20 20
 
21
-    public $validator_cmd;
21
+	public $validator_cmd;
22 22
 
23
-    public function setUp()
24
-    {
23
+	public function setUp()
24
+	{
25 25
 	 $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";
26
-    }
26
+	}
27 27
  
28
-    // recursive glob
29
-    // On Windows glob() is case-sensitive.
30
-    public function globr($sDir, $sPattern, $nFlags = NULL) 
31
-    { 
28
+	// recursive glob
29
+	// On Windows glob() is case-sensitive.
30
+	public function globr($sDir, $sPattern, $nFlags = NULL) 
31
+	{ 
32 32
 	// Get the list of all matching files currently in the 
33 33
 	// directory. 
34 34
 
@@ -41,25 +41,25 @@  discard block
 block discarded – undo
41 41
 
42 42
 	foreach ($aDirs as $sSubDir) 
43 43
 	{ 
44
-	    if ($sSubDir != '.' && $sSubDir != '..')
45
-	    {
44
+		if ($sSubDir != '.' && $sSubDir != '..')
45
+		{
46 46
 		$aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags); 
47 47
 		$aFiles = array_merge($aFiles, $aSubFiles); 
48
-	    }
48
+		}
49 49
 	} 
50 50
 
51 51
 	// return merged array with all (recursive) files
52 52
 	return $aFiles; 
53
-    } 
53
+	} 
54 54
 
55
-    /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
56
-    public function invoke_testReleasedXMLLangFiles
55
+	/** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
56
+	public function invoke_testReleasedXMLLangFiles
57 57
 	(
58
-	    $released_files,
59
-	    $expected_return_code,
60
-	    $validator_args = ''
58
+		$released_files,
59
+		$expected_return_code,
60
+		$validator_args = ''
61 61
 	)
62
-    {
62
+	{
63 63
 	// this file is in tools/dbxml_validator/tests
64 64
 	$xe_dir = __DIR__ . '/../../..';
65 65
 
@@ -70,67 +70,67 @@  discard block
 block discarded – undo
70 70
 	$xml_files = array();
71 71
 
72 72
 	foreach ($released_files as $released_file_mask)
73
-	    $xml_files =
73
+		$xml_files =
74 74
 		array_merge
75 75
 		(
76
-		    $xml_files,
77
-		    $this->globr
76
+			$xml_files,
77
+			$this->globr
78 78
 			(
79
-			    $xe_dir,
80
-			    $released_file_mask,
81
-			    GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
79
+				$xe_dir,
80
+				$released_file_mask,
81
+				GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
82 82
 			)
83 83
 		);
84 84
 
85 85
 	while ($cnt < count($xml_files))
86 86
 	{
87
-	    $cmd = $this->validator_cmd . $validator_args;
87
+		$cmd = $this->validator_cmd . $validator_args;
88 88
 
89
-	    // Validate 50 files at once
90
-	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
89
+		// Validate 50 files at once
90
+		foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
91 91
 		$cmd .= " " . escapeshellarg($xml_file);
92 92
 
93
-	    exec($cmd . ' 2>&1', $validator_output, $return_code);
93
+		exec($cmd . ' 2>&1', $validator_output, $return_code);
94 94
 
95
-	    $output_text = trim(trim(implode("\n", $validator_output)), "\n");
95
+		$output_text = trim(trim(implode("\n", $validator_output)), "\n");
96 96
 
97
-	    // Validator should not crash/exit-with-an-error.
98
-	    $this->assertLessThanOrEqual
97
+		// Validator should not crash/exit-with-an-error.
98
+		$this->assertLessThanOrEqual
99 99
 		(
100
-		    $expected_return_code,
101
-		    $return_code,
102
-		    "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
100
+			$expected_return_code,
101
+			$return_code,
102
+			"{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
103 103
 		);
104 104
 
105
-	    $cnt += 50;
105
+		$cnt += 50;
106
+	}
106 107
 	}
107
-    }
108 108
 
109
-    public function testReleasedXMLQueryLangFiles()
110
-    {
109
+	public function testReleasedXMLQueryLangFiles()
110
+	{
111 111
 	$this->invoke_testReleasedXMLLangFiles
112
-	    (
112
+		(
113 113
 		array('queries/*.xml', 'xml_query/*.xml'),
114 114
 		self::RETCODE_QUERY_ELEMENT
115
-	    );
115
+		);
116 116
 
117 117
 	$this->markTestIncomplete('XML Query Language files should be fixed first.');
118
-    }
118
+	}
119 119
 
120
-    public function testReleasedXMLSchemaLangFiles()
121
-    {
120
+	public function testReleasedXMLSchemaLangFiles()
121
+	{
122 122
 	$this->invoke_testReleasedXMLLangFiles
123
-	    (
123
+		(
124 124
 		array('schemas/*.xml'),
125 125
 		self::RETCODE_BUILTIN_CHECKS,
126 126
 		' --schema-language'
127
-	    );
127
+		);
128 128
 
129 129
 	$this->markTestIncomplete('XML Schema Language files should be fixed first.');
130
-    }
130
+	}
131 131
 
132
-    public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133
-    {
132
+	public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133
+	{
134 134
 	$cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);
135 135
 	$validator_output = array();
136 136
 	$return_code = 0;
@@ -141,88 +141,88 @@  discard block
 block discarded – undo
141 141
 
142 142
 	// Validator should not crash/exit-with-an-error.
143 143
 	$this->assertEquals
144
-	    (
144
+		(
145 145
 		$err_code,
146 146
 		$return_code,
147 147
 		"{$cmd}\n{$output_text}\nValidator returned code {$return_code}."
148
-	    );
148
+		);
149 149
 
150 150
 	// Validator should output some error on the test files
151 151
 	$basefilename = basename($filename);
152 152
 	$this->assertNotEmpty($output_text, "Error reporting failed for {$basefilename} validation.");
153 153
 
154
-    }
154
+	}
155 155
 
156
-    public function testInvalidQueryId()
157
-    {
156
+	public function testInvalidQueryId()
157
+	{
158 158
 	return $this->invoke_testInvalidXmlFiles(__DIR__.'/data/wrongQueryId.xml', self::RETCODE_QUERY_ELEMENT);
159
-    }
159
+	}
160 160
 
161
-    /**
162
-     * @dataProvider getFilesList
163
-     */
164
-    public function testInvalidXMLQueryFiles($filename)
165
-    {
161
+	/**
162
+	 * @dataProvider getFilesList
163
+	 */
164
+	public function testInvalidXMLQueryFiles($filename)
165
+	{
166 166
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);
167
-    }
167
+	}
168 168
 
169
-    public function getDirFilesList($dir_name)
170
-    {
169
+	public function getDirFilesList($dir_name)
170
+	{
171 171
 	$output = array();
172 172
 
173 173
 	$dir = opendir(__DIR__ . '/' . $dir_name);
174 174
 
175 175
 	if ($dir)
176 176
 	{
177
-	    $entry = readdir($dir);
177
+		$entry = readdir($dir);
178 178
 
179
-	    while ($entry !== FALSE)
180
-	    {
179
+		while ($entry !== FALSE)
180
+		{
181 181
 		$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
182 182
 
183 183
 		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
184
-		    $output[] = array($fname);
184
+			$output[] = array($fname);
185 185
 
186 186
 		$entry = readdir($dir);
187
-	    }
187
+		}
188 188
 
189
-	    closedir($dir);
189
+		closedir($dir);
190 190
 	}
191 191
 	else
192
-	    $this->assertFalse(TRUE);
192
+		$this->assertFalse(TRUE);
193 193
 
194
-        return $output;
195
-    }
194
+		return $output;
195
+	}
196 196
 
197
-    public function getFilesList()
198
-    {
197
+	public function getFilesList()
198
+	{
199 199
 	return $this->getDirFilesList('data');
200
-    }
200
+	}
201 201
 
202
-    public function getSchemaFilesList()
203
-    {
202
+	public function getSchemaFilesList()
203
+	{
204 204
 	return $this->getDirFilesList('data/schema');
205
-    }
205
+	}
206 206
 
207
-    public function getSchemaWarningFilesList()
208
-    {
207
+	public function getSchemaWarningFilesList()
208
+	{
209 209
 	return $this->getDirFilesList('data/schema/warnings');
210
-    }
210
+	}
211 211
 
212
-    /**
213
-     * @dataProvider getSchemaFilesList
214
-     */
215
-    public function testInvalidXMLSchemaFiles($filename)
216
-    {
212
+	/**
213
+	 * @dataProvider getSchemaFilesList
214
+	 */
215
+	public function testInvalidXMLSchemaFiles($filename)
216
+	{
217 217
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS, '--schema-language');
218
-    }
218
+	}
219 219
 
220
-    /**
221
-     * @dataProvider getSchemaWarningFilesList
222
-     */
223
-    public function testWarningXMLSchemaFiles($filename)
224
-    {
220
+	/**
221
+	 * @dataProvider getSchemaWarningFilesList
222
+	 */
223
+	public function testWarningXMLSchemaFiles($filename)
224
+	{
225 225
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_SUCCESS, '--schema-language');
226
-    }
226
+	}
227 227
 }
228 228
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xehub.io> */
3 3
 
4
-if (!defined('__DIR__'))
5
-    define('__DIR__', realpath(dirname(__FILE__))); 
4
+if (!defined('__DIR__')) {
5
+    define('__DIR__', realpath(dirname(__FILE__)));
6
+}
6 7
 
7 8
 /** The tests here are meant only for the built-in checks in validator.php, 
8 9
     and not for the entire syntax expressed by the .xsd files. */
@@ -69,8 +70,8 @@  discard block
 block discarded – undo
69 70
 	$cmd = $this->validator_cmd;
70 71
 	$xml_files = array();
71 72
 
72
-	foreach ($released_files as $released_file_mask)
73
-	    $xml_files =
73
+	foreach ($released_files as $released_file_mask) {
74
+		    $xml_files =
74 75
 		array_merge
75 76
 		(
76 77
 		    $xml_files,
@@ -81,14 +82,16 @@  discard block
 block discarded – undo
81 82
 			    GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
82 83
 			)
83 84
 		);
85
+	}
84 86
 
85 87
 	while ($cnt < count($xml_files))
86 88
 	{
87 89
 	    $cmd = $this->validator_cmd . $validator_args;
88 90
 
89 91
 	    // Validate 50 files at once
90
-	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
91
-		$cmd .= " " . escapeshellarg($xml_file);
92
+	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file) {
93
+	    		$cmd .= " " . escapeshellarg($xml_file);
94
+	    }
92 95
 
93 96
 	    exec($cmd . ' 2>&1', $validator_output, $return_code);
94 97
 
@@ -180,16 +183,17 @@  discard block
 block discarded – undo
180 183
 	    {
181 184
 		$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
182 185
 
183
-		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
184
-		    $output[] = array($fname);
186
+		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') {
187
+				    $output[] = array($fname);
188
+		}
185 189
 
186 190
 		$entry = readdir($dir);
187 191
 	    }
188 192
 
189 193
 	    closedir($dir);
194
+	} else {
195
+		    $this->assertFalse(TRUE);
190 196
 	}
191
-	else
192
-	    $this->assertFalse(TRUE);
193 197
 
194 198
         return $output;
195 199
     }
Please login to merge, or discard this patch.