summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-02-14 22:28:20 +0000
committerBharat Mediratta <bharat@menalto.com>2009-02-14 22:28:20 +0000
commit3bfe4a07bdad0c5a3b743919411b9576515d83a6 (patch)
tree2439784e04810e169ae494f895e25717316120dc
parent410aabf12470f42cd53fff671d826104d64c5338 (diff)
Fix rewritten urls to handle query params properly. This was breaking
code like: url::site("albums/3?page=2")
-rw-r--r--core/helpers/MY_url.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/helpers/MY_url.php b/core/helpers/MY_url.php
index 8969228c..a9ebbcc9 100644
--- a/core/helpers/MY_url.php
+++ b/core/helpers/MY_url.php
@@ -19,11 +19,18 @@
*/
class url extends url_Core {
static function site($uri, $protocol=false) {
+ if (($pos = strpos($uri, "?")) !== false) {
+ list ($uri, $query) = explode("?", $uri, 2);
+ $query = "?$query";
+ } else {
+ $query = "";
+ }
+
list($controller, $arg1, $args) = explode("/", $uri, 3);
if ($controller == "albums" || $controller == "photos") {
$uri = ORM::factory("item", $arg1)->relative_path();
}
- return parent::site($uri, $protocol);
+ return parent::site($uri . $query, $protocol);
}
static function parse_url() {