From 526ccc870b652e58768c19bcd7dca9f683c5d6f7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 27 Aug 2017 13:53:08 +0200 Subject: [PATCH] Fix: add compatibility with old modules --- htdocs/core/lib/security2.lib.php | 6 ++- htdocs/core/tpl/login.tpl.php | 67 +++++++++++++++---------------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index fa87294b44f..d0def9d5627 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -204,7 +204,11 @@ function dol_loginfunction($langs,$conf,$mysoc) // Execute hook getLoginPageOptions (for table) $parameters=array('entity' => GETPOST('entity','int')); $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. - $morelogincontent = $hookmanager->resPrint; + if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { + $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility + } else { + $morelogincontent = $hookmanager->resPrint; + } // Execute hook getLoginPageExtraOptions (eg for js) $parameters=array('entity' => GETPOST('entity','int')); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 5c603f531f9..b0616cadb80 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -123,27 +123,28 @@ if ($disablenofollow) echo ''; $option) - { - if ($format == 'table') { - echo ''; - echo $option; +if (! empty($morelogincontent)) { + if (is_array($morelogincontent)) { + foreach ($morelogincontent as $format => $option) + { + if ($format == 'table') { + echo ''; + echo $option; + } } } -}*/ -if (! empty($morelogincontent)) { - echo ''; - echo $morelogincontent; + else { + echo ''; + echo $morelogincontent; + } } -?> - @@ -279,25 +280,25 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { -global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?> - $option) - { - if ($format == 'js') { - echo "\n".''; - echo $option."\n"; +if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; + +if (! empty($morelogincontent)) { + if (is_array($morelogincontent)) { + foreach ($morelogincontent as $format => $option) + { + if ($format == 'js') { + echo "\n".''; + echo $option."\n"; + } } } -}*/ -if (! empty($moreloginextracontent)) { - echo ''; - echo $moreloginextracontent; + else { + echo ''; + echo $moreloginextracontent; + } } -?> -google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) { @@ -317,9 +318,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID) print ''."\n"; } } -?> -google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {