function splitWords($str, $style = 'array') { //字典文件太大,防止读取时服务器配置内存不够用 //@ini_set("memory_limit","30M"); require_once dirname(__FILE__) . "/utf8_splitword.php"; $sp = new SplitWord(); $result = $sp->SplitRMM($str); $sp->Clear(); if ($style == 'string') { return $result; } else { if ($style == 'array') { return split(',', $result); } } }
/** *Ajax检测商机名称 * **/ public function check() { import("@.ORG.SplitWord"); $sp = new SplitWord(); $m_business = M('Business'); $useless_words = array(L('COMPANY'), L('LIMITED'), L('DI'), L('LIMITED_COMPANY')); if ($this->isAjax()) { $split_result = $sp->SplitRMM($_POST['name']); if (!is_utf8($split_result)) { $split_result = iconv("GB2312//IGNORE", "UTF-8", $split_result); } $result_array = explode(' ', trim($split_result)); if (count($result_array) < 2) { $this->ajaxReturn(0, '', 0); die; } foreach ($result_array as $k => $v) { if (in_array($v, $useless_words)) { unset($result_array[$k]); } } $name_list = $m_business->getField('name', true); $seach_array = array(); foreach ($name_list as $k => $v) { $search = 0; foreach ($result_array as $k2 => $v2) { if (strpos($v, $v2) > -1) { $v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count); $search += $count; } } if ($search > 2) { $seach_array[$k] = array('value' => $v, 'search' => $search); } } $seach_sort_result = array_sort($seach_array, 'search', 'desc'); if (empty($seach_sort_result)) { $this->ajaxReturn(0, L('ABLE_ADD'), 0); } else { $this->ajaxReturn($seach_sort_result, L('CUSTOMER_IS_CREATED'), 1); } } }
function usingRMM($keyword) { $yuan = trim($keyword); $yuan = iconv('UTF-8', 'GB2312', $yuan); $tt = $yuan; $str = gl($tt); $sp = new SplitWord(); $tt = $sp->SplitRMM($str); $cc = $tt; if (substr($cc, 0, 3) == "、") { $cc = substr($cc, 3); } if (substr($cc, -3, 3) == "、") { $cc = substr($cc, 0, -3); } $newstr = explode("、", $cc); if ($newstr[0] == "") { return false; } for ($i = 0; $i < count($newstr); $i++) { $newstr[$i] = iconv("gb2312", "UTF-8", $newstr[$i]); } return $newstr; }
$i_sqlstr = "select * from tb_video_type "; $arraysi = $result->getRows($i_sqlstr, $conn); $smarty->assign("video_type", $arraysi); //获取更多相关视频 require "splitword.php"; //进行分词处理 require "common/function.php"; //过滤标点 if (isset($_GET["video_name"])) { $keyword = urldecode($_GET['video_name']); //获取内容 } $yuan = trim($keyword); $tt = $yuan; $str = gl($tt); $sp = new SplitWord(); $sp->SplitRMM($str); $tt = $sp->SplitRMM($str); //$sp->Clear(); $str = array(" ", ""); //定义一个数组 $cc = str_replace($str, "", $tt); //去掉字符串中的空格 if (substr($cc, 0, 2) == "、") { $cc = substr($cc, 2); //去掉前面的“、”符号 } if (substr($cc, -2, 2) == "、") { $cc = substr($cc, 0, -2); //去掉后面的“、”符号 }
function addnews_action() { if ($_POST['updatenews']) { $news_base = $this->obj->DB_select_once('news_base', "`id`='" . $_POST['id'] . "'", "`newsphoto`,`s_thumb`,`datetime`"); if ($_POST['uplocadpic']) { if ($news_base['s_thumb'] != $_POST['uplocadpic']) { if ($news_base['s_thumb']) { unlink_pic('../' . $news_base['s_thumb']); unlink_pic('../' . $news_base['newsphoto']); } $upload = $this->upload_pic("../data/upload/news/"); if (file_exists('..' . $_POST['uplocadpic'])) { $uplocadpic = $upload->picture('..' . $_POST['uplocadpic'], false, 1); //同名文件已经存在了 $s_thumb = $upload->news_makeThumb($uplocadpic, 120, 120, '_S_'); $value .= "`newsphoto`='" . str_replace("../data/upload/new", "data/upload/new", $uplocadpic) . "',"; $value .= "`s_thumb`='" . str_replace("../data/upload/new", "data/upload/new", $s_thumb) . "',"; } else { $s_thumb = $upload->news_makeThumb('..' . $_POST['uplocadpic'], 120, 120, '_S_'); $value .= "`newsphoto`='" . str_replace("/config/", "config/", $_POST['uplocadpic']) . "',"; $value .= "`s_thumb`='" . str_replace("../config/", "config/", $s_thumb) . "',"; } } unlink_pic('..' . $_POST['uplocadpic']); } $content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ''), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312")); $describe = @implode(",", $_POST['describe']); $time = time(); if (empty($_POST['did'])) { $_POST['did'] = 0; } $value .= "`did`='" . $_POST['did'] . "',"; $value .= "`color`='" . $_POST['color'] . "',"; $value .= "`sort`='" . $_POST['sort'] . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`author`='" . $_POST['author'] . "',"; $value .= "`source`='" . $_POST['source'] . "',"; $value .= "`title`='" . $_POST['title'] . "',"; $value .= "`describe`='" . $describe . "',"; $value .= "`lastupdate`='" . $time . "',"; if (!$_POST['keyword']) { require LIB_PATH . "lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags($content)); $value .= "`keyword`='" . @implode(",", $keywordarr) . "',"; } else { $value .= "`keyword`='" . $_POST['keyword'] . "',"; } $value .= "`description`='" . $_POST['description'] . "'"; $nbid = $this->obj->DB_update_all("news_base", $value, "`id`='" . $_POST['id'] . "'"); $row = $this->obj->DB_select_once('news_content', "`nbid`='" . $_POST['id'] . "'", "nbid"); if (is_array($row)) { $cont = $this->obj->DB_update_all("news_content", "`content`='" . $content . "'", "`nbid`='" . $_POST['id'] . "'"); } else { $cont = $this->obj->DB_insert_once("news_content", "`nbid`='" . $_POST['id'] . "',`content`='" . $content . "'"); } $this->autohtml($_POST['id'], $news_base['datetime']); isset($nbid) ? $this->ACT_layer_msg("新闻(ID:" . $_POST['id'] . ")更新成功!", 9, Url('admin_news', null, 'admin'), 2, 1) : ${$this}->ACT_layer_msg("更新失败!", 8, Url('admin_news', null, 'admin')); } if ($_POST['newsadd']) { if ($_POST['uplocadpic']) { $upload = $this->upload_pic("../data/upload/news/"); if (file_exists('..' . $_POST['uplocadpic'])) { $uplocadpic = $upload->picture('..' . $_POST['uplocadpic'], false, 1); $s_thumb = $upload->news_makeThumb($uplocadpic, 120, 120, '_S_'); $value .= "`newsphoto`='" . str_replace("../data/upload/new", "data/upload/new", $uplocadpic) . "',"; $value .= "`s_thumb`='" . str_replace("../data/upload/new", "data/upload/new", $s_thumb) . "',"; } else { $s_thumb = $upload->news_makeThumb('..' . $_POST['uplocadpic'], 120, 120, '_S_'); $value .= "`newsphoto`='" . str_replace("/config/", "config/", $_POST['uplocadpic']) . "',"; $value .= "`s_thumb`='" . str_replace("../config/", "config/", $s_thumb) . "',"; } unlink_pic('..' . $_POST['uplocadpic']); } $content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ""), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312")); $describe = @implode(",", $_POST['describe']); $time = time(); if ($_POST['sort'] != '') { $value .= "`sort`='" . $_POST['sort'] . "',"; } else { $value .= "`sort`='0',"; } if (empty($_POST['did'])) { $_POST['did'] = 0; } $value .= "`did`='" . $_POST['did'] . "',"; $value .= "`color`='" . $_POST['color'] . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`author`='" . $_POST['author'] . "',"; $value .= "`source`='" . $_POST['source'] . "',"; $value .= "`title`='" . $_POST['title'] . "',"; $value .= "`datetime`='" . $time . "',"; $value .= "`lastupdate`='" . $time . "',"; $value .= "`describe`='" . $describe . "',"; if (!$_POST["keyword"]) { require LIB_PATH . "lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags($content)); $value .= "`keyword`='" . @implode(",", $keywordarr) . "',"; } else { $value .= "`keyword`='" . $_POST['keyword'] . "',"; } $value .= "`description`='" . $_POST["description"] . "'"; $nbid = $this->obj->DB_insert_once("news_base", $value); $cont = $this->obj->DB_insert_once("news_content", "`nbid`='{$nbid}',`content`='" . $content . "'"); $this->autohtml($nbid, $time); isset($cont) ? $this->ACT_layer_msg("新闻(ID:" . $nbid . ")添加成功!", 9, Url('admin_news', null, 'admin'), 2, 1) : $this->ACT_layer_msg("添加失败!", 8, Url('admin_news', null, 'admin')); } }
/** * 拆分字符串 * @param $string 要拆分的字符 * @param string $source_charset 输入字符的字符编码 * @param string $target_charset 输出字符的字符编码 * @param bool $load_all * @param string $source * @return array 拆分后的字符以数组形式返回,键名为字符,键值为字符数量 */ public static function splitWord($string, $source_charset = 'utf-8', $target_charset = 'utf-8', $load_all = TRUE, $source = '') { require_cache(HDPHP_EXTEND_PATH . '/Org/SplitWord/SplitWord.class.php'); $words = SplitWord::splitWord($string, $source_charset = 'utf-8', $target_charset = 'utf-8', $load_all = TRUE, $source = ''); //按词频从大向小排序 if (is_array($words)) { array_multisort($words, SORT_DESC); } return $words; }
/** * 拆分字符串 * @param $string 要拆分的字符 * @param string $source_charset 输入字符的字符编码 * @param string $target_charset 输出字符的字符编码 * @param bool $load_all * @param string $source * @return array 拆分后的字符以数组形式返回,键名为字符,键值为字符数量 */ public static function splitWord($string, $source_charset = 'utf-8', $target_charset = 'utf-8', $load_all = TRUE, $source = '') { require_cache(HDPHP_EXTEND_PATH . '/Org/SplitWord/SplitWord.class.php'); return SplitWord::splitWord($string, $source_charset = 'utf-8', $target_charset = 'utf-8', $load_all = TRUE, $source = ''); }
function q($wd, $domain = '') { global $db; $this->db =& $db; $this->wd = $wd; require "../include/splitword.func.php"; $sp = new SplitWord(); $wd_split = $sp->SplitRMM($wd); $sp->Clear(); $this->wd_split = $wd_split = ereg_replace("[ ]{1,}", " ", trim($wd_split)); $this->wd_array = $wd_array = explode(" ", $wd_split); $this->wd_count = $wd_count = count($wd_split); //echo $wd_count; $tgarray = $this->GetTg(); $tgarray_count = count($tgarray); $ordersql = " order by links.tuiguang desc,("; foreach ($wd_array as $value) { $ordersql .= "(case when links.title like '%" . $value . "%' then 1 else 0 end)+"; } $ordersql .= "(case when links.title like '%" . $wd . "%' then 8 else 0 end)"; // $ordersql=rtrim($ordersql,"+"); $ordersql .= ") desc"; $keywordsql = $this->GetKeywordSql("links.title,' ',links.url,' ',links.keywords"); if (empty($keywordsql)) { $keywordsql = "links.title like '%" . $wd . "%'"; } if (empty($domain)) { $sql = "select links.*,sites.qp from kuaso_links links left join kuaso_sites sites on links.site_id=sites.site_id where links.title<>'' and " . $keywordsql . $ordersql; } else { if ($domain == getdomain($domain)) { $sql = "select * from kuaso_links where title<>'' and url like '%." . $domain . "%' or url like '%//" . $domain . "%'"; //echo $sql; } else { $sql = "select * from kuaso_links where title<>'' and url regexp 'http://" . $domain . "'"; //echo $sql; } } //echo $sql; $query = $db->query($sql); $this->total = $total = $db->num_rows($query) + $tgarray_count; $pagesize = 10; $this->totalpage = $totalpage = ceil($total / $pagesize); $p = intval($_GET["p"]); if ($p <= 0) { $p = 1; } $offset = ($p - 1) * $pagesize; $query = $db->query($sql . " limit {$offset},{$pagesize}"); while ($row = $db->fetch_array($query)) { $data["title"] = $this->GetRedKeyWord(str_cut($row["title"], 60)); $data["txt"] = $this->GetRedKeyWord(str_cut($row["fulltxt"], 250)); $data["url"] = str_cut($row["url"], 50); $data["updatetime"] = date("Y-m-d", $row["updatetime"]); $data["pagesize"] = $row["pagesize"]; $data["link_id"] = $row["link_id"]; $data["tuiguang"] = $row["tuiguang"]; $array[] = $data; } $array_count = count($array); if (empty($array_count)) { $newarray = $tgarray; } elseif ($p == 1 && $tgarray_count > 0) { $newarray = array_merge($tgarray, $array); } else { $newarray = $array; } return $newarray; }
//获取记录,并分析关键字 if ($totalnum > $startdd + $pagesize) { $limitSql = " limit {$startdd},{$pagesize}"; } else { if ($totalnum - $startdd > 0) { $limitSql = " limit {$startdd}," . ($totalnum - $startdd); } else { $limitSql = ''; } } $tjnum = $startdd; if ($limitSql != '') { $fquery = "Select arc.id,arc.title,arc.keywords,addon.body From `#@__archives` arc\r\n\t left join `#@__addonarticle` addon on addon.aid=arc.id where arc.channel='1' {$limitSql} "; $dsql->SetQuery($fquery); $dsql->Execute(); $sp = new SplitWord(); while ($row = $dsql->GetObject()) { if ($row->keywords != '') { continue; } $tjnum++; $id = $row->id; $keywords = ""; if ($cfg_soft_lang == 'utf-8') { $row->title = utf82gb($row->title); $row->body = utf82gb($row->body); } $titleindexs = explode(' ', trim($sp->GetIndexText($row->title))); $allindexs = explode(' ', trim($sp->GetIndexText(Html2Text($row->body), 500))); if (is_array($allindexs) && is_array($titleindexs)) { foreach ($titleindexs as $k) {
/** * 处理HTML文本 * 删除非站外链接、自动摘要、自动获取缩略图 * * @access public * @param string $body 内容 * @param string $description 描述 * @param string $litpic 缩略图 * @param string $keywords 关键词 * @param string $dtype 类型 * @return string */ function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '') { global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang; $autolitpic = empty($autolitpic) ? '' : $autolitpic; $body = stripslashes($body); //远程图片本地化 if ($remote == 1) { $body = GetCurContent($body); } //删除非站内链接 if ($dellink == 1) { $allow_urls = array($_SERVER['HTTP_HOST']); // 读取允许的超链接设置 if (file_exists(DEDEDATA . "/admin/allowurl.txt")) { $allow_urls = array_merge($allow_urls, file(DEDEDATA . "/admin/allowurl.txt")); } $body = Replace_Links($body, $allow_urls); } //自动摘要 if ($description == '' && $cfg_auot_description > 0) { $description = cn_substr(html2text($body), $cfg_auot_description); $description = trim(preg_replace('/#p#|#e#/', '', $description)); $description = addslashes($description); } //自动获取缩略图 if ($autolitpic == 1 && $litpic == '') { $litpic = GetDDImgFromBody($body); } //自动获取关键字 if ($autokey == 1 && $keywords == '') { $subject = $title; $message = $body; include_once DEDEINC . '/splitword.class.php'; $keywords = ''; $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); $sp->SetSource($subject, $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); $sp->SetSource(Html2Text($message), $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); $allindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); if (is_array($allindexs) && is_array($titleindexs)) { foreach ($titleindexs as $k => $v) { if (strlen($keywords . $k) >= 60) { break; } else { if (strlen($k) <= 2) { continue; } $keywords .= $k . ','; } } foreach ($allindexs as $k => $v) { if (strlen($keywords . $k) >= 60) { break; } else { if (!in_array($k, $titleindexs)) { if (strlen($k) <= 2) { continue; } $keywords .= $k . ','; } } } } $sp = null; } $body = GetFieldValueA($body, $dtype, $id); $body = addslashes($body); return $body; }
/** * 导出词典的词条 * @parem $targetfile 保存位置 * @return void */ static private function ExportDict($targetfile) { if (!self::$mainDicHand) { self::$mainDicHand = fopen(self::$mainDicFile, 'rw'); } $fp = fopen($targetfile, 'w'); for ($i = 0; $i <= self::$mask_value; $i++) { $move_pos = $i * 8; fseek(self::$mainDicHand, $move_pos, SEEK_SET); $dat = fread(self::$mainDicHand, 8); $arr = unpack('I1s/n1l/n1c', $dat); if ($arr['l'] == 0) { continue; } fseek(self::$mainDicHand, $arr['s'], SEEK_SET); $data = @unserialize(fread(self::$mainDicHand, $arr['l'])); if (!is_array($data)) continue; foreach ($data as $k => $v) { $w = iconv(UCS2, 'utf-8', $k); fwrite($fp, "{$w},{$v[0]},{$v[1]}\n"); } } fclose($fp); return TRUE; }
$artUrl = MakeArt($aid, true, true); $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1'; ShowMsg('成功更新一篇文档的基本信息!', $backurl); exit; } else { if ($dopost == "makekw") { include_once DEDEINC . '/splitword.class.php'; CheckPurview('a_Commend,sys_ArcBatch'); if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit; } $sp = new SplitWord(); $arcids = ereg_replace('[^0-9,]', '', ereg_replace('`', ',', $qstr)); $query = "Select arc.*, addt.* From `#@__archives` arc left join `#@__addonarticle` addt on addt.aid=arc.id where arc.id in({$arcids}) And arc.channel=1 "; $dsql->SetQuery($query); $dsql->Execute(); while ($row = $dsql->GetArray()) { //跳过已经有关键字的内容 if (trim($row['keywords']) != '') { continue; } $aid = $row['id']; $keywords = ''; $title = $row['title']; $description = $row['description']; $body = cn_substr($row['body'], 5000); if ($cfg_soft_lang == 'utf-8') {
//获取记录,并分析关键字 if ($totalnum > $startdd + $pagesize) { $limitSql = " LIMIT {$startdd},{$pagesize}"; } else { if ($totalnum - $startdd > 0) { $limitSql = " LIMIT {$startdd}," . ($totalnum - $startdd); } else { $limitSql = ''; } } $tjnum = $startdd; if ($limitSql != '') { $fquery = "SELECT arc.id,arc.title,arc.keywords,addon.body FROM `#@__archives` arc\n LEFT JOIN `#@__addonarticle` addon ON addon.aid=arc.id WHERE arc.channel='1' {$limitSql} "; $dsql->SetQuery($fquery); $dsql->Execute(); $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); while ($row = $dsql->GetObject()) { if ($row->keywords != '') { continue; } $tjnum++; $id = $row->id; $keywords = ""; $sp->SetSource($row->title, $cfg_soft_lang, $cfg_soft_lang); $sp->SetResultType(2); $sp->StartAnalysis(TRUE); $titleindexs = $sp->GetFinallyIndex(); $sp->SetSource(Html2Text($row->body), $cfg_soft_lang, $cfg_soft_lang); $sp->SetResultType(2); $sp->StartAnalysis(TRUE); $allindexs = $sp->GetFinallyIndex();
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '') { global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang; $autolitpic = empty($autolitpic) ? '' : $autolitpic; $body = stripslashes($body); //远程图片本地化 if ($remote == 1) { $body = GetCurContent($body); } //删除非站内链接 if ($dellink == 1) { $basehost = "http://" . $_SERVER['HTTP_HOST']; $body = str_replace($cfg_basehost, '#basehost#', $body); $body = str_replace($basehost, '#2basehost2#', $body); $body = preg_replace("/(<a[ \t\r\n]{1,}href=[\"']{0,}http:\\/\\/[^\\/]([^>]*)>)|(<\\/a>)/isU", "", $body); $body = str_replace('#basehost#', $cfg_basehost, $body); $body = str_replace('#2basehost2#', $basehost, $body); } //自动摘要 if ($description == '' && $cfg_auot_description > 0) { $description = cn_substr(html2text($body), $cfg_auot_description); $description = trim(preg_replace('/#p#|#e#/', '', $description)); $description = addslashes($description); } //自动获取缩略图 if ($autolitpic == 1 && $litpic == '') { $litpic = GetDDImgFromBody($body); } //自动获取关键字 if ($autokey == 1 && $keywords == '') { $subject = $title; $message = $body; if ($cfg_soft_lang == 'utf-8') { $subject = utf82gb($title); $message = utf82gb($message); } include_once DEDEINC . '/splitword.class.php'; $keywords = ''; $sp = new SplitWord(); $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($subject))); $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($message), 500))); if (is_array($allindexs) && is_array($titleindexs)) { foreach ($titleindexs as $k) { if (strlen($keywords . $k) >= 60) { break; } else { $keywords .= $k . ','; } } foreach ($allindexs as $k) { if (strlen($keywords . $k) >= 60) { break; } else { if (!in_array($k, $titleindexs)) { $keywords .= $k . ','; } } } } $sp->Clear(); $sp = null; } $body = GetFieldValueA($body, $dtype, $id); $body = addslashes($body); return $body; }
/** * [SplitWord 分词] * @param [type] $str [description] */ function SplitWord($str) { vendor('SplitWord/SplitWord'); $split = new SplitWord(); $data = $split->SplitRMM($str); p($data); $split->Clear(); return $data; }
function addnews_action() { include "locoy_config.php"; if ($locoyinfo['locoy_online'] != 1) { echo 4; die; } if ($locoyinfo['locoy_key'] != trim($_GET['key'])) { echo 5; die; } if (!$_POST['title'] || !$_POST['content'] || !$_POST['nid']) { echo 2; die; } $row = $this->obj->DB_select_once("news_base", "`title`='" . trim($_POST['title']) . "' and `nid`='" . $_POST['nid'] . "'"); if (is_array($row)) { echo 3; die; } $value = ""; $value .= "`title`='" . trim($_POST['title']) . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`author`='" . $_POST['author'] . "',"; $value .= "`description`='" . $_POST['description'] . "',"; $value .= "`source`='" . $_POST['source'] . "'"; if ($_POST['ctime']) { $value .= ",`datetime`='" . strtotime($_POST['ctime']) . "'"; } else { $value .= ",`datetime`='" . time() . "'"; } if ($_POST['hits']) { $value .= ",`hits`='" . trim($_POST['hits']) . "'"; } else { $row = explode('-', $locoyinfo['locoy_rand']); if (is_array($row)) { $rand = rand(trim($row[0]), trim($row[1])); } else { $rand = !trim($row) ? 0 : $row; } $value .= ",`hits`='" . $rand . "'"; } if ($_POST['sort']) { $value .= ",`sort`='" . trim($_POST['sort']) . "'"; } else { $row = explode('-', $locoyinfo['locoy_sort']); if (is_array($row)) { $rand = rand(trim($row[0]), trim($row[1])); } else { $rand = !trim($row) ? 0 : $row; } $value .= ",`sort`='" . $rand . "'"; } if ($_POST['newsphoto']) { $value .= ",`newsphoto`='" . trim($_POST['newsphoto']) . "'"; } if ($_POST['s_thumb']) { $value .= ",`s_thumb`='" . trim($_POST['s_thumb']) . "'"; } $content = $_POST['content']; if (!$_POST['keyword'] && $locoyinfo['locoy_keyword'] == 1) { require APP_PATH . "/include/lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags($content)); $value .= ",`keyword`='" . @implode(",", $keywordarr) . "'"; } elseif ($_POST['keyword']) { $value .= ",`keyword`='" . str_replace(",", ",", $_POST['keyword']) . "'"; } $new_base = $this->obj->DB_insert_once("news_base", $value); $news_content = $this->obj->DB_insert_once("news_content", "`nbid`='{$new_base}',`content`='{$content}'"); if ($new_base) { echo 1; die; } else { echo 0; die; } }
function addnews_action() { //新闻添加 include "locoy_config.php"; if ($locoyinfo['locoy_online'] != 1) { echo 4; die; } if ($locoyinfo['locoy_key'] != trim($_GET['key'])) { echo 5; die; } if (!$_POST['title'] || !$_POST['content'] || !$_POST['nid']) { echo 2; die; } $row = $this->obj->DB_select_once("news_base", "`title`='" . trim($_POST['title']) . "' and `nid`='" . $_POST['nid'] . "'"); if (is_array($row)) { echo 3; die; } $content = $_POST['content']; $value = ""; $value .= "`title`='" . trim($_POST['title']) . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`did`='0',"; $value .= "`author`='" . $_POST['author'] . "',"; $description = mb_substr(strip_tags(html_entity_decode($content, ENT_NOQUOTES, "GB2312")), 0, 180, "gbk"); $description = $_POST['description'] ? $_POST['description'] : $description; $description = str_replace(array(' ', "\n", "\r", "\r\n", " "), array(''), $description); $value .= "`description`='" . $description . "',"; $value .= "`source`='" . $_POST['source'] . "'"; if ($_POST['ctime']) { $value .= ",`datetime`='" . strtotime($_POST['ctime']) . "'"; } else { $value .= ",`datetime`='" . time() . "'"; } if ($_POST['hits']) { $value .= ",`hits`='" . trim($_POST['hits']) . "'"; } else { $row = explode('-', $locoyinfo['locoy_rand']); if (is_array($row)) { $rand = rand(trim($row[0]), trim($row[1])); } else { $rand = !trim($row) ? 0 : $row; } $value .= ",`hits`='" . $rand . "'"; } if ($_POST['sort']) { $value .= ",`sort`='" . trim($_POST['sort']) . "'"; } else { $row = explode('-', $locoyinfo['locoy_sort']); if (is_array($row)) { $rand = rand(trim($row[0]), trim($row[1])); } else { $rand = !trim($row) ? 0 : $row; } $value .= ",`sort`='" . $rand . "'"; } if ($_POST['newsphoto']) { $value .= ",`newsphoto`='" . trim($_POST['newsphoto']) . "'"; } if ($_POST['s_thumb']) { $value .= ",`s_thumb`='" . trim($_POST['s_thumb']) . "'"; } if (!$_POST['keyword'] && $locoyinfo['locoy_keyword'] == 1) { require LIB_PATH . "lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags(html_entity_decode($content))); $value .= ",`keyword`='" . strip_tags(@implode(",", $keywordarr)) . "'"; } elseif ($_POST['keyword']) { $value .= ",`keyword`='" . str_replace(",", ",", $_POST['keyword']) . "'"; } $new_base = $this->obj->DB_insert_once("news_base", $value); $news_content = $this->obj->DB_insert_once("news_content", "`nbid`='{$new_base}',`content`='{$content}'"); if ($new_base) { echo 1; die; } else { echo 0; die; } }
$smarty->assign('goods_type_selected', $_REQUEST['goods_type']); $smarty->assign('cat_list', cat_list(0, $adv_value['category'], true, 2, false)); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('action', 'form'); $smarty->assign('use_storage', $_CFG['use_storage']); $action = 'form'; } /* 初始化搜索条件 */ $keywords = ''; $tag_where = ''; if (!empty($_REQUEST['keywords'])) { /* 代码修改_START By www.68ecshop.com */ include_once 'includes/lib_splitword_www_68ecshop_com.php'; $Recordkw = str_replace(array("\\'"), array(''), trim($_REQUEST['keywords'])); $cfg_soft_lang_www_68ecshop_com = 'utf-8'; $sp_www_68ecshop_com = new SplitWord($cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com); $sp_www_68ecshop_com->SetSource($Recordkw, $cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com); $sp_www_68ecshop_com->SetResultType(1); $sp_www_68ecshop_com->StartAnalysis(TRUE); $word_www_68ecshop_com = $sp_www_68ecshop_com->GetFinallyResult(' '); //echo $word_www_68ecshop_com; $word_www_68ecshop_com = preg_replace("/[ ]{1,}/", " ", trim($word_www_68ecshop_com)); $replacef_www_68ecshop_com = explode(' ', $word_www_68ecshop_com); $keywords = 'AND ('; $goods_ids = array(); foreach ($replacef_www_68ecshop_com as $key => $val) { if ($key > 0 && $key < count($replacef_www_68ecshop_com) && count($replacef_www_68ecshop_com) > 1) { $keywords .= " AND "; } $val = mysql_like_quote(trim($val)); $sc_dsad = $_REQUEST['sc_ds'] ? " OR goods_desc LIKE '%{$val}%'" : '';
function GetKeywords($keyword) { $keyword = cn_substr($keyword, 50); $row = $this->dsql->GetOne("Select spwords From `#@__search_keywords` where keyword='" . addslashes($keyword) . "'; "); if (!is_array($row)) { if (strlen($keyword) > 7) { $sp = new SplitWord(); $keywords = $sp->GetSplitRMM($keyword); $sp->Clear(); $keywords = ereg_replace("[ ]{1,}", " ", trim($keywords)); } else { $keywords = $keyword; } $inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)\r\n VALUES ('" . addslashes($keyword) . "', '" . addslashes($keywords) . "', '1', '0', '" . time() . "'); "; $this->dsql->ExecuteNoneQuery($inquery); } else { $this->dsql->ExecuteNoneQuery("Update `#@__search_keywords` set count=count+1,lasttime='" . time() . "' where keyword='" . addslashes($keyword) . "'; "); $keywords = $row['spwords']; } return $keywords; }
/** * 获得关键字的分词结果,并保存到数据库 * * @access public * @param string $keyword 关键词 * @return string */ function GetKeywords($keyword) { global $cfg_soft_lang; $keyword = cn_substr($keyword, 50); $row = $this->dsql->GetOne("SELECT spwords FROM `#@__search_keywords` WHERE keyword='" . addslashes($keyword) . "'; "); if (!is_array($row)) { if (strlen($keyword) > 7) { $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); $sp->SetSource($keyword, $cfg_soft_lang, $cfg_soft_lang); $sp->SetResultType(2); $sp->StartAnalysis(TRUE); $keywords = $sp->GetFinallyResult(); $idx_keywords = $sp->GetFinallyIndex(); ksort($idx_keywords); $keywords = $keyword . ' '; foreach ($idx_keywords as $key => $value) { if (strlen($key) <= 3) { continue; } $keywords .= ' ' . $key; } $keywords = preg_replace("/[ ]{1,}/", " ", $keywords); //var_dump($idx_keywords);exit(); unset($sp); } else { $keywords = $keyword; } $inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)\n VALUES ('" . addslashes($keyword) . "', '" . addslashes($keywords) . "', '1', '0', '" . time() . "'); "; $this->dsql->ExecuteNoneQuery($inquery); } else { $this->dsql->ExecuteNoneQuery("UPDATE `#@__search_keywords` SET count=count+1,lasttime='" . time() . "' WHERE keyword='" . addslashes($keyword) . "'; "); $keywords = $row['spwords']; } return $keywords; }
$objWebInit->db(); $arrWhere = array(); $arrLink = array(); $arrWhere[] = "pass='******'"; $strLink = ''; if (!empty($_REQUEST['keywords'])) { $strKeywords = strval(urldecode($_REQUEST['keywords'])); if ($strKeywords[0] == '/') { //精确查询ID $strKeywords = substr($strKeywords, 1); if (is_numeric($strKeywords)) { $arrWhere[] = "id = '" . $strKeywords . "'"; } } else { $strKeywords = strval(urldecode($_REQUEST['keywords'])); $objSP = new SplitWord(); $strok = $objSP->SplitRMM($strKeywords); $arrKeywords = explode(' ', $strok); foreach ($arrKeywords as $v) { $v = trim($v); if (!empty($v)) { $arrWhere[] = "tag LIKE '%{$v}%'"; } } } $arrLink[] = 'keywords=' . urlencode($strKeywords); } else { check::AlertExit("错误:关键词必须填写!", -1); } if (empty($_GET['page'])) { $intPage = 1;
if ($_POST['summary'] == '') { $_POST['summary'] = check::csubstr(trim(str_replace(" ", " ", str_replace("\r\n", "", strip_tags($_POST['intro'])))), 0, $arrGWeb['db_summary_len']); } if ($_POST['title'] != '') { $_POST['title_md5'] = md5($_POST['title']); } if (is_array($_POST['photo'])) { $_POST['thumbnail'] = $_POST['photo'][0]['photo']; } else { $_POST['thumbnail'] = $_POST['photo']; } $_POST['photo'] = array_values($_POST['photo']); $_POST['video'] = array_values($_POST['video']); #自动拆字生成tag if (empty($_POST['tag'])) { $objSP = new SplitWord(); $_POST['tag'] = $objSP->SplitRMM($_POST['title'], false); } $_POST = array_merge($arrInfo, $_POST); $objWebInit->saveInfo($_POST, 1); $objWebInit->updateCache($_POST['id'], $_POST['type_id'], $arrMOutput); check::WindowLocation('index.php', 'page=' . $_GET['page']); } if (!is_array($arrMType) || empty($arrMType)) { $arrMType = $objWebInit->getTypeList(); $arrMType = $objWebInit->formatTypeList(0, $arrMType); } // 输出到模板 $arrMOutput["template_file"] = "admin.html"; $arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath']; $arrMOutput["smarty_assign"]['FileListPicSize'] = $objWebInit->arrGPic['FileListPicSize'];
$artUrl = MakeArt($aid, TRUE, TRUE); $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1'; ShowMsg('成功更新一篇文档的基本信息!', $backurl); exit; } else { if ($dopost == "makekw") { include_once DEDEINC . '/splitword.class.php'; CheckPurview('a_Commend,sys_ArcBatch'); if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit; } $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); $query = "SELECT arc.*, addt.* From `#@__archives` arc LEFT JOIN `#@__addonarticle` addt ON addt.aid=arc.id WHERE arc.id in({$arcids}) AND arc.channel=1 "; $dsql->SetQuery($query); $dsql->Execute(); while ($row = $dsql->GetArray()) { //跳过已经有关键字的内容 if (trim($row['keywords']) != '') { continue; } $aid = $row['id']; $keywords = ''; $title = $row['title']; $description = $row['description']; $body = cn_substr($row['body'], 5000); $sp->SetSource($title, $cfg_soft_lang, $cfg_soft_lang);
return $this->result; } public function hot_word($N = "") { $HW = array_count_values($this->result); arsort($HW); if ($N) { $i = 0; foreach ($HW as $key => $val) { if ($i < $N && cstrlen($key) > 1) { $R[] = $key; $i++; } elseif ($i > $N) { break; } } return $R; } return $HW; } } //function cstrlen($str){ // return mb_strlen($str,"gb2312"); //} //function csubstr($str,$length,$suffix=FALSE,$start=0){ // return mb_substr($str, $start, $length, "gb2312"); //} $sw = new SplitWord(); $k = $sw->getWord('“我是一个好宝宝,明天去上学!”', 4); $hw = $sw->hot_word(10); var_dump($k);
if($description=="" && $cfg_auot_description>0){ $description = stripslashes(cn_substr(html2text($body),$cfg_auot_description)); $description = trim(preg_replace("/#p#|#e#/","",$description)); $description = addslashes($description); } //把内容中远程的图片资源本地化 //------------------------------------ if($cfg_isUrlOpen && $remote==1){ $body = GetCurContent($body); } //自动获取关键字 //---------------------------------- if($autokey==1){ require_once(DEDEADMIN."/../include/pub_splitword_www.php"); $keywords = ""; $sp = new SplitWord(); $titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title)))); $allindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM(Html2Text($body)),200))); if(is_array($allindexs) && is_array($titleindexs)){ foreach($titleindexs as $k){ if(strlen($keywords)>=50) break; else $keywords .= $k." "; } foreach($allindexs as $k){ if(strlen($keywords)>=50) break; else if(!in_array($k,$titleindexs)) $keywords .= $k." "; } } $sp->Clear(); unset($sp); $keywords = preg_replace("/#p#|#e#/","",$keywords);
public function check() { import("@.ORG.SplitWord"); $sp = new SplitWord(); $m_leads = M('Leads'); $m_customer = M('Customer'); //ignore words $useless_words = array(L('COMPANY'), L('LIMITED'), L('OF'), L('COMPANY_LIMITED')); if ($this->isAjax()) { $split_result = $sp->SplitRMM($_POST['name']); if (!is_utf8($split_result)) { $split_result = iconv("GB2312//IGNORE", "UTF-8", $split_result); } $result_array = explode(' ', trim($split_result)); if (count($result_array) < 2) { $this->ajaxReturn(0, '', 0); die; } foreach ($result_array as $k => $v) { if (in_array($v, $useless_words)) { unset($result_array[$k]); } } $leads_commpany_list = $m_leads->getField('name', true); $customer_commpany_list = $m_customer->getField('name', true); $search_array = array(); foreach ($leads_commpany_list as $k => $v) { $search = 0; foreach ($result_array as $k2 => $v2) { if (strpos($v, $v2) > -1) { $v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count); $search += $count; } } if ($search > 2) { $search_array[$k] = array('value' => $v, 'search' => $search); } } $seach_sort_result['leads'] = array_sort($search_array, 'search', 'desc'); $customer_search_array = array(); foreach ($customer_commpany_list as $k => $v) { $search = 0; foreach ($result_array as $k2 => $v2) { if (strpos($v, $v2) > -1) { $v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count); $search += $count; } } if ($search > 2) { $customer_search_array[$k] = array('value' => $v, 'search' => $search); } } $seach_sort_result['customer'] = array_sort($customer_search_array, 'search', 'desc'); $leads_search = $seach_sort_result['leads']; $customer_search = $seach_sort_result['customer']; if (empty($leads_search) && empty($customer_search)) { $this->ajaxReturn(0, L('YOU_CAN_ADD'), 0); } else { $this->ajaxReturn($seach_sort_result, L('EXIST_SAME_LEADS_OR_COMPANY'), 1); } } }
function q($wd, $domain = '') { global $db; $this->db =& $db; $this->wd = $wd; if (empty($wd)) { $sql = "select * from ve123_links where title<>'' order by updatetime desc"; } elseif (!empty($domain)) { if ($domain == getdomain($domain)) { $sql = "select * from ve123_links where title<>'' and url like '%." . $domain . "%' or url like '%//" . $domain . "%'"; //echo $sql; } else { $sql = "select * from ve123_links where title<>'' and url regexp 'http://" . $domain . "'"; //echo $sql; } } else { $this->update_keywords(); require PATH . "include/splitword.func.php"; $sp = new SplitWord(); $wd_split = $sp->SplitRMM($wd); $sp->Clear(); $this->wd_split = $wd_split = ereg_replace("[ ]{1,}", " ", trim($wd_split)); $this->wd_array = $wd_array = explode(" ", $wd_split); $this->wd_count = $wd_count = count($wd_split); //echo $wd_count; $tgarray = $this->GetTg(); $tgarray_count = count($tgarray); $ordersql = " order by ("; foreach ($wd_array as $value) { $strlen = strlen($value); if ($strlen > 2) { $points = $strlen; } else { $points = 1; } $ordersql .= "(case when title like '%" . $value . "%' then " . $points . " else 0 end)+"; } $ordersql .= "(case when title like '%" . $wd . "%' then 8 else 0 end)"; // $ordersql=rtrim($ordersql,"+"); $ordersql .= ") desc,updatetime desc"; $keywordsql = $this->GetKeywordSql("title,' ',url,' ',keywords,' ',fulltxt"); if (empty($keywordsql)) { $keywordsql = "title like '%" . $wd . "%'"; } $sql = "select * from ve123_links where title<>'' and " . $keywordsql . $ordersql; // // } //echo $sql; $query = $db->query($sql); $this->total = $total = $db->num_rows($query) + $tgarray_count; $pagesize = 10; $this->totalpage = $totalpage = ceil($total / $pagesize); $p = intval($_GET["p"]); if ($p <= 0) { $p = 1; } $offset = ($p - 1) * $pagesize; $query = $db->query($sql . " limit {$offset},{$pagesize}"); while ($row = $db->fetch_array($query)) { $data["title"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["title"], 60))); $data["txt"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["fulltxt"], 250))); $data["description"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["description"], 250))); $data["url"] = str_cut($row["url"], 50); $data["updatetime"] = date("Y-m-d", $row["updatetime"]); $data["pagesize"] = $row["pagesize"]; $data["link_id"] = $row["link_id"]; $data["tuiguang"] = $row["tuiguang"]; $array[] = $data; } $array_count = count($array); if (empty($array_count)) { $newarray = $tgarray; } elseif ($p == 1 && $tgarray_count > 0) { $newarray = array_merge($tgarray, $array); } else { $newarray = $array; } return $newarray; }
function addnews_action() { if ($_POST['updatenews']) { $news_base = $this->obj->DB_select_once('news_base', "`id`='" . $_POST['id'] . "'", "`newsphoto`,`s_thumb`,`datetime`"); if ($_POST['uplocadpic']) { if ($news_base['s_thumb'] != $_POST['uplocadpic']) { if ($news_base['s_thumb']) { $this->obj->unlink_pic('../' . $news_base['s_thumb']); $this->obj->unlink_pic('../' . $news_base['newsphoto']); } if ($_POST['uplocadpic']) { $_POST['uplocadpic'] = str_replace($this->config['sy_weburl'], "", $_POST['uplocadpic']); $value .= "`newsphoto`='" . $_POST['uplocadpic'] . "',"; $value .= "`s_thumb`='" . $_POST['uplocadpic'] . "',"; } } } $content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ''), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312")); $describe = @implode(",", $_POST['describe']); $time = time(); if (empty($_POST['did'])) { $_POST['did'] = 0; } $value .= "`did`='" . $_POST['did'] . "',"; $value .= "`color`='" . $_POST['color'] . "',"; $value .= "`sort`='" . $_POST['sort'] . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`author`='" . $_POST['author'] . "',"; $value .= "`source`='" . $_POST['source'] . "',"; $value .= "`title`='" . $_POST['title'] . "',"; $value .= "`describe`='" . $describe . "',"; $value .= "`lastupdate`='" . $time . "',"; if (!$_POST['keyword']) { require APP_PATH . "/include/lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags($content)); $value .= "`keyword`='" . @implode(",", $keywordarr) . "',"; } else { $value .= "`keyword`='" . $_POST['keyword'] . "',"; } $value .= "`description`='" . $_POST['description'] . "'"; $nbid = $this->obj->DB_update_all("news_base", $value, "`id`='" . $_POST['id'] . "'"); $row = $this->obj->DB_select_once('news_content', "`nbid`='" . $_POST['id'] . "'", "nbid"); if (is_array($row)) { $cont = $this->obj->DB_update_all("news_content", "`content`='" . $content . "'", "`nbid`='" . $_POST['id'] . "'"); } else { $cont = $this->obj->DB_insert_once("news_content", "`nbid`='" . $_POST['id'] . "',`content`='" . $content . "'"); } $this->autohtml($_POST['id'], $news_base['datetime']); $lasturl = str_replace("&", "&", $_POST['lasturl']); isset($nbid) ? $this->obj->ACT_layer_msg("新闻(ID:" . $_POST['id'] . ")更新成功!", 9, $lasturl, 2, 1) : ${$this}->obj->ACT_layer_msg("更新失败!", 8, $lasturl); } if ($_POST['newsadd']) { if ($_POST['uplocadpic']) { $_POST['uplocadpic'] = str_replace($this->config['sy_weburl'], "", $_POST['uplocadpic']); $value .= "`newsphoto`='" . $_POST['uplocadpic'] . "',"; $value .= "`s_thumb`='" . $_POST['uplocadpic'] . "',"; } $content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ""), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312")); $describe = @implode(",", $_POST['describe']); $time = time(); if ($_POST['sort'] != '') { $value .= "`sort`='" . $_POST['sort'] . "',"; } else { $value .= "`sort`='0',"; } if (empty($_POST['did'])) { $_POST['did'] = 0; } $value .= "`did`='" . $_POST['did'] . "',"; $value .= "`color`='" . $_POST['color'] . "',"; $value .= "`nid`='" . $_POST['nid'] . "',"; $value .= "`author`='" . $_POST['author'] . "',"; $value .= "`source`='" . $_POST['source'] . "',"; $value .= "`title`='" . $_POST['title'] . "',"; $value .= "`datetime`='" . $time . "',"; $value .= "`lastupdate`='" . $time . "',"; $value .= "`describe`='" . $describe . "',"; if (!$_POST["keyword"]) { require APP_PATH . "/include/lib_splitword_class.php"; $sp = new SplitWord(); $keywordarr = $sp->getkeyword(strip_tags($content)); $value .= "`keyword`='" . @implode(",", $keywordarr) . "',"; } else { $value .= "`keyword`='" . $_POST['keyword'] . "',"; } $value .= "`description`='" . $_POST["description"] . "'"; $nbid = $this->obj->DB_insert_once("news_base", $value); $cont = $this->obj->DB_insert_once("news_content", "`nbid`='{$nbid}',`content`='" . $content . "'"); $this->autohtml($nbid, $time); $lasturl = "index.php?m=admin_news&c=news&nid=" . $_POST['nid']; isset($cont) ? $this->obj->ACT_layer_msg("新闻(ID:" . $nbid . ")添加成功!", 9, $lasturl, 2, 1) : $this->obj->ACT_layer_msg("添加失败!", 8, $lasturl); } }