<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/msgscrip/rpshow.html
 * 如果您的模型要进行修改，请修改 models/modules/msgscrip/rpshow.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
	//引入语言包
	$m_langpackage=new msglp;
	
  //变量获得
  $msg_id=short_check(get_argg("id"));
  $user_uid=get_sess_userid();

  //数据表定义
  $t_msg_inbox = $tablePreStr."msg_inbox";
  $t_msg_outbox = $tablePreStr."msg_outbox";

  $sql="";
  $relaUserStr="";
  $reTurnUrl="";
  if(short_check(get_argg("t"))=="0"){
  	
  	//刷新提醒页面
        echo "<script type='text/javascript'>
  parent.frames['remind'].location.reload();
  </script>";
  
	$dbo = new dbex;
	//读写分离定义函数
	dbtarget('r',$dbServs);

    $sql="select mess_title,mess_content,from_user_id,from_user,from_user_ico,add_time,mesinit_id,mess_id,readed "
         ."from $t_msg_inbox where mess_id='$msg_id' and user_id='$user_uid'";
		$rs = $dbo ->getRow($sql);
    $relaUserStr="$m_langpackage->m_from_user";
    $reTurnTxt="$m_langpackage->m_in";
    $reTurnUrl="?app=msg_minbox";
    $reButTxt="$m_langpackage->m_b_com";
    $reButUrl="?app=msg_creator&2id=$rs[2]&rt=".urlencode($rs[0]);

	//读写分离定义函数
	dbtarget('w',$dbServs);
    if($rs[8]=="0"){
      $sql="update $t_msg_inbox set readed='1' where mess_id='$rs[7]'";
      $dbo ->exeUpdate($sql);
      $sql="update $t_msg_outbox set state='2' where mess_id='$rs[6]'";
      $dbo ->exeUpdate($sql);
    }
    
  }else if(get_argg("t")=="1"){
  	$dbo = new dbex;

	//读写分离定义函数
	dbtarget('r',$dbServs);

    $sql="select mess_title,mess_content,to_user_id,to_user,to_user_ico,add_time,state,mess_id "
         ."from $t_msg_outbox where mess_id='$msg_id' and user_id='$user_uid'";
		$rs = $dbo ->getRow($sql);

    $relaUserStr="$m_langpackage->m_to_user";
    $reTurnTxt="$m_langpackage->m_out";
    $reTurnUrl="?app=msg_moutbox";

    if($rs[6]=="0"){
       $reButTxt="$m_langpackage->m_b_sed";
       $reButUrl="do.php?act=msg_send&to_id=$rs[7]";
    }else{
       $reButTxt="$m_langpackage->m_b_con";
       $reButUrl="$reTurnUrl";
    }
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/iframe.css">
</head>

<body>
  <div class="main_right_title">
     <span class="main_title_dot4"></span>
     <span class="main_title_txt"><?php echo $m_langpackage->m_title;?></span>
  </div>
	<div id="tabsB">
		<ul>
			<li><a href="#" class="nowbutl"><span class="nowbutr"><?php echo $m_langpackage->m_mess_detail;?></span></a></li>
		</ul>
  		<div class="div_but_2" onclick="location.href='<?php echo $reTurnUrl;?>'"><?php echo $m_langpackage->m_b_bak;?><?php echo $reTurnTxt;?></div>
	</div>
<div class="photo_view_box <?php echo $isset_data;?>">
	<div class="photo_view_content">	
	<table class="rs_list bnone">
		<tr>
			<td rowspan="5" valign="top" width="22%">
				<a href='home.php?h=<?php echo $rs[2];?>' target="_blank">
					<img src='<?php echo $rs[4];?>' onerror="parent.pic_error(this)" class='user_ico' />
				</a>
			</td>	
			<td style='text-align:right' width="15%">
				<?php echo $relaUserStr;?>：
			</td>
			<td align="left" width="*">
				<?php echo $rs[3];?>
			</td>
		</tr>
		
		<tr>
			<td style='text-align:right'>
				<?php echo $m_langpackage->m_tit;?>：
			</td>
			<td>
				<?php echo $rs[0];?>
			</td>
		</tr>
		
		<tr>
			<td style='text-align:right'> 	
				<?php echo $m_langpackage->m_time;?>：
			</td>
			<td>
				<?php echo $rs[5];?>
			</td>
		</tr>
		
		<tr>
			<td valign="top"  style='text-align:right'>
				<?php echo $m_langpackage->m_cont;?>：
			</td>
			<td>
				<?php echo $rs[1];?>
			</td>
		</tr>
		
		<tr>
			<td></td>
			<td>
				<input type=button class="anniu" value="<?php echo $reButTxt;?>"  
onclick="location.href='<?php echo $reButUrl;?>'">&nbsp;&nbsp;&nbsp;
				<input type=button class="anniu" value="<?php echo $m_langpackage->m_del;?>"	onclick='location.href="do.php?act=msg_del&id=<?php echo $msg_id;?>&t=<?php echo get_argg("t");?>";'>
			</td>
		</tr>
	</table>
	</div></div>
</body>
</html>