Esempio n. 1
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. 2
0
*/
define('IN_ECS', true);
define('INIT_NO_USERS', true);
define('INIT_NO_SMARTY', true);
require dirname(__FILE__) . '/includes/init.php';
require ROOT_PATH . 'includes/cls_rss.php';
header('Content-Type: application/xml; charset=' . EC_CHARSET);
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
header('Last-Modified: ' . date('r'));
header('Pragma: no-cache');
$ver = isset($_REQUEST['ver']) ? $_REQUEST['ver'] : '2.00';
$cat = isset($_REQUEST['cat']) ? ' AND ' . get_children(intval($_REQUEST['cat'])) : '';
$brd = isset($_REQUEST['brand']) ? ' AND g.brand_id=' . intval($_REQUEST['brand']) . ' ' : '';
$uri = $ecs->url();
$rss = new RSSBuilder(EC_CHARSET, $uri, htmlspecialchars($_CFG['shop_name']), htmlspecialchars($_CFG['shop_desc']), $uri . 'animated_favicon.gif');
$rss->addDCdata('', 'http://www.ecshop.com', date('r'));
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'];
# only rss 2.0
$category = project_get_name($f_project_id);
if ($f_project_id !== 0) {
    $title .= ' - ' . $category;
}
$title .= ' - ' . lang_get('issues');
if ($f_username !== null) {
    $title .= " - ({$f_username})";
}
if ($f_filter_id !== 0) {
    $title .= ' (' . filter_get_field($f_filter_id, 'name') . ')';
}
$description = $title;
# in minutes (only rss 2.0)
$cache = '10';
$rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache);
# person, an organization, or a service
$publisher = '';
# person, an organization, or a service
$creator = '';
$date = (string) date('r');
$language = lang_get('phpmailer_language');
$rights = '';
# spatial location , temporal period or jurisdiction
$coverage = (string) '';
# person, an organization, or a service
$contributor = (string) '';
$rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor);
# hourly / daily / weekly / ...
$period = (string) 'hourly';
# every X hours/days/...
 /**
  */
 public function perform($data = FALSE)
 {
     /* create the object - remember, not all attibutes are supported by every rss version. just hand over an empty string if you don't need a specific attribute */
     if (isset($data['filename'])) {
         $filename = $data['filename'];
     } else {
         $filename = FALSE;
     }
     if (!isset($data['rss']['encoding'])) {
         $data['rss']['encoding'] = 'UTF-8';
     }
     $encoding = (string) $data['rss']['encoding'];
     if (!isset($data['rss']['about'])) {
         $data['rss']['about'] = '';
     }
     $about = (string) $data['rss']['about'];
     if (!isset($data['rss']['title'])) {
         $data['rss']['title'] = '';
     }
     $title = (string) $data['rss']['title'];
     if (!isset($data['rss']['description'])) {
         $data['rss']['description'] = '';
     }
     $description = (string) $data['rss']['description'];
     if (!isset($data['rss']['image_link'])) {
         $data['rss']['image_link'] = '';
     }
     $image_link = (string) $data['rss']['image_link'];
     if (!isset($data['rss']['category'])) {
         $data['rss']['category'] = '';
     }
     $category = (string) $data['rss']['category'];
     // (only rss 2.0)
     if (!isset($data['rss']['cache'])) {
         $data['rss']['cache'] = 0;
     }
     $cache = (string) $data['rss']['cache'];
     // in minutes (only rss 2.0)
     $rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache, $filename);
     /* if you want you can add additional Dublic Core data to the basic rss file (if rss version supports it) */
     if (!isset($data['dc']['publisher'])) {
         $data['dc']['publisher'] = '';
     }
     $publisher = (string) $data['dc']['publisher'];
     // person, an organization, or a service
     if (!isset($data['dc']['creator'])) {
         $data['dc']['creator'] = '';
     }
     $creator = (string) $data['dc']['creator'];
     // person, an organization, or a service
     $date = (string) time();
     if (!isset($data['dc']['language'])) {
         $data['dc']['language'] = '';
     }
     $language = (string) $data['dc']['language'];
     if (!isset($data['dc']['rights'])) {
         $data['dc']['rights'] = '';
     }
     $rights = (string) $data['dc']['rights'];
     if (!isset($data['dc']['coverage'])) {
         $data['dc']['coverage'] = '';
     }
     $coverage = (string) $data['dc']['coverage'];
     // spatial location , temporal period or jurisdiction
     if (!isset($data['dc']['contributor'])) {
         $data['dc']['contributor'] = '';
     }
     $contributor = (string) $data['dc']['contributor'];
     // person, an organization, or a service
     $rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor);
     /* if you want you can add additional Syndication data to the basic rss file (if rss version supports it) */
     if (!isset($data['sydate']['period'])) {
         $data['sydate']['period'] = '';
     }
     $period = (string) $data['sydate']['period'];
     // hourly / daily / weekly / ...
     if (!isset($data['sydate']['frequency'])) {
         $data['sydate']['frequency'] = 0;
     }
     $frequency = (int) $data['sydate']['frequency'];
     // every X hours/days/...
     if (!isset($data['sydate']['base'])) {
         $data['sydate']['base'] = 10000;
     }
     $base = (string) time() - $data['sydate']['base'];
     $rssfile->addSYdata($period, $frequency, $base);
     return $rssfile;
 }
