<?php
$config['language'] = isset($_SESSION["ADMIN_LANG"])?$_SESSION["ADMIN_LANG"]:$config['language'];
include_once($config['webroot']."/lang/".$config['language']."/admin.php");
//=====================================
$status=array(
  '-1'=>lang_show('notpass'),
  '0'=>lang_show('wpass'),
  '1'=>lang_show('auditpass'),
  '2'=>lang_show('recom'),
);
$ext_rec=explode("|",$config['ext_rec']);
foreach($ext_rec as $key=>$v)
{
	$nums=count($status)-1+$key;
	$status[$nums]=$v;
}
if($_POST['submit'])
{
	$sql="update ".INFO." set statu='$_POST[statu]' where id='$_POST[id]'";
	$db->query($sql);
	//-------------邮件发送-----------
	if(!empty($_GET['mail_title'])&&!empty($_GET['mail_con']))
	{
		$sql="select a.title,b.email,b.user from ".INFO." a left join ".ALLUSER." b on a.userid=b.userid where a.id='$_POST[id]'";
		$db->query($sql);
		$de=$db->fetchRow();
		$ar1=array('[title]','[weburl]');
		$ar2=array($de['title'],$config['weburl']);
		$con=str_replace($ar1,$ar2,$_GET['mail_con']);
		send_mail($de['email'],$de['user'],$_GET['mail_title'],$con);
	}
	//-------------------------------
	$st=$status[$_POST[statu]];
	echo "<script>window.parent.close_win();</script>";
	//-------------------------------
}
?>
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<link href="main.css" rel="stylesheet" type="text/css" />
<style>
.auditing .td1 label{ margin:0 3px; text-decoration:none; font-size:14px; color:#333; line-height:30px;}
.auditing .td2{padding-left:8px;}
.auditing .td2 textarea{ height:153px; width:95%; font-size:12px; line-height:16px; color:#444; border:1px solid #ddd; padding:2px;}
.auditing .td3{padding:5px 0px 5px 4px; height:30px;}
#statu_list{margin-bottom:3px;}
</style>
<form action="" method="post">
  <table cellpadding="0" cellspacing="0" border="0" class="auditing" style="margin:0; width:100%;">
    <tr>
      <td style="line-height:26px; margin-top:10px; height:52px;" class="td1" id='statu_list'>
	  		<?php
				foreach ($status as $key=>$val)
				{
					if($_GET['statu']==$key)
						$str="checked='checked'";
					else
						$str="";
					echo "<label><input type='radio' class='radio' name='statu' id='statu' value='".$key."' $str />".$val."</label>";
				}
			?>
        <br />
        <label>
        <input checked="checked" id="send_mail" name="send_mail" type="checkbox" value="1" />
        <span class="bz"><?php echo lang_show('send_mail_user');?></span></label>
        <br />
      </td>
    </tr>
    <tr>
      <td style="padding-top:10px;" class="td2"><input class="text" style="width:95%; display:none;" name="mail_title" id="mail_title" value="<?php $mail_temp=get_mail_template('review_info'); echo $mail_temp['subject']; ?>" />
        <textarea class="text" style="margin-top:5px; height:126px; display:none;" name="mail_con" id="mail_con" rows="6" cols="42"><?php echo $mail_temp['message'];?></textarea>
        <input name="submit" class="btn" type="submit"  id="submit" value="<?php echo lang_show('subsend');?>" />
        &nbsp;
        <input class="btn" type="reset" value="<?php echo lang_show('subreset');?>" />
        <input name="id" type="hidden" value="<?php echo $_GET['id'];?>" />
      </td>
    </tr>
  </table>
</form>
<script>
$(document).ready(function(){
	
	$('#mail_con').show();
	$('#mail_title').show();
	$('#con').hide();
			
	$("#send_mail").click(function()
	{	
		if($('#send_mail').attr("checked")==true)
		{
			$('#mail_con').show();
			$('#mail_title').show();
			$('#con').hide();
		}
		else
		{
			$('#mail_con').hide();
			$('#mail_title').hide();
			$('#con').show();
		}

	});	
});
</script>
