Esempio n. 1
0
function rss_build($comune)
{
    //build the RSS feed
    $RB = new RSSBuilder();
    $file_rss = dirname(__FILE__) . "/" . $comune . "AlboPOP.xml";
    $web_link = "http://194.243.23.67:8080/albopretorio/albo" . $comune . ".php";
    $parsed = parsing_albo_vallata($web_link);
    $RB->addChannel();
    $RB->addChannelElement('title', 'alboPOP' . $comune);
    $RB->addChannelElement('link', $web_link);
    $RB->addChannelElement('description', '*non ufficiale* feed RSS Albo Pretorio di ' . $comune);
    $RB->addChannelElement('pubDate', 'Fri, 12 Feb 2016 00:00:00 +0100');
    $RB->addChannelElement('lastBuildDate', 'Fri, 12 Feb 2016 00:00:00 +0100');
    $RB->addChannelElement('generator', 'PHP Framework');
    for ($i = 0; $i < count($parsed[1]); $i++) {
        $RB->addItem();
        $RB->addItemElement('title', $parsed[0][$i][count($parsed[0][$i]) - 1]);
        $RB->addItemElement('description', $parsed[0][$i][count($parsed[0][$i]) - 1]);
        $RB->addItemElement('link', $parsed[1][$i]);
        $RB->addItemElement('pubDate', string2dataRSS($parsed[0][$i][count($parsed[0][$i]) - 3]));
    }
    //echo $RB;
    file_put_contents($file_rss, $RB);
    //insert no track indications
    add_notrack_info($file_rss);
}
Esempio n. 2
0
	public function init() {
		$siteurl = siteurl(SITEID);
		if(empty($this->rssid)) {
			$catid = $_GET['catid'] ? intval($_GET['catid']) : '0';
			$siteids = getcache('category_content','commons');
			$siteid = $siteids[$catid] ? $siteids[$catid] : 1;
			$CATEGORYS = getcache('category_content_'.$siteid,'commons');
			$subcats = subcat($catid,0,1,$siteid);
			foreach ($CATEGORYS as $r) if($r['parentid'] == 0) $channel[] = $r;
			include template('content','rss');
		} else {
			$CATEGORYS = getcache('category_content_'.$this->siteid,'commons');
			$SITEINFO = getcache('sitelist','commons');
			$CAT = $CATEGORYS[$this->rssid];
			if(count($CAT) == 0) showmessage(L('missing_part_parameters'),'blank');
			$siteid = $CAT['siteid'];
			$sitedomain = $SITEINFO[$siteid]['domain'];  //获取站点域名
			$MODEL = getcache('model','commons');
			$modelid = $CAT['modelid'];		
		    $encoding   =  CHARSET;
		    $about      =  SITE_PROTOCOL.SITE_URL;
		    $title      =  $CAT['catname'];
		    $description = $CAT['description'];
		    $content_html = $CAT['content_ishtml'];
		    $image_link =  "<![CDATA[".$CAT['image']."]]> ";
		    $category   =  '';
		    $cache      =  60;
		    $rssfile    = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache);
		    $publisher  =  '';
		    $creator    =  SITE_PROTOCOL.SITE_URL;
		    $date       =  date('r');
		    $rssfile->addDCdata($publisher, $creator, $date);
		    $ids = explode(",",$CAT['arrchildid']);
		    if(count($ids) == 1 && in_array($this->rssid, $ids)) {
		        $sql .= "`catid` = '$this->rssid' AND `status` = '99'";
		    } else {
		        $sql .= get_sql_catid('category_content_'.$siteid,$this->rssid)." AND `status` = '99'";
		    }
			if(empty($MODEL[$modelid]['tablename'])) showmessage(L('missing_part_parameters'),'blank');
		    $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename'];
			$info = $this->db->select($sql,'`title`, `description`, `url`, `inputtime`, `thumb`, `keywords`','0,20','id DESC');
		
			foreach ($info as $r) {
			    //添加项目
			    if(!empty($r['thumb'])) $img = "<img src=".thumb($r['thumb'], 150, 150)." border='0' /><br />";else $img = '';
		        $about          =  $link = (strpos($r['url'], 'http://') !== FALSE || strpos($r['url'], 'https://') !== FALSE) ? "<![CDATA[".$r['url']."]]> " : (($content_html == 1) ? "<![CDATA[".substr($sitedomain,0,-1).$r['url']."]]> " : "<![CDATA[".substr(APP_PATH,0,-1).$r['url']."]]> ");
		        $title          =   "<![CDATA[".$r['title']."]]> ";
		        $description    =  "<![CDATA[".$img.$r['description']."]]> ";
		        $subject        =  '';
		        $date           =  date('Y-m-d H:i:s' , $r['inputtime']);
		        $author         =  $ZLCMS['sitename'].' '.SITE_PROTOCOL.SITE_URL;
		        $comments       =  '';//注释;
	
		        $rssfile->addItem($about, $title, $link, $description, $subject, $date,	$author, $comments, $image);
			}	
			$version = '2.00';
	    	$rssfile->outputRSS($version);
		}    	        	
	}
