Author: Jannis Pohl Version: 2.0.0-Alpha Git commit: 0638fa8bb13e1aca64885a4be9e6b7d78aab0af7 Committed at: Wed Aug 24 23:16:56 BST 2011 Licence: http://www.typefish.co.uk/licences/
Наследование: extends Script
 function actionPerform(&$skin, $moduleID)
 {
     $query = "SELECT  *  FROM {$skin->main->databaseTablePrefix}module_settings WHERE setting_key='feed_URL' AND module_id={$moduleID}";
     $recordSet = $skin->main->databaseConnection->Execute($query);
     //Check for error, if an error occured then report that error
     if (!$recordSet) {
         //Assign codeBehind variables
         $skin->main->controlVariables["rssFeed"]["allItems"] = array();
         $skin->main->controlVariables["rssFeed"]["itemCount"] = 0;
         trigger_error("Unable to get rss feed url\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
     } else {
         $rows = $recordSet->GetRows();
         if (sizeof($rows) == 1) {
             $feedURL = $rows[0]['setting_value'];
             $rss = new RSS(implode("", file($feedURL)));
             //Assign codeBehind variables
             $allItems = $rss->getAllItems();
             $skin->main->controlVariables["rssFeed"]["allItems"] = $allItems;
             $skin->main->controlVariables["rssFeed"]["itemCount"] = count($allItems);
         } else {
             //Assign codeBehind variables
             $skin->main->controlVariables["rssFeed"]["allItems"] = array();
             $skin->main->controlVariables["rssFeed"]["itemCount"] = 0;
         }
     }
 }
Пример #2
0
 /**
  * Create an RSS Feed
  *
  * @param string $title - feed title
  * @param string $link - url feed title should point to
  * @param string $description - feed description
  * @param array $items - $items[0] = array('title'=>TITLE, 'link'=>URL, 'date'=>TIMESTAMP, 'description'=>DESCRIPTION)
  */
 public function rss($h, $title = '', $link = '', $description = '', $items = array())
 {
     require_once EXTENSIONS . 'RSSWriterClass/rsswriter.php';
     $feed = new RSS();
     $feed->title = stripslashes(html_entity_decode(urldecode($title), ENT_QUOTES, 'UTF-8'));
     $feed->link = html_entity_decode($link, ENT_QUOTES, 'UTF-8');
     $feed->description = $description;
     if ($items) {
         foreach ($items as $item) {
             $rssItem = new RSSItem();
             if (isset($item['title'])) {
                 $rssItem->title = stripslashes(html_entity_decode(urldecode($item['title']), ENT_QUOTES, 'UTF-8'));
             }
             if (isset($item['link'])) {
                 $rssItem->link = html_entity_decode($item['link'], ENT_QUOTES, 'UTF-8');
             }
             if (isset($item['date'])) {
                 $rssItem->setPubDate($item['date']);
             }
             if (isset($item['description'])) {
                 $rssItem->description = "<![CDATA[ " . stripslashes(urldecode($item['description'])) . " ]]>";
             }
             if (isset($item['enclosure'])) {
                 $rssItem->enclosure($item['enclosure']['url'], $item['enclosure']['type'], $item['enclosure']['length']);
             }
             if (isset($item['author'])) {
                 $rssItem->addTag('author', $item['author']);
             }
             $feed->addItem($rssItem);
         }
     }
     echo $feed->serve();
 }
Пример #3
0
 public function crotypedia()
 {
     $RSS = new RSS($this->db);
     $this->f3->set('feed_url', $this->f3->get('site') . $this->f3->get('ALIASES')['rss_all']);
     $this->f3->set('feed_title', 'CR');
     $this->f3->set('feeds', $RSS->crotypedia());
     echo Template::instance()->render('rss/feed.xml', 'application/xml');
 }
Пример #4
0
 /**
  * 文章feed
  * @param string $type 文章类型
  * @internal param $null 显示数量由 feed_num决定* 显示数量由 feed_num决定
  */
 public function listPost($type = 'single')
 {
     $PostsList = new PostsLogic();
     $post_list = $PostsList->getList(get_opinion('feed_num'), $type, 'post_date desc', true);
     $RSS = new RSS(get_opinion('title'), '', get_opinion('description'), '');
     // 站点标题的链接
     foreach ($post_list as $list) {
         $RSS->addItem($list['post_title'], 'http://' . $_SERVER["SERVER_NAME"] . get_post_url($list), $list['post_content'], $list['post_date']);
     }
     $RSS->display();
 }
Пример #5
0
 /**
  * 页面feed
  * @param null
  * 显示数量由 feed_num决定
  */
 public function listsPage()
 {
     $PostsList = new PostsLogic();
     $post_list = $PostsList->getList(get_opinion('feed_num'), 'page', 'post_id desc', true);
     $RSS = new RSS(get_opinion('title'), '', get_opinion('description'), '');
     // 站点标题的链接
     foreach ($post_list as $list) {
         $RSS->AddItem($list['post_title'], 'http://' . $_SERVER["SERVER_NAME"] . getPageURLByID($list['post_id']), $list['post_content'], $list['post_date']);
     }
     $RSS->Display();
 }
Пример #6
0
 /**
  * Create an RSS Feed
  *
  * @param string $title - feed title
  * @param string $link - url feed title should point to
  * @param string $description - feed description
  * @param array $items - $items[0] = array('title'=>TITLE, 'link'=>URL, 'date'=>TIMESTAMP, 'description'=>DESCRIPTION)
  * @param string $content_type e.g. 'application/xml' or 'text/plain'
  */
 public function rss($h, $title = '', $link = '', $description = '', $items = array(), $content_type = 'application/xml')
 {
     require_once EXTENSIONS . 'RSSWriterClass/rsswriter.php';
     $feed = new \RSS($h->url(array('page' => 'rss')));
     $feed->title = stripslashes(html_entity_decode(urldecode($title), ENT_QUOTES, 'UTF-8'));
     $feed->link = html_entity_decode($link, ENT_QUOTES, 'UTF-8');
     $feed->description = $description;
     if ($items) {
         $feed->addItem($items);
     }
     echo $feed->out($content_type);
 }
Пример #7
0
 public function execute()
 {
     $this->output->description = "News";
     $this->output->keywords = "news";
     $this->output->title = "News";
     $this->output->add_alternate("News", "application/rss+xml", "/news.xml");
     if ($this->page->type == "xml") {
         /* RSS feed
          */
         $rss = new RSS($this->output);
         if ($rss->fetch_from_cache("news_rss") == false) {
             $rss->title = $this->settings->head_title . " news";
             $rss->description = $this->settings->head_description;
             if (($news = $this->model->get_news(0, $this->settings->news_rss_page_size)) != false) {
                 foreach ($news as $item) {
                     $link = "/news/" . $item["id"];
                     $rss->add_item($item["title"], $item["content"], $link, $item["timestamp"]);
                 }
             }
             $rss->to_output();
         }
     } else {
         if (valid_input($this->page->pathinfo[1], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
             /* News item
              */
             if (($item = $this->model->get_news_item($this->page->pathinfo[1])) == false) {
                 $this->output->add_tag("result", "Unknown news item");
             } else {
                 $this->output->title = $item["title"] . " - News";
                 $item["timestamp"] = date("j F Y, H:i", strtotime($item["timestamp"]));
                 $this->output->record($item, "news");
             }
         } else {
             /* News overview
              */
             if (($count = $this->model->count_news()) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             $paging = new pagination($this->output, "news", $this->settings->news_page_size, $count);
             if (($news = $this->model->get_news($paging->offset, $paging->size)) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             foreach ($news as $item) {
                 $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
                 $this->output->record($item, "news");
             }
             $paging->show_browse_links(7, 3);
         }
     }
 }
Пример #8
0
/**
 * Add an entry to the modlog
 *
 * @param string $entry Entry text
 * @param integer $category Category to file under. 0 - No category, 1 - Login, 2 - Cleanup/rebuild boards and html files, 3 - Board adding/deleting, 4 - Board updates, 5 - Locking/stickying, 6 - Staff changes, 7 - Thread deletion/post deletion, 8 - Bans, 9 - News, 10 - Global changes, 11 - Wordfilter
 * @param string $forceusername Username to force as the entry username
 */
function management_addlogentry($entry, $category = 0, $forceusername = '')
{
    global $tc_db;
    $username = $forceusername == '' ? $_SESSION['manageusername'] : $forceusername;
    if ($entry != '') {
        $tc_db->Execute("INSERT INTO `" . KU_DBPREFIX . "modlog` ( `entry` , `user` , `category` , `timestamp` ) VALUES ( " . $tc_db->qstr($entry) . " , '" . $username . "' , " . $tc_db->qstr($category) . " , '" . time() . "' )");
    }
    if (KU_RSS) {
        require_once KU_ROOTDIR . 'inc/classes/rss.class.php';
        $rss_class = new RSS();
        print_page(KU_BOARDSDIR . 'modlogrss.xml', $rss_class->GenerateModLogRSS($entry), '');
    }
}
Пример #9
0
 function getRSSFromId($id)
 {
     $query = "SELECT * FROM RSS WHERE id = {$id}";
     try {
         $r = $this->db->query($query)->fetch();
         if ($r != NULL && !empty($r)) {
             $rss = new RSS($r['url']);
             $rss->update();
             return $rss;
         }
     } catch (PDOException $ex) {
         die("PDO Error :" . $ex->getMessage());
     }
 }
Пример #10
0
    public function updateGlobalRSS()
    {
        echo '[' . date('H:m:s') . "] Updating global RSS channel...\n";
        $filename = PATH_PUBLIC . 'rss-global.xml';
        $sites = Database::sites();
        $st = array();
        $cursor = Database::jobs()->find();
        $cursor->sort(array('stamp' => -1));
        $cursor->limit(25);
        date_default_timezone_set('GMT');
        // generating global rss feed
        $rss = RSS::create($filename);
        while ($item = $cursor->getNext()) {
            if (!isset($st[$item['site']])) {
                $st[$item['site']] = $sites->findOne(array('code' => $item['site']));
            }
            $s = $st[$item['site']];
            $desc = <<<EOF
{$item['desc']}<br /><p style="padding: 0.2em; background-color: silver; border: 1px dotted black; align: center;" align="center"><a href="{$item['url']}">{$item['title']}</a></p>
EOF;
            $rss->addItem($s['name'] . ': ' . $item['title'], 'http://workbreeze.com/jobs/' . $s['folder'] . '/' . $item['id'], $desc, 'http://workbreeze.com/jobs/' . $s['folder'] . '/' . $item['id'], $item['stamp']);
        }
        $rss->save();
        // compressing for nginx static gzip
        $out = system('gzip -c9 ' . escapeshellarg($filename) . ' > ' . escapeshellarg($filename . '.gz'));
    }
Пример #11
0
 public function __construct($config)
 {
     $config['link'] = 'http://www.facebook.com/' . $config['username'] . '/';
     $config['url'] = sprintf('http://www.facebook.com/feeds/status.php?id=%d&viewer=%d&key=%s&format=rss20', $config['id'], $config['id'], $config['key']);
     parent::__construct($config);
     $this->setItemTemplate('<li><a href="{{{link}}}">{{{title}}}</a> {{{date}}}</li>' . "\n");
 }
Пример #12
0
 public function __construct($config)
 {
     $config['link'] = 'http://del.icio.us/' . $config['username'] . '/';
     $config['url'] = sprintf('http://feeds.delicious.com/v2/rss/%s?count=%s', $config['username'], $config['total']);
     parent::__construct($config);
     $this->setItemTemplate('<li><a href="{%link%}">{%title%}</a></li>' . "\n");
 }
Пример #13
0
 public function __construct($config)
 {
     $config['link'] = 'http://www.instapaper.com/';
     $config['url'] = sprintf('http://www.instapaper.com/archive/rss/%s/%s', $config['userid'], $config['token']);
     parent::__construct($config);
     $this->setItemTemplate('<li><a href="{{{link}}}">{{{title}}}</a></li>' . "\n");
 }
Пример #14
0
 public function __construct($config)
 {
     $config['link'] = 'http://delicious.com/' . $config['username'] . '/';
     $config['url'] = sprintf('http://feeds.delicious.com/v2/rss/%s?count=%s', $config['username'], $config['total']);
     parent::__construct($config);
     $this->setItemTemplate('<li class="link"><a href="{{{link}}}">{{{title}}}</a>{{{tags}}}</li>' . "\n");
 }
Пример #15
0
 function show()
 {
     $url = FoodleUtils::getUrl() . 'foodle/' . $this->foodle->identifier;
     $responses = $this->foodle->getResponses();
     $rssentries = array();
     foreach ($responses as $response) {
         #echo '<pre>'; print_r($response); echo '</pre>';
         $newrssentry = array('title' => $response->username, 'description' => 'Response: ' . self::encodeResponse($response->response['data']), 'pubDate' => $response->created);
         if (isset($entry['notes'])) {
             $newrssentry['description'] .= '<br /><strong>Comment from user: </strong><i>' . $response->notes . '</i>';
         }
         $newrssentry['description'] .= '<br />[ <a href="' . $url . '">go to foodle</a> ]';
         $rssentries[] = $newrssentry;
     }
     $rss = new RSS($this->foodle->name);
     #$rss->description = $this->foodle->description;
     $rsstext = $rss->get($rssentries);
     header('Content-Type: text/xml');
     echo $rsstext;
 }
Пример #16
0
 public function action_handler_dev_feed($handler_vars)
 {
     $rss = Plugins::get_by_interface('RSS');
     if (count($rss) !== 1) {
         exit;
     }
     $xml = reset($rss)->create_rss_wrapper();
     $connection_string = Options::get('tracfeed__connection_string');
     $username = Options::get('tracfeed__username');
     $password = Options::get('tracfeed__password');
     $db = DatabaseConnection::ConnectionFactory($connection_string);
     $db->connect($connection_string, $username, $password);
     $times = $db->get_column('SELECT time from ticket_change group by time order by time desc limit 15;');
     $mintime = array_reduce($times, 'min', reset($times));
     $comments = $db->get_results("\n\t\t\tSELECT *, ticket_change.time as changetime from ticket_change \n\t\t\tINNER JOIN ticket on ticket.id = ticket_change.ticket\n\t\t\twhere \n\t\t\tchangetime >= ? and\n\t\t\tnot (field ='comment' and newvalue = '') \n\t\t\torder by ticket_change.time DESC;\n\t\t", array($mintime));
     $posts = array();
     foreach ($comments as $comment) {
         $post_id = md5($comment->ticket . ':' . $comment->changetime . ':' . $comment->author);
         if (!array_key_exists($post_id, $posts)) {
             $post = new Post();
             $post->title = "Ticket #{$comment->ticket}: {$comment->summary}";
             $post->content = "Changes by {$comment->author} on ticket <a href=\"http://trac.habariproject.org/habari/ticket/{$comment->ticket}\">#{$comment->ticket}</a>.\n<br>\n<br>";
             $post->guid = 'tag:' . Site::get_url('hostname') . ',trac_comment,' . $post_id;
             $post->content_type = 'dev_feed';
             $post->slug = "http://trac.habariproject.org/habari/ticket/{$comment->ticket}";
             $post->pubdate = date('r', $comment->changetime);
             $posts[$post_id] = $post;
         } else {
             $post = $posts[$post_id];
         }
         switch ($comment->field) {
             case 'comment':
                 $content = $comment->newvalue;
                 $content = preg_replace('/\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|]/i', '<a href="$0">[link]</a>', $content);
                 $content = preg_replace('%\\br([0-9]+)\\b%', '<a href="http://trac.habariproject.org/habari/changeset/$1">r$1</a>', $content);
                 $content = preg_replace('%\\b#([0-9]+)\\b%', '<a href="http://trac.habariproject.org/habari/ticket/$1">$1</a>', $content);
                 $post->content .= "Comment #{$comment->oldvalue} by {$comment->author}:\n<blockquote><pre>{$content}</pre></blockquote>\n<br>";
                 break;
             default:
                 if (trim($comment->oldvalue) == '') {
                     $post->content .= "Set <b>{$comment->field}</b> to: {$comment->newvalue}\n<br>";
                 } else {
                     $post->content .= "Changed <b>{$comment->field}</b> from: {$comment->oldvalue}\n<br> To: {$comment->newvalue}\n<br>";
                 }
                 break;
         }
     }
     $xml = RSS::add_posts($xml, $posts);
     ob_clean();
     header('Content-Type: application/xml');
     echo $xml->asXML();
     exit;
 }
Пример #17
0
 public function execute()
 {
     if ($this->page->type == "xml") {
         /* RSS feed
          */
         $rss = new RSS($this->output);
         if ($rss->fetch_from_cache("rss_cache_id") == false) {
             $rss->title = "RSS title";
             $rss->description = "RSS description";
             if (($items = $this->model->get_items()) != false) {
                 foreach ($items as $item) {
                     $rss->add_item($item["title"], $item["content"], $item["link"], $item["timestamp"]);
                 }
                 $rss->to_output();
             }
         }
     } else {
         /* Other page type
          */
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     $module_id = $request->get_getstring('module_id', '');
     if (empty($module_id)) {
         AppContext::get_response()->redirect(Environment::get_home_page());
     }
     $this->init();
     $module_category_id = $request->get_getint('module_category_id', 0);
     $feed_name = $request->get_getstring('feed_name', Feed::DEFAULT_FEED_NAME);
     $feed = new RSS($module_id, $feed_name, $module_category_id);
     if ($feed !== null && $feed->is_in_cache()) {
         $this->tpl->put('SYNDICATION', $feed->read());
     } else {
         $eps = AppContext::get_extension_provider_service();
         if ($eps->provider_exists($module_id, FeedProvider::EXTENSION_POINT)) {
             $provider = $eps->get_provider($module_id);
             $feeds = $provider->feeds();
             $data = $feeds->get_feed_data_struct($module_category_id, $feed_name);
             if ($data === null) {
                 AppContext::get_response()->set_header('content-type', 'text/html');
                 DispatchManager::redirect(PHPBoostErrors::unexisting_element());
             } else {
                 $feed->load_data($data);
                 $feed->cache();
                 $this->tpl->put('SYNDICATION', $feed->export());
             }
         } else {
             DispatchManager::redirect(PHPBoostErrors::module_not_installed());
         }
     }
     return $this->build_response($this->tpl);
 }
Пример #19
0
 public function __construct()
 {
     parent::__construct("https://i-share.carli.illinois.edu/newbooks/newbooks.cgi?library=WHEdb&list=all&day=7&op=and&text=&lang=English&submit=RSS");
     $nitems = count($this->xml->channel->item);
     for ($i = 0; $i < $nitems; ++$i) {
         $tidy_desc = \str_replace(array('&lt;B&gt;', '&lt;/B&gt;', '<description>', '</description>'), '', $this->xml->channel->item[$i]->description->asXML());
         $matches = array();
         if (\preg_match('@&lt;img border="0" src="(.*)" vspace="3" border="0" align="right"/&gt;@', $tidy_desc, $matches)) {
             if (\util\Utility::isValidImage($matches[1])) {
                 $imgurl = $matches[1];
             } else {
                 $imgurl = "";
             }
             $tidy_desc = str_replace($matches[0], '', $tidy_desc);
         } else {
             $imgurl = "";
         }
         $fieldstr = \explode('&lt;BR/&gt;', $tidy_desc);
         $this->xml->channel->item[$i]->description = \implode("\n", $fieldstr);
         $fields = array();
         foreach ($fieldstr as $f) {
             //separate field name and field value
             $matches = array();
             if (\preg_match("/^([-a-zA-Z_ ]*[a-zA-Z]{4}): /", $f, $matches)) {
                 $fname = \strtolower(str_replace(' ', '_', \trim($matches[1])));
                 $fvalue = \trim(str_replace($matches[0], '', $f));
                 $fields[$fname] = $fvalue;
                 $this->xml->channel->item[$i]->addChild($fname, $fvalue);
             }
         }
         $cn_data = \cn\processor\Factory::make($fields)->data();
         foreach ($cn_data as $name => $value) {
             $name = \htmlspecialchars($name);
             $value = \htmlspecialchars($value);
             $this->xml->channel->item[$i]->addChild($name, $value);
         }
         unset($this->xml->channel->item[$i]->description[0]);
         if (!\util\Utility::isValidImage($imgurl)) {
             $imgurl = "";
         }
         $this->xml->channel->item[$i]->addChild('cover', $imgurl);
     }
 }
Пример #20
0
 /**
  * rss
  */
 public function feed()
 {
     $rss = \RSS::make();
     Log::info("开始构建RSS XML.");
     if (Cache::has('self:rss')) {
         Log::info("发现缓存的RSS XMLDOCUMENT。");
         $rss = Cache::get("self:rss");
         // make channel.
     } else {
         Log::info("没有发现缓存中存在RSS XMLDOCUMENT。开始构建。");
         $rss->channel(['title' => 'LuBlog', 'description' => '蝼蚁虽小,也有梦想。', 'link' => url('/')])->withImage(['url' => asset('/images/avatar.jpg'), 'title' => '头像', 'link' => url('/')]);
         $articles = Article::orderBy('created_at', 'desc')->take(20)->get();
         // gen posts data ......
         foreach ($articles as $article) {
             $rss->item(['title' => $article->title, 'description|cdata' => $article->description, 'link' => url('/article/' . $article->id)]);
         }
         $expries_at = Carbon::now()->addMinutes(30);
         Cache::put('self:rss', $rss, $expries_at);
     }
     // If you want to save the rss data to file.
     // $rss->save('rss.xml');
     // Or just make a response to the http request.
     return \Response::make($rss->render(), 200, ['Content-Type' => 'text/xml']);
 }
Пример #21
0
<?php

header("Content-Type: application/xml; charset=ISO-8859-1");
include "classes/RSS.class.php";
$rss = new RSS();
echo $rss->GetFeed();
Пример #22
0
 public function getRSS(Channel $channel, array $timeline)
 {
     $rss = new RSS();
     $rss->setChannel($channel)->parseTimeline($timeline);
     return $rss->toXML();
 }
Пример #23
0
 /**
  * displayRSS
  * 
  * Display the follow-ups of this artifact as a rss feed
  *
  */
 function displayRSS()
 {
     $uh = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $group = $this->ArtifactType->getGroup();
     $rss = new RSS(array('title' => $group->getPublicName() . ' ' . $this->ArtifactType->getName() . ' #' . $this->getId() . ' - ' . $this->getValue('summary') . ' - ' . $GLOBALS['Language']->getText('tracker_include_artifact', 'follow_ups'), 'description' => '', 'link' => '<![CDATA[' . get_server_url() . '/tracker/?atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . ']]>', 'language' => 'en-us', 'copyright' => $GLOBALS['Language']->getText('rss', 'copyright', array($GLOBALS['sys_long_org_name'], $GLOBALS['sys_name'], date('Y', time()))), 'pubDate' => gmdate('D, d M Y h:i:s', $this->getLastUpdateDate()) . ' GMT'));
     $result = $this->getFollowups();
     for ($i = 0; $i < db_numrows($result); $i++) {
         $comment_type = db_result($result, $i, 'comment_type');
         $comment_type_id = db_result($result, $i, 'comment_type_id');
         $comment_id = db_result($result, $i, 'artifact_history_id');
         $field_name = db_result($result, $i, 'field_name');
         $orig_subm = $this->getOriginalCommentSubmitter($comment_id);
         $orig_date = $this->getOriginalCommentDate($comment_id);
         if ($comment_type_id == 100 || $comment_type == "") {
             $comment_type = '';
         } else {
             $comment_type = '<strong>[' . $comment_type . ']</strong><br />';
         }
         $rss->addItem(array('title' => '<![CDATA[' . $GLOBALS['Language']->getText('tracker_include_artifact', 'add_flup_comment') . ' #' . $comment_id . ']]>', 'description' => '<![CDATA[' . $comment_type . util_make_links(nl2br(db_result($result, $i, 'new_value')), $group->getGroupId(), $this->ArtifactType->getID()) . ']]>', 'pubDate' => gmdate('D, d M Y h:i:s', db_result($orig_date, 0, 'date')) . ' GMT', 'dc:creator' => $hp->purify($uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by'))), 'link' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>', 'guid' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>'));
     }
     $rss->display();
     exit;
 }
Пример #24
0
 public function getData()
 {
     $data = parent::getParentData();
     return $data->item;
 }
Пример #25
0
 function __construct()
 {
     parent::__construct();
 }
Пример #26
0
#!/usr/bin/php
<?php 
require 'rss.php';
require '/home/www/richtaur.com/chat/common/init.php';
$room_id = (int) $argv[1];
$url = $argv[2];
$rss = new RSS($url, $room_id);
$json = json_decode($rss->get());
if (!$json || !$json->guid) {
    exit;
}
$log .= "----------\n";
$log .= "Time: " . date('r') . "\n";
$threshold = time() - 300;
// 5 minutes ago
$time = strtotime($json->pubDate);
if ($time < $threshold) {
    $log .= "{$time} < {$threshold}, exiting ...\n";
    file_put_contents('/home/richter/tmp/chat.log', $log, FILE_APPEND);
    exit;
}
$log .= "going\n";
$tokens = explode(':', $json->description);
$name = $tokens[0];
$message = substr($json->description, strlen($name) + 2);
$message .= " (via http://twitter.com/{$name})";
/*
echo "going ahead\n";
echo "twitter time: $time\n";
echo "php time: " . time() . "\n";
Пример #27
0
<meta http-equiv="Content-Language" content="pl" />
<style type="text/css" media="all">
@import "style.css";
</style>
<title>OpLUG planet</title>

</head> 
 
<body>

<div class="baner"><a href="http://linux.opole.pl">OpLUG Planet</a></div>

<div class="main">

<?php 
$rss = new RSS("channels.rss", 3);
$a = 0;
while ($a <= $rss->curID) {
    print "<div class=\"notka\">";
    print "<h2 class=\"tytul\"><a href=\"" . $rss->get_link($a) . "\">" . $rss->get_title($a) . "</a></h2>";
    print "<div class=\"info\"><span class=\"autor\">" . $rss->get_author($a) . "</span> | <span class=\"data\">" . $rss->get_data_string($a) . "</span></div>";
    print "<div class=\"tresc\">" . $rss->get_content($a) . "</div>";
    print "</div>";
    $a++;
}
print "<div class=\"credits\">";
$rss->print_credits();
print "</div>";
// Klasa RSS umozliwia odczytywanie kanalow RSS i przetwarzanie interesujacych nas informacji na HTML.
// Na razie nie jest to duzo, ale od czegos trzeba zaczac...
//Metody publiczne:
Пример #28
0
<?php

$rss = new RSS("Letzte Antworten - " . SiteConfig::val("page/title", "Q/A Forum"), "Die neusten Antworten aus dem Forum", get_path("/questions/rss"));
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.*,T3.title,T2.username as authorname FROM answers as T1 LEFT JOIN user_list as T2 ON T1.author=T2.id LEFT JOIN questions as T3 ON T1.question=T3.id WHERE 1 ORDER BY date_created DESC LIMIT 0,30');
foreach ($rows as $row) {
    $item = new RSSItem("Antwort auf: " . $row["title"], $row["txt"] . '<br/><br/><div style="color:#8080ff;">SPAMcheck: ' . SpamText($row["isSPAM"]) . '<br/><i>' . html($row["authorname"]) . '</i></div>', Question::PermalinkByData($row["question"], $row["title"]) . "#answer-" . $row["id"]);
    $rss->addItem($item);
}
//die($rss->fetch());
$rss->display();
exit(1);
function SpamText($v)
{
    switch ($v) {
        case -2:
            return "Akismet gute Antwort";
        case -1:
            return "Ham";
        case 1:
            return "<b>Spam</b>";
        case 2:
            return "<b>Akismet SPAM</b>";
    }
}
Пример #29
0
function metaWeblog_editPost()
{
    $params = func_get_args();
    $result = api_login($params[1], $params[2]);
    if ($result) {
        return $result;
    }
    $post = api_make_post($params[3], $params[4], $params[0]);
    $post->created = null;
    if (!$post) {
        return new XMLRPCFault(1, "Textcube editing error");
    }
    $ret = $post->update();
    // 기존 글의 파일들 지우기 (잘 찾아서)
    // 새로 업로드 된 파일들 옮기기
    api_update_attaches_with_replace($post->id);
    fireEvent('UpdatePostByBlogAPI', $id, $post);
    RSS::refresh();
    $post->close();
    if ($ret != false) {
        Setting::setBlogSettingGlobal('LatestEditedEntry', $post->id);
    }
    return $ret ? true : false;
}
Пример #30
0
<?php

/**
 * Copyright (c) 2009 West Virginia University
 * 
 * Licensed under the MIT License
 * Redistributions of files must retain the above copyright notice.
 * 
 */
require_once "../../../lib/rss_services.php";
require_once "../data/data.inc.php";
$Emergency = new RSS();
$emergencies = $Emergency->get_feed($emergency_rss_feed);
if ($emergencies === False) {
    echo 'Emergency information is currently not available';
} else {
    foreach ($emergencies as $title => $emergency) {
        $text = explode("\n", $emergency[$title]['text']);
        $paragraphs = array();
        foreach ($text as $paragraph) {
            if ($paragraph) {
                echo $paragraph;
            }
        }
    }
    // handle the case that an emergency RSS feed doesn't return data until emergency (like e2campus)
    if ($paragraphs == False) {
        echo "There is currently no emergency on campus.";
    }
}