<?php
// $Id: index.php,v 1.1 2004/07/11 10:28:07 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: Half-Dead
// Author Website : http://www.e-xoops.com
// License Type   : Proprietary: See /manual/LICENSES/E-Xoops.txt
// ------------------------------------------------------------------------- //

include_once("../../mainfile.php");
include_once("../../header.php");
include_once(XOOPS_ROOT_PATH . "/class/cafeRSS.php");

$xoopsOption['show_rblock'] = 1;

if ($xoopsConfig['startpage'] == "headlines") {
	make_cblock();
	echo "<br />";
	OpenTable();
		} else {
		OpenTable();
		echo "<h4>"._MI_HEADLINES_NAME."<hr /></h4>";
}

$rss       = new cafeRSS();
$cache_dir = XOOPS_ROOT_PATH."/modules/headlines/cache";

$result = $db->query("SELECT id, headlineurl, template, cache, items FROM ".$db->prefix("headlines")." WHERE (type='main' OR type='both') AND status=1 ORDER BY weight ASC");
while ( list($id, $headlineurl, $template, $cache, $items) = $db->fetch_row($result) ) {

$rss->assign('items', intval($items));
$rss->assign('use_cache', 1);
$rss->assign('echo', 0);
$rss->assign('refresh_time', (intval($cache) * 60));
$rss->assign('template_file', XOOPS_ROOT_PATH."/modules/headlines/templates/$template");
$rss->assign('cache_dir', $cache_dir);
$content = $rss->display($headlineurl);

if (!empty($rss->error)) {
	echo $rss->error.'<br />';
	} else {
		echo "$content<br />";
	}
}

CloseTable();
include_once("../../footer.php");
?>
