<?php

include('azatech/initvars.php');
include('azatech/xml.php');
include('azatech/rss.php');


//allways define these vars
$items_limit = 10; //int number of items to use
$channel_title = array( //format: 'language' => 'title',
                       'ro' => $init_vars['site_name'].' - Ultimele ştiri',
                       'en' => $init_vars['site_name'].' - Latest news',
                       'it' => $init_vars['site_name'].' - Ultime notizie'
                      );
$channel_link = $base->SITE_URI.'/news_'.$lang->LANG.'.php'; //$base->SITE_URI if channel is on index page
$channel_description = array( //format: 'language' => 'description',
                             'ro' => 'Ultimele '.$items_limit.' ştiri pe site-ul '.$init_vars['site_name'],
                             'en' => 'Latest '.$items_limit.' news on the '.$init_vars['site_name'].' website',
                             'it' => 'Le ultime '.$items_limit.' notizie sul sito '.$init_vars['site_name']
                            );
$channel_copyright = $init_vars['site_company']; //str copyright or bool false
$channel_ttl = 60; //minutes to cache the feed //int minutes or false
$channel_image_url = false; //str full uri or bool false
$sql = 'select id_news as id, title_'.$lang->LANG.' as title, text_'.$lang->LANG.' as description, lastmod from news_news order by id_news desc limit 0,'.$items_limit; //edit fileds for "as id", "as title", "as description", but not "lastmod"
$item_link = 'news_'; //$item_link.$item['id'].'_'.$lang->LANG.'.php';
$item_use_lastmod = true; //anything or bool false
$item_use_image = 'media/news/'; //str directory or bool false //format: 'media/news/'


 //do not edit from this point on
//send header
header($init_vars['rss_content_type']);

 //start rss
//xml, rss, channel
$rss = new rss($init_vars['xmlspec'], $base->HTTP_DIR);
$rss->open_tag('rss', $init_vars['rss_spec']);
$rss->open_tag('channel');
$rss->add_channel_data($channel_title[$lang->LANG], $channel_link, $channel_description[$lang->LANG], $channel_copyright, $channel_ttl, $channel_image_url);

//items
$csql->query($sql);
$rss->add_items($csql->ITEMS, $lang->LANG, $item_link, $item_use_lastmod, $item_use_image, 'jpg');

//close xml, rss, channel
$rss->close_tag('channel');
$rss->close_tag('rss');

//strip bbcode
if(isset($init_vars['show_bbcode']))
 {
  if($init_vars['show_bbcode'] == 'Y')
   {
    $rss->TREE = $base->strip_bbcode($rss->tree());
   }
 }

//show tree
print $rss->tree();