From 1ec6359faacc64e1c994abeb37c2af8cbcfb571f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 6 Feb 2018 16:44:48 +0000 Subject: [PATCH] Duplicate check --- include/text.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/text.php b/include/text.php index bc53f2d7b5..d40a1feef8 100644 --- a/include/text.php +++ b/include/text.php @@ -1897,9 +1897,10 @@ function file_tag_save_file($uid, $item, $file) intval($uid) ); if (DBM::is_result($r)) { - $fields = ['file' => $r[0]['file'] . '[' . file_tag_encode($file) . ']']; - Item::update($fields, ['id' => $item]); - + if (!stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) { + $fields = ['file' => $r[0]['file'] . '[' . file_tag_encode($file) . ']']; + Item::update($fields, ['id' => $item]); + } $saved = PConfig::get($uid, 'system', 'filetags'); if (!strlen($saved) || !stristr($saved, '[' . file_tag_encode($file) . ']')) { PConfig::set($uid, 'system', 'filetags', $saved . '[' . file_tag_encode($file) . ']'); -- 2.39.5