Bläddra i källkod

Merge pull request #91 from ycastillo/yoselyn.6314

Fixing problem of loosing url_id when navigating -refs #6314
Yannick Warnier 11 år sedan
förälder
incheckning
85e8b26749
1 ändrade filer med 10 tillägg och 5 borttagningar
  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'];
         }