From f5bd6574df9e14eea9b6ee26e0d5cc61f5617b3b Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 10 Oct 2010 16:25:28 -0400 Subject: [PATCH] Hotfix for fixing URL generation on dev.horde.org. Commit 043b05f09f66a78566fb broke url generation when an app's webroot is an absolute url like e.g., http://git.horde.org on simon. This can probably be tweaked a bit later, but this fixes the immediate issue. --- framework/Core/lib/Horde.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 13e297c60..6b318960a 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -919,8 +919,9 @@ HTML; $puri = parse_url($uri); $url = ''; + $webroot = ltrim($GLOBALS['registry']->get('webroot', empty($opts['app']) ? null : $opts['app']), '/'); - if ($full && !isset($puri['scheme'])) { + if ($full && !isset($puri['scheme']) && !preg_match('|^([\w+-]{1,20})://|', $webroot) ) { /* Store connection parameters in local variables. */ $server_name = $GLOBALS['conf']['server']['name']; $server_port = $GLOBALS['conf']['server']['port']; @@ -955,10 +956,11 @@ HTML; $url = $protocol . '://' . $server_name; } - if (isset($puri['path']) && substr($puri['path'], 0, 1) == '/') { + if (isset($puri['path']) && substr($puri['path'], 0, 1) == '/' && !preg_match('|^([\w+-]{1,20})://|', $webroot)) { $url .= $puri['path']; + } elseif (isset($puri['path']) && preg_match('|^([\w+-]{1,20})://|', $webroot)) { + $url = $webroot . (substr($puri['path'], 0, 1) != '/' ? '/' : '') . $puri['path']; } else { - $webroot = ltrim($GLOBALS['registry']->get('webroot', empty($opts['app']) ? null : $opts['app']), '/'); $url .= '/' . ($webroot ? $webroot . '/' : '') . (isset($puri['path']) ? $puri['path'] : ''); } -- 2.11.0