Mass tag: fixed tag case sensitiveness bug
This commit is contained in:
parent
601bdab8e1
commit
6549237dda
3 changed files with 16 additions and 3 deletions
|
@ -122,7 +122,10 @@ class PostController
|
||||||
$post = Model_Post::locate($id);
|
$post = Model_Post::locate($id);
|
||||||
R::preload($post, ['uploader' => 'user']);
|
R::preload($post, ['uploader' => 'user']);
|
||||||
$this->context->transport->post = $post;
|
$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'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -886,7 +889,8 @@ class PostController
|
||||||
$ext = '.dat';
|
$ext = '.dat';
|
||||||
$fn = sprintf('%s_%s_%s.%s',
|
$fn = sprintf('%s_%s_%s.%s',
|
||||||
$this->config->main->title,
|
$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);
|
$ext);
|
||||||
$fn = preg_replace('/[[:^print:]]/', '', $fn);
|
$fn = preg_replace('/[[:^print:]]/', '', $fn);
|
||||||
|
|
||||||
|
|
|
@ -56,4 +56,13 @@ class Model_Post extends AbstractModel
|
||||||
{
|
{
|
||||||
return 'Model_Post_QueryBuilder';
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<?php $masstag = (isset($this->context->source) and $this->context->source == 'mass-tag' and !empty($this->context->additionalInfo)) ?>
|
<?php $masstag = (isset($this->context->source) and $this->context->source == 'mass-tag' and !empty($this->context->additionalInfo)) ?>
|
||||||
<?php if ($masstag): ?>
|
<?php if ($masstag): ?>
|
||||||
<?php $classNames []= 'taggable' ?>
|
<?php $classNames []= 'taggable' ?>
|
||||||
<?php if (in_array($this->context->additionalInfo, array_map(function($x) { return $x->name; }, $this->context->post->sharedTag))): ?>
|
<?php if ($this->context->post->isTaggedWith($this->context->additionalInfo)): ?>
|
||||||
<?php $classNames []= 'tagged' ?>
|
<?php $classNames []= 'tagged' ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
Loading…
Reference in a new issue