rss = new lastRSS(); $this->rss->cache_dir = $cache_dir; $this->cache_time = $this->rsscache_time; if($this->rss_object = $this->rss->get($url)) { $this->rss_title = $this->rss_object["title"]; $this->rss_link = $this->rss_object["link"]; return true; }else { return false; }*/ $this->rss = new feedParser(); // Read in our sample feed file $data = @implode("",@file($url)); // Tell feedParser to parse the data $info = $this->rss->parseFeed($data); if(isset($info)) { $this->rss_object = $info["channel"]; }else { return false; } if(isset($this->rss_object)) { $this->rss_title = $this->rss_object["title"]; $this->rss_link = $this->rss_object["link"]; $this->rss_object = $info["item"]; return true; }else { return false; } } /*function getRSSHeadings() { global $image_path; if($this->rss_object) { $shtml = "
rss_object[link]."\">".$this->rss_object[title]."
"; return $shtml; } }*/ function getListViewRSSHtml() { if(isset($this->rss_object)) { $i = 0; foreach($this->rss_object as $key=>$item) { $i = $i + 1; $shtml .= "
  • $item[title]
  • "; if($i == 10) { return $shtml; } } return $shtml; }else { $shtml = "Sorry: It's not possible to reach RSS URL"; } //return $shtml; } function saveRSSUrl($url,$makestarred,$rsscategory) { global $adb; if ($url != "") { $rsstitle = $this->rss_title; if($rsstitle == "") { $rsstitle = $url; } $genRssId = $adb->getUniqueID("rss"); $sSQL = "insert into rss (RSSID,RSSURL,RSSTITLE,RSSTYPE,STARRED,RSSCATEGORY) values (".$genRssId.",'".addslashes($url); $sSQL .= "','".addslashes($rsstitle)."',0,".$makestarred.",'".addslashes($rsscategory)."')"; $result = $adb->query($sSQL); if($result) { return true; }else { return false; } } } function getStarredRssFolder() { global $adb; global $image_path; $sSQL = "select * from rss where starred=1"; $result = $adb->query($sSQL); while($allrssrow = $adb->fetch_array($result)) { $shtml .= ""; $shtml .= " "; $shtml .= "".substr($allrssrow['rsstitle'],0,15)."..."; $shtml .= ""; } return $shtml; } function getCRMRssFeeds() { global $adb; global $image_path; $sSQL = "select * from rss where rsstype=1"; $result = $adb->query($sSQL); //$allrssrow = $adb->fetch_array($result); while($allrssrow = $adb->fetch_array($result)) { $shtml .= ""; if($allrssrow["starred"] == 1) { $shtml .= " "; }else { $shtml .= " "; } $shtml .= "".$allrssrow[rsstitle].""; $shtml .= ""; } return $shtml; } function getAllRssFeeds() { global $adb; global $image_path; $sSQL = "select * from rss where rsstype <> 1"; $result = $adb->query($sSQL); while($allrssrow = $adb->fetch_array($result)) { $shtml .= ""; if($allrssrow["starred"] == 1) { $shtml .= " "; }else { $shtml .= " "; } $shtml .= "".$allrssrow[rsstitle].""; $shtml .= ""; } return $shtml; } function getRssUrlfromId($rssid) { global $adb; if($rssid != "") { $sSQL = "select * from rss where rssid=".$rssid; $result = $adb->query($sSQL); $rssrow = $adb->fetch_array($result); if(count($rssrow) > 0) { $rssurl = $rssrow[rssurl]; } } return $rssurl; } function getRSSHeadings($rssid) { global $image_path; global $adb; if($rssid != "") { $sSQL = "select * from rss where rssid=".$rssid; $result = $adb->query($sSQL); $rssrow = $adb->fetch_array($result); if(count($rssrow) > 0) { $shtml = "
    "; if($rssrow[starred] == 1) { $shtml .= ""; }else { $shtml .= ""; } $shtml .= "rss_object[link]."\"> ".$rssrow[rsstitle]."
    "; } } return $shtml; /*if($this->rss_object) { $shtml = "
    rss_object[link]."\">".$this->rss_object[title]."
    "; return $shtml; }*/ } function getTopStarredRSSFeeds() { global $adb; global $image_path; $sSQL = "select * from rss where starred=1"; $result = $adb->query($sSQL); $shtml .= "Add New Rss"; while($allrssrow = $adb->fetch_array($result)) { $shtml .= ""; $shtml .= " ".substr($allrssrow['rsstitle'],0,10)."..."; } return $shtml; } function getStarredRssHTML() { global $adb; global $image_path; $sSQL = "select * from rss where starred=1"; $result = $adb->query($sSQL); //$shtml = ""; while($allrssrow = $adb->fetch_array($result)) { //$allrssrow["rssurl"]; if($this->setRSSUrl($allrssrow["rssurl"])) { $rss_html = $this->getListViewRSSHtml(); } $shtml .= ""; $sreturnhtml[] = $shtml; $shtml = ""; } $recordcount = round((count($sreturnhtml))/2); $j = $recordcount; for($i=0;$i<$recordcount;$i++) { $starredhtml .= "".$sreturnhtml[$i].$sreturnhtml[$j].""; $j = $j + 1; } $starredhtml = "
    "; $shtml .= ""; if(isset($this->rss_object)) { if(count($this->rss_object) > 10) { $shtml .= ""; } } $shtml .= "
    "; $shtml .= " Today at"; $shtml .= " rss_link\" target=\"_blank\">".$allrssrow['rsstitle'].""; $shtml .= "
      ".$rss_html."
    rss_link\">More...
      
    ".$starredhtml."
    "; return $starredhtml; } function getSelectedRssHTML($rssid) { global $adb; global $image_path; $sSQL = "select * from rss where rssid=".$rssid; $result = $adb->query($sSQL); // $shtml = ""; while($allrssrow = $adb->fetch_array($result)) { //$allrssrow["rssurl"]; if($this->setRSSUrl($allrssrow["rssurl"])) { $rss_html = $this->getListViewRSSHtml(); } $shtml = "
    "; $shtml .= ""; } if(isset($this->rss_object)) { if(count($this->rss_object) > 10) { $shtml .= ""; } } $shtml .= "
    "; if($allrssrow["starred"] == 1) { $shtml .= " Today at "; }else { $shtml .= " Today at "; } $shtml .= " rss_link\" target=\"_blank\">".$allrssrow['rsstitle'].""; $shtml .= "
      ".$rss_html."
    rss_link\">More...
    "; return $shtml; } function getRSSCategoryHTML() { global $adb; global $image_path; $sSQL = "select * from rsscategory where presence = 1 order by sortorderid"; $result = $adb->query($sSQL); // $categoryrow = $adb->fetch_array($result); while($categoryrow = $adb->fetch_array($result)) { $shtml .= "
    ".$categoryrow["rsscategory"]."
    ".$this->getRssFeedsbyCategory($categoryrow["rsscategory"])."
    "; } return $shtml; } function getRssFeedsbyCategory($rsscategory) { global $adb; global $image_path; $sSQL = "select * from rss where starred <> 1 and rsscategory='".$rsscategory."'"; $result = $adb->query($sSQL); while($allrssrow = $adb->fetch_array($result)) { $shtml .= ""; $shtml .= " "; $shtml .= "".$allrssrow[rsstitle].""; $shtml .= ""; } return $shtml; } function getRsscategory() { global $adb; global $image_path; $sSQL = "select * from rsscategory where presence = 1 order by sortorderid"; $result = $adb->query($sSQL); while($categoryrow = $adb->fetch_array($result)) { $rsscategories[] = $categoryrow["rsscategory"]; } return $rsscategories; } } ?>