FIX: Fix to allow use of foreign text as tags and categories. Fixes #243

This commit is contained in:
Gordon Anderson 2015-05-15 18:59:09 +07:00
parent 17832fd942
commit 7c8bd693f2

View File

@ -803,9 +803,14 @@ class Blog_Controller extends Page_Controller {
*/ */
$dataRecord = $this->dataRecord; $dataRecord = $this->dataRecord;
$tag = $this->request->param('Tag'); // get the tag value and generate a URL Segment for it
// use the URL segment for searching
$tagvalue = $this->request->param('Tag');
if($tagvalue) {
$tempTag = new BlogTag();
$tempTag->Title = $tagvalue;
$tag = $tempTag->generateURLSegment();
if($tag) {
return $dataRecord->Tags() return $dataRecord->Tags()
->filter('URLSegment', $tag) ->filter('URLSegment', $tag)
->first(); ->first();
@ -844,9 +849,12 @@ class Blog_Controller extends Page_Controller {
*/ */
$dataRecord = $this->dataRecord; $dataRecord = $this->dataRecord;
$category = $this->request->param('Category'); $categoryValue = $this->request->param('Category');
if($category) { if($categoryValue) {
$tempCategory = new BlogCategory();
$tempCategory->Title = $categoryValue;
$category = $tempCategory->generateURLSegment();
return $dataRecord->Categories() return $dataRecord->Categories()
->filter('URLSegment', $category) ->filter('URLSegment', $category)
->first(); ->first();