Inheritance: extends SidebarRssAppModel
Exemple #1
0
function getFluxRss()
{
    global $bdd;
    global $_TABLES;
    $ajax = new Ajax();
    $flux = "";
    $flux_items = "";
    $view_rss = new Template(dirname(dirname(__FILE__)) . '/html/rss.html');
    $view_item = new Template(dirname(dirname(__FILE__)) . '/html/rss-item.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objRss = new Rss($bdd, $_TABLES);
        $items = $objRss->getAll();
        if (!is_null($items)) {
            foreach ($items as $key => $value) {
                $flux_items .= $view_item->getView(array("guid" => 'http://' . $_SERVER['HTTP_HOST'] . '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "url" => 'http://' . $_SERVER['HTTP_HOST'] . '/to/' . $value->guid . '#' . $value->url, "description" => $value->description, "date_publication" => date("D, d M Y H:i:s", strtotime($value->date_publication)) . ' +0200'));
            }
            $flux = $view_rss->getView(array("flux_rss" => 'http://' . $_SERVER['HTTP_HOST'] . $ajax->env->flux_rss, "title_site" => $ajax->env->title_site, "url_site" => 'http://' . $_SERVER['HTTP_HOST'], "description_site" => $ajax->env->description_site, "items" => $flux_items, "date_publication_site" => date("D, d M Y H:i:s", strtotime("now")) . ' +0200'));
            $fp = fopen(dirname(dirname(dirname(dirname(__FILE__)))) . "/rss.xml", 'w+');
            fputs($fp, html_entity_decode(htmlspecialchars_decode($flux)));
            fclose($fp);
            return file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/rss.xml");
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
 public function index()
 {
     $where = array();
     $catid = I('get.catid', 0, 'intval');
     $rssid = I('get.rssid', 0, 'intval');
     if ($rssid) {
         header("Content-Type: text/xml; charset=" . C("DEFAULT_CHARSET"));
         //检测缓存
         $data = S("Rss_{$rssid}");
         if ($data) {
             echo $data;
             exit;
         }
         $Cat = getCategory($rssid);
         //检查栏目是否存在
         if (empty($Cat)) {
             $this->error('该栏目不存在!');
         }
         //检查栏目类型
         if ($Cat['type'] != 0) {
             $this->error('栏目类型不正确!');
         }
         $where['status'] = array("EQ", 99);
         //判断是否有子栏目
         if (getCategory($rssid, 'child')) {
             $where['catid'] = array("IN", getCategory($rssid, 'arrchildid'));
         } else {
             $where['catid'] = array("EQ", $rssid);
         }
         //模型ID
         $modelid = getCategory($rssid, 'modelid');
         //获取表名
         $tablename = ucwords(getModel($modelid, 'tablename'));
         if (empty($tablename)) {
             $this->error('出现错误!');
         }
         //栏目配置
         $setting = getCategory($rssid, 'setting');
         $data = M($tablename)->where($where)->order(array("updatetime" => "DESC", "id" => "DESC"))->limit(50)->select();
         import('@.ORG.Rss');
         $Rss = new Rss($this->XMLstr(getCategory($rssid, 'catname') . ' - ' . CONFIG_SITENAME), $this->XMLstr(getCategory($rssid, 'url')), $this->XMLstr(getCategory($rssid, 'description')), $this->XMLstr(getCategory($rssid, 'image')));
         foreach ($data as $k => $v) {
             $v = $this->XMLstr($v);
             $Rss->AddItem($v['title'], $v['url'], $v['description'], date("Y-m-d H:i:s A", $v['updatetime']));
         }
         //进行缓存
         S("Rss_{$rssid}", $Rss->Fetch(), 900);
         $Rss->Display();
     }
     $this->assign('catid', $catid);
     $this->assign('rssid', $rssid);
     $this->assign("SEO", seo(0, 'Rss订阅中心'));
     $this->display();
 }
 private function rss()
 {
     Yii::import('ext.Rss.Rss');
     $rss = new Rss(config('index.rss.url'), config('index.rss.date_format'), config('index.rss.cache'));
     try {
         $dataProvider = new CArrayDataProvider($rss->parse(), array('pagination' => array('pageSize' => (int) config('index.rss.limit'), 'pageVar' => 'page')));
     } catch (Exception $e) {
         throw new CHttpException(404, $e->getMessage());
     }
     $this->render('//rss-news', array('dataProvider' => $dataProvider));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     try {
         $log = new Process();
         $log->name = "get-links";
         $log->status = "running";
         $log->save();
         //Check new links
         Rss::chunk(100, function ($rss) {
             foreach ($rss as $value) {
                 $this->loadRss($value);
                 $value->touch();
             }
         });
         //Remove old links
         $filterDate = new DateTime('now');
         $filterDate->sub(new DateInterval('P1D'));
         Link::where('date', '<', $filterDate)->where('updated_at', '<', $filterDate)->delete();
         $log->status = "finished";
         $log->save();
     } catch (Exception $e) {
         $this->info($url);
         $this->info($e->getMessage());
     }
 }
 public function rss()
 {
     // set headers
     Rss::headers();
     // set content
     Rss::generate();
 }
Exemple #6
0
 public function rss()
 {
     // set headers
     Response::header('Content-Type', 'application/xml');
     // set content
     $xml = Rss::generate();
     // dump xml tree
     Response::content($xml);
 }
 public function index()
 {
     $where = array();
     $catid = (int) $this->_get('catid');
     $rssid = (int) $this->_get('rssid');
     if ($rssid) {
         header("Content-Type: text/xml; charset=" . C("DEFAULT_CHARSET"));
         //检测缓存
         $data = S("Rss_{$rssid}");
         if ($data) {
             echo $data;
             exit;
         }
         $Category = F("Category");
         $Model = F("Model");
         $where['status'] = array("EQ", 99);
         //判断是否有子栏目
         if ($Category[$rssid]['child']) {
             $where['catid'] = array("IN", $Category[$rssid]['arrchildid']);
         } else {
             $where['catid'] = array("EQ", $rssid);
         }
         //模型ID
         $modelid = $Category[$rssid]['modelid'];
         //获取表名
         $tablename = ucwords($Model[$modelid]['tablename']);
         //栏目配置
         $setting = unserialize($Category[$rssid]['setting']);
         $data = M($tablename)->where($where)->order(array("updatetime" => "DESC", "id" => "DESC"))->limit(50)->select();
         import('@.ORG.Rss');
         $Rss = new Rss($this->XMLstr($Category[$rssid]['catname'] . ' - ' . CONFIG_SITENAME), $this->XMLstr($Category[$rssid]['url']), $this->XMLstr($Category[$rssid]['description']), $this->XMLstr($Category[$rssid]['image']));
         foreach ($data as $k => $v) {
             $v = $this->XMLstr($v);
             $Rss->AddItem($v['title'], $v['url'], $v['description'], date("Y-m-d H:i:s A", $v['updatetime']));
         }
         //进行缓存
         S("Rss_{$rssid}", $Rss->Fetch(), 900);
         $Rss->Display();
     }
     $this->assign('catid', $catid);
     $this->assign('rssid', $rssid);
     $this->assign("SEO", seo(0, 'Rss订阅中心'));
     $this->display();
 }
 /**
  * @return mixed
  */
 public function rss()
 {
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel(array('title' => \Config::get('laravel-blog.meta.rss_feed.title'), 'description' => \Config::get('laravel-blog.meta.rss_feed.description'), 'link' => \URL::current()));
     $posts = $this->post->live()->where($this->post->getTable() . '.in_rss', '=', true)->orderBy($this->post->getTable() . '.published_date', 'desc')->take(10)->get();
     foreach ($posts as $post) {
         $feed->item(array('title' => $post->title, 'description' => $post->summary, 'link' => \URL::action('\\Fbf\\LaravelBlog\\PostsController@view', array('slug' => $post->slug))));
     }
     return \Response::make($feed, 200, array('Content-Type', 'application/rss+xml'));
 }
Exemple #9
0
 public static function fetch($url, $params = array())
 {
     $url = str_replace('https:', 'http:', rtrim($url, '/')) . '/rss';
     $latest_news = parent::fetch($url);
     if ($latest_news) {
         foreach ($latest_news as &$news_row) {
             $news_row['guid'] = str_replace('rss_', 'tumblr_', $news_row['guid']);
         }
     }
     return $latest_news;
 }
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'PHPhub - PHP & Laravel的中文社区', 'description' => 'PHPhub是 PHP 和 Laravel 的中文社区,在这里我们讨论技术, 分享技术。', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id), 'pubDate' => date('Y-m-d', strtotime($topic->created_at))]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'phphub++ - Business Forum', 'description' => 'Opportunity business goal driven forum', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id), 'pubDate' => date('Y-m-d', strtotime($topic->created_at))]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Exemple #12
0
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'Laravel 台灣 - 討論 PHP 與 Laravel 的好所在', 'description' => 'PHP 和 Laravel 的中文社群,在這裡我們討論技術, 分享技術。', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id)]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Exemple #13
0
function rssFeedNews_getContent()
{
    global $template;
    $template->setFile('rssFeedNews.tmpl');
    $template->setShowRresource(false);
    $rss = new Rss();
    $rss->cache_dir = realpath(dirname(__FILE__) . '/../cache');
    //path to cache directory on your server from this script. Chmod 777!
    $rss->date_format = 'd M Y g:i:s A';
    //date format of RSS item. See PHP date() function for possible input.
    $rss->cache_time = 300;
    $rss->CDATA = 'strip';
    // -------------------------------------------------------------------
    // outputRSS_XML()- Outputs the "title", "link", "description", and "pubDate" elements of an RSS feed in XML format
    // -------------------------------------------------------------------
    if ($rs = $rss->get(RSS_PATH)) {
        if (sizeof($rs['rssFeeds']) > 0) {
            $template->addVars($rs);
        }
    }
}
Exemple #14
0
 /**
  * Rss insert head
  *
  * @param string $module
  * @param string $controller
  * @param string $section
  * @return array
  */
 public function hookRssInsertHead($module, $controller, $section)
 {
     if ($module == 'article') {
         $feeds = array();
         if ($controller == 'index' && Rss::feedExists('article-' . $section)) {
             $feeds[] = 'article-' . $section;
         }
         if (Rss::feedExists('article-latest')) {
             $feeds[] = 'article-latest';
         }
         return $feeds;
     }
 }
