Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created March 2, 2009 17:38
Show Gist options
  • Save shadowhand/72877 to your computer and use it in GitHub Desktop.
Save shadowhand/72877 to your computer and use it in GitHub Desktop.
Index: /Volumes/Webserver/Checkout/mukuru/system/libraries/Router.php
===================================================================
--- /Volumes/Webserver/Checkout/mukuru/system/libraries/Router.php (revision 4024)
+++ /Volumes/Webserver/Checkout/mukuru/system/libraries/Router.php (working copy)
@@ -35,12 +35,6 @@
*/
public static function setup()
{
- if ( ! empty($_SERVER['QUERY_STRING']))
- {
- // Set the query string to the current query string
- self::$query_string = '?'.trim($_SERVER['QUERY_STRING'], '&/');
- }
-
if (self::$routes === NULL)
{
// Load routes
@@ -63,18 +57,9 @@
$default_route = TRUE;
}
- // Make sure the URL is not tainted with HTML characters
- self::$current_uri = html::specialchars(self::$current_uri, FALSE);
-
- // Remove all dot-paths from the URI, they are not valid
- self::$current_uri = preg_replace('#\.[\s./]*/#', '', self::$current_uri);
-
// At this point segments, rsegments, and current URI are all the same
self::$segments = self::$rsegments = self::$current_uri = trim(self::$current_uri, '/');
- // Set the complete URI
- self::$complete_uri = self::$current_uri.self::$query_string;
-
// Explode the segments by slashes
self::$segments = ($default_route === TRUE OR self::$segments === '') ? array() : explode('/', self::$segments);
@@ -241,6 +226,21 @@
// Reduce multiple slashes into single slashes
self::$current_uri = preg_replace('#//+#', '/', self::$current_uri);
}
+
+ // Make sure the URL is not tainted with HTML characters
+ self::$current_uri = html::specialchars(self::$current_uri, FALSE);
+
+ // Remove all dot-paths from the URI, they are not valid
+ self::$current_uri = preg_replace('#\.[\s./]*/#', '', self::$current_uri);
+
+ if ( ! empty($_SERVER['QUERY_STRING']))
+ {
+ // Set the query string to the current query string
+ self::$query_string = '?'.trim($_SERVER['QUERY_STRING'], '&/');
+ }
+
+ // Set the complete URI
+ self::$complete_uri = self::$current_uri.self::$query_string;
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment