Beispiel #1
0
 protected function _content()
 {
     global $dbtable_prefix;
     $query = "SELECT `feed_xml` FROM `{$dbtable_prefix}feed_cache` WHERE `module_code`='" . $this->module_code . "'";
     if (!($res = @mysql_query($query))) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     if (mysql_num_rows($res) && mysql_result($res, 0, 0)) {
         require_once _BASEPATH_ . '/includes/classes/feed_reader.class.php';
         $fr = new feedReader();
         $fr->setRawXML(mysql_result($res, 0, 0));
         $ok = $fr->parseFeed();
         if ($ok) {
             $items = $fr->getFeedOutputData();
             for ($i = 0; isset($items['item'][$i]); ++$i) {
                 $items['item'][$i]['description'] = isset($items['item'][$i]['description']) ? substr($items['item'][$i]['description'], 0, $this->config['num_chars']) : (isset($items['item'][$i]['content:encoded']) ? substr($items['item'][$i]['content:encoded'], 0, $this->config['num_chars']) : '');
                 unset($items['item'][$i]['content:encoded']);
             }
             $this->tpl->set_file('widget.content', 'widgets/osignal_feed/display.html');
             $this->tpl->set_loop('loop', array_slice($items['item'], 0, $this->config['num_stories']));
             $this->tpl->process('widget.content', 'widget.content', TPL_LOOP);
             $this->tpl->drop_loop('loop');
         }
     }
 }
Beispiel #2
0
function get_osignal_feed()
{
    global $dbtable_prefix;
    require_once _BASEPATH_ . '/includes/classes/feed_reader.class.php';
    $module_code = 'osignal_feed';
    $config = get_site_option(array('enabled', 'feed_url'), $module_code);
    if ($config['enabled']) {
        $fr = new feedReader();
        $ok = $fr->getFeed($config['feed_url']);
        if ($ok) {
            $query = "REPLACE INTO `{$dbtable_prefix}feed_cache` SET `module_code`='{$module_code}',`feed_xml`='" . sanitize_and_format($fr->getRawXML(), TYPE_STRING, FORMAT_ADDSLASH) . "',`update_time`='" . gmdate('YmdHis') . "'";
            if (!($res = @mysql_query($query))) {
                trigger_error(mysql_error(), E_USER_ERROR);
            }
        } else {
            echo 'error retrieving the feed--> ';
        }
    }
    return true;
}
Beispiel #3
0
 protected function _content()
 {
     if (is_file(_BASEPATH_ . '/rss/site_news.xml')) {
         require_once _BASEPATH_ . '/includes/classes/feed_reader.class.php';
         $fr = new feedReader();
         $fr->getFeed(_BASEPATH_ . '/rss/site_news.xml', true);
         if ($fr->parseFeed()) {
             $items = $fr->getFeedOutputData();
             if (isset($_SESSION[_LICENSE_KEY_]['user']['prefs'])) {
                 for ($i = 0; isset($items['item'][$i]); ++$i) {
                     $items['item'][$i]['dc:date'] = strftime($_SESSION[_LICENSE_KEY_]['user']['prefs']['datetime_format'], $items['item'][$i]['dc:date'] + $_SESSION[_LICENSE_KEY_]['user']['prefs']['time_offset']);
                 }
             }
             $this->tpl->set_file('widget.content', 'widgets/site_news_feed/display.html');
             $this->tpl->set_loop('loop', array_slice($items['item'], 0, $this->config['total']));
             $this->tpl->process('widget.content', 'widget.content', TPL_LOOP);
             $this->tpl->drop_loop('loop');
         }
     }
 }
