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.
$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) // Execute hook getLoginPageExtraOptions (eg for js)
$parameters=array('entity' => GETPOST('entity','int')); $parameters=array('entity' => GETPOST('entity','int'));

View File

@ -123,27 +123,28 @@ if ($disablenofollow) echo '</a>';
</span> </span>
</td></tr> </td></tr>
<?php <?php
/*if (! empty($morelogincontent) && is_array($morelogincontent)) { if (! empty($morelogincontent)) {
foreach ($morelogincontent as $format => $option) if (is_array($morelogincontent)) {
{ foreach ($morelogincontent as $format => $option)
if ($format == 'table') { {
echo '<!-- Option by hook -->'; if ($format == 'table') {
echo $option; echo '<!-- Option by hook -->';
echo $option;
}
} }
} }
}*/ else {
if (! empty($morelogincontent)) { 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'); else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog');
else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); // TODO: provide accessible captcha variants
// TODO: provide accessible captcha variants
?> ?>
<!-- Captcha --> <!-- Captcha -->
<tr> <tr>
@ -279,25 +280,25 @@ 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;
foreach ($morelogincontent as $format => $option)
{ if (! empty($morelogincontent)) {
if ($format == 'js') { if (is_array($morelogincontent)) {
echo "\n".'<!-- Javascript by hook -->'; foreach ($morelogincontent as $format => $option)
echo $option."\n"; {
if ($format == 'js') {
echo "\n".'<!-- Javascript by hook -->';
echo $option."\n";
}
} }
} }
}*/ else {
if (! empty($moreloginextracontent)) { echo '<!-- Javascript by hook -->';
echo '<!-- Extra option 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))
{ {