<?php
// $Id: rss.php,v 1.5 2006/09/02 16:05:04 ohwada Exp $

// 2006-09-01 K.OHWADA
// use happy_linux_build_rss
// fuzzy search

// 2006-07-10 K.OHWADA
// use config_basic

// 2006-06-04 K.OHWADA
// use header.php
// move debug view into admin page

//================================================================
// Rss center Module
// 2006-01-01 K.OHWADA
//================================================================

include 'header.php';

// system files
include_once XOOPS_ROOT_PATH.'/class/template.php';
include_once XOOPS_ROOT_PATH.'/class/xoopsuser.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/build_rss.php';

include_once RSSC_ROOT_PATH."/class/rssc_build_rssc.php";
include_once RSSC_ROOT_PATH."/class/rssc_search_handler.php";

$search_handler =& rssc_get_handler( 'search', RSSC_DIRNAME );
$conf_handler   =& rssc_get_handler( 'config_basic', RSSC_DIRNAME );
$builder        =& rssc_build_rssc::getInstance();

$view_goto_url = RSSC_URL.'/index.php';

$TEMPLATE_RDF  = RSSC_ROOT_PATH.'/templates/xml/rssc_build_rdf.html';
$TEMPLATE_RSS  = RSSC_ROOT_PATH.'/templates/xml/rssc_build_rss.html';
$TEMPLATE_ATOM = RSSC_ROOT_PATH.'/templates/xml/rssc_build_atom.html';

$conf_data =& $conf_handler->get_conf();
$max_limit = $conf_data['main_search_perpage'];
$min       = $conf_data['main_search_min'];

$search_handler->setFeedLimit(  $max_limit );
$search_handler->setMinKeyword( $min );
$search_handler->setFeedOrder(  $conf_data['main_search_order'] );
$search_handler->setFutureDays( $conf_data['basic_future_days'] );
$search_handler->setFlagSanitize(0);	// not sanitize

$mode   = $search_handler->get_get_rss_mode();
$limit  = $search_handler->get_get_limit();
$start  = $search_handler->get_get_start();
$action = $search_handler->get_post_get_action();
$andor  = $search_handler->get_post_get_andor();
$query  = $search_handler->get_post_get_query();

if ($limit <= 0)
{
	$limit = $max_limit;
}

$feeds = array();

if ($query)
{
	if ( $search_handler->parseQuery() )
	{
		if ( $search_handler->getSearchCount() > 0 )
		{
			$feeds =& $search_handler->getSearchFeeds($limit, $start);
		}
	}
}
else
{
	$feeds =& $search_handler->getLatest($limit, $start);
}

$builder->set_mode( $mode );
$builder->set_rdf_template(  $TEMPLATE_RDF );
$builder->set_rss_template(  $TEMPLATE_RSS );
$builder->set_atom_template( $TEMPLATE_ATOM );
$builder->set_items($feeds);
$builder->build();

exit();
// --- main end ---

?>