X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPost%2FCategory.php;h=c242e8ffd878dd97ee046331d79a688667504aa9;hb=fdaff4303952427f222ee21f6b501d5087e25932;hp=2c35a40ad4b8756adc990ecfe01bce85982ed371;hpb=4faf08c0643d3e6bbe2a0a77be2ff8c1dbea4d5c;p=friendica.git diff --git a/src/Model/Post/Category.php b/src/Model/Post/Category.php index 2c35a40ad4..c242e8ffd8 100644 --- a/src/Model/Post/Category.php +++ b/src/Model/Post/Category.php @@ -33,9 +33,10 @@ use Friendica\Model\Tag; */ class Category { - const UNKNOWN = 0; - const CATEGORY = 3; - const FILE = 5; + const UNKNOWN = 0; + const CATEGORY = 3; + const FILE = 5; + const SUBCRIPTION = 10; /** * Delete all categories and files from a given uri-id and user @@ -80,7 +81,7 @@ class Category { $file_text = ''; - $tags = DBA::selectToArray('category-view', ['type', 'name'], ['uri-id' => $uri_id, 'uid' => $uid]); + $tags = DBA::selectToArray('category-view', ['type', 'name'], ['uri-id' => $uri_id, 'uid' => $uid, 'type' => [Category::FILE, Category::CATEGORY]]); foreach ($tags as $tag) { if ($tag['type'] == self::CATEGORY) { $file_text .= '<' . $tag['name'] . '>'; @@ -177,12 +178,7 @@ class Category continue; } - DBA::replace('post-category', [ - 'uri-id' => $uri_id, - 'uid' => $uid, - 'type' => self::FILE, - 'tid' => $tagid - ]); + self::storeByURIId($uri_id, $uid, self::FILE, $tagid); } } @@ -193,13 +189,18 @@ class Category } } - public static function storeFileByURIId(int $uri_id, int $uid, int $type, string $file) + public static function storeFileByURIId(int $uri_id, int $uid, int $type, string $file, string $url = ''): bool { - $tagid = Tag::getID($file); + $tagid = Tag::getID($file, $url); if (empty($tagid)) { return false; } + return self::storeByURIId($uri_id, $uid, $type, $tagid); + } + + private static function storeByURIId(int $uri_id, int $uid, int $type, int $tagid): bool + { return DBA::replace('post-category', [ 'uri-id' => $uri_id, 'uid' => $uid,