Completed
Branch develop (e217cd)
by
unknown
25:11
created
test/phpunit/SecurityTest.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
  *		\remarks	To run this script as CLI:  phpunit filename.php
26 26
  */
27 27
 
28
-global $conf,$user,$langs,$db;
28
+global $conf, $user, $langs, $db;
29 29
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
30 30
 //require_once 'PHPUnit/Autoload.php';
31 31
 
32
-if (! defined('NOREQUIRESOC')) {
32
+if (!defined('NOREQUIRESOC')) {
33 33
 	define('NOREQUIRESOC', '1');
34 34
 }
35
-if (! defined('NOCSRFCHECK')) {
35
+if (!defined('NOCSRFCHECK')) {
36 36
 	define('NOCSRFCHECK', '1');
37 37
 }
38
-if (! defined('NOTOKENRENEWAL')) {
38
+if (!defined('NOTOKENRENEWAL')) {
39 39
 	define('NOTOKENRENEWAL', '1');
40 40
 }
41
-if (! defined('NOREQUIREMENU')) {
41
+if (!defined('NOREQUIREMENU')) {
42 42
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
43 43
 }
44
-if (! defined('NOREQUIREHTML')) {
44
+if (!defined('NOREQUIREHTML')) {
45 45
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
46 46
 }
47
-if (! defined('NOREQUIREAJAX')) {
47
+if (!defined('NOREQUIREAJAX')) {
48 48
 	define('NOREQUIREAJAX', '1');
49 49
 }
50
-if (! defined("NOLOGIN")) {
51
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
50
+if (!defined("NOLOGIN")) {
51
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
52 52
 }
53
-if (! defined("NOSESSION")) {
53
+if (!defined("NOSESSION")) {
54 54
 	define("NOSESSION", '1');
55 55
 }
56 56
 
57
-require_once dirname(__FILE__).'/../../htdocs/main.inc.php';	// We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
57
+require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
58 58
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
59 59
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
60 60
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		$result = testSqlAndScriptInject($test, 0);
229 229
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee');
230 230
 
231
-		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">";		// Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
232
-		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">";	// Same
231
+		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
232
+		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">"; // Same
233 233
 
234 234
 		$test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>';
235 235
 		$result = testSqlAndScriptInject($test, 0);
@@ -263,21 +263,21 @@  discard block
 block discarded – undo
263 263
 		$result = testSqlAndScriptInject($test, 0);
264 264
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll');
265 265
 
266
-		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>';	// Add the char %F6 into the variable
266
+		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable
267 267
 		$result = testSqlAndScriptInject($test, 0);
268 268
 		//print "test=".$test." result=".$result."\n";
269 269
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm');
270 270
 
271 271
 
272 272
 		$test = "Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)";
273
-		$result = testSqlAndScriptInject($test, 0);	// result must be 0
273
+		$result = testSqlAndScriptInject($test, 0); // result must be 0
274 274
 		$this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not');
275 275
 
276 276
 		$test = '<a href="j&Tab;a&Tab;v&Tab;asc&NewLine;ri&Tab;pt:&lpar;a&Tab;l&Tab;e&Tab;r&Tab;t&Tab;(document.cookie)&rpar;">XSS</a>';
277 277
 		$result = testSqlAndScriptInject($test, 0);
278 278
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not');
279 279
 
280
-		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc";	// Add the char %F6 into the variable
280
+		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable
281 281
 		$result = testSqlAndScriptInject($test, 2);
282 282
 		//print "test=".$test." result=".$result."\n";
283 283
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char');
@@ -389,21 +389,21 @@  discard block
 block discarded – undo
389 389
 	{
390 390
 		global $conf;
391 391
 
392
-		$genpass1 = getRandomPassword(true);				// Should be a string return by dol_hash (if no option set, will be md5)
392
+		$genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
393 393
 		print __METHOD__." genpass1=".$genpass1."\n";
394 394
 		$this->assertEquals(strlen($genpass1), 32);
395 395
 
396
-		$genpass1 = getRandomPassword(true, array('I'));	// Should be a string return by dol_hash (if no option set, will be md5)
396
+		$genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5)
397 397
 		print __METHOD__." genpass1=".$genpass1."\n";
398 398
 		$this->assertEquals(strlen($genpass1), 32);
399 399
 
400 400
 		$conf->global->USER_PASSWORD_GENERATED = 'None';
401
-		$genpass2 = getRandomPassword(false);				// Should return an empty string
401
+		$genpass2 = getRandomPassword(false); // Should return an empty string
402 402
 		print __METHOD__." genpass2=".$genpass2."\n";
403 403
 		$this->assertEquals($genpass2, '');
404 404
 
405 405
 		$conf->global->USER_PASSWORD_GENERATED = 'Standard';
406
-		$genpass3 = getRandomPassword(false);				// Should return a password of 12 chars
406
+		$genpass3 = getRandomPassword(false); // Should return a password of 12 chars
407 407
 		print __METHOD__." genpass3=".$genpass3."\n";
408 408
 		$this->assertEquals(strlen($genpass3), 12);
409 409
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function testRestrictedArea()
419 419
 	{
420
-		global $conf,$user,$langs,$db;
420
+		global $conf, $user, $langs, $db;
421 421
 		$conf = $this->savconf;
422 422
 		$user = $this->savuser;
423 423
 		$langs = $this->savlangs;
@@ -448,40 +448,40 @@  discard block
 block discarded – undo
448 448
 		$tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']);
449 449
 		$this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should.");
450 450
 
451
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
452
-		$tmp = getURLContent($url, 'GET', '', 0);	// We do NOT follow
451
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
452
+		$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
453 453
 		print __METHOD__." url=".$url."\n";
454 454
 		$this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response');
455 455
 
456
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
457
-		$tmp = getURLContent($url);		// We DO follow a page with return 300 so result should be 200
456
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
457
+		$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
458 458
 		print __METHOD__." url=".$url."\n";
459 459
 		$this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code']));
460 460
 
461 461
 		$url = 'http://localhost';
462
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
462
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
463 463
 		print __METHOD__." url=".$url."\n";
464
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL');	// Test we receive an error because localtest.me is not an external URL
464
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
465 465
 
466 466
 		$url = 'http://127.0.0.1';
467
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
467
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
468 468
 		print __METHOD__." url=".$url."\n";
469
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.0.1 is not an external URL
469
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
470 470
 
471 471
 		$url = 'http://127.0.2.1';
472
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
472
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
473 473
 		print __METHOD__." url=".$url."\n";
474
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.2.1 is not an external URL
474
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
475 475
 
476 476
 		$url = 'https://169.254.0.1';
477
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
477
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
478 478
 		print __METHOD__." url=".$url."\n";
479
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 169.254.0.1 is not an external URL
479
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
480 480
 
481 481
 		$url = 'http://[::1]';
482
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
482
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
483 483
 		print __METHOD__." url=".$url."\n";
484
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because [::1] is not an external URL
484
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
485 485
 
486 486
 		/*$url = 'localtest.me';
487 487
 		 $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 		 */
491 491
 
492 492
 		$url = 'http://192.0.0.192';
493
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL but on an IP in blacklist
493
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist
494 494
 		print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n";
495
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not');	// Test we receive an error because ip is in blacklist
495
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist
496 496
 
497 497
 		return 0;
498 498
 	}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function testDolSanitizeUrl()
506 506
 	{
507
-		global $conf,$user,$langs,$db;
507
+		global $conf, $user, $langs, $db;
508 508
 		$conf = $this->savconf;
509 509
 		$user = $this->savuser;
510 510
 		$langs = $this->savlangs;
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	public function testDolSanitizeEmail()
532 532
 	{
533
-		global $conf,$user,$langs,$db;
533
+		global $conf, $user, $langs, $db;
534 534
 		$conf = $this->savconf;
535 535
 		$user = $this->savuser;
536 536
 		$langs = $this->savlangs;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function testDolSanitizeFileName()
562 562
 	{
563
-		global $conf,$user,$langs,$db;
563
+		global $conf, $user, $langs, $db;
564 564
 		$conf = $this->savconf;
565 565
 		$user = $this->savuser;
566 566
 		$langs = $this->savlangs;
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 */
584 584
 	public function testDolEval()
585 585
 	{
586
-		global $conf,$user,$langs,$db;
586
+		global $conf, $user, $langs, $db;
587 587
 		$conf = $this->savconf;
588 588
 		$user = $this->savuser;
589 589
 		$langs = $this->savlangs;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
594 594
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
595 595
 
596
-		$result = dol_eval('1==\x01', 1, 0);	// Check that we can't make dol_eval on string containing \ char.
596
+		$result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char.
597 597
 		print "result0 = ".$result."\n";
598 598
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result);
599 599
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 		// Now string not allowed
641 641
 
642 642
 		$s = '4 <5';
643
-		$result = (string) dol_eval($s, 1, 1, '2');		// in mode 2, char < is allowed only if followed by a space
643
+		$result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space
644 644
 		print "result = ".$result."\n";
645 645
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 <5 - The string was not detected as evil');
646 646
 
647 647
 		$s = '4 < 5';
648
-		$result = (string) dol_eval($s, 1, 1, '1');		// in mode 1, char < is always forbidden
648
+		$result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden
649 649
 		print "result = ".$result."\n";
650 650
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 < 5 - The string was not detected as evil');
651 651
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		print "result = ".$result."\n";
660 660
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil');
661 661
 
662
-		$result = dol_eval('$a=function() { }; $a', 1, 1, '0');		// result of dol_eval may be an object Closure
662
+		$result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure
663 663
 		print "result5 = ".json_encode($result)."\n";
664 664
 		$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil');
665 665
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		// Must be allowed
703 703
 
704
-		global $leftmenu;	// Used into strings to eval
704
+		global $leftmenu; // Used into strings to eval
705 705
 
706 706
 		$leftmenu = 'AAA';
707 707
 		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1');
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 		$this->assertFalse($result);
726 726
 
727 727
 		$leftmenu = 'XXX';
728
-		$conf->global->MAIN_FEATURES_LEVEL = 1;		// Force for the case option is -1
728
+		$conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1
729 729
 		$string = '(isModEnabled("agenda") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)';
730 730
 		$result = dol_eval($string, 1, 1, '1');
731 731
 		print "result17 = ".$result."\n";
732 732
 		$this->assertTrue($result);
733 733
 
734
-		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...'
734
+		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...'
735 735
 		print "result18 = ".$result."\n";
736 736
 		$this->assertFalse($result);
737 737
 
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
 		global $conf;
772 772
 
773 773
 		// Set options for cleaning data
774
-		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;	// disabled, does not work on HTML5 and some libxml versions
774
+		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions
775 775
 		// Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible
776 776
 		if (extension_loaded('tidy') && class_exists("tidy")) {
777 777
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
778 778
 		}
779
-		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;	// disabled, does not work on HTML5 and some libxml versions
779
+		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
780 780
 
781 781
 
782 782
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1);
789 789
 		$result = dolPrintHTML($stringtotest);
790 790
 		print __METHOD__." result=".$result."\n";
791
-		$this->assertEquals($stringfixed, $result, 'Error');    // Expected '' because should failed because login 'auto' does not exists
791
+		$this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists
792 792
 
793 793
 
794 794
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 		// With cleaning options of HTML TIDY
858 858
 		if (extension_loaded('tidy') && class_exists("tidy")) {
859 859
 			$stringtotest = "Message<br>with ' and &egrave; and &#39; !";
860
-			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !";		// The &#39; is modified into ' because html tidy fix it.
860
+			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !"; // The &#39; is modified into ' because html tidy fix it.
861 861
 			/*
862 862
 			var_dump($stringtotest);
863 863
 			var_dump(dol_htmlentitiesbr($stringtotest));
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
 		$this->assertEquals('a', $result);
890 890
 
891 891
 		// Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range
892
-		$arraytmp = array(0 => '&#9989;', 1 => '9989;');	// Encoded as decimal
892
+		$arraytmp = array(0 => '&#9989;', 1 => '9989;'); // Encoded as decimal
893 893
 		$result = realCharForNumericEntities($arraytmp);
894 894
 		$this->assertEquals('✅', $result);
895 895
 
896
-		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;');	// Encoded as hexadecimal
896
+		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;'); // Encoded as hexadecimal
897 897
 		$result = realCharForNumericEntities($arraytmp);
898 898
 		$this->assertEquals('✅', $result);
899 899
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 		// For a string with js and link with restricthtmlallowlinkscript
964 964
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
965 965
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
966
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
966
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
967 967
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
968 968
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
969 969
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 		// For a string with js and link with restricthtmlallowlinkscript
977 977
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
978 978
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
979
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
979
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
980 980
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
981 981
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
982 982
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 		// For a string with js and link with restricthtmlallowlinkscript
990 990
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
991 991
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
992
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
992
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
993 993
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
994 994
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
995 995
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/content/tables.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 // Includes
36
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
37 37
 
38 38
 // Load documentation translations
39 39
 $langs->load('uxdocumentation');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 // Set view for menu and breadcrumb
51 51
 // Menu must be set in constructor of documentation class
52
-$documentation->view = array('Content','Tables');
52
+$documentation->view = array('Content', 'Tables');
53 53
 
54 54
 // Output sidebar
55 55
 $documentation->showSidebar(); ?>
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/class/documentation.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 		$arrayofcss[] = 'admin/tools/ui/css/documentation.css';
197 197
 
198
-		top_htmlhead('',  $title, 0, 0, $arrayofjs, $arrayofcss);
198
+		top_htmlhead('', $title, 0, 0, $arrayofjs, $arrayofcss);
199 199
 
200 200
 		print '<body class="dolibarr-doc">';
201 201
 	}
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	public function showCode($lines = array(), $option = 'html')
395 395
 	{
396
-		require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
396
+		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
397 397
 		print '<div class="documentation-code">';
398
-		$content = implode("\n", $lines) . "\n";
398
+		$content = implode("\n", $lines)."\n";
399 399
 		$doleditor = new DolEditor(md5($content), $content, '', 0, 'Basic', 'In', true, false, 'ace', 0, '99%', 1);
400 400
 		print $doleditor->Create(1, '', false, '', $option);
401 401
 		print '</div>';
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 }
33 33
 
34 34
 // Includes
35
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
36 36
 
37 37
 // Load documentation translations
38 38
 $langs->load('uxdocumentation');
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/components/progress-bars.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 // Includes
36
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
37 37
 
38 38
 // Load documentation translations
39 39
 $langs->load('uxdocumentation');
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 // Set view for menu and breadcrumb
53 53
 // Menu must be set in constructor of documentation class
54
-$documentation->view = array('Components','Progress');
54
+$documentation->view = array('Components', 'Progress');
55 55
 
56 56
 // Output sidebar
57 57
 $documentation->showSidebar(); ?>
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/components/event-message.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 // Includes
36
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
37 37
 
38 38
 // Load documentation translations
39 39
 $langs->load('uxdocumentation');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 // Set view for menu and breadcrumb
69 69
 // Menu must be set in constructor of documentation class
70
-$documentation->view = array('Components','Event Message');
70
+$documentation->view = array('Components', 'Event Message');
71 71
 
72 72
 // Output sidebar
73 73
 $documentation->showSidebar(); ?>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 					$label = 'My action label used for accessibility visually for impaired people';
102 102
 					$user_right = 1;
103 103
 
104
-					$html = '<span class="fa fa-comments paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayMessages');;
104
+					$html = '<span class="fa fa-comments paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayMessages'); ;
105 105
 					$action_type = 'displayeventmessages';
106 106
 					$url = $_SERVER["PHP_SELF"].'?action=displayeventmessages';
107 107
 					print dolGetButtonAction($label, $html, $action_type, $url, '', $user_right); ?>
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 				<?php
139 139
 				$label = 'My action label used for accessibility visually for impaired people';
140 140
 				$user_right = 1;
141
-				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayOKMessage');;
141
+				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayOKMessage'); ;
142 142
 				$action_type = 'displayeventmessageok';
143 143
 				$url = $_SERVER["PHP_SELF"].'?action=displayeventmessageok#seteventmessagesection-contextvariations';
144 144
 				$params['attr']['style'] = 'background: #446548';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 				$label = 'My action label used for accessibility visually for impaired people';
148 148
 				$user_right = 1;
149
-				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayWarningMessage');;
149
+				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayWarningMessage'); ;
150 150
 				$action_type = 'displayeventmessagewarning';
151 151
 				$url = $_SERVER["PHP_SELF"].'?action=displayeventmessagewarning#seteventmessagesection-contextvariations';
152 152
 				$params['attr']['style'] = 'background: #a28918';
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 				$label = 'My action label used for accessibility visually for impaired people';
156 156
 				$user_right = 1;
157
-				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayErrorMessage');;
157
+				$html = '<span class="fa fa-comment paddingright"></span>'.$langs->trans('DocSetEventMessageDisplayErrorMessage'); ;
158 158
 				$action_type = 'displayeventmessageerror';
159 159
 				$url = $_SERVER["PHP_SELF"].'?action=displayeventmessageerror#seteventmessagesection-contextvariations';
160 160
 				$params['attr']['style'] = 'background: #a72947';
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/components/buttons.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 // Includes
36
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
37 37
 
38 38
 // Load documentation translations
39 39
 $langs->load('uxdocumentation');
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Set view for menu and breadcrumb
52 52
 // Menu must be set in constructor of documentation class
53
-$documentation->view = array('Components','Buttons');
53
+$documentation->view = array('Components', 'Buttons');
54 54
 
55 55
 // Output sidebar
56 56
 $documentation->showSidebar(); ?>
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				$html = '<span class="fa fa-trash-alt paddingright" aria-hidden="true"></span> My delete action';
159 159
 				$actionType = 'delete';
160 160
 				$id = 'button-id-8';
161
-				$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
161
+				$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
162 162
 				$params = array(
163 163
 					'confirm' => array(
164 164
 						'url' => 'your confirm action url',
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/components/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 }
34 34
 
35 35
 // Includes
36
-require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php';
37 37
 
38 38
 // Load documentation translations
39 39
 $langs->load('uxdocumentation');
Please login to merge, or discard this patch.
htdocs/admin/tools/ui/components/test_buttons.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	$actionType = 'delete';
93 93
 	$n++;
94 94
 	$id = 'mybuttonid'.$n;
95
-	$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
95
+	$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
96 96
 	print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight);
97 97
 
98 98
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	$actionType = 'danger';
101 101
 	$n++;
102 102
 	$id = 'mybuttonid'.$n;
103
-	$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
103
+	$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
104 104
 	print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight);
105 105
 
106 106
 	?>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	$actionType = 'delete';
126 126
 	$n++;
127 127
 	$id = 'mybuttonid'.$n;
128
-	$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
128
+	$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
129 129
 	print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight);
130 130
 
131 131
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	$actionType = 'danger';
134 134
 	$n++;
135 135
 	$id = 'mybuttonid'.$n;
136
-	$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
136
+	$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
137 137
 	print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight);
138 138
 
139 139
 	?>
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$actionType = 'delete';
165 165
 		$n++;
166 166
 		$id = 'mybuttonid'.$n;
167
-		$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
167
+		$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
168 168
 
169 169
 		$params = array(
170 170
 			'confirm' => array(
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		$actionType = 'delete';
204 204
 		$n++;
205 205
 		$id = 'mybuttonid'.$n;
206
-		$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
206
+		$url = $_SERVER['PHP_SELF'].'?token='.newToken().'#'.$id;
207 207
 
208 208
 		$params = array(
209 209
 			'confirm' => array(
Please login to merge, or discard this patch.