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); } }
$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 ? '?' : '&'; $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 ? '?' : '&'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['act_desc']); $subject = $_LANG['snatch']; $date = local_date('r', $row['start_time']);
if ($t_bug->view_state == VS_PRIVATE) { $title .= ' [' . lang_get('private') . ']'; } $description = string_rss_links($t_bug->description); # subject is category. $subject = category_full_name($t_bug->category_id, false); # optional DC value $date = $t_bug->last_updated; # author of item $author = ''; if (access_has_global_level(config_get('show_user_email_threshold'))) { $t_author_name = user_get_name($t_bug->reporter_id); $t_author_email = user_get_field($t_bug->reporter_id, 'email'); if (!is_blank($t_author_email)) { if (!is_blank($t_author_name)) { $author = $t_author_name . ' <' . $t_author_email . '>'; } else { $author = $t_author_email; } } } # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1'; # url to comment page rss 2.0 value $comments = $t_path . 'view.php?id=' . $t_bug->id . '#bugnotes'; # optional mod_im value for dispaying a different pic for every item $image = ''; $rssfile->addRSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); } /** @todo consider making this a configuration option - 0.91 / 1.0 / 2.0 */ $version = '2.0'; $rssfile->outputRSS($version);
if ($t_bug->view_state == VS_PRIVATE) { $t_title .= ' [' . lang_get('private') . ']'; } $t_description = string_rss_links($t_bug->description); # subject is category. $t_subject = category_full_name($t_bug->category_id, false); # optional DC value $t_date = $t_bug->last_updated; # author of item $t_author = ''; if (access_has_global_level(config_get('show_user_email_threshold'))) { $t_author_name = user_get_name($t_bug->reporter_id); $t_author_email = user_get_field($t_bug->reporter_id, 'email'); if (!is_blank($t_author_email)) { if (!is_blank($t_author_name)) { $t_author = $t_author_name . ' <' . $t_author_email . '>'; } else { $t_author = $t_author_email; } } } # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1'; # url to comment page rss 2.0 value $t_comments = $t_path . 'view.php?id=' . $t_bug->id . '#bugnotes'; # optional mod_im value for dispaying a different pic for every item $t_image = ''; $t_rssfile->addRSSItem($t_about, $t_title, $t_link, $t_description, $t_subject, $t_date, $t_author, $t_comments, $t_image); } # @todo consider making this a configuration option - 0.91 / 1.0 / 2.0 $t_version = '2.0'; $t_rssfile->outputRSS($t_version);