Server : Apache System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/wwwroot/saimikebio.com/mobile/ecshopjcw/ |
<?php define('IN_ECTOUCH', true); require(dirname(__FILE__) . '/includes/init.php'); include_once(ROOT_PATH . '/include/cls_image.php'); require('wxch_lg.php'); $_REQUEST['act'] = trim($_REQUEST['act']); if($_REQUEST['act'] == 'list') { $smarty->display('wxch_keywords.html'); } elseif($_REQUEST['act'] == 'add') { if($_POST) { $image = new cls_image($_CFG['bgcolor']); $path = $image->upload_image($_FILES['path']); $name = $_POST['name']; $keyword = $_POST['keyword']; $type = $_POST['type']; $contents = $_POST['contents']; if($type == 0) { $get_type = $_GET['type']; switch ($get_type) { case 'text':$type = 1; break; case 'image':$type = 2; break; } } if($type == 1) { $contents = htmltowei($contents); $db->query("INSERT INTO ". $GLOBALS['ecs']->table('weixin_keywords') ." (`name`, `keyword`, `type`, `contents`, `count`, `status`) VALUES ('$name', '$keyword', $type, '$contents', 0, 1);"); } elseif($type == 2) { $kws_id = $_SESSION['kws_id']; if(!empty($kws_id)) { $db->query("UPDATE ". $GLOBALS['ecs']->table('weixin_keywords') ." SET `name` = '$name',`keyword` = '$keyword',`type` = '$type',`status` = '1' WHERE `id` =$kws_id;"); } } $link[] = array('href' =>'wxch-ent.php?act=keywords', 'text' => '消息自动回复'); sys_msg('添加成功',0,$link); } else { require(ROOT_PATH . 'include/fckeditor/fckeditor.php'); $lang = array(); $lang['tab_general'] = '文字信息'; $lang['tab_images'] = '图文信息'; $input_name="contents"; $kindeditor="<script charset='utf-8' src='../include/kindeditor/kindeditor.js'></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name=\"$input_name\"]', { allowFileManager : true, width : '700px', height: '300px', resizeType: 0 //固定宽高 }); }); </script> <textarea id=\"$input_name\" name=\"$input_name\" style='width:700px;height:300px;'></textarea> "; $smarty->assign('FCKeditor', $kindeditor); $smarty->assign('lang',$lang); $smarty->assign('wxch_lang',$wxch_lang); if($_GET['type'] == 'text') { $wxch_lang['ur_here'] = '添加文字信息'; $smarty->display('wxch_keywords_infotext.html'); } elseif($_GET['type'] == 'image') { $wxch_lang['ur_here'] = '添加图文信息'; $smarty->display('wxch_keywords_infoimage.html'); } } } elseif($_REQUEST['act'] == 'edit') { if($_POST) { $id = $_POST['id']; $name = $_POST['name']; $keyword = $_POST['keyword']; $type = $_POST['type']; $contents = strip_tags($_POST['contents'],"<a>"); $update_sql = "UPDATE ". $GLOBALS['ecs']->table('weixin_keywords') ." SET `name` = '$name',`keyword` = '$keyword',`type` = '$type',`name` = '$name',`contents` = '$contents' WHERE `id` ='$id';"; $db->query($update_sql); $link[] = array('href' =>'wxch-ent.php?act=keywords', 'text' => '消息自动回复'); sys_msg('修改成功',0,$link); } require(ROOT_PATH . 'include/fckeditor/fckeditor.php'); $id = $_GET['id']; $data = $db->getRow("SELECT * FROM ". $GLOBALS['ecs']->table('weixin_keywords') ." WHERE `id` = $id"); if($_GET['type'] == 'image') { $article_list = get_keywords_articles($id, $db); } $lang = array(); $lang['tab_general'] = '主要信息'; $input_name="contents"; $contents=$data['contents']; $kindeditor="<script charset='utf-8' src='../include/kindeditor/kindeditor.js'></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name=\"$input_name\"]', { allowFileManager : true, width : '700px', height: '300px', resizeType: 0 //固定宽高 }); }); </script> <textarea id=\"$input_name\" name=\"$input_name\" style='width:700px;height:300px;'>$contents</textarea> "; $smarty->assign('FCKeditor', $kindeditor); $smarty->assign('lang',$lang); $smarty->assign('data',$data); $smarty->assign('article_list',$article_list); $smarty->assign('wxch_lang',$wxch_lang); if($_GET['type'] == 'text') { $wxch_lang['ur_here'] = '添加文字信息'; $smarty->display('wxch_keywords_infotext.html'); } elseif($_GET['type'] == 'image') { $wxch_lang['ur_here'] = '添加图文信息'; $smarty->display('wxch_keywords_infoimage.html'); } } elseif($_REQUEST['act'] == 'remove') { $id = $_GET['id']; $filter['page'] = $_GET['page']; $filter['page_size'] = $_GET['page_size']; if(empty($filter['page_size'])) { $filter['page_size'] = 15; } $filter['page_count'] = $_GET['page_count']; $filter['record_count'] = $_GET['record_count']; if($filter['page'] <=1) { $start = 0; } else { $start = ($filter['page']-1) * $filter['page_size']; } $filter['start'] = $start; $ret = $db->getAll("SELECT * FROM ". $GLOBALS['ecs']->table('weixin_keywords') ." LIMIT $start , $filter[page_size]"); $wxchdata = array(); foreach($ret as $k=>$v) { if($v['type'] == 1) { $v['type'] = '文字'; } elseif($v['type'] == 2) { $v['type'] = '图文'; } $wxchdata[$k] = $v; } $smarty->assign('wxchdata',$wxchdata); $smarty->assign('filter',$filter); make_json_result($smarty->fetch('wxch_keywords.html'), '',array('filter' => $filter, 'page_count' => $filter['page_count'])); } elseif($_REQUEST['act'] == 'edit_title') { $title = json_str_iconv(trim($_POST['val'])); make_json_result(stripslashes($title)); } elseif ($_REQUEST['act'] == 'get_article_list') { include_once(ROOT_PATH . 'include/cls_json.php'); $json = new JSON; $filters =(array) $json->decode(json_str_iconv($_GET['JSON'])); $where = " WHERE cat_id > 0 "; if (!empty($filters['title'])) { $keyword = trim($filters['title']); $where .= " AND title LIKE '%" . mysql_like_quote($keyword) . "%' "; } $sql = 'SELECT article_id, title FROM ' .$ecs->table('article'). $where. 'ORDER BY article_id DESC LIMIT 50'; $res = $db->query($sql); $arr = array(); while ($row = $db->fetchRow($res)) { $arr[] = array('value' => $row['article_id'], 'text' => $row['title'], 'data'=>''); } make_json_result($arr); } elseif ($_REQUEST['act'] == 'add_article') { include_once(ROOT_PATH . 'include/cls_json.php'); $json = new JSON; $articles = $json->decode($_GET['add_ids']); $arguments = $json->decode($_GET['JSON']); if(!empty($arguments[0])) { $kws_id = $arguments[0]; } else { $insert_sql = "INSERT INTO ". $GLOBALS['ecs']->table('weixin_keywords') ." (`name`) VALUES ('');"; $db->query($insert_sql); $kws_id = $db->insert_id(); $_SESSION['kws_id'] = $kws_id; } foreach ($articles AS $val) { $sql = "INSERT INTO ". $GLOBALS['ecs']->table('weixin_keywords_article') ." (kws_id, article_id) VALUES ('$kws_id', '$val')"; $db->query($sql); } $arr = get_keywords_articles($kws_id,$db); $opt = array(); foreach ($arr AS $val) { $opt[] = array('value' => $val['article_id'], 'text' => $val['title'], 'data' => ''); } make_json_result($opt); } elseif ($_REQUEST['act'] == 'drop_article') { include_once(ROOT_PATH . 'include/cls_json.php'); $json = new JSON; $articles = $json->decode($_GET['drop_ids']); $arguments = $json->decode($_GET['JSON']); foreach ($articles AS $val) { $sql = "DELETE FROM ". $GLOBALS['ecs']->table('weixin_keywords_article') ." WHERE `article_id` = $val;"; $db->query($sql); } $arr = get_keywords_articles($arguments[0],$db); $opt = array(); if(is_array($arr)) { foreach ($arr AS $val) { $opt[] = array('value' => $val['article_id'], 'text' => $val['title'], 'data' => ''); } } make_json_result($opt); } elseif($_REQUEST['act'] == 'query') { if(!empty($_POST['keyword'])) { $keyword = $_POST['keyword']; $filter['page'] = $_POST['page']; $filter['page_size'] = $_POST['page_size']; if(empty($filter['page_size'])) { $filter['page_size'] = 15; } $filter['page_count'] = ceil($_POST['page_count']/$filter['page_size']); $filter['record_count'] = $_POST['record_count']; if($filter['page'] <=1) { $start = 0; } else { $start = ($filter['page']-1) * $filter['page_size']; } $filter['start'] = $start; $ret = $db->getAll("SELECT * FROM ". $GLOBALS['ecs']->table('weixin_keywords') ." WHERE `name` LIKE '%$keyword%' LIMIT $start , $filter[page_size]"); $wxchdata = array(); foreach($ret as $k=>$v) { if($v['type'] == 1) { $v['type'] = '文字'; } elseif($v['type'] == 2) { $v['type'] = '图文'; } $wxchdata[$k] = $v; } $smarty->assign('wxchdata',$wxchdata); $smarty->assign('filter',$filter); make_json_result($smarty->fetch('wxch_keywords.html'), '',array('filter' => $filter, 'page_count' => $filter['page_count'])); } } function htmltowei($contents) { $contents = strip_tags($contents,'<br>'); $contents = str_replace('<br />',"\r\n",$contents); $contents = str_replace('"','"',$contents); $contents = str_replace(' ','',$contents); return $contents; } function get_keywords_articles($kws_id,$db) { $sql = "SELECT `article_id` FROM ". $GLOBALS['ecs']->table('weixin_keywords_article') ." WHERE `kws_id` = '$kws_id'"; $ret = $db->getAll($sql); foreach($ret as $v) { $articles .= $v['article_id'].','; } $length = strlen($articles)-1; $articles = substr($articles, 0, $length); if(!empty($articles)) { $sql2 = "SELECT `article_id`,`title` FROM ".$GLOBALS['ecs']->table('article')." WHERE `article_id` IN ($articles)"; $res = $db->getAll($sql2); } return $res; } ?>