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) // Execute hook getLoginPageOptions (for table)
$parameters=array('entity' => GETPOST('entity','int')); $parameters=array('entity' => GETPOST('entity','int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. $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; $morelogincontent = $hookmanager->resPrint;
}
// Execute hook getLoginPageExtraOptions (eg for js) // Execute hook getLoginPageExtraOptions (eg for js)
$parameters=array('entity' => GETPOST('entity','int')); $parameters=array('entity' => GETPOST('entity','int'));

View File

@ -123,7 +123,8 @@ if ($disablenofollow) echo '</a>';
</span> </span>
</td></tr> </td></tr>
<?php <?php
/*if (! empty($morelogincontent) && is_array($morelogincontent)) { if (! empty($morelogincontent)) {
if (is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option) foreach ($morelogincontent as $format => $option)
{ {
if ($format == 'table') { if ($format == 'table') {
@ -131,14 +132,14 @@ if ($disablenofollow) echo '</a>';
echo $option; echo $option;
} }
} }
}*/ }
if (! empty($morelogincontent)) { else {
echo '<!-- Option by hook -->'; echo '<!-- Option by hook -->';
echo $morelogincontent; echo $morelogincontent;
}
} }
?>
<?php if ($captcha) {
if ($captcha) {
// Add a variable param to force not using cache (jmobile) // Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time
if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog');
@ -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 --> <!-- 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 <?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) foreach ($morelogincontent as $format => $option)
{ {
if ($format == 'js') { if ($format == 'js') {
@ -290,14 +292,13 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
echo $option."\n"; echo $option."\n";
} }
} }
}*/ }
if (! empty($moreloginextracontent)) { else {
echo '<!-- Extra option by hook -->'; echo '<!-- Javascript by hook -->';
echo $moreloginextracontent; echo $moreloginextracontent;
}
} }
?>
<?php
// Google Analytics (need Google module) // Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) 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"; print '</script>'."\n";
} }
} }
?>
<?php
// Google Adsense // Google Adsense
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
{ {