mirror of https://github.com/FreshRSS/FreshRSS.git
Merge 07799ca714
into 08d6328975
This commit is contained in:
commit
36ae0f1979
|
@ -19,13 +19,7 @@ final class FreshRSS_Context {
|
|||
public static string $description = '';
|
||||
public static int $total_unread = 0;
|
||||
public static int $total_important_unread = 0;
|
||||
|
||||
/** @var array{'all':int,'read':int,'unread':int} */
|
||||
public static array $total_starred = [
|
||||
'all' => 0,
|
||||
'read' => 0,
|
||||
'unread' => 0,
|
||||
];
|
||||
public static int $unread_favorites;
|
||||
|
||||
public static int $get_unread = 0;
|
||||
|
||||
|
@ -215,7 +209,7 @@ final class FreshRSS_Context {
|
|||
if ($computeStatistics && self::$total_unread === 0) {
|
||||
// Update number of read / unread variables.
|
||||
$entryDAO = FreshRSS_Factory::createEntryDao();
|
||||
self::$total_starred = $entryDAO->countUnreadReadFavorites();
|
||||
self::$unread_favorites = $entryDAO->countUnreadFavorites();
|
||||
self::$total_unread = FreshRSS_Category::countUnread(self::categories(), FreshRSS_Feed::PRIORITY_MAIN_STREAM);
|
||||
self::$total_important_unread = FreshRSS_Category::countUnread(self::categories(), FreshRSS_Feed::PRIORITY_IMPORTANT);
|
||||
}
|
||||
|
@ -410,7 +404,7 @@ final class FreshRSS_Context {
|
|||
self::$current_get['starred'] = true;
|
||||
self::$name = _t('index.feed.title_fav');
|
||||
self::$description = FreshRSS_Context::systemConf()->meta_description;
|
||||
self::$get_unread = self::$total_starred['unread'];
|
||||
self::$get_unread = self::$unread_favorites;
|
||||
|
||||
// Update state if favorite is not yet enabled.
|
||||
self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE;
|
||||
|
|
|
@ -1424,36 +1424,51 @@ SQL;
|
|||
return isset($res[0]) ? (int)($res[0]) : -1;
|
||||
}
|
||||
|
||||
/** @return array{'all':int,'read':int,'unread':int} */
|
||||
public function countUnreadReadFavorites(): array {
|
||||
/** @return int */
|
||||
public function countUnreadFavorites(): int {
|
||||
$sql = <<<'SQL'
|
||||
SELECT c FROM (
|
||||
SELECT COUNT(e1.id) AS c, 1 AS o
|
||||
FROM `_entry` AS e1
|
||||
JOIN `_feed` AS f1 ON e1.id_feed = f1.id
|
||||
WHERE e1.is_favorite = 1
|
||||
AND f1.priority >= :priority1
|
||||
UNION
|
||||
SELECT COUNT(e2.id) AS c, 2 AS o
|
||||
FROM `_entry` AS e2
|
||||
JOIN `_feed` AS f2 ON e2.id_feed = f2.id
|
||||
WHERE e2.is_favorite = 1
|
||||
AND e2.is_read = 0 AND f2.priority >= :priority2
|
||||
SELECT COUNT(e.id) AS c
|
||||
FROM `_entry` AS e
|
||||
JOIN `_feed` AS f ON e.id_feed = f.id
|
||||
WHERE e.is_favorite = 1
|
||||
AND e.is_read = 0 AND f.priority >= :priority_category
|
||||
) u
|
||||
ORDER BY o
|
||||
SQL;
|
||||
//Binding a value more than once is not standard and does not work with native prepared statements (e.g. MySQL) https://bugs.php.net/bug.php?id=40417
|
||||
$res = $this->fetchColumn($sql, 0, [
|
||||
':priority1' => FreshRSS_Feed::PRIORITY_CATEGORY,
|
||||
':priority2' => FreshRSS_Feed::PRIORITY_CATEGORY,
|
||||
':priority_category' => FreshRSS_Feed::PRIORITY_CATEGORY,
|
||||
]);
|
||||
if ($res === null) {
|
||||
return ['all' => -1, 'unread' => -1, 'read' => -1];
|
||||
return -1;
|
||||
}
|
||||
|
||||
rsort($res);
|
||||
$unread = (int)($res[0] ?? 0);
|
||||
return $unread;
|
||||
}
|
||||
|
||||
/** @return int */
|
||||
public function countFavorites(): int {
|
||||
$sql = <<<'SQL'
|
||||
SELECT c FROM (
|
||||
SELECT COUNT(e.id) AS c
|
||||
FROM `_entry` AS e
|
||||
JOIN `_feed` AS f ON e.id_feed = f.id
|
||||
WHERE e.is_favorite = 1
|
||||
AND f.priority >= :priority_category
|
||||
) u
|
||||
SQL;
|
||||
//Binding a value more than once is not standard and does not work with native prepared statements (e.g. MySQL) https://bugs.php.net/bug.php?id=40417
|
||||
$res = $this->fetchColumn($sql, 0, [
|
||||
':priority_category' => FreshRSS_Feed::PRIORITY_CATEGORY,
|
||||
]);
|
||||
if ($res === null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rsort($res);
|
||||
$all = (int)($res[0] ?? 0);
|
||||
$unread = (int)($res[1] ?? 0);
|
||||
return ['all' => $all, 'unread' => $unread, 'read' => $all - $unread];
|
||||
return $all;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Starší než jeden den',
|
||||
'before_one_week' => 'Starší než jeden týden',
|
||||
'bookmark_query' => 'Uložit aktuální dotaz do záložek',
|
||||
'favorites' => 'Oblíbené (%s)',
|
||||
'favorites' => 'Oblíbené',
|
||||
'global_view' => 'Zobrazení přehledu',
|
||||
'important' => 'Důležité kanály',
|
||||
'main_stream' => 'Hlavní kanál',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Vor einem Tag',
|
||||
'before_one_week' => 'Vor einer Woche',
|
||||
'bookmark_query' => 'Aktuelle Abfrage speichern',
|
||||
'favorites' => 'Favoriten (%s)',
|
||||
'favorites' => 'Favoriten',
|
||||
'global_view' => 'Globale Ansicht',
|
||||
'important' => 'Wichtige Feeds',
|
||||
'main_stream' => 'Haupt-Feeds',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Older than one day', // TODO
|
||||
'before_one_week' => 'Older than one week', // TODO
|
||||
'bookmark_query' => 'Bookmark current query', // TODO
|
||||
'favorites' => 'Favourites (%s)', // TODO
|
||||
'favorites' => 'Favourites', // TODO
|
||||
'global_view' => 'Global view', // TODO
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'Main stream', // TODO
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Older than one day', // IGNORE
|
||||
'before_one_week' => 'Older than one week', // IGNORE
|
||||
'bookmark_query' => 'Bookmark current query', // IGNORE
|
||||
'favorites' => 'Favorites (%s)',
|
||||
'favorites' => 'Favorites',
|
||||
'global_view' => 'Global view', // IGNORE
|
||||
'important' => 'Important feeds', // IGNORE
|
||||
'main_stream' => 'Main stream', // IGNORE
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Older than one day',
|
||||
'before_one_week' => 'Older than one week',
|
||||
'bookmark_query' => 'Bookmark current query',
|
||||
'favorites' => 'Favourites (%s)',
|
||||
'favorites' => 'Favourites',
|
||||
'global_view' => 'Global view',
|
||||
'important' => 'Important feeds',
|
||||
'main_stream' => 'Main stream',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Con más de 1 día',
|
||||
'before_one_week' => 'Con más de una semana',
|
||||
'bookmark_query' => 'Marcar consulta actual',
|
||||
'favorites' => 'Favoritos (%s)',
|
||||
'favorites' => 'Favoritos',
|
||||
'global_view' => 'Vista Global',
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'Salida Principal',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => ' بزرگتر از یک روز',
|
||||
'before_one_week' => ' بزرگتر از یک هفته',
|
||||
'bookmark_query' => ' درخواست فعلی را نشانکگذاری کنید',
|
||||
'favorites' => ' موارد دلخواه (%s)',
|
||||
'favorites' => ' موارد دلخواه',
|
||||
'global_view' => ' نمای جهانی',
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => ' جریان اصلی',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Antérieurs à 1 jour',
|
||||
'before_one_week' => 'Antérieurs à 1 semaine',
|
||||
'bookmark_query' => 'Enregistrer la recherche courante',
|
||||
'favorites' => 'Articles favoris (%s)',
|
||||
'favorites' => 'Articles favoris',
|
||||
'global_view' => 'Vue globale',
|
||||
'important' => 'Flux importants',
|
||||
'main_stream' => 'Flux principaux',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'אתמול',
|
||||
'before_one_week' => 'לפני שבוע',
|
||||
'bookmark_query' => 'Bookmark current query', // TODO
|
||||
'favorites' => 'מועדפים (%s)',
|
||||
'favorites' => 'מועדפים',
|
||||
'global_view' => 'תצוגה גלובלית',
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'הזנה ראשית',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Egy napnál régebbiek',
|
||||
'before_one_week' => 'Egy hétnél régebbiek',
|
||||
'bookmark_query' => 'Jelenlegi lekérdezés könyvjelzőzése',
|
||||
'favorites' => 'Kedvencek (%s)',
|
||||
'favorites' => 'Kedvencek',
|
||||
'global_view' => 'Globális nézet',
|
||||
'important' => 'Fontos hírforrások',
|
||||
'main_stream' => 'Minden cikk',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Older than one day', // TODO
|
||||
'before_one_week' => 'Older than one week', // TODO
|
||||
'bookmark_query' => 'Bookmark current query', // TODO
|
||||
'favorites' => 'Favorites (%s)',
|
||||
'favorites' => 'Favorites',
|
||||
'global_view' => 'Global view', // TODO
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'Main stream', // TODO
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Giorno precedente',
|
||||
'before_one_week' => 'Settimana precedente',
|
||||
'bookmark_query' => 'Inserisci la ricerca corrente nei segnalibri',
|
||||
'favorites' => 'Preferiti (%s)',
|
||||
'favorites' => 'Preferiti',
|
||||
'global_view' => 'Vista globale per categorie',
|
||||
'important' => 'Feed importanti',
|
||||
'main_stream' => 'Flusso principale',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => '一日以上前',
|
||||
'before_one_week' => '一週間以上前',
|
||||
'bookmark_query' => '現在のブックマーククエリ',
|
||||
'favorites' => 'お気に入り (%s)',
|
||||
'favorites' => 'お気に入り',
|
||||
'global_view' => 'グローバルビュー',
|
||||
'important' => '重要なフィード',
|
||||
'main_stream' => 'メイン',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => '하루 전',
|
||||
'before_one_week' => '일주일 전',
|
||||
'bookmark_query' => '현재 쿼리 북마크',
|
||||
'favorites' => '즐겨찾기 (%s)',
|
||||
'favorites' => '즐겨찾기',
|
||||
'global_view' => '전체 모드',
|
||||
'important' => '중요 피드',
|
||||
'main_stream' => '메인 스트림',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Vecāks par vienu dienu',
|
||||
'before_one_week' => 'Vecāks par vienu nedēļu',
|
||||
'bookmark_query' => 'Pievienot grāmatzīmi pašreizējam pieprasījumam',
|
||||
'favorites' => 'Mīļākie (%s)',
|
||||
'favorites' => 'Mīļākie',
|
||||
'global_view' => 'Globālais skats',
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'Galvenā plūsma',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Ouder dan een dag',
|
||||
'before_one_week' => 'Ouder dan een week',
|
||||
'bookmark_query' => 'Huidige query opslaan',
|
||||
'favorites' => 'Favorieten (%s)',
|
||||
'favorites' => 'Favorieten',
|
||||
'global_view' => 'Globale weergave',
|
||||
'important' => 'Belangrijke feeds',
|
||||
'main_stream' => 'Overzicht',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => '1 jorn en arrièr',
|
||||
'before_one_week' => '1 setmana en arrièr',
|
||||
'bookmark_query' => 'Marcar aquesta requèsta',
|
||||
'favorites' => 'Favorits (%s)',
|
||||
'favorites' => 'Favorits',
|
||||
'global_view' => 'Vista generala',
|
||||
'important' => 'Important feeds', // TODO
|
||||
'main_stream' => 'Flux màger',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Starsze niż dzień',
|
||||
'before_one_week' => 'Starsze niż tydzień',
|
||||
'bookmark_query' => 'Zapisz bieżące zapytanie',
|
||||
'favorites' => 'Ulubione (%s)',
|
||||
'favorites' => 'Ulubione',
|
||||
'global_view' => 'Widok globalny',
|
||||
'important' => 'Ważne kanały',
|
||||
'main_stream' => 'Kanał główny',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Antes de um dia',
|
||||
'before_one_week' => 'Antes de uma semana',
|
||||
'bookmark_query' => 'Salvar pesquisa atual',
|
||||
'favorites' => 'Favoritos (%s)',
|
||||
'favorites' => 'Favoritos',
|
||||
'global_view' => 'Visualização global',
|
||||
'important' => 'Feeds importantes',
|
||||
'main_stream' => 'Stream principal',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Старше одного дня',
|
||||
'before_one_week' => 'Старше одной недели',
|
||||
'bookmark_query' => 'Сохранить текущий запрос',
|
||||
'favorites' => 'Избранное (%s)',
|
||||
'favorites' => 'Избранное',
|
||||
'global_view' => 'Глобальный вид',
|
||||
'important' => 'Важные ленты',
|
||||
'main_stream' => 'Основной поток',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Pred 1 dňom',
|
||||
'before_one_week' => 'Pred 1 týždňom',
|
||||
'bookmark_query' => 'Pridať aktuálny dopyt do obľúbených',
|
||||
'favorites' => 'Obľúbené (%s)',
|
||||
'favorites' => 'Obľúbené',
|
||||
'global_view' => 'Prehľad',
|
||||
'important' => 'Dôležité kanály',
|
||||
'main_stream' => 'Všetky kanály',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => 'Bir gün önce',
|
||||
'before_one_week' => 'Bir hafta önce',
|
||||
'bookmark_query' => 'Şuana ait yer imi sorgusu',
|
||||
'favorites' => 'Favoriler (%s)',
|
||||
'favorites' => 'Favoriler',
|
||||
'global_view' => 'Evrensel görünüm',
|
||||
'important' => 'Önemli akışlar',
|
||||
'main_stream' => 'Ana akış',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => '一天前',
|
||||
'before_one_week' => '一周前',
|
||||
'bookmark_query' => '收藏当前查询',
|
||||
'favorites' => '收藏(%s)',
|
||||
'favorites' => '收藏',
|
||||
'global_view' => '全局视图',
|
||||
'important' => '重要的订阅',
|
||||
'main_stream' => '首页',
|
||||
|
|
|
@ -43,7 +43,7 @@ return array(
|
|||
'before_one_day' => '一天前',
|
||||
'before_one_week' => '一週前',
|
||||
'bookmark_query' => '收藏當前查詢',
|
||||
'favorites' => '收藏(%s)',
|
||||
'favorites' => '收藏',
|
||||
'global_view' => '全局視圖',
|
||||
'important' => '重要的源',
|
||||
'main_stream' => '首頁',
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
|
||||
<li class="tree-folder category favorites<?= FreshRSS_Context::isCurrentGet('s') ? ' active' : '' ?>">
|
||||
<div class="tree-folder-title">
|
||||
<?= _i('starred') ?><a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_starred['unread']) ?>" href="<?= _url('index', $actual_view, 'get', 's') . $state_filter_manual ?>">
|
||||
<?= _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])) ?>
|
||||
<?= _i('starred') ?><a class="title" data-unread="<?= format_number(FreshRSS_Context::$unread_favorites) ?>" href="<?= _url('index', $actual_view, 'get', 's') . $state_filter_manual ?>">
|
||||
<?= _t('index.menu.favorites') ?>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -66,7 +66,7 @@ foreach ($users as $username) {
|
|||
$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username);
|
||||
|
||||
$nbEntries = $entryDAO->countUnreadRead();
|
||||
$nbFavorites = $entryDAO->countUnreadReadFavorites();
|
||||
$nbFavorites = $entryDAO->countFavorites();
|
||||
$feedList = $feedDAO->listFeedsIds();
|
||||
|
||||
$data = array(
|
||||
|
@ -80,7 +80,7 @@ foreach ($users as $username) {
|
|||
'feeds' => count($feedList),
|
||||
'reads' => (int)$nbEntries['read'],
|
||||
'unreads' => (int)$nbEntries['unread'],
|
||||
'favourites' => (int)$nbFavorites['all'],
|
||||
'favourites' => $nbFavorites,
|
||||
'tags' => $tagDAO->count(),
|
||||
'lang' => FreshRSS_Context::userConf()->language,
|
||||
'mail_login' => FreshRSS_Context::userConf()->mail_login,
|
||||
|
|
Loading…
Reference in New Issue