Skip to content
Snippets Groups Projects
Commit 1154091e authored by Giovannoni Laurent's avatar Giovannoni Laurent
Browse files

FIX: makes core/xml/config.xml path absolute to avoid errors

FIX: Better algorythm to build the core URL
parent 1830d0bc
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,10 @@ class portal extends functions ...@@ -41,7 +41,10 @@ class portal extends functions
* Loads Maarch portal configuration into sessions from an xml configuration file (core/xml/config.xml) * Loads Maarch portal configuration into sessions from an xml configuration file (core/xml/config.xml)
*/ */
public function build_config() { public function build_config() {
$xmlconfig = simplexml_load_file('core'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'config.xml'); $xmlconfig = simplexml_load_file(dirname(__FILE__)
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . 'xml'
. DIRECTORY_SEPARATOR . 'config.xml');
foreach($xmlconfig->CONFIG as $CONFIG) { foreach($xmlconfig->CONFIG as $CONFIG) {
$_SESSION['config']['corename'] = (string) $CONFIG->corename; $_SESSION['config']['corename'] = (string) $CONFIG->corename;
$_SESSION['config']['corepath'] = (string) $CONFIG->corepath; $_SESSION['config']['corepath'] = (string) $CONFIG->corepath;
...@@ -76,14 +79,20 @@ class portal extends functions ...@@ -76,14 +79,20 @@ class portal extends functions
if(!preg_match('/:[0-9]+$/', $host)) { if(!preg_match('/:[0-9]+$/', $host)) {
$tmp =$host.$server_port; $tmp =$host.$server_port;
} }
if (isset($_SERVER['HTTP_X_BASE_URL']) if (isset($_SERVER['HTTP_X_BASE_URL'])
&& $_SERVER['HTTP_X_BASE_URL'] <> "" && $_SERVER['HTTP_X_BASE_URL'] <> ""
) { ) {
$uri = $_SERVER['HTTP_X_BASE_URL']; $uri = str_replace($_SERVER['HTTP_X_BASE_URL'], '', $_SERVER['SCRIPT_NAME']);
} else { } else {
$uri = str_replace('index.php','', $uri = $_SERVER['SCRIPT_NAME'];
$_SERVER['SCRIPT_NAME']);
} }
if (($appsInUri = strpos($uri, 'apps')) !== false) {
$uri = substr($uri, 0, $appsInUri);
}
$uri = str_replace('index.php', '', $uri);
$_SESSION['config']['coreurl'] = $protocol . "://" . $tmp $_SESSION['config']['coreurl'] = $protocol . "://" . $tmp
. $uri; . $uri;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment