废弃 删除TAG关键词获取业务相关功能
This commit is contained in:
parent
4144f6e3f5
commit
9dc5374759
|
@ -20,7 +20,7 @@ require './source/function/function_forum.php';
|
||||||
|
|
||||||
$modarray = array('ajax','announcement','attachment','forumdisplay',
|
$modarray = array('ajax','announcement','attachment','forumdisplay',
|
||||||
'group','image','index','medal','misc','modcp','notice','post','redirect',
|
'group','image','index','medal','misc','modcp','notice','post','redirect',
|
||||||
'relatekw','relatethread','rss','topicadmin','trade','viewthread','tag','collection','guide'
|
'rss','topicadmin','trade','viewthread','tag','collection','guide'
|
||||||
);
|
);
|
||||||
|
|
||||||
$modcachelist = array(
|
$modcachelist = array(
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
|
||||||
* This is NOT a freeware, use is subject to license terms
|
|
||||||
*
|
|
||||||
* $Id: spacecp_relatekw.php 6752 2010-03-25 08:47:54Z cnteacher $
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(!defined('IN_DISCUZ')) {
|
|
||||||
exit('Access Denied');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$_G['setting']['headercharset']) {
|
|
||||||
@header('Content-Type: text/html; charset='.CHARSET);
|
|
||||||
}
|
|
||||||
$_G['inajax'] = 1;
|
|
||||||
|
|
||||||
$subjectenc = rawurlencode(strip_tags($_GET['subjectenc']));
|
|
||||||
$messageenc = rawurlencode(strip_tags(preg_replace("/\[.+?\]/U", '', $_GET['messageenc'])));
|
|
||||||
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?title=$subjectenc&content=$messageenc&ics={$_G[charset]}&ocs={$_G[charset]}"));
|
|
||||||
|
|
||||||
if($data) {
|
|
||||||
$parser = xml_parser_create();
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
|
|
||||||
xml_parse_into_struct($parser, $data, $values, $index);
|
|
||||||
xml_parser_free($parser);
|
|
||||||
|
|
||||||
$kws = array();
|
|
||||||
|
|
||||||
foreach($values as $valuearray) {
|
|
||||||
if($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
|
|
||||||
if(PHP_VERSION > '5' && CHARSET != 'utf-8') {
|
|
||||||
$kws[] = diconv(trim($valuearray['value']), 'utf-8');
|
|
||||||
} else {
|
|
||||||
$kws[] = trim($valuearray['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = '';
|
|
||||||
if($kws) {
|
|
||||||
foreach($kws as $kw) {
|
|
||||||
$kw = dhtmlspecialchars($kw);
|
|
||||||
$return .= $kw.' ';
|
|
||||||
}
|
|
||||||
$return = trim($return);
|
|
||||||
}
|
|
||||||
|
|
||||||
showmessage($return, '', array(), array('msgtype' => 3, 'handle' => false));
|
|
||||||
} else {
|
|
||||||
showmessage(' ', '', array(), array('msgtype' => 3, 'handle' => false));
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,70 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
|
||||||
* This is NOT a freeware, use is subject to license terms
|
|
||||||
*
|
|
||||||
* $Id: forum_relatekw.php 29236 2012-03-30 05:34:47Z chenmengshu $
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(!defined('IN_DISCUZ')) {
|
|
||||||
exit('Access Denied');
|
|
||||||
}
|
|
||||||
|
|
||||||
if($tid = @intval($_GET['tid'])) {
|
|
||||||
$data = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
|
|
||||||
$subject = $data['subject'];
|
|
||||||
$message = cutstr($data['message'], 500, '');
|
|
||||||
$pid = $data['pid'];
|
|
||||||
} else {
|
|
||||||
$subject = $_GET['subjectenc'];
|
|
||||||
$message = $_GET['messageenc'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$subjectenc = rawurlencode(strip_tags($subject));
|
|
||||||
$messageenc = rawurlencode(strip_tags(preg_replace("/\[.+?\]/U", '', $message)));
|
|
||||||
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?ics=".CHARSET."&ocs=".CHARSET."&title=$subjectenc&content=$messageenc"));
|
|
||||||
|
|
||||||
if($data) {
|
|
||||||
|
|
||||||
if(PHP_VERSION > '5' && CHARSET != 'utf-8') {
|
|
||||||
require_once libfile('class/chinese');
|
|
||||||
$chs = new Chinese('utf-8', CHARSET);
|
|
||||||
}
|
|
||||||
|
|
||||||
$parser = xml_parser_create();
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
|
|
||||||
xml_parse_into_struct($parser, $data, $values, $index);
|
|
||||||
xml_parser_free($parser);
|
|
||||||
|
|
||||||
$kws = array();
|
|
||||||
|
|
||||||
foreach($values as $valuearray) {
|
|
||||||
if($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
|
|
||||||
$kws[] = !empty($chs) ? $chs->convert(trim($valuearray['value'])) : trim($valuearray['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = '';
|
|
||||||
if($kws) {
|
|
||||||
foreach($kws as $kw) {
|
|
||||||
$kw = dhtmlspecialchars($kw);
|
|
||||||
$return .= $kw.',';
|
|
||||||
}
|
|
||||||
$return = dhtmlspecialchars($return);
|
|
||||||
}
|
|
||||||
$return = substr($return, 0, strlen($return)-1);
|
|
||||||
|
|
||||||
if(!$tid) {
|
|
||||||
$_G['inajax'] = 1;
|
|
||||||
include template('forum/relatekw');
|
|
||||||
} elseif($kws) {
|
|
||||||
loadcache('censor');
|
|
||||||
C::t('forum_post')->update('tid:'.$_G['tid'], $pid, array(
|
|
||||||
'tags' => implode(',', $kws),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,118 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
|
||||||
* This is NOT a freeware, use is subject to license terms
|
|
||||||
*
|
|
||||||
* $Id: forum_relatethread.php 25791 2011-11-22 07:10:59Z zhengqingpeng $
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(!defined('IN_DISCUZ')) {
|
|
||||||
exit('Access Denied');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$_G['setting']['qihoo']['relate']['bbsnum']) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SERVER = empty($_SERVER) ? $HTTP_SERVER_VARS : $_SERVER;
|
|
||||||
$_GET = empty($_GET) ? $HTTP_GET_VARS : $_GET;
|
|
||||||
|
|
||||||
$site = $_SERVER['HTTP_HOST'];
|
|
||||||
$subjectenc = rawurlencode($_GET['subjectenc']);
|
|
||||||
$tags = explode(' ',trim($_GET['tagsenc']));
|
|
||||||
$tid = intval($_GET['tid']);
|
|
||||||
|
|
||||||
if($_GET['verifykey'] <> md5($_G['authkey'].$tid.$subjectenc.CHARSET.$site)) {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$tshow = !$_G['setting']['qihoo']['relate']['position'] ? 'mid' : 'bot';
|
|
||||||
$intnum = intval($_G['setting']['qihoo']['relate']['bbsnum']);
|
|
||||||
$extnum = intval($_G['setting']['qihoo']['relate']['webnum']);
|
|
||||||
$exttype = $_G['setting']['qihoo']['relate']['type'];
|
|
||||||
$up = intval($_GET['qihoo_up']);
|
|
||||||
$data = @implode('', file("http://related.code.qihoo.com/related.html?title=$subjectenc&ics=".CHARSET."&ocs=".CHARSET."&site=$site&sort=pdate&tshow=$tshow&intnum=$intnum&extnum=$extnum&exttype=$exttype&up=$up"));
|
|
||||||
|
|
||||||
if($data) {
|
|
||||||
$timestamp = time();
|
|
||||||
$chs = '';
|
|
||||||
|
|
||||||
if(PHP_VERSION > '5' && CHARSET != 'utf-8') {
|
|
||||||
require_once libfile('class/chinese');
|
|
||||||
$chs = new Chinese('utf-8', CHARSET);
|
|
||||||
}
|
|
||||||
|
|
||||||
$parser = xml_parser_create();
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
|
|
||||||
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
|
|
||||||
xml_parse_into_struct($parser, $data, $values, $index);
|
|
||||||
xml_parser_free($parser);
|
|
||||||
|
|
||||||
$xmldata = array('chanl', 'fid', 'title', 'tid', 'author', 'pdate', 'rdate', 'rnum', 'vnum', 'insite');
|
|
||||||
$relatedthreadlist = $keywords = array();
|
|
||||||
$nextuptime = 0;
|
|
||||||
foreach($index as $tag => $valuearray) {
|
|
||||||
if(in_array($tag, $xmldata)) {
|
|
||||||
foreach($valuearray as $key => $value) {
|
|
||||||
if($values[$index['title'][$key]]['value']) {
|
|
||||||
$relatedthreadlist[$key][$tag] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
|
|
||||||
$relatedthreadlist[$key]['fid'] = !$values[$index['fid'][$key]]['value'] ? preg_replace("/(.+?)\/forum\-(\d+)\-(\d+)\.html/", "\\2", trim($values[$index['curl'][$key]]['value'])) : trim($values[$index['fid'][$key]]['value']);
|
|
||||||
$relatedthreadlist[$key]['tid'] = !$values[$index['tid'][$key]]['value'] ? preg_replace("/(.+?)\/thread\-(\d+)\-(\d+)-(\d+)\.html/", "\\2", trim($values[$index['surl'][$key]]['value'])) : trim($values[$index['tid'][$key]]['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif(in_array($tag, array('kw', 'ekw'))) {
|
|
||||||
$type = $tag == 'kw' ? 'general' : 'trade';
|
|
||||||
foreach($valuearray as $value) {
|
|
||||||
$keywords[$type][] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
|
|
||||||
}
|
|
||||||
} elseif($tag == 'nextuptime') {
|
|
||||||
$nextuptime = $values[$index['nextuptime'][0]]['value'];
|
|
||||||
} elseif($tag == 'keep' && intval($values[$index['keep'][0]]['value'])) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$generalnew = array();
|
|
||||||
if($keywords['general']) {
|
|
||||||
$searchkeywords = rawurlencode(implode(' ', $keywords['general']));
|
|
||||||
foreach($keywords['general'] as $keyword) {
|
|
||||||
$generalnew[] = $keyword;
|
|
||||||
if(!in_array($keyword, $tags)) {
|
|
||||||
$relatedkeywords .= '<a href="forum.php?mod=search&srchtype=qihoo&srchtxt='.rawurlencode($keyword).'&searchsubmit=yes" target="_blank"><strong><font color="red">'.$keyword.'</font></strong></a> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$keywords['general'] = $generalnew;
|
|
||||||
|
|
||||||
$threadlist = array();
|
|
||||||
if($relatedthreadlist) {
|
|
||||||
foreach($relatedthreadlist as $key => $relatedthread) {
|
|
||||||
if($relatedthread['insite'] == 1) {
|
|
||||||
$threadlist['bbsthread'][] = $relatedthread;
|
|
||||||
} elseif($_G['setting']['qihoo']['relate']['webnum']) {
|
|
||||||
if(empty($_G['setting']['qihoo']['relate']['banurl']) || !preg_match($_G['setting']['qihoo']['relate']['banurl'], $relatedthread['tid'])) {
|
|
||||||
$threadlist['webthread'][] = $relatedthread;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$threadlist['bbsthread'] = $threadlist['bbsthread'] ? array_slice($threadlist['bbsthread'], 0, $_G['setting']['qihoo']['relate']['bbsnum']) : array();
|
|
||||||
$threadlist['webthread'] = $threadlist['webthread'] ? array_slice($threadlist['webthread'], 0, $_G['setting']['qihoo']['relate']['bbsnum'] - count($threadlist['bbsthread'])) : array();
|
|
||||||
$relatedthreadlist = array_merge($threadlist['bbsthread'], $threadlist['webthread']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$keywords['general'] = $keywords['general'][0] ? implode("\t", $keywords['general']) : '';
|
|
||||||
$keywords['trade'] = $keywords['trade'][0] ? implode("\t", $keywords['trade']) : '';
|
|
||||||
$relatedthreads = $relatedthreadlist ? addslashes(serialize($relatedthreadlist)) : '';
|
|
||||||
$expiration = $nextuptime ? $nextuptime : $timestamp + 86400;
|
|
||||||
|
|
||||||
$data = array('tid' => $tid, 'type' => 'general', 'expiration' => $expiration, 'keywords' => $keywords[general], 'relatedthreads' => $relatedthreads);
|
|
||||||
C::t('forum_relatedthread')->insert($data, 0, 1);
|
|
||||||
if($keywords['trade']) {
|
|
||||||
$data['type'] = 'trade';
|
|
||||||
$data['keywords'] = $keywords['trade'];
|
|
||||||
C::t('forum_relatedthread')->insert($data, 0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -14,7 +14,7 @@ if(!defined('IN_DISCUZ')) {
|
||||||
require_once libfile('function/spacecp');
|
require_once libfile('function/spacecp');
|
||||||
require_once libfile('function/magic');
|
require_once libfile('function/magic');
|
||||||
|
|
||||||
$acs = array('doing', 'upload', 'comment', 'blog', 'album', 'relatekw', 'common', 'class',
|
$acs = array('doing', 'upload', 'comment', 'blog', 'album', 'common', 'class',
|
||||||
'swfupload', 'poke', 'friend', 'eccredit', 'favorite', 'follow',
|
'swfupload', 'poke', 'friend', 'eccredit', 'favorite', 'follow',
|
||||||
'avatar', 'profile', 'theme', 'feed', 'privacy', 'pm', 'share', 'invite','sendmail',
|
'avatar', 'profile', 'theme', 'feed', 'privacy', 'pm', 'share', 'invite','sendmail',
|
||||||
'credit', 'usergroup', 'domain', 'click','magic', 'top', 'videophoto', 'index', 'plugin', 'search', 'promotion');
|
'credit', 'usergroup', 'domain', 'click','magic', 'top', 'videophoto', 'index', 'plugin', 'search', 'promotion');
|
||||||
|
|
|
@ -27,19 +27,6 @@ function edit_save() {
|
||||||
backupContent($('uchome-ttHtmlEditor').value);
|
backupContent($('uchome-ttHtmlEditor').value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function relatekw() {
|
|
||||||
edit_save();
|
|
||||||
var subject = cnCode($('subject').value);
|
|
||||||
var message = cnCode($('uchome-ttHtmlEditor').value);
|
|
||||||
if(message) {
|
|
||||||
message = message.substr(0, 500);
|
|
||||||
}
|
|
||||||
var x = new Ajax();
|
|
||||||
x.get('home.php?mod=spacecp&ac=relatekw&inajax=1&subjectenc=' + subject + '&messageenc=' + message, function(s){
|
|
||||||
$('tag').value = s;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function downRemoteFile() {
|
function downRemoteFile() {
|
||||||
edit_save();
|
edit_save();
|
||||||
var formObj = $("articleform");
|
var formObj = $("articleform");
|
||||||
|
|
|
@ -185,23 +185,6 @@ function postsubmit(theform) {
|
||||||
theform.submit();
|
theform.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function relatekw(subject, message) {
|
|
||||||
if(isUndefined(subject) || subject == -1) {
|
|
||||||
subject = $('subject').value;
|
|
||||||
subject = subject.replace(/<\/?[^>]+>|\[\/?.+?\]|"/ig, "");
|
|
||||||
subject = subject.replace(/\s{2,}/ig, ' ');
|
|
||||||
}
|
|
||||||
if(isUndefined(message) || message == -1) {
|
|
||||||
message = getEditorContents();
|
|
||||||
message = message.replace(/<\/?[^>]+>|\[\/?.+?\]|"/ig, "");
|
|
||||||
message = message.replace(/\s{2,}/ig, ' ');
|
|
||||||
}
|
|
||||||
subject = (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(subject) : subject);
|
|
||||||
message = (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(message) : message);
|
|
||||||
message = message.replace(/&/ig, '', message).substr(0, 500);
|
|
||||||
ajaxget('forum.php?mod=relatekw&subjectenc=' + subject + '&messageenc=' + message, 'tagselect');
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchicon(iconid, obj) {
|
function switchicon(iconid, obj) {
|
||||||
$('iconid').value = iconid;
|
$('iconid').value = iconid;
|
||||||
$('icon_img').src = obj.src;
|
$('icon_img').src = obj.src;
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<td class="xw1">{lang post_tag}</td>
|
<td class="xw1">{lang post_tag}</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="px vm" size="60" id="tags" name="tags" value="$postinfo[tag]" onblur="extraCheck(4)" />
|
<input type="text" class="px vm" size="60" id="tags" name="tags" value="$postinfo[tag]" onblur="extraCheck(4)" />
|
||||||
<a href="javascript:;" id="clickbutton[]" class="xi2" onclick="relatekw('-1','-1');doane();">{lang auto_keyword}</a><span class="pipe">|</span><a href="javascript:;" id="choosetag" class="xi2" onclick="showWindow(this.id, 'forum.php?mod=tag', 'get', 0)">{lang choosetag}</a>
|
<a href="javascript:;" id="choosetag" class="xi2" onclick="showWindow(this.id, 'forum.php?mod=tag', 'get', 0)">{lang choosetag}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<input name="subject" type="hidden" value="" />
|
<input name="subject" type="hidden" value="" />
|
||||||
<!--{else}-->
|
<!--{else}-->
|
||||||
<!--{if $_GET[action] != 'reply'}-->
|
<!--{if $_GET[action] != 'reply'}-->
|
||||||
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span>
|
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span>
|
||||||
<!--{else}-->
|
<!--{else}-->
|
||||||
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');return false;">{lang modify}</a>]</span>
|
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');return false;">{lang modify}</a>]</span>
|
||||||
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" /></span>
|
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" /></span>
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
<!--{hook/spacecp_blog_top}-->
|
<!--{hook/spacecp_blog_top}-->
|
||||||
<table cellspacing="0" cellpadding="0" class="tfm">
|
<table cellspacing="0" cellpadding="0" class="tfm">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="text" id="subject" name="subject" value="$blog[subject]" size="60" {if $_GET[op] != 'edit'}onblur="relatekw();"{/if} class="px" style="width: 63%;" /></td>
|
<td><input type="text" id="subject" name="subject" value="$blog[subject]" size="60" class="px" style="width: 63%;" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{lang label}</th>
|
<th>{lang label}</th>
|
||||||
<td class="pns"><input type="text" class="px vm" size="40" id="tag" name="tag" value="$blog[tag]" /> <button type="button" name="clickbutton[]" onclick="relatekw();" class="pn vm"><em>{lang auto_keyword}</em></button></td>
|
<td class="pns"><input type="text" class="px vm" size="40" id="tag" name="tag" value="$blog[tag]" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!--{if $blog['uid'] && $blog['uid']!=$_G['uid']}-->
|
<!--{if $blog['uid'] && $blog['uid']!=$_G['uid']}-->
|
||||||
|
|
Loading…
Reference in New Issue