Tag merging: fixed validation

This commit is contained in:
Marcin Kurczewski 2013-11-01 09:42:13 +01:00
parent bd05123cfc
commit fe99f97287

View file

@ -29,8 +29,16 @@ class TagController
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
if (InputHelper::get('submit'))
{
$sourceTag = Model_Tag::locate(InputHelper::get('source-tag'));
$targetTag = Model_Tag::locate(InputHelper::get('target-tag'));
$suppliedSourceTag = InputHelper::get('source-tag');
$suppliedSourceTag = Model_Tag::validateTag($suppliedSourceTag);
$sourceTag = Model_Tag::locate($suppliedSourceTag);
$suppliedTargetTag = InputHelper::get('target-tag');
$suppliedTargetTag = Model_Tag::validateTag($suppliedTargetTag);
$targetTag = Model_Tag::locate($suppliedTargetTag);
if ($sourceTag->id == $targetTag->id)
throw new SimpleException('Source and target tag are the same');
R::preload($sourceTag, 'post');