<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?>
<!--<?php

//相关执行信息
switch($action){
	case 'BuyTools':
	case 'BuyUserTools':
	case 'SellTools':
		//道具信息
		ToolsInfo();
		BuyTools();
		break;
	case 'SaveBuyTools':
		SaveBuyTools();
		//道具信息
		ToolsInfo();
		break;
	case 'SaveSellTools':
		SaveSellTools();
		//道具信息
		ToolsInfo();
		break;
	case 'SaveBuyUserTools':
		SaveBuyUserTools();
		//道具信息
		ToolsInfo();
		break;
}

//道具信息
function ToolsInfo(){
	global $lang,$toolsInfo,$toolsSetting;
	if( $toolsInfo['toolsimg'] == '' ){
		$toolsInfo['toolsimg'] = 'dv_plus/tools/pic/none.jpg';
	}
	else{
		$toolsInfo['toolsimg'] = strtolower($toolsInfo['toolsimg']);
	}
	if( $toolsInfo['sysstock'] <= 0 ){
		$toolsInfo['buytype'] = -1;
	}
	print <<<EOT
-->
<table border="0" cellpadding="0" cellspacing="0" align="center" class="mainbox tableborder">
<form name="plustools" method="post">
	<tr>
		<th height="23" colspan="3">{$toolsInfo['toolsname']} -- {$lang['tpl.str2']}</th>
	</tr>
	<tr>
		<td width="30%" rowspan="18" align="center">
			<font size="4"><b>{$toolsInfo['toolsname']}</b></font>
			<br><img src="{$toolsInfo['toolsimg']}" border="0" />
		</td>
		<td width="70%" height="20" colspan="2">
			{$lang['tpl.str3']}<hr style="BORDER: #807d76 1px dotted;height:1px;">{$toolsInfo['toolsinfo']}
		</td>
	</tr>
	<tr>
		<th height="23" colspan="2">{$lang['tpl.str4']}</th>
	</tr>
	<tr>
		<td width="30%" height="20" align="Right">{$lang['tpl.str5']}</td>
		<td width="40%"><font color="{$_DCACHE['stylecss'][19]}"><B>{$toolsInfo['usermoney']}</B></font></td>
	</tr>
	<tr>
		<td height="20" align="Right">{$lang['tpl.str6']}</td>
		<td><font color="{$_DCACHE['stylecss'][19]}"><B>{$toolsInfo['userticket']}</B></font></td>
	</tr>
	<tr>
		<td height="20" align="Right">{$lang['tpl.str7']}</td>
		<td>{$lang['GetBuyType'][$toolsInfo['buytype']]}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str8']}</td>
		<td><B>{$toolsInfo['sysstock']}</B></td>
	</tr>
	<tr>
		<th height="23" colspan="2">{$lang['tpl.str9']}</th>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str10']}</td>
		<td>{$toolsInfo['userpost']}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str11']}</td>
		<td>{$toolsInfo['userwealth']}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str12']}</td>
		<td>{$toolsInfo['userep']}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str13']}</td>
		<td>{$toolsInfo['usercp']}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str14']}</td>
		<td>{$toolsSetting[0]}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str15']}</td>
		<td>{$toolsSetting[1]}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str16']}</td>
		<td>{$toolsSetting[2]}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str17']}</td>
		<td>{$toolsSetting[3]}</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str18']}</td>
		<td>
			<select name="toolsgroupid" size="1">
<!--
EOT;
	$userGrps =& getUserGroupsBy($toolsInfo['usergroupid']);
	if( $userGrps === false ){
		print <<<EOT
-->
				<option value="0">{$lang['tpl.str19']}</option>
<!--
EOT;
	} else{
		foreach( $userGrps as $val ){
			$val['usertitle'] = htmlspecialchars($val['usertitle']);
			print <<<EOT
-->
				<option value="{$val['usergroupid']}">{$val['usertitle']}</option>
<!--
EOT;
		}
	}
	print <<<EOT
-->
			</select>
		</td>
	</tr>
	<tr>
		<td height="23" align="Right">{$lang['tpl.str20']}</td>
		<td>
			<select name="toolsboardid" size="1">
<!--
EOT;
	global $_DCACHE, $lang;
	if( empty($_DCACHE['all_forums']) ){
		include_once CACHE_PATH.'board/board_all.php';
	}
	$count = 0;
	if( !empty($_DCACHE['all_forums']) && is_array($_DCACHE['all_forums']) ){
		$ToolsBoardList = ','.$toolsInfo['boardid'].',';
		foreach( $_DCACHE['all_forums'] as $currBoardID => $currBoardInfo ){
			$strPrev = '';
			if( strpos($ToolsBoardList,",{$currBoardID},") !== false ){
				$count++;
				if( $currBoardInfo['depth'] == 0 ){
					$strPrev = $lang['tpl.str46'];
				} elseif( $currBoardInfo['depth'] == 1 ){
					$strPrev = "&nbsp;&nbsp;{$lang['tpl.str47']}";
				} elseif( $currBoardInfo['depth'] > 1 ){
					$strPrev = str_repeat('&nbsp;&nbsp;'.$lang['tpl.str48'], $currBoardInfo['depth']).'&nbsp;&nbsp;'.$lang['tpl.str47'];
				}
			$currBoardType = $strPrev.' '.$currBoardInfo['boardtype'];
				print <<<EOT
-->
				<option value="{$currBoardID}">{$currBoardType}</option>
<!--
EOT;
			}
		}
	}
	if( $count <= 0 ){
		print <<<EOT
-->
				<option value="0">{$lang['tpl.str21']}</option>
<!--
EOT;
	}
	print <<<EOT
-->
			</select>
		</td>
	</tr>
	<tr>
		<td height="23" colspan="2" class="tablebody2"></td>
	</tr>
	</form>
</table>
<!--
EOT;
}

