Example #1
0
/**
 *
 *
 * @param unknown $params
 * @param unknown $bBlog  (reference)
 * @return unknown
 */
function smarty_function_getrss($params, &$bBlog)
{
    $outputcharset = 'UTF8';
    if (isset($params['id'])) {
        $rssrow = $bBlog->get_row("select * from " . T_RSS . " where url<>'' and id='" . $params['id'] . "'");
    } else {
        // get random one
        $rssrow = $bBlog->get_row("select * from " . T_RSS . " where url<>'' order by rand(" . time() . ") limit 0,1");
    }
    if (!isset($params['limit'])) {
        $params['limit'] = 20;
    }
    return get_rss($rssrow->url, $rssrow->input_charset, $outputcharset, $params['limit']);
}
function smarty_function_getrss($params, &$loq)
{
    $outputcharset = 'UTF8';
    if (isset($params['id'])) {
        $rs = $loq->_adb->Execute("select * from " . T_RSS . " where url<>'' and id='" . $params['id'] . "'");
        if ($rs !== false && !$rs->EOF) {
            $rssrow = $rs->FetchRow();
        }
    } else {
        // get random one
        $rs = $loq->_adb->Execute("select * from " . T_RSS . " where url<>'' order by rand(" . time() . ") limit 0,1");
        if ($rs !== false && !$rs->EOF) {
            $rssrow = $rs->FetchRow();
        }
    }
    if (!isset($params['limit'])) {
        $params['limit'] = 20;
    }
    return get_rss($rssrow['url'], $rssrow['input_charset'], $outputcharset, $params['limit']);
}
Example #3
0
echo base_url();
?>
public/js/jquery.jSlider.js" type="text/javascript"></script>
</head>
<body>
	<div class="crmpage">
		<?php 
echo $this->load->view('common/logoheader', null, true);
?>
		<?php 
echo get_menu();
?>
	
		<div class="container">
			<div class="column span-5" id="tasks">
				<?php 
echo get_tasks_js() . get_tasks();
?>
			</div>
			<div class="column span-19 last" style="width: 80%;">
				<?php 
echo get_rss();
?>
			</div>
		</div>		
		<?php 
echo $this->load->view('common/footer', null, true);
?>
	</div>
</body>
</html>
Example #4
0
function generate_upload_rss_xml()
{
    global $tmp, $ftp_con, $ftp_dir, $id_task;
    $rss_xml = get_rss();
    $fh = fopen('tmp/' . $tmp . '/rss.xml', 'w+');
    fputs($fh, $rss_xml);
    fclose($fh);
    $upload_page = upload_page_to_host('rss.xml', $ftp_con, $ftp_dir);
    if (!$upload_page) {
        echo "Невозможно залить rss.xml на хост";
        set_status('dorgen_tasks', $id_task, 'dor_status', 'error');
        exit;
    }
    unlink('tmp/' . $tmp . '/rss.xml');
}
function odst_rss($gamertag)
{
    // Regular expressions for parsing the RSS
    $regex_link = '/gameid=([0-9]+)/';
    $regex_description = '/(?:Difficulty: (?P<difficulty>(?:Easy|Normal|Heroic|Legendary))).*?(?:Game Duration: (?P<duration>[0-9\\.]+) minutes).*?(?:Players: (?P<players>[0-9]))/';
    $regex_waves = '/(?:Waves: (?P<waves>[0-9]+))/';
    $regex_score = '/(?:Score: (?P<score>[0-9]+))/';
    $games = array();
    // Get RSS
    $rss = get_rss($gamertag, RSS_MODE_ODST);
    // Parse XML
    foreach ($rss->getElementsByTagName('item') as $rss_game) {
        // Create new RSS game
        $game = new RecentODSTGame();
        $game->game = GAME_ODST;
        // Get the data from the XML
        $title = $rss_game->getElementsByTagName('title')->item(0)->nodeValue;
        $link = $rss_game->getElementsByTagName('link')->item(0)->nodeValue;
        $date = $rss_game->getElementsByTagName('pubDate')->item(0)->nodeValue;
        $description = $rss_game->getElementsByTagName('description')->item(0)->nodeValue;
        // Mode, map
        list($game->mode, $game->map) = explode(' on ', $title, 2);
        // Game ID
        preg_match($regex_link, parse_url($link, PHP_URL_QUERY), $link_match);
        list(, $game->gameid) = explode("=", $link_match[0]);
        // Datetime
        $game->datetime = date_create($date);
        // Remaining stats
        // Run the regular expressions on the description.
        // TODO: Make this more clean; merge the reg exps
        preg_match($regex_description, $description, $desc_match);
        preg_match($regex_score, $description, $desc_match_score);
        preg_match($regex_waves, $description, $desc_match_waves);
        $desc_match = array_merge($desc_match, $desc_match_score, $desc_match_waves);
        // Run through the results of the regular expressions
        switch ($desc_match['difficulty']) {
            case 'Easy':
                $game->difficulty = RecentODSTGame::EASY;
                break;
            case 'Normal':
                $game->difficulty = RecentODSTGame::NORMAL;
                break;
            case 'Heroic':
                $game->difficulty = RecentODSTGame::HEROIC;
                break;
            case 'Legendary':
                $game->difficulty = RecentODSTGame::LEGENDARY;
                break;
        }
        $game->duration = $desc_match['duration'] * 60;
        $game->players = $desc_match['players'];
        if (array_key_exists('score', $desc_match) and !is_null($desc_match['score'])) {
            $game->score = $desc_match['score'];
        }
        if ($game->mode === 'Firefight') {
            $game->waves = $desc_match['waves'];
        }
        // Append game to the array of games
        $games[] = $game;
    }
    return $games;
}
Example #6
0
<?php

if (!defined('e107_INIT')) {
    exit;
}
require_once e_PLUGIN . "content/handlers/content_class.php";
$aa = new content();
//##### create feed for admin, return array $eplug_rss_feed --------------------------------
$feed = get_rss();
foreach ($feed as $k => $v) {
    $eplug_rss_feed[] = $v;
}
function get_rss()
{
    global $aa;
    require_once e_PLUGIN . "content/handlers/content_class.php";
    $aa = new content();
    $rss = array();
    $array = $aa->getCategoryTree('', '', FALSE);
    foreach ($array as $k => $v) {
        $name = '';
        for ($i = 0; $i < count($array[$k]); $i++) {
            $name .= $array[$k][$i + 1] . " > ";
            $i++;
        }
        $name = substr($name, 0, -3);
        $feed['name'] = $name;
        $feed['url'] = 'content';
        //the identifier for the rss feed url
        $feed['topic_id'] = $k;
        //the topic_id, empty on default (to select a certain category)