function getBody($link, $id) { $body = false; if ($link == 'messages') { $msg = new suxThreadedMessages(); $body = $msg->getByID($id); $body = "{$body['title']} \n\n {$body['body_plaintext']}"; } elseif ($link == 'rss_items') { $rss = new suxRSS(); $body = $rss->getItemByID($id); $body = "{$body['title']} \n\n {$body['body_plaintext']}"; } elseif ($link == 'bookmarks') { $bm = new suxBookmarks(); $body = $bm->getByID($id); $body = "{$body['title']} \n\n {$body['body_plaintext']}"; } return $body; }
/** * Display RSS Feed */ function rss() { // Cache $cache_id = $this->profile['nickname'] . '|rss'; $this->tpl->caching = 1; if (!$this->tpl->isCached('rss.tpl', $cache_id)) { $fp = $this->log->get($this->minifeed_limit * 5, 0, $this->profile['users_id']); if ($fp) { $rss = new suxRSS(); $title = "{$this->r->title} | {$this->profile['nickname']}"; $url = suxFunct::makeUrl('/user/profile/' . $this->profile['nickname'], null, true); $rss->outputRSS($title, $url, null); foreach ($fp as $item) { $url2 = $url . '#' . strtotime($item['ts']); $rss->addOutputItem($item['ts'], $url2, $item['body_html']); } $this->tpl->assign('xml', $rss->saveXML()); } } // Template header('Content-type: text/xml; charset=utf-8'); $this->tpl->display('rss.tpl', $cache_id); }
/** * Display RSS Feed */ function rss() { // Cache $cache_id = 'rss'; $this->tpl->caching = 1; if (!$this->tpl->isCached('rss.tpl', $cache_id)) { $fp = $this->bm->get($this->pager->limit); if ($fp) { $rss = new suxRSS(); $title = "{$this->r->title} | {$this->r->gtext['bookmarks']}"; $url = suxFunct::makeUrl('/bookmarks', null, true); $rss->outputRSS($title, $url, null); foreach ($fp as $item) { $rss->addOutputItem($item['title'], $item['url'], $item['body_html']); } $this->tpl->assign('xml', $rss->saveXML()); } } // Template header('Content-type: text/xml; charset=utf-8'); $this->tpl->display('rss.tpl', $cache_id); }
die; } // --------------------------------------------------------------------------- // Error checking // --------------------------------------------------------------------------- if (!isset($_SESSION['users_id'])) { failure('Invalid user id'); } if (!isset($_POST['id']) || !filter_var($_POST['id'], FILTER_VALIDATE_INT) || $_POST['id'] < 1) { failure('Invalid feed id'); } $id = $_POST['id']; // --------------------------------------------------------------------------- // Secondary error checking // --------------------------------------------------------------------------- $feed = new suxRSS(); if (!$feed->getFeedByID($id)) { failure('Invalid feed'); } // --------------------------------------------------------------------------- // Go // --------------------------------------------------------------------------- $module = 'feeds'; $link = 'link__rss_feeds__users'; $col = 'rss_feeds'; // Get image names from template config $tpl = new suxTemplate($module); $tpl->configLoad('my.conf', $module); $image = $tpl->getConfigVars('imgUnsubscribed'); $db = suxDB::get(); $query = "SELECT COUNT(*) FROM {$link} WHERE {$col}_id = ? AND users_id = ? ";
<?php // Cron job to retrieve RSS feeds and put them in the database require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/../../initialize.php'; try { $rss = new suxRSS(); $rss->cron(); } catch (Exception $e) { echo $e->getMessage(), "\n"; echo "File: ", $e->getFile(), "\n"; echo "Line: ", $e->getLine(), "\n\n"; }