Merge pull request #245 from gordonbanderson/ISSUE_243

FIX: Fix to allow use of foreign text as tags and categories.  Fixes …
This commit is contained in:
Christopher Pitt 2015-06-03 18:38:34 +12:00
commit 1b7c312eb1

View File

@ -802,9 +802,14 @@ class Blog_Controller extends Page_Controller {
*/
$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()
->filter('URLSegment', $tag)
->first();
@ -843,9 +848,12 @@ class Blog_Controller extends Page_Controller {
*/
$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()
->filter('URLSegment', $category)
->first();