Beispiel #4
0
 /**
  * @param $rss_titleA
  * @param $rss_contentA
  * @param $linkA
  * @return bool
  */
 function rotowire(&$rss_titleA, &$rss_contentA, &$rss_linkA)
 {
     $this->rss_url = "http://www.rotowire.com/rss/news.htm?sport=nhl";
     $fr = new feedReader();
     $fr->setFeedUrl($this->rss_url);
     $fr->parseFeed();
     $array = $fr->getFeedOutputData();
     $number = $fr->getFeedNumberOfNodes();
     for ($i = 0; $i < $number; $i++) {
         $title = $array["item"]["title"][$i];
         $desc = $array["item"]["description"][$i];
         $pubdate = $array["item"]["pubdate"][$i];
         $link = $array["item"]["link"][$i];
         $rss_titleA[] = $title;
         $rss_contentA[] = "{$desc} \n\n (maj: {$pubdate})";
         $rss_linkA[] = $link;
         //echo "$title \n $desc (updated on $pubdate) \n";
     }
     /*
               $LOCKFILE = "/export/home/www/rss/rss_rowotire.lock";
     $RSSFILE = "/export/home/www/rss/rss_rotowire.rss";
     
     if (file_exists($LOCKFILE)) return FALSE;
     if (! file_exists($RSSFILE)) return FALSE;
     
     $handle = fopen($RSSFILE, "r");
     
     while (!feof($handle)) {
          $title = fgets($handle);
          $content = fgets($handle);
          
          $rss_titleA[] = $title;
          $rss_contentA[] = $content;
     }
     
     fclose($handle);
     */
     return TRUE;
 }
 public function process($do)
 {
     if ($do == 'ok') {
         $this->status = true;
         return;
     }
     if (empty($_POST['feed_url'])) {
         return;
     }
     $this->feed_url = $_POST['feed_url'];
     $feed = feedReader::quickParse($this->feed_url);
     if ($feed === false) {
         throw new Exception(__('Cannot retrieve feed URL.'));
     }
     if (count($feed->items) == 0) {
         throw new Exception(__('No items in feed.'));
     }
     if ($this->core->plugins->moduleExists('metadata')) {
         $meta = new dcMeta($this->core);
     }
     $cur = $this->core->con->openCursor($this->core->prefix . 'post');
     $this->core->con->begin();
     foreach ($feed->items as $item) {
         $cur->clean();
         $cur->user_id = $this->core->auth->userID();
         $cur->post_content = $item->content ? $item->content : $item->description;
         $cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content), 60);
         $cur->post_format = 'xhtml';
         $cur->post_status = -2;
         $cur->post_dt = strftime('%Y-%m-%d %H:%M:%S', $item->TS);
         try {
             $post_id = $this->core->blog->addPost($cur);
         } catch (Exception $e) {
             $this->core->con->rollback();
             throw $e;
         }
         if (isset($meta)) {
             foreach ($item->subject as $subject) {
                 $meta->setPostMeta($post_id, 'tag', dcMeta::sanitizeMetaID($subject));
             }
         }
     }
     $this->core->con->commit();
     http::redirect($this->getURL() . '&do=ok');
 }
