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'];
                $date = local_date('r', $row['start_time']);
$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/...
$frequency = (int) 1;
$base = (string) date('Y-m-d\\TH:i:sO');
# add missing : in the O part of the date.  PHP 5 supports a 'c' format which will output the format
# exactly as we want it.
# // 2002-10-02T10:00:00-0500 -> // 2002-10-02T10:00:00-05:00
$base = utf8_substr($base, 0, 22) . ':' . utf8_substr($base, -2);
$rssfile->addSYdata($period, $frequency, $base);
$t_page_number = 1;
$t_issues_per_page = 25;
$t_page_count = 0;
$t_issues_count = 0;
$t_project_id = $f_project_id;
 /**
  */
 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
$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/...
$t_frequency = 1;
$t_base = date('Y-m-d\\TH:i:sO');
# add missing : in the O part of the date.  PHP 5 supports a 'c' format which will output the format
# exactly as we want it.
# 2002-10-02T10:00:00-0500 -> 2002-10-02T10:00:00-05:00
$t_base = utf8_substr($t_base, 0, 22) . ':' . utf8_substr($t_base, -2);
$t_rssfile->addSYdata($t_period, $t_frequency, $t_base);
$t_page_number = 1;
$t_issues_per_page = 25;
$t_page_count = 0;
$t_issues_count = 0;
$t_project_id = $f_project_id;
Esempio n. 6
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://http://www.nirvanainfo.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'];
                $date = local_date('r', $row['start_time']);