<?php
/*******************************************************************
 * 版权协议：2009-2019
 * 版权所有: PHP-北京金南曦网络技术有限公司旗下PHPWMS，PHP商城系统技术支持中心http://www.php188.net，并保留所有权利。 
* PHP商城系统网址: http://www.php188.com
 * PHPWMS系统网址：http://www.phpwms.com
 * 销售电话：010-87875088
 * 销售电话：010-87875188 
*------------------------------------------------------------------
 * 这不是一个完全免费软件！您只能在不用于商业目的的前提下对程序代码进
 * 行修改和使用；不允许对程序代码以任何形式任何目的的再发布。
 *------------------------------------------------------------------
 * 文件名称：admin_replybook.php
 * 摘　　要：邮件回复
 * 适用范围：PHPWMS 1.0
 * 版　　本：1.0
 *------------------------------------------------------------------
 * Script Written By phpwms项目组
 * 最后更新： 2009-09-24 phpwms 由PHP金南曦网络技术有限公司整理发布
 *******************************************************************/
if(!defined('IN_SYS'))exit('access die'); 
$do = trim($_REQUEST['do']);
$data = $_REQUEST['data'];
$gbid = trim($_REQUEST['gbid']);
$email = trim($_REQUEST['email']);
$page = $_GET['page'];
$tpl -> assign('curpage', $page);
if ($do =='reply') {
	require_once SYS_ROOT . 'include/classes/cls.data_check.php';
	$dc = new DataCheck();
   if (trim($data['email'])=='') {
	   die($sp -> bgmsg('对不起，回复的邮箱地址不能空！',"admincp.php?action=replybook&gbid=".$data['gbid']));
   } else if (!is_email(trim($data['email']))) {
	   die($sp -> bgmsg('电子邮箱格式不正确！',"admin_replybook.php?gbid=".$data['gbid']));
   } else if (!$dc-> chkLength(trim($data['remark']),2,255)) {
	   die($sp -> bgmsg('回复内容不能小于2个字符大于500个字符！',"admincp.php?action=replybook&gbid=".trim($data['gbid'])."&email=".trim($data['email'])));
   }
   $eresult =  send_mail('', '', '',array(trim($data['email'])), trim($data['subject']),trim($data['remark']));
   if($eresult) {
	     die($sp -> bgmsg('恭喜你，回复E-Mail操作成功！',"admincp.php?action=guestbook&do=list&page=" . $page));
   } else {
         die($sp -> bgmsg('邮件发送失败！' . $eresult,"?action=replybook&gbid=".trim($data['gbid'])."&email=".trim($data['email']) . "&page=" . $page));
   }
}
require_once SYS_ROOT.'pub/phpwms.kineditor.php';
$fck = new editor();
$fck->instanceName = 'data[remark]' ;
$fckstr = $fck->create();
$pn  = '客服留言回复';
$tpl -> assign("gbid",$gbid);
$tpl -> assign("email",$email);
$tpl -> assign('setEditor',$fckstr);
$sp  -> outPut('replybook.tpl',$pn);
?>