From b70efb5d7b4bdbb76afd8549b62ba64a0b4ca2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 01:10:33 +0200 Subject: [PATCH] add new rule --- .travis.yml | 4 ++-- htdocs/filefunc.inc.php | 11 +++-------- htdocs/zapier/admin/setup.php | 3 +-- htdocs/zapier/class/hook.class.php | 2 +- htdocs/zapier/hook_agenda.php | 8 ++------ htdocs/zapier/hook_card.php | 8 ++------ htdocs/zapier/hook_document.php | 4 +--- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9958556d42d..752dd572371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -291,8 +291,8 @@ script: # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . + #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b70419de5f4..d1a33d24344 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -87,9 +87,7 @@ if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done // Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails, // but we don't want to change this because when URL is correct, we must be sure the redirect to install/index.php will be correct. $path = ''; - } - else - { + } else { // If what we look is not index.php, we can try to guess location of root. May not work all the time. // There is no real solution, because the only way to know the apache url relative path is to have it into conf file. // If it fails to find correct $path, then only solution is to ask user to enter the correct URL to index.php or install/index.php @@ -114,9 +112,7 @@ if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done if (!empty($dolibarr_strict_mode)) { error_reporting(E_ALL | E_STRICT); -} -else -{ +} else { error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); } @@ -156,8 +152,7 @@ if (!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck)) { $csrfattack = false; if (empty($_SERVER['HTTP_REFERER'])) $csrfattack = true; // An evil browser was used - else - { + else { $tmpa = parse_url($_SERVER['HTTP_HOST']); $tmpb = parse_url($_SERVER['HTTP_REFERER']); if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) $csrfattack = true; diff --git a/htdocs/zapier/admin/setup.php b/htdocs/zapier/admin/setup.php index e608ece5bb7..8a74b525c2b 100644 --- a/htdocs/zapier/admin/setup.php +++ b/htdocs/zapier/admin/setup.php @@ -110,8 +110,7 @@ if ($action == 'edit') { print '
'; print ''.$langs->trans("Modify").''; print '
'; - } else - { + } else { print '
'.$langs->trans("NothingToSetup"); } } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index b985c77434e..280780f8f25 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -398,7 +398,7 @@ class Hook extends CommonObject { $result = $this->fetchCommon($id, $ref); if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); + //$this->fetchLines(); } return $result; } diff --git a/htdocs/zapier/hook_agenda.php b/htdocs/zapier/hook_agenda.php index ca046392cec..b036057cb04 100644 --- a/htdocs/zapier/hook_agenda.php +++ b/htdocs/zapier/hook_agenda.php @@ -45,9 +45,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else -{ +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -217,9 +215,7 @@ if ($object->id > 0) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print ''.$langs->trans("AddAction").''; - } - else - { + } else { print ''.$langs->trans("AddAction").''; } } diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index c2755892716..660e972cf28 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -338,9 +338,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->mymodule->write) { print ''.$langs->trans("Modify").''."\n"; - } - else - { + } else { print ''.$langs->trans('Modify').''."\n"; } @@ -367,9 +365,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->mymodule->delete) { print ''.$langs->trans('Delete').''."\n"; - } - else - { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/zapier/hook_document.php b/htdocs/zapier/hook_document.php index cdc5f8c7ddf..4c390a118e2 100644 --- a/htdocs/zapier/hook_document.php +++ b/htdocs/zapier/hook_document.php @@ -132,9 +132,7 @@ if ($object->id) print ''; dol_fiche_end(); -} -else -{ +} else { accessforbidden('', 0, 0); }