<?php
require('includes/application_top.php');
header('Content-Type: application/rss+xml;charset=UTF-8');
ob_end_clean();
function encodeIfNeeded($text) {
if('utf-8' != strtolower(CHARSET)) {
$text = iconv(CHARSET, 'UTF-8', $text);
}
return $text;
}
function replace_problem_characters($text) {
$formattags = array("&");
$replacevals = array("&");
$text = str_replace($formattags, $replacevals, $text);
$in[] = '@&(amp|#038);@i'; $out[] = '&';
$in[] = '@&(#036);@i'; $out[] = '$';
$in[] = '@&(quot);@i'; $out[] = '"';
$in[] = '@&(#039);@i'; $out[] = '\'';
$in[] = '@&(nbsp|#160);@i'; $out[] = ' ';
$in[] = '@&(hellip|#8230);@i'; $out[] = '...';
$in[] = '@&(copy|#169);@i'; $out[] = '(c)';
$in[] = '@&(trade|#129);@i'; $out[] = '(tm)';
$in[] = '@&(lt|#60);@i'; $out[] = '<';
$in[] = '@&(gt|#62);@i'; $out[] = '>';
$in[] = '@&(laquo);@i'; $out[] = '«';
$in[] = '@&(raquo);@i'; $out[] = '»';
$in[] = '@&(deg);@i'; $out[] = '°';
$in[] = '@&(mdash);@i'; $out[] = '—';
$in[] = '@&(reg);@i'; $out[] = '®';
$in[] = '@&(–);@i'; $out[] = '-';
$text = preg_replace($in, $out, $text);
return $text;
}
function strip_html_tags($str) {
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
// and white space. It will also convert some
// common HTML entities to their text equivalent.
$search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
"'<[/!]*?[^<>]*?>'si", // Strip out HTML tags
//"'([rn])[s]+'", // Strip out white space
"'&(quot|#34);'i", // Replace HTML entities
// "'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&#(d+);'e"); // evaluate as php
$replace = array ("",
"",
//"\1",
"\"",
"&",
"<",
">",
" ",
chr(160),
chr(161),
chr(162),
chr(163),
chr(169),
"chr(\1)");
return preg_replace($search, $replace, $str);
}
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<?php
echo '<title>Catalog Feed</title>'. "\n";
$store=mysqli_fetch_assoc(mysqli_query("select * from ".DB_PREFIX."configuration where configuration_key='STORE_NAME'"));
echo '<link>'.HTTP_SERVER.DIR_WS_CATALOG.'</link>'. "\n";
echo '<description>Catalog Feed generated by StoreYa.com 2.1</description>'. "\n";
// * NOTICE OF LICENSE
// *
// * This source file is the property of StoreYa Feed LTD. and a part of its patent pending technology.
// * Using this file is allowed only for the purpose of importing web stores onto Facebook using the service of StoreYa Feed LTD.
// * Do NOT copy/edit/change this file or use it to any service other than the above.
$admin=mysqli_fetch_assoc(mysqli_query("select * from ".DB_PREFIX."admin limit 0,1"));
echo '<lastBuildDate>'.date('m/d/Y H:is').'</lastBuildDate>'. "\n";
//echo '<copyright>Copyright '.date('Y').', '.$_SERVER['HTTP_HOST'].'</copyright>'. "\n";
if($_GET['language_id']=='')
{
$lang=mysqli_fetch_assoc(mysqli_query("select languages_id from ".DB_PREFIX."languages where code in (select configuration_value from ".DB_PREFIX."configuration where configuration_key='DEFAULT_LANGUAGE')"));
$language_id=$lang['languages_id'];
}
else
$language_id=$_GET['language_id'];
$prdqry= mysqli_query("select ".DB_PREFIX."products.products_id,products_price,products_price_sorter,products_ image,products_name,products_description,products_url from ".DB_PREFIX."products,".DB_PREFIX."products_description where ".DB_PREFIX."products.products_status='1' and ".DB_PREFIX."products.products_id=".DB_PREFIX."products_description.products _id and ".DB_PREFIX."products_description.language_id='".$language_id."' order by ".DB_PREFIX."products.products_id ");
while($row=mysqli_fetch_assoc($prdqry))
{
echo '<item>'. "\n";
echo ' <title>'.strip_html_tags(replace_problem_characters(encodeIfNeeded($row['products_name']))).'</title>'. "\n";
echo ' <link>'. htmlentities(HTTP_SERVER.DIR_WS_CATALOG.'index.php?main_page=product_info&produc ts_id='.$row['products_id']).'</link>'. "\n";
echo ' <description>'. htmlspecialchars(strip_html_tags(replace_problem_characters(encodeIfNeeded($row['products_description'])))).'</description>'. "\n";
echo ' <g:image_link>'.HTTP_SERVER.DIR_WS_CATALOG.'images/'.$row['products_image'].'</g:image_link>'. "\n";
echo ' <g:id>'.$row['products_id'].'</g:id>'. "\n";
echo ' <g

rice>'.$row['products_price'].'</g

rice>'. "\n";
echo ' <g:sale_price>'.$row['products_price_sorter'].'</g:sale_price>'. "\n";
$catqry=mysqli_query("select categories_name from ".DB_PREFIX."categories_description,".DB_PREFIX."products_to_categories where language_id='".$language_id."' and ".DB_PREFIX."products_to_categories.categories_id=".DB_PREFIX."categories_descri ption.categories_id and ".DB_PREFIX."products_to_categories.products_id='".$row['products_id']."'");
while($catrow=mysqli_fetch_assoc($catqry))
{
echo ' <g

roduct_type>'.strip_html_tags(replace_problem_characters(encodeIfNeeded($catrow['categories_name']))).'</g

roduct_type>'. "\n";
}
echo '</item>'. "\n";
}
echo '</channel>'. "\n";
echo '</rss>';
Bookmarks