Beispiel #6
0
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2009 Olivier Meunier and contributors
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::checkSuper();
$is_writable = is_dir(DC_L10N_ROOT) && is_writable(DC_L10N_ROOT);
$iso_codes = l10n::getISOCodes();
# Get languages list on Dotclear.net
$dc_langs = false;
$feed_reader = new feedReader();
$feed_reader->setCacheDir(DC_TPL_CACHE);
$feed_reader->setTimeout(5);
$feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/');
try {
    $dc_langs = $feed_reader->parse(sprintf(DC_L10N_UPDATE_URL, DC_VERSION));
    if ($dc_langs !== false) {
        $dc_langs = $dc_langs->items;
    }
} catch (Exception $e) {
}
# Delete a language pack
if ($is_writable && !empty($_POST['delete']) && !empty($_POST['locale_id'])) {
    try {
        $locale_id = $_POST['locale_id'];
        if (!isset($iso_codes[$locale_id]) || !is_dir(DC_L10N_ROOT . '/' . $locale_id)) {
/_img/site/banner02.png" alt="" />
            <img src="<?php 
echo siteInfo::url();
?>
/_img/site/banner03.png" alt="" />
        </div>
        
        <div class="column left">
            <!--Content Box - Bug Tracker -->
            <section class="contentBox" id="bugTracker">
            	<header>
                	<h2>Bug Tracker</h2>
                </header>
                <ul>
                	<?php 
$feedInstance = new feedReader();
$feeds = $feedInstance->read('http://letsrider.clockingit.com/feeds/rss/77eac84edf93f6d1f99a87d763c094a1');
$i = 0;
foreach ($feeds as $feed) {
    $i++;
    $class = $feed->title;
    $class = explode(' [', $class);
    $class = strtolower($class[0]);
    $class = substr($class, 0, -1);
    $class = substr($class, 1);
    $date = $feed->pubDate;
    $date = strtr(substr($date, 5, -15), " ", "-");
    echo '<li class="' . $class . '"><p><time datetime="' . $feed->pubDate . '">' . $date . '</time> - ' . $feed->title . '</p><a href="' . $feed->link . '" title="Ver detalhes deste bug" class="viewDetails">Ver detalhes &raquo;</a></li>';
    if ($i == 8) {
        break;
    }
Beispiel #8
0
    dc_check_store_update($core->plugins, $core->blog->settings->system->store_plugin_url, 'plugins', $__dashboard_icons['plugins']);
}
if (isset($__dashboard_icons['blog_theme'])) {
    $themes = new dcThemes($core);
    $themes->loadModules($core->blog->themes_path, null);
    dc_check_store_update($themes, $core->blog->settings->system->store_theme_url, 'blog-theme', $__dashboard_icons['blog_theme']);
}
# Latest news for dashboard
$__dashboard_items = new ArrayObject(array(new ArrayObject(), new ArrayObject()));
$dashboardItem = 0;
if ($core->auth->user_prefs->dashboard->dcnews) {
    try {
        if (empty($__resources['rss_news'])) {
            throw new Exception();
        }
        $feed_reader = new feedReader();
        $feed_reader->setCacheDir(DC_TPL_CACHE);
        $feed_reader->setTimeout(2);
        $feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/');
        $feed = $feed_reader->parse($__resources['rss_news']);
        if ($feed) {
            $latest_news = '<div class="box medium dc-box"><h3>' . __('Dotclear news') . '</h3><dl id="news">';
            $i = 1;
            foreach ($feed->items as $item) {
                $dt = isset($item->link) ? '<a href="' . $item->link . '" class="outgoing" title="' . $item->title . '">' . $item->title . ' <img src="images/outgoing-blue.png" alt="" /></a>' : $item->title;
                if ($i < 3) {
                    $latest_news .= '<dt>' . $dt . '</dt>' . '<dd><p><strong>' . dt::dt2str(__('%d %B %Y:'), $item->pubdate, 'Europe/Paris') . '</strong> ' . '<em>' . text::cutString(html::clean($item->content), 120) . '...</em></p></dd>';
                } else {
                    $latest_news .= '<dt>' . $dt . '</dt>' . '<dd>' . dt::dt2str(__('%d %B %Y:'), $item->pubdate, 'Europe/Paris') . '</dd>';
                }
                $i++;
 public static function feed(&$w)
 {
     if (!$w->url) {
         return;
     }
     global $core;
     if ($w->homeonly && $core->url->type != 'default') {
         return;
     }
     $limit = abs((int) $w->limit);
     try {
         $feed = feedReader::quickParse($w->url, DC_TPL_CACHE);
         if ($feed == false || count($feed->items) == 0) {
             return;
         }
     } catch (Exception $e) {
         return;
     }
     $res = '<div class="feed">' . ($w->title ? '<h2>' . html::escapeHTML($w->title) . '</h2>' : '') . '<ul>';
     $i = 0;
     foreach ($feed->items as $item) {
         $li = isset($item->link) ? '<a href="' . $item->link . '">' . $item->title . '</a>' : $item->title;
         $res .= ' <li>' . $li . '</li> ';
         $i++;
         if ($i >= $limit) {
             break;
         }
     }
     $res .= '</ul></div>';
     return $res;
 }
Beispiel #10
0
 public static function feed($w)
 {
     global $core;
     if (!$w->url) {
         return;
     }
     if ($w->offline) {
         return;
     }
     if ($w->homeonly == 1 && $core->url->type != 'default' || $w->homeonly == 2 && $core->url->type == 'default') {
         return;
     }
     $limit = abs((int) $w->limit);
     try {
         $feed = feedReader::quickParse($w->url, DC_TPL_CACHE);
         if ($feed == false || count($feed->items) == 0) {
             return;
         }
     } catch (Exception $e) {
         return;
     }
     $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . '<ul>';
     $i = 0;
     foreach ($feed->items as $item) {
         $title = isset($item->title) && strlen(trim($item->title)) ? $item->title : '';
         $link = isset($item->link) && strlen(trim($item->link)) ? $item->link : '';
         if (!$link && !$title) {
             continue;
         }
         if (!$title) {
             $title = substr($link, 0, 25) . '...';
         }
         $li = $link ? '<a href="' . html::escapeHTML($item->link) . '">' . $title . '</a>' : $title;
         $res .= ' <li>' . $li . '</li> ';
         $i++;
         if ($i >= $limit) {
             break;
         }
     }
     $res .= '</ul>';
     return $w->renderDiv($w->content_only, 'feed ' . $w->class, '', $res);
 }