]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2463: Added support for forwarding to root-level files, e.g. forward('install...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Nov 2010 20:56:14 +0000 (20:56 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Nov 2010 20:56:14 +0000 (20:56 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7238 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/output.php
engine/tests/api/helpers.php

index 6f4ef7b962af9adbd1b02a80a092d659d0617d89..2c3324b49495e390ea53db3cb38031ab5c0e9b2c 100644 (file)
@@ -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";
index 8dab74ff8e0a4514f6f5a3267ae4c4c301583e8a..565cf054a58d403975dcbf0cd27a13419b76edc0 100644 (file)
@@ -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) {