X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FFileTag.php;h=2ad864c9c4d1fe4cce6db1fa3fa6919a2b9ff48c;hb=2b0610eaf5ea67cc6b6a8e59b4f9c08249f90370;hp=d3baffdd4fd02106e2ba307009ed068911be1d71;hpb=bd972151478f40f73585519110700222a1931d44;p=friendica.git diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index d3baffdd4f..2ad864c9c4 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -8,7 +8,6 @@ namespace Friendica\Model; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Database\DBA; -use Friendica\Model\Item; /** * @brief This class handles FileTag related functions @@ -134,16 +133,17 @@ class FileTag return $list; } - /** - * @brief Update file tags in PConfig - * - * @param int $uid Unique Identity. - * @param string $file_old Categories previously associated with an item - * @param string $file_new New list of categories for an item - * @param string $type Optional file type. - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Update file tags in PConfig + * + * @param int $uid Unique Identity. + * @param string $file_old Categories previously associated with an item + * @param string $file_new New list of categories for an item + * @param string $type Optional file type. + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function updatePconfig($uid, $file_old, $file_new, $type = 'file') { if (!intval($uid)) { @@ -220,15 +220,16 @@ class FileTag return true; } - /** - * @brief Add tag to file - * - * @param int $uid Unique identity. - * @param int $item_id Item identity. - * @param string $file File tag. - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Add tag to file + * + * @param int $uid Unique identity. + * @param int $item_id Item identity. + * @param string $file File tag. + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function saveFile($uid, $item_id, $file) { if (!intval($uid)) @@ -258,16 +259,17 @@ class FileTag return true; } - /** - * @brief Remove tag from file - * - * @param int $uid Unique identity. - * @param int $item_id Item identity. - * @param string $file File tag. - * @param boolean $cat Optional value indicating the term type (i.e. Category or File) - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Remove tag from file + * + * @param int $uid Unique identity. + * @param int $item_id Item identity. + * @param string $file File tag. + * @param boolean $cat Optional value indicating the term type (i.e. Category or File) + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function unsaveFile($uid, $item_id, $file, $cat = false) { if (!intval($uid)) @@ -276,10 +278,10 @@ class FileTag } if ($cat == true) { - $pattern = '<' . self::encode($file) . '>' ; + $pattern = '<' . self::encode($file) . '>'; $termtype = TERM_CATEGORY; } else { - $pattern = '[' . self::encode($file) . ']' ; + $pattern = '[' . self::encode($file) . ']'; $termtype = TERM_FILE; } @@ -291,6 +293,7 @@ class FileTag } $fields = ['file' => str_replace($pattern, '', $item['file'])]; + Item::update($fields, ['id' => $item_id]); $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",