encode($res));
break;
}
}
function blOPML() {
// Unread count
$ucres = rss_query ("select cid, count(*) from " .getTable("item")
." where (unread & " . RSS_MODE_UNREAD_STATE.")!=0 "
. " and (unread & " . RSS_MODE_DELETED_STATE.")=0 group by cid");
$uc = array();
while (list($uccid,$ucuc) = rss_fetch_row($ucres)) {
$uc[$uccid]=$ucuc;
}
$sql = "select "
." c.id, c.title, c.url, c.siteurl, f.name "
." from ".getTable("channels")." c "
." inner join " . getTable("folders")." f "
." on f.id = c.parent";
if (hidePrivate()) {
$sql .= " and (c.mode & ".RSS_MODE_PRIVATE_STATE.")=0 ";
}
$sql .= " and (c.mode & ".RSS_MODE_DELETED_STATE.")=0 ";
if (getConfig('rss.config.absoluteordering')) {
$sql .= " order by f.position asc, c.position asc";
} else {
$sql .= " order by f.name, c.title asc";
}
$folders = array();
$res = rss_query($sql);
while (list($cid,$title,$xmlUrl,$siteUrl,$folder) = rss_fetch_row($res)) {
if (!isset($folders[$folder])) {
$folders[$folder] = array();
}
$folders[$folder][] = array(
'title' => htmlspecialchars($title),
'htmlUrl' => htmlspecialchars($siteUrl),
'xmlUrl' => htmlspecialchars($xmlUrl),
'BloglinesUnread'=>(isset($uc[$cid]) ? $uc[$cid]:0),
'BloglinesSubId'=>$cid
);
}
header('Content-Type: text/xml; charset=utf-8');
echo "\n";
echo "\n"
."\n"
."\tGregarius Subscriptions\n"
."\t". date('D, j M Y H:i:s \G\M\T') ."\n"
."\t\n"
."\n"
."\n";
foreach ($folders as $fname => $folder) {
echo "\t\n";
foreach ($folder as $feed) {
echo "\t\t $value) {
echo " $key=\"$value\"";
}
echo " />\n";
}
echo "\t\n";
}
echo "\n"
."\n";
}
function blGetItems($cid,$date,$markread) {
if (hidePrivate()) {
header('HTTP/1.x 401 Not Authorized');
exit();
}
if (!$cid) {
header ('HTTP/1.x 403 Forbidden');
exit();
}
$sql = "select i.title as ititle, i.description as idescr, c.title as ctitle, "
." c.descr as cdescr, c.url as curl, i.author as iauth, i.url as iurl, "
." unix_timestamp(coalesce(i.pubdate, i.added)) as idate ,i.id as iid"
." from ".getTable('item')." i "
." inner join " .getTable('channels') ." c "
." on c.id = i.cid "
." where (i.unread & ". RSS_MODE_UNREAD_STATE.")!=0 and c.id=$cid";
if ($date) {
$sql .= " and coalesce(i.pubdate, i.added) > $date ";
}
$rs = rss_query($sql);
if (rss_num_rows($rs) == 0) {
header('HTTP/1.x 304 Not Modified');
exit();
}
$ids = array();
header('Content-Type: text/xml; charset=utf-8');
$hdr = false;
while($row=rss_fetch_assoc($rs)) {
if (!$hdr) {
$hdr = true;
echo "<" ."?xml version=\"1.0\"?" .">\n"
."\n"
."\n"
."\t".htmlspecialchars($row['ctitle'])."\n"
."\t".htmlspecialchars($row['curl'])."\n"
."\t".htmlspecialchars($row['cdescr'])."\n"
."\ten-us\n"
."\tsupport@bloglines.com\n"
//."\t66\n"
;
}
$ids[] = $row['iid'];
echo "\t- \n"
."\t\t".htmlspecialchars($row['ititle'])."\n"
."\t\t".htmlspecialchars($row['iauth'])."\n"
."\t\t".htmlspecialchars($row['iurl'])."\n"
."\t\t".htmlspecialchars($row['iurl'])."\n"
."\t\t\n"
."\t\t".date('D, j M Y H:i:s \G\M\T',$row['idate'])."\n"
."\t\t".$row['iid']."\n"
."\t
\n";
}
echo "\n\n";
if ($markread) {
$sql = "update ".getTable('item')." set unread = unread & " .SET_MODE_READ_STATE
." where id in (" . implode(',',$ids) .")";
rss_query($sql);
rss_invalidate_cache();
}
}
function osSearch($q) {
rss_require('cls/search.php');
$sil = new SearchItemList($q,5);
$results = array();
foreach($sil -> feeds as $feed) {
foreach($feed -> items as $item) {
$results[] = $item -> title;
}
}
return array($q,$results,array(),array());
}
?>