diff options
author | Christian Schneider | 2009-08-10 10:16:44 +0000 |
---|---|---|
committer | Christian Schneider | 2009-08-10 10:16:44 +0000 |
commit | df5810a6fa88aa1f7504cf44a0922ec563fb8351 (patch) | |
tree | 07622adfe2809bebf077caec435d940937dc9f56 | |
parent | b6444754507321571e8c06c91d50d56265c104ba (diff) | |
download | itools-df5810a6fa88aa1f7504cf44a0922ec563fb8351.tar.gz itools-df5810a6fa88aa1f7504cf44a0922ec563fb8351.tar.bz2 itools-df5810a6fa88aa1f7504cf44a0922ec563fb8351.zip |
Support ports othen than port 80, output full url in noredir mode
-rw-r--r-- | it_url.class | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/it_url.class b/it_url.class index 7035291..83c0781 100644 --- a/it_url.class +++ b/it_url.class @@ -583,7 +583,7 @@ function absolute($url=null) { $dir = preg_replace('#/[^/]*$#', '/', $_SERVER['PHP_SELF']); $url = preg_match('#^/#', $url) ? $url : "$dir$url"; - $url = "//" . $_SERVER['HTTP_HOST'] . $url; + $url = "//" . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] == 80 ? "" : ":{$_SERVER['SERVER_PORT']}") . $url; } $url = "http" . (isset($_SERVER['HTTPS']) ? 's':'') . ":$url"; } @@ -598,13 +598,12 @@ function absolute($url=null) */ function redirect($url = null) { + $url = preg_replace("/[\r\n].*/", '', it_url::absolute($url)); # Security: cut after CR/LF + if (EDC('noredir')) - echo "<a href='" . htmlspecialchars(it_url::absolute($url)) . "'>" . htmlspecialchars($url) . "</a><br />"; + echo "<a href='" . htmlspecialchars($url) . "'>" . htmlspecialchars($url) . "</a><br />"; else - { - $url = preg_replace("/[\r\n].*/", '', it_url::absolute($url)); # Security: cut after CR/LF header('Location: ' . it_untaint($url, TC_SELF)); - } exit; } |