diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-03-05 16:51:20 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-03-05 16:51:20 -0800 |
commit | 451ef39d58c64b5387b835b5a8c11b98a5c9659b (patch) | |
tree | ccf394b63fed825a39ca8fcc5ae2c5bbb7f9d317 | |
parent | bda14f29eac2c7471d4e5e554493dd21728199e2 (diff) |
PATH_INFO mangles apostrophe (and other symbols, I'm sure) into a
question mark, so any tags containing an apostrophe won't display
their contents.
Take the simple fix here and change the tag urls to also contain the
tag id, which avoids having to add a slug for the tag and all kinds of
validation code.
Fixes #1636.
-rw-r--r-- | modules/tag/controllers/tag.php | 4 | ||||
-rw-r--r-- | modules/tag/models/tag.php | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php index 7aa038c6..8f885dea 100644 --- a/modules/tag/controllers/tag.php +++ b/modules/tag/controllers/tag.php @@ -19,8 +19,8 @@ */ class Tag_Controller extends Controller { public function __call($function, $args) { - $tag_name = $function; - $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find(); + $tag_id = $function; + $tag = ORM::factory("tag")->where("id", "=", $tag_id)->find(); $page_size = module::get_var("gallery", "page_size", 9); $page = (int) Input::instance()->get("page", "1"); $children_count = $tag->items_count(); diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 53ccc856..479a7da0 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -132,7 +132,7 @@ class Tag_Model_Core extends ORM { * @param string $query the query string (eg "page=3") */ public function url($query=null) { - $url = url::site("tag/{$this->name}"); + $url = url::site("tag/{$this->id}/{$this->name}"); if ($query) { $url .= "?$query"; } |