aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-04 20:56:14 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-04 20:56:14 +0000
commitb81a214ca823f7078c733828c4455843cf8598d9 (patch)
treecdce2be3e0663c2d415bfc6b21dc68099b9838a1
parenta2511db0c9e2bf53d8c8bc8186b3f80c838d0879 (diff)
downloadelgg-b81a214ca823f7078c733828c4455843cf8598d9.tar.gz
elgg-b81a214ca823f7078c733828c4455843cf8598d9.tar.bz2
Fixes #2463: Added support for forwarding to root-level files, e.g. forward('install.php')
git-svn-id: http://code.elgg.org/elgg/trunk@7238 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/output.php5
-rw-r--r--engine/tests/api/helpers.php9
2 files changed, 14 insertions, 0 deletions
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 6f4ef7b96..2c3324b49 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -160,6 +160,11 @@ function elgg_normalize_url($url) {
return $url;
}
+ // 'install.php', 'install.php?step=step'
+ elseif (preg_match("#^[^/]*\.php(\?.*)?$#i", $url)) {
+ return elgg_get_site_url().$url;
+ }
+
// 'example.com', 'example.com/subpage'
elseif (preg_match("#^[^/]*\.#i", $url)) {
return "http://$url";
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index 8dab74ff8..565cf054a 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -72,10 +72,19 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
'http://example.com' => 'http://example.com',
'https://example.com' => 'https://example.com',
'//example.com' => '//example.com',
+
'example.com' => 'http://example.com',
'example.com/subpage' => 'http://example.com/subpage',
+
'pg/page/handler' => elgg_get_site_url().'pg/page/handler',
'mod/plugin/file.php' => elgg_get_site_url().'mod/plugin/file.php',
+ 'rootfile.php' => elgg_get_site_url().'rootfile.php',
+ 'rootfile.php?setting=setting' => elgg_get_site_url().'rootfile.php?setting=setting',
+
+ '/pg/page/handler' => elgg_get_site_url().'pg/page/handler',
+ '/mod/plugin/file.php' => elgg_get_site_url().'mod/plugin/file.php',
+ '/rootfile.php' => elgg_get_site_url().'rootfile.php',
+ '/rootfile.php?setting=setting' => elgg_get_site_url().'rootfile.php?setting=setting',
);
foreach ($conversions as $input => $output) {