diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 09623a63..3f9a15ad 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -122,7 +122,10 @@ class PostController $post = Model_Post::locate($id); R::preload($post, ['uploader' => 'user']); $this->context->transport->post = $post; - $tag = Model_Tag::validateTag($tag); + + $tagRow = Model_Tag::locate($tag, false); + if ($tagRow !== null) + $tag = $tagRow->name; if (InputHelper::get('submit')) { @@ -886,7 +889,8 @@ class PostController $ext = '.dat'; $fn = sprintf('%s_%s_%s.%s', $this->config->main->title, - $post->id, join(',', array_map(function($tag) { return $tag->name; }, $post->sharedTag)), + $post->id, + join(',', array_map(function($tag) { return $tag->name; }, $post->sharedTag)), $ext); $fn = preg_replace('/[[:^print:]]/', '', $fn); diff --git a/src/Models/Model_Post.php b/src/Models/Model_Post.php index 5e9f3fd3..8833bd1f 100644 --- a/src/Models/Model_Post.php +++ b/src/Models/Model_Post.php @@ -56,4 +56,13 @@ class Model_Post extends AbstractModel { return 'Model_Post_QueryBuilder'; } + + public function isTaggedWith($tagName) + { + $tagName = trim(strtolower($tagName)); + foreach ($this->sharedTag as $tag) + if (trim(strtolower($tag->name)) == $tagName) + return true; + return false; + } } diff --git a/src/Views/post-small.phtml b/src/Views/post-small.phtml index 02f8992b..3203ac15 100644 --- a/src/Views/post-small.phtml +++ b/src/Views/post-small.phtml @@ -2,7 +2,7 @@ context->source) and $this->context->source == 'mass-tag' and !empty($this->context->additionalInfo)) ?> - context->additionalInfo, array_map(function($x) { return $x->name; }, $this->context->post->sharedTag))): ?> + context->post->isTaggedWith($this->context->additionalInfo)): ?>