<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
include "header.php";
?>
<div id="nav_top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="user_right_td">
<!---##########################右边样式部分##########################--->
<form action="messanger.php" method=post name=inbox>
<SCRIPT LANGUAGE="JavaScript">
function CheckAll(form)  
  {  
  for (var i=0;i<form.elements.length;i++)  
    {  
    var e = form.elements[i];	
    if (e.name != 'chkall' && e.type=="checkbox")  
       e.checked = form.chkall.checked;  
    }  
  }
</SCRIPT>
	<div id="tabtitle">
	<div id="topicbodyuser">
	<div class="user_nav_topic" style="text-align:center;">
<table width="98%" border="0" cellspacing="0" cellpadding="0"><TBODY>
<TR>
<TD align=center>
<div align=center>
<a href=usersms.php?action=inbox><img src="<?=$Sms_inbox?>" border=0 alt="<?=$lang['tpl.sms.str1']?>"></a> &nbsp; 
<a href=usersms.php?action=outbox><img src="<?=$Sms_outbox?>" border=0 alt="<?=$lang['tpl.sms.str2']?>"></a> &nbsp; 
<a href=usersms.php?action=issend><img src="<?=$Sms_issend?>" border=0 alt="<?=$lang['tpl.sms.str3']?>"></a>&nbsp; 
<a href=usersms.php?action=recycle><img src="<?=$Sms_recycle?>" border=0 alt="<?=$lang['tpl.sms.str4']?>"></a>&nbsp; 
<a href=friendlist.php><img src="<?=$Sms_address?>" border=0 alt="<?=$lang['tpl.sms.str5']?>"></a>&nbsp;
<a href=JavaScript:openScript('messanger.php?action=new',500,400)><img src="<?=$Sms_write?>" border=0 alt="<?=$lang['tpl.sms.str6']?>"></a>&nbsp;
</div>
</td></tr></TBODY></TABLE><br>
<TABLE width="98%" cellpadding=0 cellspacing=0 border=0 align=center class="mainbox tableborder" style="display:nowrap; border:1px solid #C4B287; border-top:none;"><TR>
<td Width="100" class="tablebody6"  align=right><?=$lang['tpl.sms.str7']?></td>
<td Width="*" class="tablebody6" align="left" ><img src="images/bar/bar3.gif" width="0" height="16" id="Sms_bar" align=absmiddle></td>
<td Width="150" class="tablebody5" align=center id="Sms_txt">100%</td>
</tr></TABLE>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<form action="messanger.php" method=post name=inbox>
<SCRIPT LANGUAGE="JavaScript">
function CheckAll(form)  
  {  
  for (var i=0;i<form.elements.length;i++)  
    {  
    var e = form.elements[i];	
    if (e.name != 'chkall' && e.type=="checkbox")  
       e.checked = form.chkall.checked;  
    }  
  }
</SCRIPT>
 <tr id="user_nav">
	<td width="40" align="center"><?=$lang['tpl.sms.str8']?></td>
	<td class="tdcolor">
	<?
		if($smstype=="inbox" or $smstype=="recycle"){
			echo $lang['tpl.sms.str9'];
		}
		else{
			echo $lang['tpl.sms.str10'];
		}
	?>
	</td>
	<td><?=$lang['tpl.sms.str11']?></td>
	<td class="tdcolor"><?=$lang['tpl.sms.str12']?></td>
	<td width="60"><?=$lang['tpl.sms.str13']?></td>
	<td width="60"><?=$lang['tpl.sms.str14']?></td>
