Fix: add compatibility with old modules

This commit is contained in:
Regis Houssin 2017-08-27 13:53:08 +02:00
parent 1ce1899a46
commit 526ccc870b
2 changed files with 38 additions and 35 deletions

View File

@ -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.
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'));

View File

@ -123,7 +123,8 @@ if ($disablenofollow) echo '</a>';
</span>
</td></tr>
<?php
/*if (! empty($morelogincontent) && is_array($morelogincontent)) {
if (! empty($morelogincontent)) {
if (is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option)
{
if ($format == 'table') {
@ -131,13 +132,13 @@ if ($disablenofollow) echo '</a>';
echo $option;
}
}
}*/
if (! empty($morelogincontent)) {
}
else {
echo '<!-- Option by hook -->';
echo $morelogincontent;
}
?>
<?php
}
if ($captcha) {
// Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time
@ -279,10 +280,11 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
<!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
<?php if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?>
<?php
/*if (! empty($morelogincontent) && is_array($morelogincontent)) {
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') {
@ -290,14 +292,13 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
echo $option."\n";
}
}
}*/
if (! empty($moreloginextracontent)) {
echo '<!-- Extra option by hook -->';
}
else {
echo '<!-- Javascript by hook -->';
echo $moreloginextracontent;
}
?>
}
<?php
// Google Analytics (need Google module)
if (! empty($conf->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 '</script>'."\n";
}
}
?>
<?php
// Google Adsense
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
{