@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n"; |
| 109 | 109 | print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n"; |
| 110 | 110 | print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n"; |
| 111 | -print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? img_picto('', 'tick').' ' .ini_get('session.cookie_samesite') : 'None'); |
|
| 111 | +print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? img_picto('', 'tick').' '.ini_get('session.cookie_samesite') : 'None'); |
|
| 112 | 112 | if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') { |
| 113 | 113 | print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>"; |
| 114 | 114 | } elseif (ini_get('session.cookie_samesite') == 'Strict') { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $todisabletext = ''; |
| 150 | 150 | $i = 0; |
| 151 | 151 | foreach ($arrayoffunctionstodisable as $functiontodisable) { |
| 152 | - if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) { |
|
| 152 | + if (!in_array($functiontodisable, $arrayoffunctionsdisabled)) { |
|
| 153 | 153 | if ($i > 0) { |
| 154 | 154 | $todisabletext .= ', '; |
| 155 | 155 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $todisabletext = ''; |
| 165 | 165 | $i = 0; |
| 166 | 166 | foreach ($arrayoffunctionstodisable2 as $functiontodisable) { |
| 167 | - if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) { |
|
| 167 | + if (!in_array($functiontodisable, $arrayoffunctionsdisabled)) { |
|
| 168 | 168 | if ($i > 0) { |
| 169 | 169 | $todisabletext .= ', '; |
| 170 | 170 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | // JSON |
| 190 | 190 | print '<strong>JSON</strong>: '; |
| 191 | -$loadedExtensions = array_map('strtolower', get_loaded_extensions(false)); |
|
| 191 | +$loadedExtensions = array_map('strtolower', get_loaded_extensions(false)); |
|
| 192 | 192 | $test = !in_array('json', $loadedExtensions); |
| 193 | 193 | if ($test || function_exists('dol_json_decode')) { |
| 194 | 194 | print img_picto('', 'error').' '.$langs->trans("NotInstalled").' - '.$langs->trans("VulnerableToRCEAttack"); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | print '<br>'; |
| 250 | 250 | print '<br>'; |
| 251 | 251 | |
| 252 | -print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php |
|
| 252 | +print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php |
|
| 253 | 253 | $perms = fileperms($dolibarr_main_document_root.'/'.$conffile); |
| 254 | 254 | if ($perms) { |
| 255 | 255 | if (($perms & 0x0004) || ($perms & 0x0002)) { |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | if (!getDolGlobalString('MAIN_ANTIVIRUS_COMMAND')) { |
| 484 | 484 | print ' - <span class="opacitymedium">'.$langs->trans("Recommended").': '.$langs->trans("DefinedAPathForAntivirusCommandIntoSetup", $langs->transnoentitiesnoconv("Home")." - ".$langs->transnoentitiesnoconv("Setup")." - ".$langs->transnoentitiesnoconv("Security")).'</span>'; |
| 485 | 485 | } else { |
| 486 | - print ' - ' . getDolGlobalString('MAIN_ANTIVIRUS_COMMAND'); |
|
| 486 | + print ' - '.getDolGlobalString('MAIN_ANTIVIRUS_COMMAND'); |
|
| 487 | 487 | if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { |
| 488 | 488 | print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>'; |
| 489 | 489 | } |
@@ -494,11 +494,11 @@ discard block |
||
| 494 | 494 | $umask = getDolGlobalString('MAIN_UMASK'); |
| 495 | 495 | |
| 496 | 496 | print '<strong>'.$langs->trans("UMask").'</strong>: '; |
| 497 | -if (! in_array($umask, array('600', '660', '0600', '0660'))) { |
|
| 497 | +if (!in_array($umask, array('600', '660', '0600', '0660'))) { |
|
| 498 | 498 | print img_warning().' '; |
| 499 | 499 | } |
| 500 | 500 | print $umask; |
| 501 | -if (! in_array($umask, array('600', '660', '0600', '0660'))) { |
|
| 501 | +if (!in_array($umask, array('600', '660', '0600', '0660'))) { |
|
| 502 | 502 | print ' <span class="opacitymedium">('.$langs->trans("Recommended").': 0600 | 0660)</span>'; |
| 503 | 503 | } |
| 504 | 504 | print '<br>'; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; |
| 708 | 708 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1; |
| 709 | 709 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
| 710 | -$result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed'); |
|
| 710 | +$result = dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed'); |
|
| 711 | 711 | if ($result == 'InvalidHTMLStringCantBeCleaned') { |
| 712 | 712 | print ' - '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !'; |
| 713 | 713 | } else { |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; |
| 724 | 724 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
| 725 | 725 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
| 726 | - $result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed'); |
|
| 726 | + $result = dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed'); |
|
| 727 | 727 | if ($result == 'InvalidHTMLStringCantBeCleaned') { |
| 728 | 728 | print ' - '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !'; |
| 729 | 729 | } else { |
@@ -326,7 +326,7 @@ |
||
| 326 | 326 | if ($out != '') { |
| 327 | 327 | try { |
| 328 | 328 | // @phan-suppress-next-line PhanPluginUnsafeEval |
| 329 | - eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now. |
|
| 329 | + eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now. |
|
| 330 | 330 | } catch (Exception $e) { |
| 331 | 331 | $array = array(); |
| 332 | 332 | } |
@@ -26,41 +26,41 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | define('PHPUNIT_MODE', 1); |
| 28 | 28 | |
| 29 | -global $conf,$user,$langs,$db; |
|
| 29 | +global $conf, $user, $langs, $db; |
|
| 30 | 30 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 31 | 31 | //require_once 'PHPUnit/Autoload.php'; |
| 32 | 32 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
| 33 | 33 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
| 34 | 34 | |
| 35 | -if (! defined('NOREQUIREUSER')) { |
|
| 35 | +if (!defined('NOREQUIREUSER')) { |
|
| 36 | 36 | define('NOREQUIREUSER', '1'); |
| 37 | 37 | } |
| 38 | -if (! defined('NOREQUIREDB')) { |
|
| 38 | +if (!defined('NOREQUIREDB')) { |
|
| 39 | 39 | define('NOREQUIREDB', '1'); |
| 40 | 40 | } |
| 41 | -if (! defined('NOREQUIRESOC')) { |
|
| 41 | +if (!defined('NOREQUIRESOC')) { |
|
| 42 | 42 | define('NOREQUIRESOC', '1'); |
| 43 | 43 | } |
| 44 | -if (! defined('NOREQUIRETRAN')) { |
|
| 44 | +if (!defined('NOREQUIRETRAN')) { |
|
| 45 | 45 | define('NOREQUIRETRAN', '1'); |
| 46 | 46 | } |
| 47 | -if (! defined('NOCSRFCHECK')) { |
|
| 47 | +if (!defined('NOCSRFCHECK')) { |
|
| 48 | 48 | define('NOCSRFCHECK', '1'); |
| 49 | 49 | } |
| 50 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 50 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 51 | 51 | define('NOTOKENRENEWAL', '1'); |
| 52 | 52 | } |
| 53 | -if (! defined('NOREQUIREMENU')) { |
|
| 53 | +if (!defined('NOREQUIREMENU')) { |
|
| 54 | 54 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 55 | 55 | } |
| 56 | -if (! defined('NOREQUIREHTML')) { |
|
| 56 | +if (!defined('NOREQUIREHTML')) { |
|
| 57 | 57 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 58 | 58 | } |
| 59 | -if (! defined('NOREQUIREAJAX')) { |
|
| 59 | +if (!defined('NOREQUIREAJAX')) { |
|
| 60 | 60 | define('NOREQUIREAJAX', '1'); |
| 61 | 61 | } |
| 62 | -if (! defined("NOLOGIN")) { |
|
| 63 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 62 | +if (!defined("NOLOGIN")) { |
|
| 63 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function testJsonEncode() |
| 82 | 82 | { |
| 83 | 83 | //$this->sharedFixture |
| 84 | - global $conf,$user,$langs,$db; |
|
| 84 | + global $conf, $user, $langs, $db; |
|
| 85 | 85 | $this->savconf = $conf; |
| 86 | 86 | $this->savuser = $user; |
| 87 | 87 | $this->savlangs = $langs; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->assertEquals(null, $decoded, 'test to json_decode() a string that was encoded with serialize()'); |
| 98 | 98 | |
| 99 | 99 | // Do a test with an array starting with 0 |
| 100 | - $arraytotest = array(0 => array('key' => 1,'value' => 'PRODREF','label' => 'Product ref with é and special chars \\ \' "')); |
|
| 100 | + $arraytotest = array(0 => array('key' => 1, 'value' => 'PRODREF', 'label' => 'Product ref with é and special chars \\ \' "')); |
|
| 101 | 101 | $arrayencodedexpected = '[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]'; |
| 102 | 102 | |
| 103 | 103 | $encoded = json_encode($arraytotest); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | |
| 115 | 115 | // Same test but array start with 2 instead of 0 |
| 116 | - $arraytotest = array(2 => array('key' => 1,'value' => 'PRODREF','label' => 'Product ref with é and special chars \\ \' "')); |
|
| 116 | + $arraytotest = array(2 => array('key' => 1, 'value' => 'PRODREF', 'label' => 'Product ref with é and special chars \\ \' "')); |
|
| 117 | 117 | $arrayencodedexpected = '{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}'; |
| 118 | 118 | |
| 119 | 119 | $encoded = json_encode($arraytotest); |