X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPost.php;h=9ce301ade0c4540dfb06470a8d0ebb8c9e9f4d0d;hb=dd38cc330f3131d5704c4efffda1da7dcdeb7e1c;hp=d56674c3e09ddc4388856883012245163e67929b;hpb=befc2af5043a3afde251721c0d27df695db1bb7e;p=friendica.git diff --git a/src/Model/Post.php b/src/Model/Post.php index d56674c3e0..9ce301ade0 100644 --- a/src/Model/Post.php +++ b/src/Model/Post.php @@ -127,12 +127,13 @@ class Post * Check if post data exists * * @param array $condition array of fields for condition + * @param bool $user_mode true = post-user-view, false = post-view * * @return boolean Are there rows for that condition? * @throws \Exception */ - public static function exists($condition) { - return DBA::exists('post-user-view', $condition); + public static function exists($condition, bool $user_mode = true) { + return DBA::exists($user_mode ? 'post-user-view' : 'post-view', $condition); } /** @@ -140,6 +141,7 @@ class Post * * @param array $condition array of fields for condition * @param array $params Array of several parameters + * @param bool $user_mode true = post-user-view, false = post-view * * @return int * @@ -151,9 +153,9 @@ class Post * $count = Post::count($condition); * @throws \Exception */ - public static function count(array $condition = [], array $params = []) + public static function count(array $condition = [], array $params = [], bool $user_mode = true) { - return DBA::count('post-user-view', $condition, $params); + return DBA::count($user_mode ? 'post-user-view' : 'post-view', $condition, $params); } /** @@ -406,7 +408,7 @@ class Post if (!DBA::isResult($postthreaduser)) { return $postthreaduser; } - + $pinned = []; while ($useritem = DBA::fetch($postthreaduser)) { $pinned[] = $useritem['uri-id'];