From 3e373a87ff36ed1d59e7ced2504f8042fa3ee98d Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sat, 3 Aug 2013 16:25:22 -0500 Subject: [PATCH] Added feature to support sub-directories as multi-url identifiers. Still unsafe (cookies) but working. This links to task 6510 but it actually fixes an issue in refs #6314 --- main/inc/global.inc.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index 2bfb9a3367..33be773a47 100644 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -143,13 +143,26 @@ if (!empty($_configuration['multiple_access_urls'])) { $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'].'/'.$root_rel.'/'; - $request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/'.$root_rel.'/'; - - + //urls with subdomains + $request_url_root_1 = $protocol.$_SERVER['SERVER_NAME'].'/'; + $request_url_root_2 = $protocol.$_SERVER['HTTP_HOST'].'/'; + //urls with subdirs + $request_url_sub_1 = $request_url_root_1.$root_rel.'/'; + $request_url_sub_2 = $request_url_root_2.$root_rel.'/'; + + // You can use subdirs as multi-urls, but in this case none of them can be + // the root dir. The admin portal should be something like https://host/adm/ + // At this time, subdirs will still hold a share cookie, so not ideal yet + // see #6510 foreach ($access_urls as $details) { - if ($request_url1 == $details['url'] or $request_url2 == $details['url']) { + if ($request_url_sub_1 == $details['url'] or $request_url_sub_2 == $details['url']) { + $_configuration['access_url'] = $details['id']; + break; //found one match with subdir, get out of foreach + } + // Didn't find any? Now try without subdirs + if ($request_url_root_1 == $details['url'] or $request_url_root_2 == $details['url']) { $_configuration['access_url'] = $details['id']; + break; //found one match, get out of foreach } } } else {