Exemple #15
0
 function showApp()
 {
     global $navBarText, $categoryColumnsNum, $language, $jQueryLib;
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addCss(CSS_DIR . "/layout.css");
     JavaScript::addCss(CSS_DIR . "/pages.css");
     if (is_callable(array("ThemeConfig", "init"))) {
         ThemeConfig::init();
     }
     $this->makeLoginMenu();
     $this->makeAdminMenu();
     $this->applyDebugMode();
     if (class_exists('rss')) {
         Rss::makeRssFeed();
     } else {
         View::assign("mainClass", 'main_withoutSidebar');
         View::assign("outerMainClass", 'outerMain_withoutSidebar');
     }
     CustomList::getList(customlist_top);
     CustomList::getList(customlist_bottom);
     CustomList::getList(customlist_aboveContent);
     CustomList::getList(customlist_belowContent);
     CustomList::getList(customlist_right);
     CustomList::getList(customlist_left);
     $_S =& new AppSettings();
     View::assign("baseUrl", Controller::getBaseUrl());
     View::assign("userStatus", $this->showUserStatus());
     View::assign("themeSelector", $this->showSelector("Theme"));
     View::assign("languageSelector", $this->showSelector("Language"));
     View::assign("versionFooter", $_S->versionFooter);
     View::assign("infoText", $this->showInfoText());
     View::assign("jsIncludes", JavaScript::getIncludes());
     View::assign("javaScript", JavaScript::getScript());
     View::assign("titlePrefix", $_S->getAttr("titlePrefix"));
     View::assign("categoryColumnsNum", $categoryColumnsNum);
     View::assign("cssDir", CSS_DIR);
     View::assign("imagesDir", IMAGES_DIR);
     View::assign("language", $language);
     View::assign("langDir", $_S->langDir);
     View::assign("extraBody", $_S->getProAttr("extraBody"));
     View::assign("extraFooter", $_S->getProAttr("extraFooter"));
     View::assign("extraHead", $_S->getProAttr("extraHead"));
     View::assign("extraTopContent", $_S->getProAttr("extraTopContent"));
     View::assign("extraBottomContent", $_S->getProAttr("extraBottomContent"));
     AppCategory::assignCurrentCategoryFields();
     User::assignCurrentUserFields();
 }
        $input['status'] = 'spam';
    }
    $comment = Comment::create($input);
    Notify::success(__('comments.created'));
    // dont notify if we have marked as spam
    if (!$spam and Config::meta('comment_notifications')) {
        $comment->notify();
    }
    return Response::redirect($posts_page->slug . '/' . $slug . '#comment');
});
/**
 * Rss feed
 */
