[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: index.php,v 1.1 2003/06/11 17:38:00 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 header("Content-type: application/rss+xml"); 13 require ('includes/application_top.php'); 14 15 function mysqlTimestamp2unix($input){ 16 $y = substr($input,0,4);$m = substr($input,6,2);$d = substr($input,9,2); 17 $h = substr($input,12,2);$min = substr($input,15,2);$s = substr($input,18,2); 18 return mktime($h,$min,$s,$m,$d,$y); 19 } 20 //1234567890123456789 21 //2007-01-01 15:48:04 22 23 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ARTICLE_RSS); 24 25 $language_query = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id = '" . (int)$languages_id . "'"); 26 $language_code = tep_db_fetch_array($language_query); 27 $code_lang = $language_code['code']; 28 29 echo "<?xml version='1.0' ?><rss version='2.0'><channel>\n 30 31 <title>" . NEWS_TITLE . "</title>\n"; 32 33 echo "<link>" . HTTP_SERVER . "</link>\n"; 34 echo "<description>" . NEWS_DESCRIPTION . "</description>\n"; 35 echo "<language>" . $code_lang . "</language>\n"; 36 echo "<docs>" . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_ARTICLE_RSS . "</docs>\n"; 37 38 // $news_query_raw = tep_db_query("select nd.name, n.date_created, nd.content, n.id from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where nd.language_id = '" . (int)$languages_id . "' and n.id = nd.news_id order by n.id desc " ); 39 /*$news_query_raw = tep_db_query("select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, ad.articles_description, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name limit". NEWS_RSS_ARTICLE);*/ 40 41 $news_query_raw = tep_db_query("select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, ad.articles_description, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name limit " . NEWS_RSS_ARTICLE); 42 43 // use language_id for language support. 44 while ($content_rec = tep_db_fetch_array($news_query_raw)) { 45 echo "<item>"; 46 47 $headline = $content_rec['articles_name']; 48 $mydate = mysqlTimestamp2unix($content_rec['articles_date_added']); 49 $date = date('r',$mydate); 50 $content_1 = substr($content_rec['articles_description'], 0, NEWS_RSS_CHARACTERS); 51 $content = strip_tags($content_1); 52 if (strlen($content_rec['content']) > NEWS_RSS_CHARACTERS) { 53 $content = $content . "...."; 54 // maybe read more here? 55 } 56 $article_author= $content_rec['authors_name']; 57 // $article_url= $content_rec['articles_url']; 58 $article_topic= $content_rec['topics_name']; 59 $item_link = HTTP_SERVER . DIR_WS_CATALOG . FILENAME_ARTICLE_INFO . "?articles_id=" . $content_rec['articles_id']; 60 61 echo "<title>$headline</title>\n"; 62 echo "<pubDate>$date</pubDate>\n"; 63 echo "<description>$content</description>\n"; 64 echo "<author>$article_author</author>\n"; 65 echo "<category>$article_topic</category>\n"; 66 echo "<link>$item_link</link>\n"; 67 echo "<guid>$item_link</guid>\n"; 68 echo "</item>\n"; 69 } 70 71 echo "</channel></rss>"; 72 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |