function readItems($limit) { _pf('read items'); /* $hiddenIds = getHiddenChannelIds(); if (count($hiddenIds)) { $sqlWhereHidden = " and c.id not in (" . implode(',',$hiddenIds) . ") "; } else { $sqlWhereHidden = ""; } */ $readItems = new PaginatedItemList(); $readItems->setRenderOptions(IL_TITLE_NO_ESCAPE); if (getConfig('rss.config.feedgrouping')) { if ($limit <= 0) { return; } $sql = "select " . " c.id" . " from " . getTable("channels") . " c " . " inner join " . getTable("folders") . " f on f.id = c.parent "; // $sql .= $sqlWhereHidden; $sql .= " where not(c.mode & " . RSS_MODE_DELETED_STATE . ") "; if (getConfig('rss.config.absoluteordering')) { $sql .= " order by f.position asc, c.position asc"; } else { $sql .= " order by f.name asc, c.title asc"; } $res1 = rss_query($sql); while ($readItems->itemCount < $limit && (list($cid) = rss_fetch_row($res1))) { $sqlWhere = " not(i.unread & " . RSS_MODE_UNREAD_STATE . ") and i.cid= {$cid}"; $sqlWhere .= " and i.pubdate <= now() "; $readItems->populate($sqlWhere, "", 0, 2, ITEM_SORT_HINT_READ); //what if we have less than 2 items. } } else { if ($limit <= 0) { return; } $sqlWhere = " not(i.unread & " . RSS_MODE_UNREAD_STATE . ") "; $sqlWhere .= " and i.pubdate <= now() "; // $sqlWhere .= $sqlWhereHidden; $readItems->populate($sqlWhere, "", 0, $limit, ITEM_SORT_HINT_READ); $readItems->setRenderOptions(IL_NO_COLLAPSE | IL_TITLE_NO_ESCAPE); } $readItems->setTitle(__('Recent items')); $GLOBALS['rss']->appendContentObject($readItems); _pf('end read items'); }
$rdf->baselink = $baselink; $rdf->resource = $urlTag; $rdf->render($title); exit; } else { // HTML view //rss_header("Tags " . TITLE_SEP . " " . $hrTag); $GLOBALS['rss']->header = new Header("Tags " . TITLE_SEP . " " . $hrTag); $GLOBALS['rss']->feedList = new FeedList(false); //echo "\n\n<div id=\"items\" class=\"frame\">\n"; if ($gotsome) { $title = $taggedItems->itemCount . " " . ($taggedItems->itemCount > 1 ? __('items') : __('item')) . " " . ($taggedItems->itemCount > 1 || $taggedItems->itemCount == 0 ? __('tagged') : __('tagged')) . "" . " \"" . $hrTag . "\""; if (count($related)) { $taggedItems->beforeList = "\n<p>" . __('Related tags: ') . "\n" . implode(", \n", $related) . "\n</p>\n"; } $taggedItems->setTitle($title); $taggedItems->setRenderOptions(IL_NO_COLLAPSE | IL_TITLE_NO_ESCAPE); $GLOBALS['rss']->appendContentObject($taggedItems); $GLOBALS['rss']->renderWithTemplate('index.php', 'items'); } else { $GLOBALS['rss']->renderWithTemplate('index.php', 'items'); // echo "<p style=\"height: 10em; text-align:center\">"; // printf(__('Oops! No items tagged «%s» were found.'), $hrTag); // echo "</p>"; } //echo "</div>\n"; //rss_footer(); } } elseif (array_key_exists('alltags', $_GET)) { rss_require('cls/alltags.php'); $GLOBALS['rss']->header = new Header("Tags " . TITLE_SEP . " " . __('All Tags'));
function doItems($cids, $fid, $vfid, $title, $iid, $y, $m, $d, $nv, $show_what, $show_private) { $do_show = $show_what; //should we honour unread-only? if ($show_what == SHOW_UNREAD_ONLY) { // permalink will always be printed if ($iid != "") { $do_show = SHOW_READ_AND_UNREAD; } else { // archives, folders, channels $sql = "select count(*) from " . getTable('item') . " where" . " (unread & " . RSS_MODE_UNREAD_STATE . ")" . " and not(unread & " . RSS_MODE_DELETED_STATE . ") "; //archive? if ($m > 0 && $y > 0) { $sql .= " and month(ifnull(pubdate,added))= {$m} " . " and year(ifnull(pubdate, added))= {$y} "; if ($d > 0) { $sql .= " and dayofmonth(ifnull(pubdate,added))= {$d} "; } } if ($cids && count($cids)) { $sql .= " and cid in (" . implode(',', $cids) . ")"; } list($unreadCount) = rss_fetch_row(rss_query($sql)); if ($unreadCount == 0) { $do_show = SHOW_READ_AND_UNREAD; } } } $items = new PaginatedItemList(); $severalFeeds = $fid != null || $vfid != null; if ($severalFeeds && !getConfig('rss.config.feedgrouping')) { $sqlWhere = "("; foreach ($cids as $cid) { $sqlWhere .= " i.cid = {$cid} or "; } $sqlWhere .= " 1=0) "; $hint = ITEM_SORT_HINT_MIXED; if ($do_show == SHOW_UNREAD_ONLY) { $sqlWhere .= " and (i.unread & " . RSS_MODE_UNREAD_STATE . ") "; $hint = ITEM_SORT_HINT_UNREAD; } // how many items should we display in a folder view? // default to numitemsonpage. $cnt = getConfig('rss.output.frontpage.numitems'); // if that is set to zero, use itemsinchannelview times the number of feeds in the folder if ($cnt == 0) { $cnt = count($cids) * getConfig('rss.output.itemsinchannelview'); } // should that be zero too, go for a fixed value if ($cnt == 0) { // arbitrary! $cnt = 50; } $items->populate($sqlWhere, "", 0, $cnt, $hint); } else { if (!isset($cids)) { $cids = array(-1); } foreach ($cids as $cid) { $hint = ITEM_SORT_HINT_MIXED; if ($cid > -1) { $sqlWhere = "i.cid = {$cid}"; if ($do_show == SHOW_UNREAD_ONLY) { $sqlWhere .= " and (i.unread & " . RSS_MODE_UNREAD_STATE . ") "; $hint = ITEM_SORT_HINT_UNREAD; } } else { $sqlWhere = " 1 = 1 "; } if ($iid != "") { $sqlWhere .= " and i.id={$iid}"; } if ($m > 0 && $y > 0) { $sqlWhere .= " and month(ifnull(i.pubdate,i.added))= {$m} " . " and year(ifnull(i.pubdate, i.added))= {$y} "; if ($d > 0) { $sqlWhere .= " and dayofmonth(ifnull(i.pubdate,i.added))= {$d} "; } } if ($m == 0 && $y == 0) { $sqlLimit = getConfig('rss.output.itemsinchannelview'); } else { $sqlLimit = RSS_DB_MAX_QUERY_RESULTS; } /* $sqlOrder = " order by i.unread & ".RSS_MODE_UNREAD_STATE." desc"; if(getConfig("rss.config.datedesc")){ $sqlOrder .= ", ts desc, i.id asc"; } else { $sqlOrder .= ", ts asc, i.id asc"; } */ $sqlOrder = ""; $items->populate($sqlWhere, $sqlOrder, 0, $sqlLimit, $hint, true); } } if ($items->unreadCount && $iid == "") { $items->preRender[] = array("showViewForm", array($show_what, $show_private)); if (!$severalFeeds) { $items->preRender[] = array("markReadForm", $cid); $title .= " " . sprintf(__('<strong id="%s" style="%s">(%d unread)</strong>'), "ucnt", "", $items->unreadCount); } else { if (!$vfid) { list($fid) = rss_fetch_row(rss_query('select parent from ' . getTable('channels') . 'where id = ' . $cids[0])); $title .= " " . sprintf(__('<strong id="%s" style="%s">(%d unread)</strong>'), "ucnt", "", $items->unreadCount); $items->preRender[] = array("markFolderReadForm", $fid); } else { list($fid) = $vfid; $title .= " " . sprintf(__('<strong id="%s" style="%s">(%d unread)</strong>'), "ucnt", "", $items->unreadCount); $items->preRender[] = array("markVirtualFolderReadForm", $vfid); } } } $items->setTitle($title); if ($severalFeeds) { $items->setRenderOptions(IL_NO_COLLAPSE | IL_FOLDER_VIEW); } elseif ($cid && $cid > -1) { $items->setRenderOptions(IL_CHANNEL_VIEW); } else { $items->setRenderOptions(IL_NO_COLLAPSE | IL_FOLDER_VIEW); } $items->setRenderOptions(IL_TITLE_NO_ESCAPE); if ($nv != null) { list($prev, $succ, $up) = $nv; $readMoreNav = ""; if ($prev != null) { $lbl = $prev['lbl']; if (function_exists('mb_strlen') && function_exists('mb_substr') && mb_strlen($lbl) > 40) { $lbl = mb_substr($lbl, 0, 37) . "..."; } elseif (strlen($lbl) > 40) { $lbl = substr($lbl, 0, 37) . "..."; } $readMoreNav .= "<a href=\"" . $prev['url'] . "\" class=\"fl\">" . ACT_NAV_PREV_PREFIX . "{$lbl}</a>\n"; } if ($succ != null) { $lbl = $succ['lbl']; if (function_exists('mb_strlen') && function_exists('mb_substr') && mb_strlen($lbl) > 40) { $lbl = mb_substr($lbl, 0, 37) . "..."; } elseif (strlen($lbl) > 40) { $lbl = substr($lbl, 0, 37) . "..."; } $readMoreNav .= "<a href=\"" . $succ['url'] . "\" class=\"fr\">{$lbl}" . ACT_NAV_SUCC_POSTFIX . "</a>\n"; } if ($readMoreNav != "") { $items->afterList = "<div class=\"readmore\">{$readMoreNav}" . "<hr class=\"clearer hidden\"/>\n</div>\n"; } } $GLOBALS['rss']->appendContentObject($items); }