bug fix redirect url with docker installation

This commit is contained in:
Giandonato Inverso
2023-10-17 23:24:34 +02:00
committed by giandonato.inverso@edempg.it
parent c9fa6abf06
commit b52a61ca40
3 changed files with 15 additions and 8 deletions
+12 -7
View File
@@ -117,11 +117,16 @@ function paginationLinks($current_page, $total_pages, $base_url) {
return $html;
}
function base_url(){
return sprintf(
"%s://%s:%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['SERVER_NAME'],
$_SERVER['SERVER_PORT']
);
function base_url() {
require_once(__DIR__ . '/../config/environment.php');
if (defined('BASE_URL') && BASE_URL !== null) {
return BASE_URL;
} else {
return sprintf(
"%s://%s:%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http',
$_SERVER['SERVER_NAME'],
$_SERVER['SERVER_PORT']
);
}
}