<?php
// $Id: headlines.php,v 1.1 2004/07/11 10:28:06 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
// ------------------------------------------------------------------------- //

/**
* Description
*
* @param type $var description
* @return type description
*/
function b_headlines_show() {
global $db;

$cache_dir  = XOOPS_ROOT_PATH."/modules/headlines/cache";
include_once(XOOPS_ROOT_PATH . "/class/cafeRSS.php");

$rss   = new cafeRSS();
$block = array();
$block['title'] = _MB_HEADLINES_TITLE;

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

$cache_time = ($cache * 60);

$rss->assign('items', $items);
$rss->assign('use_cache', 1);
$rss->assign('echo', 0);
$rss->assign('refresh_time', $cache_time);
$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)) {
	$block['content'] .= $rss->error.'<br />';
	} else {
	$block['content'] .= "$content<br />";
	}
}

return $block;
}
?>
