FIX Debug bad path used into webportal. Missing http headers in login.

This commit is contained in:
ldestailleur 2025-09-14 19:45:41 +02:00
parent a3881ef67b
commit cf5caa80b2
7 changed files with 25 additions and 8 deletions

View file

@ -1803,9 +1803,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
}
// To fix old chrome bug
/*
if (getDolGlobalString('MAIN_FIX_FLASH_ON_CHROME')) {
print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n";
}
*/
// LEAFLET AND GEOMAN
if (getDolGlobalString('MAIN_USE_GEOPHP')) {

View file

@ -42,4 +42,6 @@ $context->controllerInstance->action();
* View
*/
// $context->controllerInstance can be LoginController, DefaultController, DocumentController...
$context->controllerInstance->display();

View file

@ -15,6 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var Context $context Object context for webportal
*/
// Protection to avoid direct call of template
if (empty($context) || !is_object($context)) {
print "Error, template page can't be called as URL";

View file

@ -1,5 +1,9 @@
<!-- file header_login.tpl.php -->
<?php
/**
* @var Context $context Object Context for webportal
*/
// Protection to avoid direct call of template
if (empty($context) || !is_object($context)) {
print "Error, template page can't be called as URL";
@ -7,6 +11,10 @@ if (empty($context) || !is_object($context)) {
}
global $langs;
// Return HTTP headers
top_httphead();
?>
<!DOCTYPE html>
<?php print '<html lang="'.substr($langs->defaultlang, 0, 2) . '">'."\n"; ?>

View file

@ -179,7 +179,7 @@ class Context
*/
private function __construct()
{
global $conf, $db;
global $db;
$this->db = $db;
@ -204,7 +204,7 @@ class Context
$this->initController();
// Init de l'url de base
// Init of base URL. Must be the public URL.
$this->rootUrl = self::getRootConfigUrl();
@ -306,16 +306,14 @@ class Context
*/
public static function getRootConfigUrl()
{
global $conf;
// Init de l'url de base
// Init of base URL
if (getDolGlobalString('WEBPORTAL_ROOT_URL')) {
$rootUrl = getDolGlobalString('WEBPORTAL_ROOT_URL');
if (substr($rootUrl, -1) !== '/') {
$rootUrl .= '/';
}
} else {
$rootUrl = dol_buildpath('/public/webportal/', 2);
$rootUrl = dol_buildpath('/public/webportal/', 3); // Return the public URL for external access
}
return $rootUrl;

View file

@ -205,7 +205,9 @@ class Controller
{
global $conf, $langs, $hookmanager, $db; // may be used into the tpl
$context = Context::getInstance(); // load for tpl
// load for tpl
// This set $context->rootUrl
$context = Context::getInstance();
if (!preg_match('/^[0-9\.A-ZaZ_\-]*$/ui', $templateName)) {
return false;

View file

@ -63,7 +63,7 @@ class LoginController extends Controller
}
/**
* Display
* Display the login page
*
* @return void
*/