add new rule

This commit is contained in:
Frédéric FRANCE 2020-05-21 15:13:31 +02:00
parent d9f42f85d1
commit 674b0e38c8
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
7 changed files with 14 additions and 27 deletions

View File

@ -214,7 +214,7 @@
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> --> <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> -->
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" /> <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

View File

@ -133,17 +133,14 @@ if (!empty($hashp))
// We remove first level of directory // We remove first level of directory
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
//var_dump($original_file); exit; //var_dump($original_file); exit;
} } else {
else {
accessforbidden('Bad link. File is from another module part.', 0, 0, 1); accessforbidden('Bad link. File is from another module part.', 0, 0, 1);
} }
} } else {
else {
$modulepart = $moduleparttocheck; $modulepart = $moduleparttocheck;
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
} }
} } else {
else {
$langs->load("errors"); $langs->load("errors");
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1);
} }
@ -181,8 +178,7 @@ if (!empty($hashp))
{ {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed $accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = ''; $sqlprotectagainstexternals = '';
} } else {
else {
// Basic protection (against external users only) // Basic protection (against external users only)
if ($user->socid > 0) if ($user->socid > 0)
{ {

View File

@ -127,8 +127,7 @@ if (GETPOST("cache", 'alpha'))
{ {
header('Cache-Control: max-age=3600, public, must-revalidate'); header('Cache-Control: max-age=3600, public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache header('Pragma: cache'); // This is to avoid having Pragma: no-cache
} } else header('Cache-Control: no-cache');
else header('Cache-Control: no-cache');
//print $dolibarr_nocache; exit; //print $dolibarr_nocache; exit;
} }

View File

@ -201,17 +201,14 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration') if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration')
{ {
// Test for migration files only // Test for migration files only
} } elseif ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/data')
elseif ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/data')
{ {
// Test for data files only // Test for data files only
} } else {
else {
if (preg_match('/\.key\.sql$/', $file)) if (preg_match('/\.key\.sql$/', $file))
{ {
// Test for key files only // Test for key files only
} } else {
else {
// Test for non key files only // Test for non key files only
$result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0); $result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0);
print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n"; print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";

View File

@ -186,8 +186,7 @@ class FactureRecTest extends PHPUnit\Framework\TestCase
if (get_class($oA) !== get_class($oB)) if (get_class($oA) !== get_class($oB))
{ {
$retAr[]="Supplied objects are not of same class."; $retAr[]="Supplied objects are not of same class.";
} } else {
else {
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);

View File

@ -365,8 +365,7 @@ class FactureTest extends PHPUnit\Framework\TestCase
if (get_class($oA) !== get_class($oB)) if (get_class($oA) !== get_class($oB))
{ {
$retAr[]="Supplied objects are not of same class."; $retAr[]="Supplied objects are not of same class.";
} } else {
else {
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);

View File

@ -255,8 +255,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} } catch (SoapFault $exception)
catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;
@ -313,8 +312,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} } catch (SoapFault $exception)
catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;
@ -413,8 +411,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} } catch (SoapFault $exception)
catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;