<?php
// $Id: system_waiting.php,v 1.1 2004/07/11 10:29:03 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   : LGPL: See /manual/LICENSES/LGPL.txt
// ------------------------------------------------------------------------- //

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function b_system_waiting_show() {
global $db, $myts, $xoopsConfig;

$block            = array();
$block['title']   = _MB_SYSTEM_WCNT;
$block['content'] = '';

$query = $db->query('SELECT dirname FROM '.$db->prefix('modules').' WHERE isactive=1 AND haswaiting=1');

if ($query) {
	while (list($dirname) = @$db->fetch_row($query)) {
		include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/xoops_version.php');
		if (@file_exists(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.$modversion['waiting']['file'])) {
			if ( @file_exists(XOOPS_ROOT_PATH."/modules/".$dirname."/language/".$xoopsConfig['language']."/blocks.php") ) {
				include_once(XOOPS_ROOT_PATH."/modules/".$dirname."/language/".$xoopsConfig['language']."/blocks.php");
				} elseif ( @file_exists(XOOPS_ROOT_PATH."/modules/".$dirname."/language/english/blocks.php") ) {
					include_once(XOOPS_ROOT_PATH."/modules/".$dirname."/language/english/blocks.php");
				}
			include_once(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.$modversion['waiting']['file']);
			$func = $modversion['waiting']['func'];
			if (function_exists($func)) {
				$content = $func();
				$size    = count($content);
				for ($i=0; $i<$size; $i++) {
					if ( !empty($content[$i]['image']) ) {
						$block['content'] .= '<img src="'.$content[$i]['image'].'" /> ';
					}
					if ( !empty($content[$i]['link']) && !empty($content[$i]['text']) ) {
						$block['content'] .= '<a href="'.$content[$i]['link'].'">'.$myts->makeTboxData4Show($content[$i]['text']).'</a>';
					}
					if ( !empty($content[$i]['count']) ) {
						$block['content'] .= ': '.intval($content[$i]['count']);
					}
					$block['content'] .= '<br />';
				}
				if ($size > 0) {
					$block['content'] .= '<br />';
				}
			}
		}
	}
}

if ($block['content'] == '') {
	$block['content'] = _NONE;
}

return $block;
}
?>
