<?php
// $Id: system_user.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: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function b_system_user_show() {
global $db, $xoopsUser;

if (!$xoopsUser) {
	return FALSE;
}

$block             = array();
$block['title']    = sprintf(_MB_SYSTEM_MENU4, $xoopsUser->uname());
$block['content']  = "<img src='".XOOPS_URL."/images/menu/pointer.gif' border='0'>";
$block['content'] .= "&nbsp;<a href='".XOOPS_URL."/user.php'>"._MB_SYSTEM_VACNT."</a><br />";
$block['content'] .= "<img src='".XOOPS_URL."/images/menu/pointer.gif' border='0'>";
$block['content'] .= "&nbsp;<a href='".XOOPS_URL."/user.php?op=logout'>"._MB_SYSTEM_LOUT."</a><br /><br />";

list($total_messages) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("priv_msgs")." WHERE to_userid = ".$xoopsUser->getVar("uid").""));
list($new_messages)   = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("priv_msgs")." WHERE to_userid = ".$xoopsUser->getVar("uid")." AND read_msg=0"));

if ($total_messages > 0) {
	if ($new_messages > 0) {
		$block['content'] .= $new_messages.": <a id='msgtxt' href='".XOOPS_URL."/viewpmsg.php' onmouseover='setBlink(0);' onmouseout='setBlink(1);'><b>"._MB_SYSTEM_NMSGS."</b></a><br />";
		if ( !defined('EXOOPS_PM_INCLUDED') ) {
			$block['content'] .= "<bgsound src='".XOOPS_URL."/images/msg.wav' loop='false'>";
		}
		$block['content'] .= '
					<script type="text/javascript">
					<!--
					var blink    = 1;
					var blinkdom = xoopsGetElementById("msgtxt");

					function blink1() {
					blinkdom.style.visibility = "hidden";
					if (blink == 1) {
						setTimeout("blink2()", 500);
						} else {
							blinkdom.style.visibility = "visible";
						}
					}

					function blink2() {
					blinkdom.style.visibility = "visible";
					if (blink == 1) {
						setTimeout("blink1()", 1000);
					}
					}

					function setBlink(val) {
					blink = val;
					blink1();
					}

					setBlink(1);
					//-->
					</script>';

		} else {
			$block['content'] .= _MB_SYSTEM_NNMSG." <br /> ";
		}
	$block['content'] .= $total_messages.": <a href='".XOOPS_URL."/viewpmsg.php'>"._MB_SYSTEM_TMSGS."</a>";
	} else {
		$block['content'] .= "<a href='".XOOPS_URL."/viewpmsg.php'>"._MB_SYSTEM_NNMSG."</a>";
	}

if ($xoopsUser->isAdmin()) {
	$block['content'] .= "<br /><br /><img src='".XOOPS_URL."/images/menu/pointer.gif' border='0'>";
	$block['content'] .= "&nbsp;<a href='".XOOPS_URL."/admin.php'>"._MB_SYSTEM_ADMENU."</a>";
}

return $block;
}

//---------------------------------------------------------------------------------------//
?>