Esempio n. 3
0
if (isset($_REQUEST['type'])) {
    if ($_REQUEST['type'] == 'group_buy') {
        $now = gmtime();
        $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_GROUP_BUY . "' " . "AND start_time <= '{$now}' AND is_finished < 3 ORDER BY start_time DESC";
        $res = $db->query($sql);
        if ($res !== false) {
            while ($row = $db->fetchRow($res)) {
                $item_url = build_uri('group_buy', array('gbid' => $row['act_id']), $row['act_name']);
                $separator = strpos($item_url, '?') === false ? '?' : '&amp;';
                $about = $uri . $item_url;
                $title = htmlspecialchars($row['act_name']);
                $link = $uri . $item_url . $separator . 'from=rss';
                $desc = htmlspecialchars($row['act_desc']);
                $subject = $_LANG['group_buy'];
                $date = local_date('r', $row['start_time']);
                $rss->addItem($about, $title, $link, $desc, $subject, $date);
            }
            $rss->outputRSS($ver);
        }
    } elseif ($_REQUEST['type'] == 'snatch') {
        $now = gmtime();
        $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_SNATCH . "' " . "AND start_time <= '{$now}' AND is_finished < 3 ORDER BY start_time DESC";
        $res = $db->query($sql);
        if ($res !== false) {
            while ($row = $db->fetchRow($res)) {
                $item_url = build_uri('snatch', array('sid' => $row['act_id']), $row['act_name']);
                $separator = strpos($item_url, '?') === false ? '?' : '&amp;';
                $about = $uri . $item_url;
                $title = htmlspecialchars($row['act_name']);
                $link = $uri . $item_url . $separator . 'from=rss';
                $desc = htmlspecialchars($row['act_desc']);
Esempio n. 4
0
    $v_headline = string_rss_links($v_headline);
    $v_body = string_rss_links($v_body);
    $v_date_posted = date('Y-m-d\\TH:i:sO', $v_date_posted);
    $about = $link = config_get('path') . "news_view_page.php?news_id={$v_id}";
    $title = $v_headline;
    $description = $v_body;
    # optional DC value
    $subject = $title;
    # optional DC value
    $date = $v_date_posted;
    # author of item
    $author = string_rss_links(user_get_name($v_poster_id));
    if (access_has_global_level(config_get('show_user_email_threshold'))) {
        $t_author_email = user_get_field($v_poster_id, 'email');
        if (is_blank($t_author_email)) {
            $t_author_email = $author . '@example.com';
        }
    } else {
        $t_author_email = $author . '@example.com';
    }
    $author .= ' &lt;' . $t_author_email . '&gt;';
    # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1';	# url to comment page rss 2.0 value
    $comments = '';
    # optional mod_im value for dispaying a different pic for every item
    $image = '';
    $rssfile->addItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image);
}
# @@@ consider making this a configuration option.
# 0.91 / 1.0 / 2.0
$version = '2.0';
$rssfile->outputRSS($version);
Esempio n. 5
0
File: rss.php Progetto: nyson/izwei
if (!isset($_GET['debug'])) {
    header("Content-Type: application/rss+xml");
    error_reporting(!E_ALL);
}
define("BASE_URL", "http://jont.se/~nyson/i/");
require_once "lib/rss/RSSBuilder.php";
require_once "lib/Search.php";
$rss = new RSSBuilder();
$s = new Search();
$maxTime = 0;
$result = $s->search();
while ($row = $result->fetch_object()) {
    $link = BASE_URL . "#{$row->id}";
    $item = new RSSBuilderItem();
    $item->addTag("title", "Wohoo, someone uploaded {$row->name}!");
    $item->addTag("guid", $link, array("isPermaLink" => "false"));
    $item->addTag("link", $link);
    $item->addTag('pubDate', RSSBuilder::formatTimestamp($row->time));
    if ($row->time > $maxTime) {
        $maxTime = $row->time;
    }
    $item->addTag("description", htmlentities("<div>" . "<h2>{$row->name}</h2>" . "<div style='float: left;'><a href='{$link}' title='{$row->name}'>" . "<img src='" . BASE_URL . "thumbs/{$row->file}' alt='{$row->name}' />" . "</a></div>" . "</div>"));
    $rss->addItem($item);
}
$rss->setInfo(array("lastBuildDate" => RSSBuilder::formatTimestamp($maxTime)));
if (!isset($_GET['debug'])) {
    echo $rss->build();
} else {
    echo str_replace(array("\n", "\t"), array("<br />", "&nbsp;&nbsp;&nbsp;&nbsp;"), htmlentities($rss->build()));
}