Explorar o código

Fixing problem of loosing url_id when navigating -refs #6314

Yoselyn Castillo %!s(int64=11) %!d(string=hai) anos
pai
achega
950199a9d7
Modificáronse 1 ficheiros con 10 adicións e 5 borrados
  1. 10 5
      main/inc/global.inc.php

+ 10 - 5
main/inc/global.inc.php

@@ -137,12 +137,17 @@ if (!$_configuration['db_host']) {
 if (!empty($_configuration['multiple_access_urls'])) {
     $_configuration['access_url'] = 1;
     $access_urls = api_get_access_urls();
-
+    
+    $root_rel = api_get_self();
+    $root_rel = substr($root_rel,1);
+    $pos = strpos($root_rel,'/');
+    $root_rel = substr($root_rel,0,$pos);
     $protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
-    $request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/';
-    $request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/';
-
-    foreach ($access_urls as & $details) {
+    $request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/'.$root_rel.'/';
+    $request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/'.$root_rel.'/';
+    
+    
+    foreach ($access_urls as $details) {
         if ($request_url1 == $details['url'] or $request_url2 == $details['url']) {
             $_configuration['access_url'] = $details['id'];
         }