<?php
// $Id: system_info.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_info_show($options) {
global $xoopsConfig, $xoopsUser, $db, $myts, $meta;

$block = array();
$block['title'] = _MB_SYSTEM_INFO;
$block['content'] = "<div style='text-align: center;'>";

if ( isset($options[3]) && $options[3] == 1 ) {
	$result = $db->query("SELECT u.uid, u.uname, u.email, u.user_viewemail, g.name AS groupname FROM ".$db->prefix("groups_users_link")." l LEFT JOIN ".$db->prefix("users")." u ON l.uid=u.uid LEFT JOIN ".$db->prefix("groups")." g ON l.groupid=g.groupid WHERE g.type='Admin' ORDER BY l.groupid");
	if ($db->num_rows($result) > 0) {
		$prev_cation = "";
		$block['content'] .= "<table width='92%' border='0' cellspacing='1' cellpadding='0' class='bg2'><tr><td>\n";
		$block['content'] .= "<table width='100%' border='0' cellspacing='1' cellpadding='8' class='bg1'><tr><td>\n";
		$prev_caption = "";

		while  ($userinfo = $db->fetch_array($result)) {
			if ($prev_caption != $userinfo['groupname']) {
				$prev_caption      = $userinfo['groupname'];
				$block['content'] .= "<tr><td colspan='2'>";
				$block['content'] .= "<small>";
				$block['content'] .= "<b>".$myts->makeTboxData4Show($prev_caption)."</b>";
				$block['content'] .= "</small>";
				$block['content'] .= "</td></tr>";
			}
			$userinfo['uname'] = $myts->makeTboxData4Show($userinfo['uname']);
			$block['content'] .= "<tr><td width='80%'>";
			$block['content'] .= "<small>";
			$block['content'] .= "<a href='".XOOPS_URL."/userinfo.php?uid=".$userinfo['uid']."'>".$userinfo['uname']."</a>";
			$block['content'] .= "</small>";
			$block['content'] .= "</td><td width='20%' align='right'>";
			if ($xoopsUser) {
				$block['content'] .= "<a href='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send2=1&amp;to_userid=".$userinfo['uid']."\",\"pmlite\",450,400);'>";
				$block['content'] .= "<img src='".XOOPS_URL."/images/icons/pm_small.gif' border='0' width='27' height='17' alt='";
				$block['content'] .= sprintf(_MB_SYSTEM_SPMTO,$userinfo['uname']);
				$block['content'] .= "' /></a>";
				} else {
					if ($userinfo['user_viewemail']) {
						$block['content'] .= "<a href='mailto:".$userinfo['email']."'><img src='".XOOPS_URL."/images/icons/em_small.gif' border='0' width='16' height='14' alt='";
						$block['content'] .= sprintf(_MB_SYSTEM_SEMTO,$userinfo['uname']);
						$block['content'] .= "' /></a>";
						} else {
							$block['content'] .= "&nbsp;";
						}
				}
				$block['content'] .= "</td></tr>";
		}
	$block['content'] .= "</table></td></tr></table><br />";
	}
}

$block['content'] .= "<img src='".XOOPS_URL."/images/".$options[2]."' alt='".$meta['title']."' border='0' />";
if ( $xoopsUser ) {
	$block['content'] .= "<br /><a href='javascript:openWithSelfMain(\"".XOOPS_URL."/misc.php?action=showpopups&amp;type=friend&amp;op=sendform&amp;t=".time()."\",\"friend\",".$options[0].",".$options[1].")'>"._MB_SYSTEM_RECO."</a>";
	} else {
		$block['content'] .= "<br /><a href='mailto:?subject=".rawurlencode( sprintf(_MB_INTSITE, $meta['title']) )."&body=".rawurlencode( _MB_INTSITEFOUND."\r\n".$meta['title'].": ".XOOPS_URL )."'>"._MB_SYSTEM_RECO."</a>";
	}
$block['content'] .= "</div>";

return $block;
}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function b_system_info_edit($options) {

$form = ""._MB_SYSTEM_PWWIDTH."&nbsp;";
$form .= "<input type='text' class='text' name='options[]' value='".$options[0]."' />";
$form .= "<br />"._MB_SYSTEM_PWHEIGHT."&nbsp;";
$form .= "<input type='text' class='text' name='options[]' value='".$options[1]."' />";
$form .= "<br />".sprintf(_MB_SYSTEM_LOGO,XOOPS_URL."/images/")."&nbsp;";
$form .= "<input type='text' class='text' name='options[]' value='".$options[2]."' />";
$form .= "<br />"._MB_SYSTEM_SADMIN."&nbsp;";

$chk = "";
if ( $options[3] == 1 ) {
		$chk = " checked='checked'";
}

$form .= "<input type='radio' class='radio' name='options[3]' value='1'".$chk." />&nbsp;"._YES."";

$chk = "";
if ( $options[3] == 0 ) {
	$chk = " checked=\"checked\"";
}

$form .= "&nbsp;<input type='radio' class='radio' name='options[3]' value='0'".$chk." />"._NO."";
return $form;
}

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