<?php
	if(!$_COOKIE["user_name"])
		header("location:admin/user_login.html");
	include_once("admin/include/config.php");
	define("THIS_PAGE","ly");
	if(!$hm_arr = get_seo(2)){
		$hm_title = $hm_key = $hm_des = hmcss_default_config(1);
	}
	else{
		$hm_title = $hm_arr[0][2];
		$hm_key = $hm_arr[0][3];
		$hm_des = $hm_arr[0][4];
	}
	$action = trim($_GET["action"]);
	$ly_id = trim($_GET["ly_id"]);
	$ly_id = is_numeric($ly_id)? $ly_id : "";
	if(!check_is_numb($ly_id) || $ly_id < 1)
		show_err("回复留言时出错，请返回重新操作");
	if($action == "save"){
		check_site_url();
		array_pop($_POST);//表单提交上来的数据都存入$_POST数组中，现在弹出最后一个数组值，因为最后一个是按纽
		extract($_POST);//把数组名作为变量名，数组值作为变量值
		strlen($reply_content) < 9 ? show_err("请输入至少10个英文字符或5个中文字的回复信息") : $reply_content = addslashes($reply_content);
		mysql_query("update hmcss_ly_main set ly_reply = '$reply_content',ly_reply_time = '" . date("Y-m-d H:i:s",time()) . "'")
			or show_err("回复留言出错，请联系管理员");
		show_err("您已回复成功","online_ly.php");
	}
	else{
		$filter_arr[0] = array("0",$ly_id,false);
		if(!$hm_arr = get_ly($filter_arr))
			show_err("系统中没有相关留言，请返回重新操作");
	}
?>
<!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="style.css" />
<style type="text/css">
#out{width:1000px; overflow:hidden; min-height:600px; height:auto; background-image:url(pics/bg/left_bg.gif); background-repeat:repeat-y;}
#right{width:800px; height:auto!important; height:auto; float:left; text-indent:2em; padding:10px 0px; line-height:20px;}
.hrm_job{margin:10px auto; width:798px; border-top:1px #CCC solid; border-left:1px #CCC solid; overflow:hidden;}
	.hrm_job ul{list-style:none; margin:0px; padding:0px;}
	.hrm_job li{list-style:none; float:left; text-indent:1em; color:#666; border-bottom:1px #CCC solid; border-right:1px #CCC solid; height:30px; line-height:30px;}
</style>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>

<body>
<?php require_once("top.php"); ?>
<div class="now_position"><span class="position_str">当前位置：<a href="index.php">首页</a>-><a href="online_ly.php">在线留言</a>->留言回复</span><span class="im_notice">
<marquee direction="left" scrolldelay="100" onmouseout="this.start()" onmouseover="this.stop()" style="width:400px;">
<?php hmcss_notice(); ?>
</marquee></span></div>
<div id="out">
<div id="left">
	<div class="left_menu">
    	<span class="left_arr_normal"></span><span class="left_menu_con"><a href="online_ly.php">留言查看</a></span>
    </div>
    <div class="left_menu">
    	<span class="left_arr_over"></span><span class="left_menu_con"><a href="online_ly_new.php">我要留言</a></span>
    </div>
</div>
<div id="right">
	<form id="form1" name="form1" method="post" action="online_ly_reply.php?action=save&ly_id=<?php echo $ly_id; ?>">
	<div class="hrm_job">
    	<ul>
            <li style="width:787px; height:auto; padding:5px; text-indent:0px;">
                <?php
                	echo stripslashes($hm_arr[0][3]);
				?>
          </li>
            <li style="width:797px; text-align:center; font-weight:bold;">回复内容</li>
            <li style="width:787px; height:auto; padding:5px; text-indent:0px;">
            	<textarea cols="80" id="reply_content" name="reply_content" rows="10" style="margin:0px auto;"><?php echo stripslashes($hm_arr[0][4]); ?></textarea>
                 <script type="text/javascript">
            if (typeof CKEDITOR == 'undefined') {
            	document.write('加载CKEditor失败');
            	}
            	else {
            	var editor = CKEDITOR.replace('reply_content');
            	}
                CKEDITOR.config.height = 400;
            </script>
            </li>
            <li style="width:777px; height:60px; text-align:center; padding:0px 10px;"><input type="image" src="pics/offer_jl.gif" style="margin:9px auto;" /></li>
        </ul>
    </div>
    </form>
</div>
</div>
<div id="foot"><?php unset($hm_arr,$filter,$hm_arr_news,$config_arr); hmcss_foot(); ?></div>
</body>
</html>