Esempio n. 5
0
# Make sure that the user selected either all projects or a public one.
$f_project_id = gpc_get_int('project_id', 0);
if ($f_project_id != 0 && VS_PRIVATE == project_get_field($f_project_id, 'view_state')) {
    access_denied();
}
# construct rss file
$encoding = lang_get('charset');
$about = config_get('path');
$title = string_rss_links(config_get('window_title') . ' - ' . lang_get('news'));
$description = $title;
$image_link = config_get('path') . 'images/mantis_logo_button.gif';
# only rss 2.0
$category = string_rss_links(project_get_name($f_project_id));
# in minutes (only rss 2.0)
$cache = '60';
$rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache);
# person, an organization, or a service
$publisher = '';
# person, an organization, or a service
$creator = '';
$date = (string) date('r');
$language = lang_get('phpmailer_language');
$rights = '';
# spatial location , temporal period or jurisdiction
$coverage = (string) '';
# person, an organization, or a service
$contributor = (string) '';
$rssfile->setPublisher($publisher);
$rssfile->setCreator($creator);
$rssfile->setRights($rights);
$rssfile->setCoverage($coverage);
Esempio n. 6
0
# only rss 2.0
$t_category = project_get_name($f_project_id);
if ($f_project_id !== 0) {
    $t_title .= ' - ' . $t_category;
}
$t_title .= ' - ' . lang_get('issues');
if ($f_username !== null) {
    $t_title .= ' - (' . $f_username . ')';
}
if ($f_filter_id !== 0) {
    $t_title .= ' (' . filter_get_field($f_filter_id, 'name') . ')';
}
$t_description = $t_title;
# in minutes (only rss 2.0)
$t_cache = '10';
$t_rssfile = new RSSBuilder($t_encoding, $t_about, $t_title, $t_description, $t_image_link, $t_category, $t_cache);
# person, an organization, or a service
$t_publisher = '';
# person, an organization, or a service
$t_creator = '';
$t_date = date('r');
$t_language = lang_get('phpmailer_language');
$t_rights = '';
# spatial location , temporal period or jurisdiction
$t_coverage = '';
# person, an organization, or a service
$t_contributor = '';
$t_rssfile->addDCdata($t_publisher, $t_creator, $t_date, $t_language, $t_rights, $t_coverage, $t_contributor);
# hourly / daily / weekly / ...
$t_period = 'hourly';
# every X hours/days/...
Esempio n. 7
0
File: rss.php Progetto: nyson/izwei
<?php

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()));
Esempio n. 8
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. 9
0
</table>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
  document.getElementById("q").focus();
//]]>
</script>

END;
// ** Final submission ** //
if ($blnSubmitForm) {
    // RSS mode
    $strRSSURL = FN_SEARCH . "{$strReQuery}&amp;mode=rss";
    if (!empty($_GET['mode']) && $_GET['mode'] == "rss") {
        $RSS = new RSSBuilder();
        $strFeed = $RSS->DisplayArticleRSS($strAreaClause, $strWhereClause, $strRSSURL);
        exit($strFeed);
    }
    // Page numbers
    $intContentPerPage = 10;
    $intStart = $CMS->PN->GetPageStart($intContentPerPage, $intPageNumber);
    // ** Per-article permissions ** //
    $CMS->RES->Admin();
    if (!$CMS->RES->IsError()) {
        $strUserGroupSQL = "";
    } else {
        $intCurrentUserID = $CMS->RES->GetCurrentUserID();
        if ($intCurrentUserID) {
            $strCurrentUserGroups = $CMS->US->GetUserGroups($intCurrentUserID);
        } else {
Esempio n. 10
0
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require 'sys/header.php';
$strFeed = empty($_GET['name']) ? "" : $CMS->FilterAlphanumeric($_GET['name'], "");
$RSS = new RSSBuilder();
switch ($strFeed) {
    case "articles":
        $intAreaID = empty($_GET['id']) ? "" : $CMS->FilterNumeric($_GET['id']);
        if (!$intAreaID) {
            $strFeedburnerURL = $CMS->SYS->GetSysPref(C_PREF_RSS_ARTICLES_URL);
            if ($strFeedburnerURL) {
                $strUserAgent = empty($_SERVER['HTTP_USER_AGENT']) ? "" : $_SERVER['HTTP_USER_AGENT'];
                if (strpos(strtoupper($strUserAgent), "FEEDBURNER") !== false) {
                    // Feedburner is OK to access this URL
                } else {
                    httpRedirect($strFeedburnerURL);
                    exit;
                }
            }
        }