From def53338de2c55147ff3d7e7b95a5f5389cb2147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 09:07:10 +0200 Subject: [PATCH] add new rule --- build/generate_filelist_xml.php | 4 +- dev/initdemo/sftpget_and_loaddump.php | 8 +- dev/initdemo/updatedemo.php | 4 +- htdocs/core/class/cunits.class.php | 8 +- htdocs/document.php | 12 +- htdocs/main.inc.php | 36 ++-- htdocs/website/class/website.class.php | 12 +- htdocs/website/class/websitepage.class.php | 5 +- htdocs/website/index.php | 169 ++++++------------ htdocs/website/samples/wrapper.php | 18 +- .../accountancy/export-thirdpartyaccount.php | 6 +- scripts/bank/export-bank-receipts.php | 3 +- .../email_expire_services_to_customers.php | 15 +- ...ail_expire_services_to_representatives.php | 9 +- scripts/cron/cron_run_jobs.php | 9 +- scripts/emailings/mailing-send.php | 15 +- .../email_unpaid_invoices_to_customers.php | 9 +- ...ail_unpaid_invoices_to_representatives.php | 3 +- .../members/sync_members_ldap2dolibarr.php | 6 +- .../sync_members_types_ldap2dolibarr.php | 3 +- scripts/user/sync_groups_ldap2dolibarr.php | 3 +- scripts/user/sync_users_ldap2dolibarr.php | 6 +- 22 files changed, 125 insertions(+), 238 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 976f2cb6ba3..581353b758b 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -110,7 +110,7 @@ print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; print "Include custom in signature : ".$includecustom."\n"; print "Include constants in signature : "; foreach ($includeconstants as $countrycode => $tmp) { - foreach($tmp as $constname => $constvalue) { + foreach ($tmp as $constname => $constvalue) { print $constname.'='.$constvalue." "; } } @@ -130,7 +130,7 @@ fputs($fp, ''."\n"); - foreach($tmp as $constname => $constvalue) { + foreach ($tmp as $constname => $constvalue) { $valueforchecksum=(empty($constvalue)?'0':$constvalue); $checksumconcat[]=$valueforchecksum; fputs($fp, ' '.$valueforchecksum.''."\n"); diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 5b16d3afe9b..4da5ffaad58 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -95,8 +95,7 @@ if ($connection) dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR); exit(-5); } - else - { + else { //$stream = ssh2_exec($connection, '/usr/bin/php -i'); /* print "Generate dump ".$filesys1.'.bz2'."\n"; @@ -125,14 +124,13 @@ if ($connection) $return_var=0; print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n"; exec($fullcommand, $output, $return_var); - foreach($output as $line) print $line."\n"; + foreach ($output as $line) print $line."\n"; //ssh2_sftp_unlink($sftp, $fileinstalllock); //print $output; } } -else -{ +else { print 'Failed to connect to ssh2 to '.$server; exit(-6); } diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 0cc43a18a9d..95d5ad12c83 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -87,7 +87,7 @@ while ($year <= $currentyear) if ($delta1) { - foreach($tables as $tablekey => $tableval) + foreach ($tables as $tablekey => $tableval) { print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." "; $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)"; @@ -105,7 +105,7 @@ while ($year <= $currentyear) print "."; $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set "; $j=0; - foreach($tableval as $field) + foreach ($tableval as $field) { if ($j) $sql2.=", "; $sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)"); diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 0b56b4c0831..80ea8e2f0cc 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -432,11 +432,9 @@ class CUnits // extends CommonObject return round($value, 2); } - - /** * get scale of unit factor - * @param $id int id of unit in dictionary + * @param int $id id of unit in dictionary * @return float|int */ public function scaleOfUnitPow($id) @@ -444,9 +442,9 @@ class CUnits // extends CommonObject $base = 10; // TODO : add base col into unit dictionary table $unit = $this->db->getRow('SELECT scale, unit_type from '.MAIN_DB_PREFIX.'c_units WHERE rowid = '.intval($id)); - if ($unit){ + if ($unit) { // TODO : if base exist in unit dictionary table remove this convertion exception and update convertion infos in database exemple time hour currently scale 3600 will become scale 2 base 60 - if ($unit->unit_type == 'time'){ + if ($unit->unit_type == 'time') { return doubleval($unit->scale); } diff --git a/htdocs/document.php b/htdocs/document.php index c1ed149649e..0d08296e63e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -134,19 +134,16 @@ if (!empty($hashp)) $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; } - else - { + else { accessforbidden('Bad link. File is from another module part.', 0, 0, 1); } } - else - { + else { $modulepart = $moduleparttocheck; $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir } } - else - { + else { $langs->load("errors"); accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); } @@ -185,8 +182,7 @@ if (!empty($hashp)) $accessallowed = 1; // When using hashp, link is public so we force $accessallowed $sqlprotectagainstexternals = ''; } -else -{ +else { // Basic protection (against external users only) if ($user->socid > 0) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 733ded3e447..569f4aa6c57 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1340,23 +1340,17 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr else print ''."\n"; if (!defined('DISABLE_JQUERY_TABLEDND')) print ''."\n"; // jQuery jnotify - if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) - { + if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; } // Flot - if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') - { - if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) - { - if (constant('JS_JQUERY_FLOT')) - { + if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') { + if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) { + if (constant('JS_JQUERY_FLOT')) { print ''."\n"; print ''."\n"; print ''."\n"; - } - else - { + } else { print ''."\n"; print ''."\n"; print ''."\n"; @@ -1375,14 +1369,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } } // Chart - if ($conf->global->MAIN_JS_GRAPH == 'chart') - { + if ($conf->global->MAIN_JS_GRAPH == 'chart') { print ''."\n"; } // jQuery jeditable for Edit In Place features - if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) - { + if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) { print ''."\n"; print ''."\n"; print ''."\n"; @@ -1401,28 +1393,26 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; } // jQuery Timepicker - if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) - { + if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { print ''."\n"; print ''."\n"; } - if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) // jQuery plugin "mutiselect", "multiple-select", "select2", ... - { + if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { + // jQuery plugin "mutiselect", "multiple-select", "select2", ... $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; print ''."\n"; // We include full because we need the support of containerCssClass } } - if (!$disablejs && !empty($conf->use_javascript_ajax)) - { + if (!$disablejs && !empty($conf->use_javascript_ajax)) { // CKEditor if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) { print ''."\n"; $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; $jsckeditor = 'ckeditor.js'; - if (constant('JS_CKEDITOR')) // To use external ckeditor 4 js lib - { + if (constant('JS_CKEDITOR')) { + // To use external ckeditor 4 js lib $pathckeditor = constant('JS_CKEDITOR'); } print '