Route::get(array('rss', 'feeds/rss'), function () {
    $uri = 'http://' . $_SERVER['HTTP_HOST'];
    $rss = new Rss(Config::meta('sitename'), Config::meta('description'), $uri, Config::app('language'));
    $query = Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc');
    foreach ($query->get() as $article) {
        $rss->item($article->title, Uri::full(Registry::get('posts_page')->slug . '/' . $article->slug), $article->description, $article->created);
    }
    $xml = $rss->output();
    return Response::create($xml, 200, array('content-type' => 'application/xml'));
});
/**
 * Json feed
 */
Route::get('feeds/json', function () {
    $json = Json::encode(array('meta' => Config::get('meta'), 'posts' => Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc')->get()));
    return Response::create($json, 200, array('content-type' => 'application/json'));
});
/**
Exemple #17
0
     $fids = $extra = '';
     $query = $db->query("SELECT fid \n\t\t\t\t\t\t\t\tFROM pw_forums \n\t\t\t\t\t\t\t\tWHERE allowvisit='' AND f_type!='hidden' AND password='' AND forumsell=''");
     while ($rt = $db->fetch_array($query)) {
         $fids .= $extra . "'" . $rt['fid'] . "'";
         $extra = ',';
     }
     if ($fids) {
         $sql = "WHERE t.fid IN({$fids}) AND ifcheck=1 AND specialsort='0' AND ifshield=0 AND postdate>" . pwEscape($timestamp - 604800) . " \n\t\t\t\t\t\tORDER BY postdate DESC \n\t\t\t\t\t\tLIMIT {$Rss_newnum}";
         $forceindex = 'FORCE INDEX (' . getForceIndex('idx_postdate') . ')';
     }
 }
 $title = $fid ? strip_tags($forum[$fid]['name']) : $db_bbsname;
 $title = decodeRssHtml($title);
 $title = xmlEscape($title);
 $channel = array('title' => $title, 'link' => $db_bbsurl, 'description' => "最新帖子", 'copyright' => "Copyright(C) {$db_bbsname}", 'generator' => "http://www.phpwind.com", 'lastBuildDate' => date('r'), 'ttl' => $ttl);
 $Rss = new Rss(array('xml' => "1.0", 'rss' => "2.0", 'encoding' => $db_charset));
 if ($sql) {
     $query = $db->query("SELECT t.tid,t.fid,t.subject,t.author,t.ifhide,t.postdate,t.anonymous,fe.forumset as forumset \n\t\t\t\t\t\t\t\tFROM pw_threads t {$forceindex} \n\t\t\t\t\t\t\t\tLEFT JOIN pw_forumsextra fe ON t.fid=fe.fid {$sql}");
     $lastPostFlag = true;
     $threaddbs = array();
     while ($threaddb = $db->fetch_array($query)) {
         $threaddbs[$threaddb[tid]] = $threaddb;
     }
     if (S::isArray($threaddbs)) {
         $tmsgTids = array_keys($threaddbs);
         $pw_tmsgs = !$db_merge_tmsgs ? GetTtable($threaddb['tid']) : 'pw_merge_tmsgs';
         $query = $db->query("SELECT tid,aid,content,ifsign FROM {$pw_tmsgs} WHERE tid IN (" . S::sqlImplode($tmsgTids) . ")");
         while ($rt = $db->fetch_array($query)) {
             isset($threaddbs[$rt['tid']]) && ($rt = array_merge((array) $rt, $threaddbs[$rt['tid']]));
             if (isset($rt['forumset']) && $rt['forumset']) {
                 $forumset = unserialize($rt['forumset']);
Exemple #18
0
 /**
  * Load an xml file through HTTP
  *
  * @param string  $xmlUrl String corresponding to the XML URL
  * @param array   $feed   Feed
  * @param array   $items  Items
  * @param boolean $force  Force update
  *
  * @return array containing feed and items
  */
 public function loadRss($xmlUrl, $feed = array(), $force = false)
 {
     $items = array();
     $feed = $this->initFeedCache($feed, $force);
     if (!ini_get('safe_mode') && isset(MyTool::$opts['http']['timeout'])) {
         set_time_limit(MyTool::$opts['http']['timeout'] + 1);
     }
     $outputUrl = MyTool::loadUrl($xmlUrl);
     if (!empty($outputUrl['error'])) {
         $feed['error'] = $outputUrl['error'];
     } else {
         if (empty($outputUrl['data'])) {
             if ($outputUrl['code'] != 304) {
                 // 304 Not modified
                 $feed['error'] = Intl::msg('Empty output data');
             }
         } else {
             $outputDom = Rss::loadDom($outputUrl['data']);
             if (!empty($outputDom['error'])) {
                 $feed['error'] = $outputDom['error'];
             } else {
                 unset($feed['error']);
                 $feed = $this->updateFeedFromDom($feed, $outputDom['dom']);
                 $feed = $this->updateFeedCache($feed, $outputUrl);
                 $items = $this->updateItemsFromDom($outputDom['dom']);
             }
         }
     }
     $feed['lastUpdate'] = time();
     return array('feed' => $feed, 'items' => $items);
 }
Exemple #19
0
 function printRss()
 {
     $rss = new Rss();
     $rss->fileManager = $this->fileManager;
     $rss->moduleManager = $this->moduleManager;
     $rss->printRss($_GET["cwdRelPath"]);
     exit(0);
 }
        }
    }
    echo "<BR><B>GOOGLEPLUS CRON ENDED @</B> : " . date('Y-m-d H:i:s A') . "<br><br>";
}
if (WORDPRESSCRONSTART == '1') {
    echo "<BR><B>WORDPRESS CRON START @</B> : " . date('Y-m-d H:i:s A') . "<br><br>";
    $sql = "SELECT * FROM wp_blog_url";
    $result = mysql_query($sql) or die(mysql_error());
    $date = date("Y-m-d H:i:s", time());
    while ($row = mysql_fetch_array($result)) {
        $id = $row['id'];
        $blogurl = $row['blogurl'];
        $sql1 = "SELECT * FROM wp_blog_feed where wp_blog_url_id = '" . $id . "'";
        $result1 = mysql_query($sql1) or die(mysql_error());
        $count1 = mysql_num_rows($result1);
        $Rss = new Rss();
        // create object
        $blogurl1 = addhttp($blogurl);
        $siteArr = parse_url($blogurl1);
        $host = $siteArr['host'];
        $siteexploArr = explode('.', $host);
        if ($count1 >= "10") {
            //update code
            if (!empty($host)) {
                $sFeedURL = $host . "/feed";
                $sValidator = 'http://feedvalidator.org/check.cgi?url=';
                if ($sValidationResponse = @file_get_contents($sValidator . urlencode($sFeedURL))) {
                    if (stristr($sValidationResponse, 'This is a valid RSS feed') !== false) {
                        $feed = $Rss->getFeed('http://' . $host . '/feed/', Rss::TXT);
                        if (empty($feed)) {
                            $feed = $Rss->getFeed('http://feeds2.feedburner.com/' . $siteexploArr['1'] . '/', Rss::TXT);
Exemple #21
0
 * 
 **/
# Setup class autoload:
function __autoload($class)
{
    require_once "include/" . $class . ".class.php";
}
# General configuration, options and feeds:
$Config = new Config();
$Config->SetOpts();
error_reporting($Config->getOpt('options', 'reporting'));
# Simplepie: 3rd-party rss processing:
#require_once('3rd-party/simplepie/SimplePieAutoloader.php');
#include_once('3rd-party/simplepie/idn/idna_convert.class.php');
# RSS init:
$rss = new Rss();
# Get the posts:
Debug::info("Getting the posts");
$posts = $rss->getPosts($Config->getFeeds());
# Write mode output openning:
Debug::info("Generating HTML output at " . OUTDIR . "/" . OUTFILE);
Debug::info("Generating RSS 2.0 output at " . OUTDIR . "/rss20.xml");
$fOutput = new Output();
#
# Output files generation:
#
# Header:
Debug::info("Headers");
$fOutput->write(File::ReadAndParse('html/header.html'));
$fOutput->writeRss(File::ReadAndParse('xml/rss20_head.xml'));
# Javascript:
Exemple #22
0
 /**
  * Edit Popup
  * @param Rss $p_oRss
  * @param array $aTrackersSelect
  * @param array $aCategoriesSelect
  * @return string Code HTML
  */
 private function createEditPopup($p_oRss, $aTrackersSelect, $aCategoriesSelect)
 {
     $oPopup = new View('popup');
     $oPopup->addData('id', $p_oRss->getId());
     $oPopup->addData('buttonstyle', 'btn-primary');
     $oPopup->addData('buttonicon', 'fa-edit');
     $oPopup->addData('buttontext', Language::translate('RSS_ADMIN_EDIT_EDIT'));
     $oPopup->addData('title', Language::translate('RSS_ADMIN_EDIT_TITLE'));
     $oFormEdit = new FormGenerator();
     $oFormEdit->setAction('index.php?p=adminrss&edit=' . $p_oRss->getId());
     $oFormEdit->addSelect(Language::translate('RSS_ADMIN_EDIT_TRACKER'), 'tracker', $aTrackersSelect, $p_oRss->getTrackerId());
     $oFormEdit->addSelect(Language::translate('RSS_ADMIN_EDIT_ENCODE'), 'encoding', Config::getEncodes(), $p_oRss->getEncoding());
     $oFormEdit->addInput(Language::translate('RSS_ADMIN_EDIT_URL'), 'url', true, false, 'text', '', $p_oRss->getUrl());
     $oFormEdit->addInput(Language::translate('RSS_ADMIN_EDIT_MASK'), 'mask', true, false, 'text', '', $p_oRss->getMask());
     $oFormEdit->addCheckbox(Language::translate('RSS_ADMIN_EDIT_DATE'), 'forcedate', $p_oRss->isForcedate());
     $oFormEdit->addCheckbox(Language::translate('RSS_ADMIN_EDIT_DEL'), 'delete');
     $oFormEdit->create();
     $oPopup->addData('content', $oFormEdit->getCode());
     $oPopup->create();
     return $oPopup->getCode();
 }
<?php

include_once 'hp-includes/rss_class.php';
include_once 'hp-includes/person_class.php';
include_once 'hp-includes/url_functions.php';
$id = $_GET['id'];
// Given the ID of a person, go through it's history and load all
// the mods (modules) in the respective directories.
$person = new Person();
$person->setId($id);
$person->loadFromDb();
$declarations = $person->searchDeclarations('', 0, 10, false, 'all');
if (sizeof($declarations) > 0) {
    $title = "Declaratii " . $person->displayName;
    $linkPath = $person->getPersonDeclarationsUrl();
    $description = "Fluxul declarațiilor lui " . $person->displayName;
    $rssDeclarationUrl = $person->getRssDeclarationUrl();
    $rss = new Rss($title, $linkPath, $description, $rssDeclarationUrl);
    foreach ($declarations as $declaration) {
        $declarationText = trim($declaration['declaration']);
        $rssItemPubDate = gmdate(DATE_RSS, $declaration['time']);
        $rssItemTitle = $person->displayName . ": " . $declarationText;
        $rssItemDescription = $declarationText;
        $rssItemLink = $person->getDeclarationUrl($declaration['id']);
        $rss->addRssItem($rssItemTitle, $rssItemDescription, $rssItemLink, $rssItemPubDate);
    }
    $rss->printRssSmarty();
}
Exemple #24
0
         $statistics = new Statistics($db);
         $statistics->run();
         httpResponse();
         break;
     case validateRoute('GET', 'run-bonus'):
         $log = new Logs($db);
         $bonus = new Bonus($db, $user, $log);
         $bonus->run();
         httpResponse();
         break;
     case validateRoute('GET', 'torrents/download/\\d+/[a-z0-9]{32}'):
         $torrent = new Torrent($db, $user);
         $torrent->download((int) $params[2], $params[3]);
         break;
     case validateRoute('GET', 'rss'):
         $rss = new Rss($db);
         $rss->renderRssFeed($_GET);
         die;
         break;
     case validateRoute('GET', 'watcher-rss'):
         $watching = new Watching($db);
         $watching->renderRssFeed($_GET);
         die;
         break;
 }
 /* Login check before the following routes */
 $user->loginCheck();
 L::setDefaultLanguage($user->getLanguage());
 switch (true) {
     case validateRoute('GET', 'status'):
         /* IP change check and logging */
Exemple #25
0
 public function getRss($slug = '')
 {
     Config::set('laravel-debugbar::config.enabled', false);
     $rss = new Rss();
     return $rss->getPage($slug);
 }
Exemple #26
0
 private function makeChannel($title, $desc, $link)
 {
     $feed = Rss::feed('2.0', 'UTF-8');
     return $feed->channel(array('title' => $title, 'description' => $desc, 'link' => $link));
 }
Exemple #27
0
 function checkDelays()
 {
     $criteria = new AndStatement();
     $field = $this->eventDao->getQStateName();
     $criteria->addStatement($field . "=1");
     $field = $this->eventDao->getQValid_dateName();
     $criteria->addStatement($field . "< NOW()");
     $field = $this->eventDao->getQDelayName();
     $criteria->addStatement($field . "=0");
     $events = $this->eventDao->find($criteria, null);
     if (is_null($events) || is_string($events) || count($events) == 0) {
         return false;
     }
     foreach ($events as $event) {
         $project = $this->getProject($event->getPid());
         if (!is_object($project)) {
             $mail = new Mail();
             $mail->setTo("*****@*****.**");
             $mail->setSubject("WorkFlow.lt Klaida nuskaitant projekta | checkDelays");
             if (is_string($project)) {
                 $mail->setText($project);
             }
             $mail->sendMail();
             continue;
         }
         $stage = $this->getStageById($event->getSid());
         if (!is_object($stage)) {
             $mail = new Mail();
             $mail->setTo("*****@*****.**");
             $mail->setSubject("WorkFlow.lt Klaida nuskaitant etapa | checkDelays");
             if (is_string($stage)) {
                 $mail->setText($stage);
             }
             $mail->sendMail();
             continue;
         }
         $client = $this->getClientById($event->getCid());
         if (!is_object($client)) {
             $mail = new Mail();
             $mail->setTo("*****@*****.**");
             $mail->setSubject("WorkFlow.lt Klaida nuskaitant klienta | checkDelays");
             if (is_string($client)) {
                 $mail->setText($client);
             }
             //$mail->sendMail();
             continue;
         }
         if (!$client->isActive() || $client->isEnded() || $client->isEnded_eve() || $client->isMoved()) {
             continue;
         }
         $event->setDelays($event->getDelays() + 1);
         $event->setDelay(true);
         $this->storeEvent($event);
         $rss = new Rss($project->getRsskey());
         $eventRss = new EventRss();
         $eventRss->title = $eventRss->getText("warningTitle", array($project->getName()));
         $eventRss->description = $eventRss->getText("warningDescription", array($project->getName(), $stage->getName(), $this->formatClientInfo($client)));
         $eventRss->link = addslashes(htmlspecialchars($this->partnerUrl)) . addslashes(htmlspecialchars($project->getCruid()));
         $eventRss->pubDate = Carbon::now()->toRssString();
         $eventRss->PID = $project->getId();
         $eventRss->CID = $client->getId();
         $eventRss->SID = $stage->getId();
         if (!$rss->addEvent($project, $eventRss)) {
             $mail = new Mail();
             $mail->setTo("*****@*****.**");
             $mail->setSubject("WorkFlow.lt Klaida kuriant RSS irasa | checkDelays");
             $mail->setText(print_r($eventRss, true));
             $mail->sendMail();
         }
         $eventHistory = new EventHistory();
         $eventHistory->setPid($event->getPid());
         $eventHistory->setCid($event->getCid());
         $eventHistory->setSid($event->getSid());
         $eventHistory->setEid($event->getId());
         $eventHistory->setR_date(Carbon::Now()->toDateTimeString());
         $eventHistory->setDescription("Pradėtas vieluoti etapas");
         $eventHistory->setValid_date($event->getValid_date());
         $this->storeEventHistory($eventHistory);
     }
 }
Exemple #28
0
 * @date       04.07.2011 17:17:29
*/
require_once 'rss2.class.php';
require_once 'googleplus.class.php';
$arrTests = array('https://plus.google.com/111291152590065605567/posts');
foreach ($arrTests as $strTest) {
    $oGooglePlus = new GooglePlus($strTest);
    if ($oGooglePlus->isReady) {
        $channel = array();
        $channel['title'] = 'Google+ profile of ' . $oGooglePlus->getName();
        $channel['description'] = $oGooglePlus->getIntroduction() . ', ' . $oGooglePlus->getOccupation();
        $channel['link'] = 'https://plus.google.com/' . $oGooglePlus->strProfileId . '/posts';
        $arrPosts = $oGooglePlus->getPosts();
        $arrLinks = $oGooglePlus->getLinks();
        $i = 0;
        $w = new Rss('php://output', $channel['title'], $channel['description'], $channel['link'], date('Y-m-d'));
        foreach ($arrPosts as $strPost) {
            $item = array();
            $item['title'] = $oGooglePlus->getShortText($strPost, 120, TRUE);
            if ($arrLinks[$i]) {
                $item['link'] = 'https://plus.google.com/' . $oGooglePlus->strProfileId . '/posts/' . $arrLinks[$i];
            }
            $item['description'] = $strPost;
            if ($arrLinks[$i]) {
                $item['guid'] = 'https://plus.google.com/' . $oGooglePlus->strProfileId . '/posts/' . $arrLinks[$i];
            }
            //$item['date'] = date('Y-m-d');
            $w->add_item($item);
            $i++;
        }
        $i++;
Exemple #29
0
 public function procede()
 {
     if (!$this->oRequest->existParam('key')) {
         throw new Error('Vous devez renseigner la clé.', 3003);
     }
     if ($this->oRequest->getParam('key', 'string') != Config::get('ingestkey')) {
         throw new Error('La clé est invalide.', 3003);
     }
     //Ajoute du titre
     $this->oView->addData('titre', 'Analyse des flux RSS');
     //On récupère les éléments pour les statistiques
     $iNbReleases = Release::getCount();
     $iNbTorrents = Torrent::getCount();
     $iStartTime = time();
     //Traitement des Trackers
     $aTrackers = Tracker::getTrackers();
     //Ajout des flux
     $aRssList = Rss::getFlux();
     foreach ($aRssList as $oRss) {
         $aTrackers[$oRss->getTrackerId()]->addFlux($oRss);
     }
     //Parsage des flux
     $aResults = array();
     foreach ($aTrackers as $oTracker) {
         $aResults = array_merge($aResults, $oTracker->parseRss());
     }
     //Traitement des résultats
     $oTable = new TableGenerator();
     $oTable->setId(md5('Ingest'));
     $oTable->addColumn('Tags');
     $oTable->addColumn('Tracker');
     $oTable->addColumn('Release');
     foreach ($aResults as $oResult) {
         if (is_string($oResult)) {
             Logger::log('ingest', $oResult);
             $this->oView->addAlert($oResult, 'danger');
         } else {
             $oResult->store();
             $sTags = '';
             foreach ($oResult->getTags() as $oTag) {
                 $oTagView = new View('label');
                 $oTagView->addData('type', 'info');
                 $oTagView->addData('text', $oTag->getName());
                 $oTagView->create();
                 $sTags .= $oTagView->getCode() . '&nbsp;';
             }
             $oTable->addLine(array($sTags, $aTrackers[$oResult->getTracker()]->getName(), $oResult->getReleaseName()));
         }
     }
     //Statistiques
     $iNewReleases = Release::getCount() - $iNbReleases;
     $iNewTorrents = Torrent::getCount() - $iNbTorrents;
     Stats::storeIngestStats($iNewReleases, $iNewTorrents, date("Y-m-j G:i:s", $iStartTime));
     //Enregistrement de la dernière date de vérification
     Rss::updateLastCheck(date("Y-m-j G:i:s", $iStartTime));
     Logger::log('ingest', $iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
     $oTable->setBottom($iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
     $oTable->create();
     $this->oView->addData('content', $oTable->getCode());
     $this->oView->Create();
 }
Exemple #30
0
     echo Parsedown::instance()->parse($menuContent);
     break;
 case 'deleteFile':
     if ($myUser != false && $myUser->can('DELETE_FILE')) {
         unlink($_['file']);
         $jsonResponse['success'] = true;
     } else {
         $jsonResponse['message'] = 'Vous ne pouvez pas editer tant que vous n\'êtes pas connecté.';
     }
     echo json_encode($jsonResponse);
     break;
 case 'rss':
     header('Content-Type: text/xml; charset=utf-8');
     $events = getEvents();
     if (!file_exists(CACHE_RSS) || time() - filemtime(CACHE_RSS) > REFRESH_RSS_TIME) {
         $rss = new Rss(APPLICATION_TITLE, $_SERVER['REMOTE_ADDR']);
         foreach ($events as $event) {
             switch ($event->type) {
                 case 'UPDATE_FILE':
                     $title = $event->user . ' a modifié la page ' . $event->page . ' le ' . $event->date;
                     break;
             }
             $rss->add($title, $event->date, $event->link, $title);
         }
         file_put_contents(CACHE_RSS, $rss->publish());
     }
     echo file_get_contents(CACHE_RSS);
     break;
 case 'files':
     $keyword = strtolower(isset($_['keyword']) ? $_['keyword'] : '');
     $files = glob(UPLOAD_FOLDER . '/*/*/*' . $keyword . '*');