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

1.9.x
Yannick Warnier 12 years ago
parent 3492a91d34
commit 3e373a87ff
  1. 23
      main/inc/global.inc.php

@ -143,13 +143,26 @@ if (!empty($_configuration['multiple_access_urls'])) {
$pos = strpos($root_rel,'/'); $pos = strpos($root_rel,'/');
$root_rel = substr($root_rel,0,$pos); $root_rel = substr($root_rel,0,$pos);
$protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://'; $protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
$request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/'.$root_rel.'/'; //urls with subdomains
$request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/'.$root_rel.'/'; $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) { 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']; $_configuration['access_url'] = $details['id'];
break; //found one match, get out of foreach
} }
} }
} else { } else {

Loading…
Cancel
Save