</tr>
<?
if( !empty($dbResults) && is_array($dbResults) ){
	foreach( $dbResults as $val ){
		$contentLength = strlen($val['content']);
?>
<?
if ($val['flag']==0){
	$tablebody="tablebody2";
	$newstyle="font-weight:bold";
}
else{
	$tablebody="tablebody1";
	$newstyle="font-weight:normal";
}
?>
<tr>
<td width="40" align="center">
<?
switch ($smstype)
{
case "inbox":
	if ($val['flag']==0){
		echo "<img src=\"".$Sms_news."\" border=0 alt=\"".$lang['tpl.sms.str17']."\">";
	}
	else{
		echo "<img src=\"".$Sms_olds."\" border=0 alt=\"".$lang['tpl.sms.str18']."\">";
	}
	break;
case "outbox":
	echo "<img src=\"".$Sms_issend_2."\" border=0 alt=\"".$lang['tpl.sms.str19']."\">";
	break;
case 'issend':
	echo "<img src=\"".$Sms_issend_1."\" border=0 alt=\"".$lang['tpl.sms.str20']."\">";
	break;
case "recycle":
	if ($val['flag']==0){
		echo "<img src=\"".$Sms_news."\" border=0  alt=\"".$lang['tpl.sms.str17']."\">";
	}
	else{
		echo "<img src=\"".$Sms_olds."\" border=0  alt=\"".$lang['tpl.sms.str18']."\">";
	}
	break;
}
?>
</td>
<td class="tdcolor">
<?
$val['sender']=htmlspecialchars($val['sender'],ENT_QUOTES);
if ($smstype=="inbox" or $smstype=="recycle"){
	echo "<a href=\"dispuser.php?name=".urlencode($val['sender'])."\" target=_blank>".$val['sender']."</a>";
}
else{
	echo "<a href=\"dispuser.php?name=".urlencode($val['incept'])."\" target=_blank>".$val['incept']."</a>";
}
?>
</td>
<td><a href="JavaScript:openScript('messanger.php?action=<?=$readaction?>&id=<?=$val['id']?>&sender=<?=urlencode(trim($val['sender']))?>',500,400)"><?=$val['title']?></a>
</td>
<td class="tdcolor">
<?php
	if( empty($val['sendtime']) ){
		$msg_time = gmdate('Y-m-d', time() + getUserTimeZoneOffset());
	} else{
		$msg_time = gmdate('Y-m-d', $val['sendtime'] + getUserTimeZoneOffset());
	}
?>
<?=$msg_time?></td>
<td><?=$contentLength?>Byte</td>
<td><input type=checkbox class=chkbox name="id[]" value="<?=$val['id']?>"></td>
</tr>
<?
	}
?>
<!--friendlist.php##公共分页-->
<tr><td valign=middle colspan=<?=$colSpan?>>
<table border=0 cellpadding=0 cellspacing=3 width="100%" align=center>
<tr><td valign=middle nowrap align="left">
<?=$lang['tpl.sms.str28']?><b><?=$CurrentPage?></b>/<b><?=$Pcount?></b><?=$lang['tpl.sms.str29']?>&nbsp;
<?=$lang['tpl.sms.str30']?><b><?=$PageNum?></b> <?=$lang['tpl.sms.str31']?><b><?=$totalrec?></b>
</td>
<td valign=middle nowrap align=right><?=$lang['tpl.sms.str32']?>
<?
	print pagelist($totalrec,$PageNum,$CurrentPage,$SearchStr,count($dbResults));
?>
</td></tr></table>
</td></tr>
<?
}else{
?>
<tr>
<td class=tablebody1 align=center valign=middle colspan=6><?=$lang['tpl.sms.str15']?><?=$boxname?><?=$lang['tpl.sms.str16']?></td>
</tr>
<?
}
if( $Sms_max == 0 ) $Sms_max = 99999999;
$tmpStr = ($SmsCount / $Sms_max);
$tmpPercent = sprintf('%0.2f%%',$tmpStr*100);
$width = number_format($tmpStr*600,2,'.','');
if( number_format($tmpStr*100,2,'.','') < 80 ){
	$innerHtml = $lang['tpl.sms.str33'].$tmpPercent;
} else{
	$innerHtml = "<font color=\"".$lang['Dvbbs.mainsetting1']."\">".$lang['tpl.sms.str33'].$tmpPercent.$lang['tpl.sms.str34']."</font>";
}
?>
<tr>
<td align="right" valign="middle" colspan="6" class="tablebody2"><?=$lang['tpl.sms.str21']?><input type="checkbox" class=checkbox name="chkall" value="on" onclick="CheckAll(inbox);"><?=$lang['tpl.sms.str22']?><button type="submit" name="action" onMousemove="button_move(this)" onMouseout="button_out(this)" onclick="{if(confirm('<?=$lang['tpl.sms.str23']?>')){return true;}return false;}" ><?=$lang['tpl.sms.str24']?><?=$boxname?></button>&nbsp;<button type="submit" name="action" onMousemove="button_move(this)" onMouseout="button_out(this)" onclick="{if(confirm('<?=$lang['tpl.sms.str25']?><?=$boxname?><?=$lang['tpl.sms.str26']?>')){this.document.inbox.submit();return true;}return false;}"><?=$lang['tpl.sms.str27']?><?=$boxname?></button>
</td>
</tr>
</form>
</table>
<!--//（图片对象名称，标题对象名称，更新数，总数）-->
<script>
var smsBarID = document.getElementById('Sms_bar');
var smsTxtID = document.getElementById('Sms_txt');
smsBarID.width ='<?=$width?>';
smsBarID.title =' <?=$lang['tpl.sms.str35']?><?=$Sms_max?>.<?=$lang['tpl.sms.str36']?><?=$lang['usersms.str1']?><?=$lang['tpl.sms.str37']?><?=$lang['usersms.str3']?><?=$SmsCount?><?=$lang['usersms.str3']?><?=$lang['tpl.sms.str38']?>';
smsTxtID.innerHTML = '<?=$innerHtml?>';
</script>


		</div>
		</div>
<!---########################## end 右边样式部分##########################--->
</td><tr>
</table>
</div>