From 1b5bcaccc6a529a48ab90cd2753b4dc193dab9cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Oct 2020 04:13:31 +0100 Subject: [PATCH] Fix remove warnings --- htdocs/core/class/hookmanager.class.php | 4 ++-- htdocs/main.inc.php | 7 ++++--- htdocs/stripe/config.php | 8 ++++---- htdocs/theme/eldy/info-box.inc.php | 9 +++++++-- htdocs/theme/eldy/style.css.php | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 39c74b4f059..45dc98f8301 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -105,7 +105,7 @@ class HookManager if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) // We instantiate action class only if initialized hook is handled by module { // Include actions class overwriting hooks - if (! is_object($this->hooks[$context][$module])) // If set, class was already loaded + if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) // If set to an object value, class was already loaded { $path = '/'.$module.'/class/'; $actionfile = 'actions_'.$module.'.class.php'; @@ -144,7 +144,7 @@ class HookManager */ public function executeHooks($method, $parameters = array(), &$object = '', &$action = '') { - if (! is_array($this->hooks) || empty($this->hooks)) return ''; + if (! is_array($this->hooks) || empty($this->hooks)) return 0; $parameters['context']=join(':', $this->contextarray); //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a29de165775..b5626b8dc4a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -238,6 +238,7 @@ if (!empty($conf->debugbar->enabled) && ! GETPOST('dol_use_jmobile') && empty($_ include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; $debugbar = new DolibarrDebugBar(); $renderer = $debugbar->getRenderer(); + if (empty($conf->global->MAIN_HTML_HEADER)) $conf->global->MAIN_HTML_HEADER = ''; $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); @@ -904,7 +905,7 @@ elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) } // set MAIN_OPTIMIZEFORCOLORBLIND -$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? '' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; // Set terminal output option according to conf->browser. if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1; @@ -1145,8 +1146,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // // A default security policy that keep usage of js external component like ckeditor, stripe, google, working // $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';"; //} - //else $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; - $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; + //else + $contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ? '': $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; if (!is_object($hookmanager)) $hookmanager = new HookManager($db); $hookmanager->initHooks(array("main")); diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 0226c724165..829f377fb42 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -34,12 +34,12 @@ global $stripearrayofkeysbyenv; $stripearrayofkeysbyenv = array( 0=>array( - "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, - "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY + "secret_key" => empty($conf->global->STRIPE_TEST_SECRET_KEY) ? '' : $conf->global->STRIPE_TEST_SECRET_KEY, + "publishable_key" => empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_TEST_PUBLISHABLE_KEY ), 1=>array( - "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, - "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY + "secret_key" => empty($conf->global->STRIPE_LIVE_SECRET_KEY) ? '' : $conf->global->STRIPE_LIVE_SECRET_KEY, + "publishable_key" => empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY ) ); diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 268f1885327..175bfce3e2a 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -153,10 +153,15 @@ a.info-box-text{ text-decoration: none;} include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $prefix=''; -//$prefix = 'background-'; if (! empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-'; -if (! isset($conf->global->THEME_AGRESSIVENESS_RATIO) && $prefix) $conf->global->THEME_AGRESSIVENESS_RATIO=-50; +if (! isset($conf->global->THEME_AGRESSIVENESS_RATIO)) { + if ($prefix) { + $conf->global->THEME_AGRESSIVENESS_RATIO = -50; + } else { + $conf->global->THEME_AGRESSIVENESS_RATIO = 0; + } +} if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENESS_RATIO=GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); //var_dump($conf->global->THEME_AGRESSIVENESS_RATIO); ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 4c8a5f2d8ee..941dba9742c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -236,7 +236,7 @@ print 'fontsizesmaller='.$fontsizesmaller."\n"; print 'topMenuFontSize='.$topMenuFontSize."\n"; print 'toolTipBgColor='.$toolTipBgColor."\n"; print 'toolTipFontColor='.$toolTipFontColor."\n"; -print 'conf->global->THEME_AGRESSIVENESS_RATIO='.$conf->global->THEME_AGRESSIVENESS_RATIO." (must be between -100 and +100)\n"; +print 'conf->global->THEME_AGRESSIVENESS_RATIO='.(empty($conf->global->THEME_AGRESSIVENESS_RATIO) ? '' : $conf->global->THEME_AGRESSIVENESS_RATIO)." (must be between -100 and +100)\n"; print '*/'."\n";