function Header($title = "", $active = 0, $cidfid = null, $onLoadAction = "", $options = HDR_NONE, $links = NULL) { _pf('Header() ctor'); $this->docTitle = $title; $this->active = $active; $this->cidfid = $cidfid; $this->onLoadAction = $onLoadAction; $this->options = $options; $this->rawTitle = $title; $this->extraHeaders = array(); $this->docTitle = makeTitle($title); if (getConfig("rss.output.titleunreadcnt") && is_array($cidfid) && ($uc = getUnreadCount($cidfid['cid'], $cidfid['fid']))) { $this->docTitle .= " ({$uc} " . __('unread') . ")"; } if ($active == 1 && MINUTE * getConfig('rss.config.refreshafter') >= 40 * MINUTE) { $this->redirectUrl = guessTransportProto() . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if (substr($this->redirectUrl, -1) != "/") { $this->redirectUrl .= "/"; } $this->redirectUrl .= "update.php"; $this->redirectTimeout = MINUTE * getConfig('rss.config.refreshafter'); } $this->links = array(); $this->links[] = array('start', 'Home', getPath()); $this->links[] = array('search', 'Search', getPath() . "search.php"); $this->links[] = array('tags', 'Tags', getPath() . (getConfig('rss.output.usemodrewrite') ? "tag/" : "tags.php?alltags")); if ($links != NULL) { //var_dump($links); foreach ($links as $rel => $link) { $this->links[] = array($rel, $link['title'], $link['href']); } } $this->javascriptFiles[] = getPath() . "ajax.php?js"; $this->javascriptFiles[] = getPath() . "extlib/md5.js"; if (getConfig('rss.output.channelcollapse')) { $this->javascriptFiles[] = getPath() . "extlib/fcollapse.js"; } $GLOBALS['rss']->sideMenu = new SideMenu(); $GLOBALS['rss']->sideMenu->addMenu(__('Feeds'), 'FeedList', "_side('FeedList')"); $GLOBALS['rss']->sideMenu->addMenu(__('Categories'), 'CatList', "_side('CatList')"); $GLOBALS['rss']->sideMenu->addMenu(__('Tags'), 'TagList', "_side('TagList')"); }
function getStats() { _pf('getStats()'); _pf(' ... unreadCount'); $unread = getUnreadCount(null, null); _pf(' ... done: unreadCount'); _pf(' ... totalCount'); // jphpsf: don't need to join on channels table $sql = "select count(*) from " . getTable("item") . "i " . " where not(i.unread & " . RSS_MODE_DELETED_STATE . ") " . (hidePrivate() ? " and not(unread & " . RSS_MODE_PRIVATE_STATE . ")" : ""); $res = rss_query($sql); list($total) = rss_fetch_row($res); _pf(' ... done: totalCount'); _pf(' ... feedsCount'); $res = rss_query("select count(*) from " . getTable("channels") . " where not(mode & " . RSS_MODE_DELETED_STATE . ")" . (hidePrivate() ? " and not(mode & " . RSS_MODE_PRIVATE_STATE . ")" : "")); list($channelcount) = rss_fetch_row($res); _pf(' ... done: feedsCount'); // jphpsf: had unread count for today $tz = getConfig('rss.config.tzoffset'); $sql = "select count(id) from " . getTable("item") . " where DATE_ADD(added,INTERVAL {$tz} HOUR) BETWEEN " . " CONCAT(DATE(DATE_ADD(CURDATE(),INTERVAL {$tz}+24 HOUR)),' 00:00:00') AND " . " CONCAT(DATE(DATE_ADD(CURDATE(),INTERVAL {$tz}+24 HOUR)),' 23:59:59') " . (hidePrivate() ? " and not(unread & " . RSS_MODE_PRIVATE_STATE . ")" : ""); $res = rss_query($sql); list($totalToday) = rss_fetch_row($res); $sql = "select count(id) from " . getTable("item") . " where unread = 5 and DATE_ADD(added,INTERVAL {$tz} HOUR) BETWEEN " . " CONCAT(DATE(DATE_ADD(CURDATE(),INTERVAL {$tz}+24 HOUR)),' 00:00:00') AND " . " CONCAT(DATE(DATE_ADD(CURDATE(),INTERVAL {$tz}+24 HOUR)),' 23:59:59') " . (hidePrivate() ? " and not(unread & " . RSS_MODE_PRIVATE_STATE . ")" : ""); $res = rss_query($sql); list($unreadToday) = rss_fetch_row($res); $this->stats = "<li>Today: <strong>{$totalToday}</strong> items (<strong>{$unreadToday}</strong> unread)</li>"; $this->stats .= "<li>Total: <strong>{$total}</strong> items (<strong>{$unread}</strong> unread)</li>"; $this->stats .= "<li>Total feeds: <strong>{$channelcount}</strong></li>"; //$this->stats = sprintf(__('<strong>%d</strong> items (<strong id="fucnt">%d</strong> unread) in <strong>%d</strong> feeds'), $total, $unread, $channelcount); _pf('done: getStats()'); return $this->stats; }
# with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit # http://www.gnu.org/licenses/gpl.html # ############################################################################### # E-mail: mbonetti at gmail dot com # Web page: http://gregarius.net/ # ############################################################################### require_once 'core.php'; rss_bootstrap(); require_once 'init.php'; if (isset($_REQUEST['method'])) { switch ($_REQUEST['method']) { case 'update': $uc = getUnreadCount(null, null); die("|{$uc}||"); break; case 'listsubs': blOPML(); break; case 'getitems': $cid = isset($_REQUEST['s']) ? $_REQUEST['s'] : null; $date = isset($_REQUEST['d']) ? $_REQUEST['d'] : null; $markread = isset($_REQUEST['n']) && $_REQUEST['n'] == '1'; $cid = sanitize($cid, RSS_SANITIZER_NUMERIC); $date = sanitize($date, RSS_SANITIZER_NUMERIC); blGetItems($cid, $date, $markread); break; case 'search': rss_require('extlib/JSON.php');
/** * Fills the instance data for this object: gets a hold * of all tags defined in the system. */ function populate() { // the all tags weighted list $sql = "select t.id, tag, count(*) as cnt from " . getTable('metatag'); if ($this->type == 'channel') { $sql .= " left join " . getTable('channels') . " c on (fid=c.id) " . "inner join " . getTable('tag') . " t " . " on tid=t.id " . " where ttype = 'channel'"; } else { $sql .= " left join " . getTable('item') . " i on (fid=i.id) " . "inner join " . getTable('tag') . " t " . " on tid=t.id " . " where ttype = 'item'"; } // Don't count tags of private items if (hidePrivate()) { $sql .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ") "; } $sql .= " and not (i.unread & " . RSS_MODE_DELETED_STATE . ") "; $sql .= " group by tid order by tag"; $res = rss_query($sql); $max = 0; $min = 100000; $cntr = 0; while (list($tid, $tag, $cnt) = rss_fetch_row($res)) { $this->allTags[$tag] = $cnt; // list of unread items $cntUnread = 0; $sql = "select fid from " . getTable('metatag') . " where tid = {$tid}"; $res2 = rss_query($sql); while (list($fid) = rss_fetch_row($res2)) { if ($this->type == 'channel') { $cntUnread += getUnreadCount($fid, null); } else { $sql = "select unread from " . getTable('item') . " where id = {$fid}" . " and (unread & " . RSS_MODE_UNREAD_STATE . ") "; if (hidePrivate()) { $sql .= " and not(unread & " . RSS_MODE_PRIVATE_STATE . ") "; } if (rss_num_rows(rss_query($sql))) { $cntUnread++; } } } $this->unreadItems[$tag] = $cntUnread; $cntr++; } }
function getStats() { _pf('getStats()'); _pf(' ... unreadCount'); $unread = getUnreadCount(null, null); _pf(' ... done: unreadCount'); _pf(' ... totalCount'); $sql = "select count(*) from " . getTable("item") . "i " . "inner join " . getTable('channels') . " c " . " on c.id = i.cid " . " where not(i.unread & " . RSS_MODE_DELETED_STATE . ") " . " and not (c.mode & " . RSS_MODE_DELETED_STATE . ")" . (hidePrivate() ? " and not(unread & " . RSS_MODE_PRIVATE_STATE . ")" : ""); //echo $sql; $res = rss_query($sql); list($total) = rss_fetch_row($res); _pf(' ... done: totalCount'); _pf(' ... feedsCount'); $res = rss_query("select count(*) from " . getTable("channels") . " where not(mode & " . RSS_MODE_DELETED_STATE . ")" . (hidePrivate() ? " and not(mode & " . RSS_MODE_PRIVATE_STATE . ")" : "")); list($channelcount) = rss_fetch_row($res); _pf(' ... done: feedsCount'); $this->stats = sprintf(__('<strong>%d</strong> items (<strong id="fucnt">%d</strong> unread) in <strong>%d</strong> feeds'), $total, $unread, $channelcount); _pf('done: getStats()'); return $this->stats; }