function BuyTools(){
	global $lang,$userinfo,$toolsInfo;
	$action = trim($GLOBALS['action']);
	$reAction = '';
	$strActDesc = '';
	if( $action === 'BuyTools' ){
		$reAction = 'SaveBuyTools';
		$strActDesc = $lang['tpl.str22'];
	} elseif( $action === 'BuyUserTools' ){
		$reAction = 'SaveBuyUserTools';
		$strActDesc = $lang['tpl.str22'];
	} elseif( $action === 'SellTools' ){
		$reAction = 'SaveSellTools';
		$strActDesc = $lang['tpl.str23'];
	}
	$countInfo =& getCountFromBuss($GLOBALS['toolsid']);
	if( $countInfo === false ){
		$TheUserToolsNum = 0;
	} else{
		$TheUserToolsNum = $countInfo['toolscount'] + $countInfo['salecount'];
	}
	print <<<EOT
-->
<form name="plustools" action="?action={$reAction}" method="post">
<table border="0" cellpadding="0" cellspacing="0" align="center" class="mainbox tableborder">
	<tr>
		<th height="23" colspan="2">{$lang['tpl.str24']}</th>
	</tr>
	<tr>
		<td height="23" colspan="2">{$lang['tpl.str25']} <B>{$userinfo['usermoney']}</B> {$lang['tpl.str26']} <B>{$userinfo['userticket']}</B> {$lang['tpl.str27']} <B>{$TheUserToolsNum}</B> {$lang['tpl.str28']}</td>
	</tr>
<!--
EOT;
	if( $action === 'BuyTools' ){
		if( $toolsInfo['sysstock'] <= 0 ){
			$toolsInfo['buytype'] = -1;
		}
		print <<<EOT
-->
	<tr>
		<td height="23" width="30%">{$lang['tpl.str29']}</td>
		<td>{$lang['GetBuyType'][$toolsInfo['buytype']]}</td>
	</tr>
<!--
EOT;
	}
		print <<<EOT
-->
	<tr>
		<td height="23" width="30%">{$lang['tpl.str30']}</td>
		<td>{$salesUserName}</td>
    </tr>
    <tr>
		<td height="23" width="30%">{$strActDesc}{$lang['tpl.str31']}</td>
		<td>
		<input type="Text" name="toolssum" value="1"><!--{$toolsInfo['sysstock']}-->
		</td>
    </tr>

    <tr>
		<td height="23" width="30%">{$strActDesc}{$lang['tpl.str32']}</td>
		<td>
		<input type="Text" name="toolsmoney" value="{$toolsInfo['usermoney']}" {$GLOBALS['inputDisable']}>
		</td>
    </tr>
    <tr>
		<td height="23" width="30%">{$strActDesc}{$lang['tpl.str33']}</td>
		<td>
		<input type="Text" name="toolsticket" value="{$toolsInfo['userticket']}" {$GLOBALS['inputDisable']}>
		</td>
    </tr>
    <tr>
		<td height="23" width="30%">{$lang['tpl.str34']}</td>
		<td>
<!--
EOT;
	$arrSelected["{$toolsInfo['buytype']}"] = ' selected ';
	if( $action === 'BuyTools' ){
		print <<<EOT
-->
			<select name="buytype">
			<option value="0" {$arrSelected['0']} >{$lang['tpl.str35']}
			<option value="1" {$arrSelected['1']} {$arrSelected['3']}>{$lang['tpl.str36']}
			<option value="2" {$arrSelected['2']}>{$lang['tpl.str37']}
			</option>
			</select>
<!--
EOT;
	} elseif( $action === 'BuyUserTools' ){
		if( $toolsInfo['usermoney'] > 0 && $toolsInfo['userticket'] == 0 ){
			$strTmp = "{$lang['tpl.str38']} <B>{$toolsInfo['usermoney']}</B> {$lang['tpl.str39']}";
		} elseif( $toolsInfo['userticket'] > 0 && $toolsInfo['usermoney'] == 0 ){
			$strTmp = "{$lang['tpl.str40']} <B>{$toolsInfo['userticket']}</B> {$lang['tpl.str41']}";
		} elseif( $toolsInfo['userticket'] > 0 && $toolsInfo['usermoney'] > 0 ){
			$strTmp = "{$lang['tpl.str42']} <B>{$toolsInfo['usermoney']}</B> {$lang['tpl.str43']} <B>{$toolsInfo['userticket']}</B> {$lang['tpl.str41']}";
		}
		print <<<EOT
-->
<!--
EOT;
	} elseif( $action === 'SellTools' ){
		print <<<EOT
-->
		{$lang['tpl.str44']}
<!--
EOT;
	}
	print <<<EOT
-->
		</td>
    </tr>
	<tr><td height="23" colspan="2" class="tablebody2" align="center">
	<button type="submit" onMousemove="button_move(this)" onMouseout="button_out(this)">{$lang['tpl.str45']}{$strActDesc}</button>
	<input type="hidden" name="toolsid" value="{$GLOBALS['toolsid']}">
	<input type="hidden" name="bussid" value="{$GLOBALS['bussid']}">
	</td></tr>
</table>
</form>
<!--
EOT;
}

?>-->