@@ -1,162 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集规则添加 | |||
* | |||
* @version $Id: co_add.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
CheckPurview('co_AddNote'); | |||
if (empty($step)) $step = ""; | |||
if (empty($exrule)) $exrule = ""; | |||
//选择操作频道类型,载入表单 | |||
/*---------------------- | |||
function Init(){ } | |||
----------------------*/ | |||
if (empty($step)) { | |||
require_once(DEDEADMIN . "/templets/co_add_step0.htm"); | |||
exit(); | |||
} else if ($step == 1) { | |||
require_once(DEDEADMIN . "/templets/co_add_step1.htm"); | |||
exit(); | |||
} | |||
//保存索引规则 | |||
/*---------------------- | |||
function Save_List(){ } | |||
----------------------*/ else if ($step == 2) { | |||
//对完整规则进行测试 | |||
if ($dopost == 'test') { | |||
include(DEDEINC . "/dedecollection.class.php"); | |||
$usemore = (!isset($usemore) ? 0 : 1); | |||
$listconfig = "{dede:noteinfo notename=\\\"$notename\\\" channelid=\\\"$channelid\\\" macthtype=\\\"$macthtype\\\" | |||
refurl=\\\"$refurl\\\" sourcelang=\\\"$sourcelang\\\" cosort=\\\"$cosort\\\" isref=\\\"$isref\\\" exptime=\\\"$exptime\\\" usemore=\\\"$usemore\\\" /} | |||
{dede:listrule sourcetype=\\\"$sourcetype\\\" rssurl=\\\"$rssurl\\\" regxurl=\\\"$regxurl\\\" | |||
startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$urlrule\\\" | |||
musthas=\\\"$musthas\\\" nothas=\\\"$nothas\\\" listpic=\\\"$listpic\\\" usemore=\\\"$usemore\\\"} | |||
{dede:addurls}$addurls{/dede:addurls} | |||
{dede:batchrule}$batchrule{/dede:batchrule} | |||
{dede:regxrule}$regxrule{/dede:regxrule} | |||
{dede:areastart}$areastart{/dede:areastart} | |||
{dede:areaend}$areaend{/dede:areaend} | |||
{/dede:listrule}\r\n"; | |||
$tmplistconfig = stripslashes($listconfig); | |||
$notename = stripslashes($notename); | |||
if ($sourcetype == 'rss' && $refurl = '') { | |||
$refurl = $rssurl; | |||
} | |||
$refurl = stripslashes($refurl); | |||
$errmsg = ''; | |||
$freq = empty($freq) ? "" : $freq; | |||
$extypeid = empty($freq) ? "" : $extypeid; | |||
//测试规则 | |||
if ($sourcetype == 'rss') { | |||
$links = GetRssLinks(stripslashes($rssurl)); | |||
$demopage = $rssurl; | |||
} else { | |||
$links = array(); | |||
$lists = GetUrlFromListRule($regxurl, stripslashes($addurls), $startid, $endid, $addv, $usemore, stripslashes($batchrule)); | |||
if (isset($lists[0][0])) { | |||
$demopage = $lists[0][0]; | |||
$dc = new DedeCollection(); | |||
$dc->LoadListConfig($tmplistconfig); | |||
$listurl = ''; | |||
$links = $dc->Testlists($listurl); | |||
$errmsg = $dc->errString; | |||
} else { | |||
$demopage = '没有匹配到适合的列表页!'; | |||
} | |||
} | |||
require_once(DEDEADMIN . "/templets/co_add_step1_test.htm"); | |||
exit(); | |||
} | |||
//从预览并提示进入下一步 | |||
else { | |||
$row = $dsql->GetOne("SELECT nid,channelid FROM `#@__co_note` WHERE isok=0 AND notename LIKE '$notename' "); | |||
if (!is_array($row)) { | |||
$uptime = time(); | |||
$listconfig = urldecode($listconfig); | |||
$inquery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`usemore`,`listconfig`,`itemconfig`) | |||
VALUES ('$channelid','$notename','$sourcelang','$uptime','0','0','0','$usemore','$listconfig',''); "; | |||
$rs = $dsql->ExecuteNoneQuery($inquery); | |||
if (!$rs) { | |||
ShowMsg("保存信息时出现错误!" . $dsql->GetError(), "-1"); | |||
exit(); | |||
} | |||
$nid = $dsql->GetLastID(); | |||
} else { | |||
$channelid = $row['channelid']; | |||
$uptime = time(); | |||
if (empty($freq)) $freq = 1; | |||
if (empty($extypeid)) $extypeid = 0; | |||
if (empty($islisten)) $islisten = 0; | |||
$usemore = (!isset($usemore) ? 0 : 1); | |||
$query = " UPDATE `#@__co_note` SET | |||
`channelid`='$channelid', | |||
`notename`='$notename', | |||
`sourcelang`='$sourcelang', | |||
`uptime`='$uptime', | |||
`isok`='1', | |||
`usemore`='$usemore', | |||
`listconfig`='$listconfig' WHERE nid='$nid'; "; | |||
$dsql->ExecuteNoneQuery($query); | |||
$nid = $row['nid']; | |||
} | |||
if (!isset($previewurl)) $previewurl = ''; | |||
require_once(DEDEINC . '/dedetag.class.php'); | |||
require_once(DEDEADMIN . "/templets/co_add_step2.htm"); | |||
exit(); | |||
} | |||
} | |||
//保存文章规则 | |||
/*---------------------- | |||
function Save_Art(){ } | |||
----------------------*/ else if ($step == 5) { | |||
/* | |||
[previewurl] => '' | |||
*/ | |||
$itemconfig = "{dede:sppage sptype=\\'$sptype\\' sptype=\\'$sptype\\' srul=\\'$srul\\' erul=\\'$erul\\'}$sppage{/dede:sppage}\r\n"; | |||
$itemconfig .= "{dede:previewurl}$previewurl{/dede:previewurl}\r\n"; | |||
$itemconfig .= "{dede:keywordtrim}$keywordtrim{/dede:keywordtrim}\r\n"; | |||
$itemconfig .= "{dede:descriptiontrim}$descriptiontrim{/dede:descriptiontrim}\r\n"; | |||
$fs = explode(',', 'value,match,isunit,isdown,trim,function'); | |||
foreach ($fields as $field) { | |||
foreach ($fs as $f) { | |||
$GLOBALS[$f . '_' . $field] = (!isset($GLOBALS[$f . '_' . $field]) ? '' : $GLOBALS[$f . '_' . $field]); | |||
} | |||
$matchstr = $GLOBALS["match_" . $field]; | |||
$trimstr = $GLOBALS["trim_" . $field]; | |||
$trimstr = trim(str_replace(' ', '#n#', $trimstr)); | |||
$matchstr = trim(str_replace(' ', '#n#', $matchstr)); | |||
if ($trimstr != '' && !preg_match("#{dede:trim#i", $trimstr)) { | |||
$trimstr = " {dede:trim}$trimstr{/dede:trim}\r\n"; | |||
} | |||
$itemconfig .= "{dede:item field=\\'" . $field . "\\' value=\\'" . $GLOBALS["value_" . $field] . "\\' isunit=\\'" . $GLOBALS["isunit_" . $field] . "\\' isdown=\\'" . $GLOBALS["isdown_" . $field] . "\\'} | |||
{dede:match}" . $matchstr . "{/dede:match} | |||
$trimstr | |||
{dede:function}" . $GLOBALS["function_" . $field] . "{/dede:function} | |||
{/dede:item}\r\n"; | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET itemconfig='$itemconfig' WHERE nid='$nid' "); | |||
//echo $dsql->GetError(); | |||
require_once(DEDEINC . '/dedecollection.class.php'); | |||
require_once(DEDEADMIN . "/templets/co_add_step2_test.htm"); | |||
exit(); | |||
} else if ($step == 6) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' "); | |||
ShowMsg("成功设置一个规则!", "co_main.php"); | |||
exit(); | |||
} else if ($step == 7) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' "); | |||
ShowMsg("成功设置一个规则,现在转向采集页面!", "co_gather_start.php?nid=$nid"); | |||
exit(); | |||
} |
@@ -1,242 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集操作 | |||
* | |||
* @version $Id: co_do.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/oxwindow.class.php"); | |||
if (!isset($nid)) $nid = 0; | |||
$ENV_GOBACK_URL = empty($_COOKIE["ENV_GOBACK_URL"]) ? "co_url.php" : $_COOKIE["ENV_GOBACK_URL"]; | |||
//删除节点 | |||
//删除节点将删除所有旧的网址索引 | |||
/* | |||
function co_delete() | |||
*/ | |||
if ($dopost == "delete") { | |||
CheckPurview('co_Del'); | |||
$nid = intval($nid); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'"); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_note` WHERE nid='$nid'"); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls` WHERE nid='$nid'"); | |||
ShowMsg("成功删除一个节点!", "co_main.php"); | |||
exit(); | |||
} | |||
//清空采集内容 | |||
//清空采集内容时仍会保留旧的网址索引,在监控模式下始终采集新的内容 | |||
/* | |||
function url_clear() | |||
*/ else if ($dopost == "clear") { | |||
CheckPurview('co_Del'); | |||
if (!isset($ids)) $ids = ''; | |||
if (empty($ids)) { | |||
if (!empty($nid)) { | |||
$nid = intval($nid); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'"); | |||
} | |||
ShowMsg("成功清空一个节点采集的内容!", "co_main.php"); | |||
exit(); | |||
} else { | |||
if (!empty($clshash)) { | |||
$dsql->SetQuery("SELECT nid,url FROM `#@__co_htmls` WHERE aid IN($ids) "); | |||
$dsql->Execute(); | |||
while ($arr = $dsql->GetArray()) { | |||
$nhash = md5($arr['url']); | |||
$nid = $row['nid']; | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls ` WHERE nid='$nid' AND hash='$nhash' "); | |||
} | |||
} | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE aid IN($ids) "); | |||
ShowMsg("成功删除指定的网址内容!", $ENV_GOBACK_URL); | |||
exit(); | |||
} | |||
} else if ($dopost == "clearct") { | |||
CheckPurview('co_Del'); | |||
if (!empty($ids)) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET isdown=0,result='' WHERE aid IN($ids) "); | |||
} | |||
ShowMsg("成功清除所有内容!", $ENV_GOBACK_URL); | |||
exit(); | |||
} | |||
/* | |||
function url_clearall() | |||
*/ else if ($dopost == "clearall") { | |||
CheckPurview('co_Del'); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` "); | |||
ShowMsg("成功清空所有采集的临时内容!", "co_main.php"); | |||
exit(); | |||
} | |||
//内容替换 | |||
/* | |||
function co_replace() { } | |||
*/ else if ($dopost == "replace") { | |||
//if() | |||
//$nid $aid $regtype $fdstring $rpstring | |||
$rpstring = trim($rpstring); | |||
if ($regtype == 'string') { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`=REPLACE(`result`,'$fdstring','$rpstring') WHERE nid='$nid' "); | |||
} else { | |||
//返回一条测试结果,并要求用户确认操作 | |||
if (empty($rpok)) { | |||
$fdstring = stripslashes($fdstring); | |||
$rpstring = stripslashes($rpstring); | |||
$hiddenrpvalue = "<textarea name='fdstring' style='display:none'>{$fdstring}</textarea>\r\n<textarea name='rpstring' style='display:none'>{$rpstring}</textarea>\r\n"; | |||
$fdstring = str_replace("\\/", "#ASZZ#", $fdstring); | |||
$fdstring = str_replace('/', "\\/", $fdstring); | |||
$fdstring = str_replace('#ASZZ#', "\\/", $fdstring); | |||
$result = $rs = stripslashes($rs); | |||
if ($fdstring != '') { | |||
$result = trim(preg_replace("/$fdstring/isU", $rpstring, $rs)); | |||
} | |||
$wintitle = "采集管理-内容替换"; | |||
$wecome_info = "<a href='co_main.php'>采集管理</a>::内容替换"; | |||
$win = new OxWindow(); | |||
$win->Init("co_do.php", "js/blank.js", "POST"); | |||
$win->AddHidden('dopost', $dopost); | |||
$win->AddHidden('nid', $nid); | |||
$win->AddHidden('regtype', 'regex'); | |||
$win->AddHidden('aid', $aid); | |||
$win->AddHidden('rpok', 'ok'); | |||
$win->AddTitle("内容替换操作确认:如果下面结果正确,点击确认,系统将替换当前节点所有内容!{$hiddenrpvalue}"); | |||
$win->AddItem("原来的内容:", "<textarea name='rs' style='width:90%;height:250px'>{$rs}</textarea>\r\n"); | |||
$win->AddItem("按规则替换后的内容:", "<textarea name='okrs' style='width:90%;height:250px'>{$result}</textarea>\r\n"); | |||
$winform = $win->GetWindow("ok"); | |||
$win->Display(); | |||
exit(); | |||
} else { | |||
if ($fdstring != '') { | |||
$dsql->SetQuery("SELECT `aid`,`result` FROM `#@__co_htmls` WHERE nid='$nid' "); | |||
$dsql->Execute(); | |||
while ($row = $dsql->GetArray()) { | |||
$fdstring = stripslashes($fdstring); | |||
$rpstring = stripslashes($rpstring); | |||
$fdstring = str_replace("\\/", "#ASZZ#", $fdstring); | |||
$fdstring = str_replace('/', "\\/", $fdstring); | |||
$fdstring = str_replace('#ASZZ#', "\\/", $fdstring); | |||
$result = trim(preg_replace("/$fdstring/isU", $rpstring, $row['result'])); | |||
$result = addslashes($result); | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`='$result' WHERE aid='{$row['aid']}' "); | |||
} | |||
} | |||
} | |||
} | |||
ShowMsg("成功替换当前节点所有数据!", "co_view.php?aid=$aid"); | |||
exit(); | |||
} | |||
//复制节点 | |||
/* | |||
function co_copy() | |||
*/ else if ($dopost == "copy") { | |||
CheckPurview('co_AddNote'); | |||
if (empty($mynotename)) { | |||
$wintitle = "采集管理-复制节点"; | |||
$wecome_info = "<a href='co_main.php'>采集管理</a>::复制节点"; | |||
$win = new OxWindow(); | |||
$win->Init("co_do.php", "js/blank.js", "POST"); | |||
$win->AddHidden("dopost", $dopost); | |||
$win->AddHidden("nid", $nid); | |||
$win->AddTitle("请输入新节点名称:"); | |||
$win->AddItem("新节点名称:", "<input type='text' name='mynotename' value='' size='30' />"); | |||
$winform = $win->GetWindow("ok"); | |||
$win->Display(); | |||
exit(); | |||
} | |||
$row = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'"); | |||
foreach ($row as $k => $v) { | |||
if (!isset($$k)) { | |||
$$k = addslashes($v); | |||
} | |||
} | |||
$usemore = (empty($usemore) ? '0' : $usemore); | |||
$inQuery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`listconfig`,`itemconfig`,`usemore`) | |||
VALUES ('$channelid','$mynotename','$sourcelang','" . time() . "','0','0','0','$listconfig','$itemconfig','$usemore'); "; | |||
$dsql->ExecuteNoneQuery($inQuery); | |||
ShowMsg("成功复制一个节点!", $ENV_GOBACK_URL); | |||
exit(); | |||
} | |||
//测试Rss源是否正确 | |||
/*----------------------- | |||
function co_testrss() | |||
-------------------------*/ else if ($dopost == "testrss") { | |||
CheckPurview('co_AddNote'); | |||
$msg = ''; | |||
if ($rssurl == '') { | |||
$msg = '你没有指定RSS地址!'; | |||
} else { | |||
include(DEDEINC . "/dedecollection.func.php"); | |||
$arr = GetRssLinks($rssurl); | |||
$msg = "从 {$rssurl} 发现的网址:<br />"; | |||
$i = 1; | |||
if (is_array($arr)) { | |||
foreach ($arr as $ar) { | |||
$msg .= "<hr size='1' />\r\n"; | |||
$msg .= "link: {$ar['link']}<br />title: {$ar['title']}<br />image: {$ar['image']}\r\n"; | |||
$i++; | |||
} | |||
} | |||
} | |||
$wintitle = "采集管理-测试"; | |||
$wecome_info = "<a href='co_main.php'>采集管理</a>::RSS地址测试"; | |||
$win = new OxWindow(); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand"); | |||
$win->Display(); | |||
exit(); | |||
} | |||
//测试批量网址是否正确 | |||
/*----------------------- | |||
function co_testregx() | |||
-------------------------*/ else if ($dopost == "testregx") { | |||
CheckPurview('co_AddNote'); | |||
$msg = ''; | |||
if ($regxurl == '') { | |||
$msg = '你没有指定匹配的网址!'; | |||
} else { | |||
include(DEDEINC . "/dedecollection.func.php"); | |||
$msg = "匹配的网址:<br />"; | |||
$lists = GetUrlFromListRule($regxurl, '', $startid, $endid, $addv); | |||
foreach ($lists as $surl) { | |||
$msg .= $surl[0] . "<br />\r\n"; | |||
} | |||
} | |||
$wintitle = "采集管理-测试匹配规则"; | |||
$wecome_info = "<a href='co_main.php'>采集管理</a>::测试匹配列表网址规则"; | |||
$win = new OxWindow(); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand"); | |||
$win->Display(); | |||
exit(); | |||
} | |||
//采集未下载内容 | |||
/*-------------------- | |||
function co_all() | |||
---------------------*/ else if ($dopost == "coall") { | |||
CheckPurview('co_PlayNote'); | |||
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` "); | |||
$totalnum = $mrow['dd']; | |||
if ($totalnum == 0) { | |||
ShowMsg("没发现可下载的内容!", "-1"); | |||
exit(); | |||
} | |||
$wintitle = "采集管理-采集未下载内容"; | |||
$wecome_info = "<a href='co_main.php'>采集管理</a>::采集未下载内容"; | |||
$win = new OxWindow(); | |||
$win->Init("co_gather_start_action.php", "js/blank.js", "GET"); | |||
$win->AddHidden('startdd', '0'); | |||
$win->AddHidden('pagesize', '5'); | |||
$win->AddHidden('sptime', '0'); | |||
$win->AddHidden('nid', '0'); | |||
$win->AddHidden('totalnum', $totalnum); | |||
$win->AddMsgItem("本操作会检测并下载‘<a href='co_url.php'><u>临时内容</u></a>’中所有未下载的内容,是否继续?"); | |||
$winform = $win->GetWindow("ok"); | |||
$win->Display(); | |||
exit(); | |||
} |
@@ -1,144 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集规则编辑 | |||
* | |||
* @version $Id: co_edit.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . '/config.php'); | |||
CheckPurview('co_EditNote'); | |||
require_once(DEDEINC . '/dedetag.class.php'); | |||
$nid = (isset($nid) ? intval($nid) : ''); | |||
if ($nid == '') { | |||
ShowMsg('参数无效!', '-1'); | |||
exit(); | |||
} | |||
if (empty($dopost)) $dopost = ''; | |||
/*---------------------- | |||
function _Save() | |||
----------------------*/ | |||
if ($dopost == 'save' || $dopost == 'saveandtest') { | |||
$usemore = (!isset($usemore) ? 0 : 1); | |||
$listconfig = "{dede:noteinfo notename=\\\"$notename\\\" channelid=\\\"$channelid\\\" macthtype=\\\"$macthtype\\\" | |||
refurl=\\\"$refurl\\\" sourcelang=\\\"$sourcelang\\\" cosort=\\\"$cosort\\\" | |||
isref=\\\"$isref\\\" exptime=\\\"$exptime\\\" usemore=\\\"$usemore\\\" /} | |||
{dede:listrule sourcetype=\\\"$sourcetype\\\" rssurl=\\\"$rssurl\\\" regxurl=\\\"$regxurl\\\" | |||
startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$urlrule\\\" musthas=\\\"$musthas\\\" | |||
nothas=\\\"$nothas\\\" listpic=\\\"$listpic\\\" usemore=\\\"$usemore\\\"} | |||
{dede:addurls}$addurls{/dede:addurls} | |||
{dede:batchrule}$batchrule{/dede:batchrule} | |||
{dede:regxrule}$regxrule{/dede:regxrule} | |||
{dede:areastart}$areastart{/dede:areastart} | |||
{dede:areaend}$areaend{/dede:areaend} | |||
{/dede:listrule}\r\n"; | |||
$itemconfig = "{dede:sppage sptype=\\'$sptype\\' srul=\\'$srul\\' erul=\\'$erul\\'}$sppage{/dede:sppage}\r\n"; | |||
$itemconfig .= "{dede:previewurl}$previewurl{/dede:previewurl}\r\n"; | |||
$itemconfig .= "{dede:keywordtrim}$keywordtrim{/dede:keywordtrim}\r\n"; | |||
$itemconfig .= "{dede:descriptiontrim}$descriptiontrim{/dede:descriptiontrim}\r\n"; | |||
$fs = explode(',', 'value,match,isunit,isdown,trim,function'); | |||
foreach ($fields as $field) { | |||
foreach ($fs as $f) { | |||
$GLOBALS[$f . '_' . $field] = (!isset($GLOBALS[$f . '_' . $field]) ? '' : $GLOBALS[$f . '_' . $field]); | |||
} | |||
$matchstr = $GLOBALS["match_" . $field]; | |||
$trimstr = $GLOBALS["trim_" . $field]; | |||
$trimstr = trim(str_replace(' ', '#n#', $trimstr)); | |||
$matchstr = trim(str_replace(' ', '#n#', $matchstr)); | |||
if ($trimstr != '' && !preg_match("#{dede:trim#isU", $trimstr)) { | |||
$trimstr = " {dede:trim}$trimstr{/dede:trim}\r\n"; | |||
} | |||
$itemconfig .= "{dede:item field=\\'" . $field . "\\' value=\\'" . $GLOBALS["value_" . $field] . "\\' isunit=\\'" . $GLOBALS["isunit_" . $field] . "\\' isdown=\\'" . $GLOBALS["isdown_" . $field] . "\\'} | |||
{dede:match}" . $matchstr . "{/dede:match} | |||
$trimstr | |||
{dede:function}" . $GLOBALS["function_" . $field] . "{/dede:function} | |||
{/dede:item}"; | |||
} | |||
$uptime = time(); | |||
if (empty($freq)) $freq = 1; | |||
if (empty($extypeid)) $extypeid = 0; | |||
if (empty($islisten)) $islisten = 0; | |||
$query = " UPDATE `#@__co_note` SET | |||
`channelid`='$channelid', | |||
`notename`='$notename', | |||
`sourcelang`='$sourcelang', | |||
`uptime`='$uptime', | |||
`isok`='1', | |||
`usemore`='$usemore', | |||
`listconfig`='$listconfig', | |||
`itemconfig`='$itemconfig' | |||
WHERE nid='$nid'; "; | |||
$rs = $dsql->ExecuteNoneQuery($query); | |||
echo $dsql->GetError(); | |||
if ($donext == 'save') { | |||
ShowMsg("成功保存配置!", "co_main.php"); | |||
} else { | |||
require_once(dirname(__FILE__) . "/co_test_rule.php"); | |||
} | |||
exit(); | |||
} | |||
$arr = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'"); | |||
//如果内容规则未设置,转到设置内容规则的表单 | |||
if (trim($arr['itemconfig']) == '') { | |||
$channelid = $arr['channelid']; | |||
$nid = $arr['nid']; | |||
if (!isset($previewurl)) $previewurl = ''; | |||
require_once(DEDEINC . '/dedetag.class.php'); | |||
require_once(DEDEADMIN . "/templets/co_add_step2.htm"); | |||
exit(); | |||
} | |||
$usemore = $arr['usemore']; | |||
$notename = $arr['notename']; | |||
$notes = array(); | |||
$dsql->FreeResult(); | |||
$dtp = new DedeTagParse(); | |||
$dtp2 = new DedeTagParse(); | |||
$dtp->LoadString($arr['listconfig'] . $arr['itemconfig']); | |||
$channelid = $arr['channelid']; | |||
$notes['keywordtrim'] = ''; | |||
$notes['descriptiontrim'] = ''; | |||
foreach ($dtp->CTags as $tid => $ctag) { | |||
if ($ctag->GetName() == 'item') { | |||
$f = $ctag->GetAtt('field'); | |||
$notes[$f]['item'] = $ctag; | |||
$dtp2->LoadString($ctag->GetInnerText()); | |||
$notes[$f]['trim'] = ''; | |||
foreach ($dtp2->CTags as $ctag2) { | |||
if ($ctag2->GetName() == 'trim') { | |||
$notes[$f]['trim'] .= "{dede:trim replace=\"" . $ctag2->GetAtt('replace') . "\"}" . $ctag2->GetInnerText() . "{/dede:trim}\r\n"; | |||
} else if ($ctag2->GetName() == 'match') { | |||
$notes[$f]['match'] = $ctag2->GetInnerText() . "\r\n"; | |||
} else if ($ctag2->GetName() == 'function') { | |||
$notes[$f]['function'] = $ctag2->GetInnerText() . "\r\n"; | |||
} | |||
} | |||
} else if ($ctag->GetName() == 'keywordtrim') { | |||
$notes['keywordtrim'] = $ctag->GetInnerText(); | |||
} else if ($ctag->GetName() == 'descriptiontrim') { | |||
$notes['descriptiontrim'] = $ctag->GetInnerText(); | |||
} else if ($ctag->GetName() == 'noteinfo') { | |||
$noteinfo = $ctag; | |||
} else if ($ctag->GetName() == 'listrule') { | |||
$listrule = $ctag; | |||
$dtp2->LoadString($ctag->GetInnerText()); | |||
$addurls = $dtp2->GetTagByName('addurls'); | |||
$regxrule = $dtp2->GetTagByName('regxrule'); | |||
$areastart = $dtp2->GetTagByName('areastart'); | |||
$areaend = $dtp2->GetTagByName('areaend'); | |||
$batchrule = $dtp2->GetTagByName('batchrule'); | |||
} else if ($ctag->GetName() == 'sppage') { | |||
$sppage = $ctag; | |||
} else if ($ctag->GetName() == 'previewurl') { | |||
$previewurl = trim($ctag->GetInnerText()); | |||
} | |||
} | |||
if (!isset($previewurl)) $previewurl = ''; | |||
require_once(DEDEADMIN . '/templets/co_edit.htm'); |
@@ -1,38 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集规则编辑-专家更改模式 | |||
* | |||
* @version $Id: co_edit_text.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require(dirname(__FILE__) . "/config.php"); | |||
CheckPurview('co_EditNote'); | |||
if (empty($job)) $job = ''; | |||
if ($job == '') { | |||
require_once(DEDEINC . "/oxwindow.class.php"); | |||
$wintitle = "更改采集规则"; | |||
$wecome_info = "<a href='co_main.php'><u>采集点管理</u></a>::更改采集规则 - 专家更改模式"; | |||
$win = new OxWindow(); | |||
$win->Init("co_edit_text.php", "js/blank.js", "POST"); | |||
$win->AddHidden("job", "yes"); | |||
$win->AddHidden("nid", $nid); | |||
$row = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid' "); | |||
$win->AddTitle("索引与基本信息配置:"); | |||
$win->AddMsgItem("<textarea name='listconfig' style='width:100%;height:200px'>{$row['listconfig']}</textarea>"); | |||
$win->AddTitle("字段配置:"); | |||
$win->AddMsgItem("<textarea name='itemconfig' style='width:100%;height:300px'>{$row['itemconfig']}</textarea>"); | |||
$winform = $win->GetWindow("ok"); | |||
$win->Display(); | |||
exit(); | |||
} else { | |||
CheckPurview('co_EditNote'); | |||
$query = "UPDATE `#@__co_note` SET listconfig='$listconfig',itemconfig='$itemconfig' WHERE nid='$nid' "; | |||
$rs = $dsql->ExecuteNoneQuery($query); | |||
ShowMsg("成功修改一个规则!", "co_main.php"); | |||
exit(); | |||
} |
@@ -1,248 +0,0 @@ | |||
<?php | |||
/** | |||
* 导出采集规则 | |||
* | |||
* @version $Id: co_edit_text.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
CheckPurview('co_Export'); | |||
if (empty($dopost)) $dopost = ''; | |||
if ($dopost != 'done') { | |||
require_once(DEDEADMIN . "/inc/inc_catalog_options.php"); | |||
$totalcc = $channelid = $usemore = 0; | |||
if (!empty($nid)) { | |||
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' "); | |||
$totalcc = $mrow['dd']; | |||
$rrow = $dsql->GetOne("SELECT channelid,usemore FROM `#@__co_note` WHERE nid='$nid' "); | |||
$channelid = $rrow['channelid']; | |||
$usemore = $rrow['usemore']; | |||
} else { | |||
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE isdown='1' "); | |||
$totalcc = $mrow['dd']; | |||
} | |||
include DedeInclude("templets/co_export.htm"); | |||
exit(); | |||
} else { | |||
require_once(DEDEINC . '/dedecollection.class.php'); | |||
$channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 0; | |||
$typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0; | |||
$pageno = isset($pageno) && is_numeric($pageno) ? $pageno : 1; | |||
$startid = isset($startid) && is_numeric($startid) ? $startid : 0; | |||
$endid = isset($endid) && is_numeric($endid) ? $endid : 0; | |||
if (!isset($makehtml)) $makehtml = 0; | |||
if (!isset($onlytitle)) $onlytitle = 0; | |||
if (!isset($usetitle)) $usetitle = 0; | |||
if (!isset($autotype)) $autotype = 0; | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
$orderway = (($co->noteInfos['cosort'] == 'desc' || $co->noteInfos['cosort'] == 'asc') ? $co->noteInfos['cosort'] : 'desc'); | |||
if ($channelid == 0 && $typeid == 0) { | |||
ShowMsg('请指定默认导出栏目或频道ID!', 'javascript:;'); | |||
exit(); | |||
} | |||
if ($channelid == 0) { | |||
$row = $dsql->GetOne("SELECT ch.* FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$typeid'; "); | |||
} else { | |||
$row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; "); | |||
} | |||
if (!is_array($row)) { | |||
echo "找不到频道内容模型信息,无法完成操作!"; | |||
exit(); | |||
} | |||
//分析规则,并生成临时的SQL语句 | |||
$channelid = $row['id']; | |||
$maintable = $row['maintable']; | |||
$addtable = $row['addtable']; | |||
if (empty($maintable)) $maintable = '#@__archives'; | |||
if (empty($addtable)) { | |||
echo "找不主表配置信息,无法完成操作!"; | |||
exit(); | |||
} | |||
$adminid = $cuserLogin->getUserID(); | |||
//微索引表 | |||
$indexSqlTemplate = "INSERT INTO `#@__arctiny`(`arcrank`,`typeid`,`channel`,`senddate`,`sortrank`) VALUES ('$arcrank','@typeid@' ,'$channelid','@senddate@', '@sortrank@'); "; | |||
//基本信息主表 | |||
$mainSqlTemplate = "INSERT INTO `$maintable`(id,typeid,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,description,keywords) | |||
VALUES ('@aid@','@typeid@','@sortrank@','@flag@','0','$channelid','$arcrank','0','0','@title@','','','@writer@','@source@','@litpic@','@pubdate@','@senddate@','$adminid','@description@','@keywords@'); "; | |||
//生成附加表插入的SQL语句 | |||
$inadd_f = $inadd_v = ''; | |||
$dtp = new DedeTagParse(); | |||
$dtp->SetNameSpace('field', '<', '>'); | |||
$dtp->LoadString($row['fieldset']); | |||
foreach ($dtp->CTags as $ctag) { | |||
$tname = $ctag->GetTagName(); | |||
$inadd_f .= ",`$tname`"; | |||
$notsend = $ctag->GetAtt('notsend'); | |||
$fieldtype = $ctag->GetAtt('type'); | |||
if ($notsend == 1) { | |||
//对不同类型设置默认值 | |||
if ($ctag->GetAtt('default') != '') { | |||
$dfvalue = $ctag->GetAtt('default'); | |||
} else if ($fieldtype == 'int' || $fieldtype == 'float' || $fieldtype == 'number') { | |||
$dfvalue = '0'; | |||
} else if ($fieldtype == 'dtime') { | |||
$dfvalue = time(); | |||
} else { | |||
$dfvalue = ''; | |||
} | |||
$inadd_v .= ",'$dfvalue'"; | |||
} else { | |||
$inadd_v .= ",'@$tname@'"; | |||
} | |||
} | |||
$addSqlTemplate = "INSERT INTO `{$addtable}`(`aid`,`typeid`{$inadd_f}) Values('@aid@','@typeid@'{$inadd_v})"; | |||
//导出数据的SQL操作 | |||
$dtp = new DedeTagParse(); | |||
$totalpage = $totalcc / $pagesize; | |||
$startdd = ($pageno - 1) * $pagesize; | |||
if (!empty($nid)) { | |||
$dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize"); | |||
} else { | |||
$dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize"); | |||
} | |||
$dsql->Execute(); | |||
while ($row = $dsql->GetObject()) { | |||
if (trim($row->result == '')) continue; | |||
//$addSqlTemplate,$mainSqlTemplate,$indexSqlTemplate | |||
$ntypeid = ($autotype == 1 && $row->typeid != 0) ? $row->typeid : $typeid; | |||
$indexSql = str_replace('@typeid@', $ntypeid, $indexSqlTemplate); | |||
$mainSql = str_replace('@typeid@', $ntypeid, $mainSqlTemplate); | |||
$addSql = str_replace('@typeid@', $ntypeid, $addSqlTemplate); | |||
$dtp->LoadString($row->result); | |||
$exid = $row->aid; | |||
if (!is_array($dtp->CTags)) continue; | |||
//获取时间和标题 | |||
$pubdate = $sortrank = time(); | |||
$title = $row->title; | |||
$litpic = ''; | |||
foreach ($dtp->CTags as $ctag) { | |||
$itemName = $ctag->GetAtt('name'); | |||
if ($itemName == 'title' && $usetitle == 0) { | |||
$title = trim($ctag->GetInnerText()); | |||
if ($title == '') { | |||
$title = $row->title; | |||
} | |||
} else if ($itemName == 'pubdate') { | |||
$pubdate = trim($ctag->GetInnerText()); | |||
if (preg_match("#[^0-9]#", $pubdate)) { | |||
$pubdate = $sortrank = GetMkTime($pubdate); | |||
} else { | |||
$pubdate = $sortrank = time(); | |||
} | |||
} else if ($itemName == 'litpic') { | |||
$litpic = trim($ctag->GetInnerText()); | |||
} | |||
} | |||
//检测重复标题 | |||
$title = addslashes($title); | |||
if ($onlytitle) { | |||
$testrow = $dsql->GetOne("SELECT COUNT(ID) AS dd FROM `$maintable` WHERE title LIKE '$title'"); | |||
if ($testrow['dd'] > 0) { | |||
echo "数据库已存在标题为: {$title} 的文档,程序阻止了此本条内容导入<br />\r\n"; | |||
continue; | |||
} | |||
} | |||
//替换固定的项目 | |||
$senddate = time(); | |||
$flag = ''; | |||
if ($litpic != '') $flag = 'p'; | |||
//随机推荐 | |||
if ($randcc > 0) { | |||
$rflag = mt_rand(1, $randcc); | |||
if ($rflag == $randcc) { | |||
$flag = ($flag == '' ? 'c' : $flag . ',c'); | |||
} | |||
} | |||
$indexSql = str_replace('@senddate@', $senddate, $indexSql); | |||
$indexSql = str_replace('@sortrank@', $sortrank, $indexSql); | |||
$mainSql = str_replace('@flag@', $flag, $mainSql); | |||
$mainSql = str_replace('@sortrank@', $sortrank, $mainSql); | |||
$mainSql = str_replace('@pubdate@', $pubdate, $mainSql); | |||
$mainSql = str_replace('@senddate@', $senddate, $mainSql); | |||
$mainSql = str_replace('@title@', cn_substr($title, $cfg_title_maxlen), $mainSql); | |||
//$mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql); 原来的语句,采集的文章导出到栏目后标题不全 | |||
$addSql = str_replace('@sortrank@', $sortrank, $addSql); | |||
$addSql = str_replace('@senddate@', $senddate, $addSql); | |||
//替换模型里的其它字段 | |||
foreach ($dtp->CTags as $ctag) { | |||
if ($ctag->GetName() != 'field') { | |||
continue; | |||
} | |||
$itemname = $ctag->GetAtt('name'); | |||
$itemvalue = addslashes(trim($ctag->GetInnerText())); | |||
$mainSql = str_replace("@$itemname@", $itemvalue, $mainSql); | |||
$addSql = str_replace("@$itemname@", $itemvalue, $addSql); | |||
} | |||
//插入数据库 | |||
$rs = $dsql->ExecuteNoneQuery($indexSql); | |||
if ($rs) { | |||
$aid = $dsql->GetLastID(); | |||
$mainSql = str_replace('@aid@', $aid, $mainSql); | |||
$addSql = str_replace('@aid@', $aid, $addSql); | |||
$mainSql = preg_replace("#@([a-z0-9]{1,})@#", '', $mainSql); | |||
$addSql = preg_replace("#@([a-z0-9]{1,})@#", '', $addSql); | |||
$rs = $dsql->ExecuteNoneQuery($mainSql); | |||
if (!$rs) { | |||
echo "导入 '$title' 时错误:" . $dsql->GetError() . "<br />"; | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' "); | |||
} else { | |||
$rs = $dsql->ExecuteNoneQuery($addSql); | |||
if (!$rs) { | |||
echo "导入 '$title' 时错误:" . $dsql->GetError() . "<br />"; | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' "); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `$maintable` WHERE id='$aid' "); | |||
} | |||
} | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET isexport=1 WHERE aid='$exid' "); | |||
} | |||
//检测是否完成或后续操作 | |||
if ($totalpage <= $pageno) { | |||
if ($channelid > 0 && $makehtml == 1) { | |||
if ($autotype == 0 && !empty($nid)) { | |||
$mhtml = "makehtml_archives_action.php?typeid=$typeid&startid=$startid&endid=$endid&pagesize=20"; | |||
ShowMsg("完成数据导入,准备生成文档HTML...", $mhtml); | |||
exit(); | |||
} else { | |||
ShowMsg("完成所有数据导入,请手工更新HTML!", "javascript:;"); | |||
exit(); | |||
} | |||
} else { | |||
ShowMsg("完成所有数据导入!", "javascript:;"); | |||
exit(); | |||
} | |||
} else { | |||
if ($totalpage > 0) { | |||
$rs = substr(($pageno / $totalpage * 100), 0, 2); | |||
} else { | |||
$rs = 100; | |||
} | |||
$pageno++; | |||
$gourl = "co_export.php?dopost=done&nid=$nid&totalcc=$totalcc&channelid=$channelid&pageno=$pageno"; | |||
$gourl .= "&nid=$nid&typeid=$typeid&autotype=$autotype&arcrank=$arcrank&pagesize=$pagesize&randcc=$randcc"; | |||
$gourl .= "&startid=$startid&endid=$endid&onlytitle=$onlytitle&usetitle=$usetitle&makehtml=$makehtml"; | |||
ShowMsg("完成 {$rs}% 导入,继续执行操作...", $gourl, '', 500); | |||
exit(); | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
<?php | |||
/** | |||
* 导出采集规则 | |||
* 统一转换为unicode编码然后再base64加密 | |||
* | |||
* @version $Id: co_export_corule.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require(dirname(__FILE__)."/config.php"); | |||
CheckPurview('co_EditNote'); | |||
require_once(DEDEINC."/oxwindow.class.php"); | |||
$nid = preg_replace('/[^0-9]/','',$nid); | |||
$row = $dsql->GetOne("Select * From `#@__co_note` where nid='$nid'"); | |||
$noteconfig = "{dede:listconfig}\r\n".$row['listconfig']."\r\n{/dede:listconfig}\r\n\r\n"; | |||
$noteconfig .= "{dede:itemconfig}\r\n".$row['itemconfig']."\r\n{/dede:itemconfig}"; | |||
if(empty($extype) || $extype=='base64') | |||
{ | |||
$noteconfig = "BASE64:".base64_encode($noteconfig).":END"; | |||
$exmsg = " <a href='co_export_corule.php?nid={$nid}&extype=text'>【导出为普通格式】</a> "; | |||
} | |||
else | |||
{ | |||
$exmsg = " <a href='co_export_corule.php?nid={$nid}&extype=base64'>【导出为Base64格式】</a> "; | |||
} | |||
$wintitle = "导出采集规则"; | |||
$wecome_info = "<a href='co_main.php'><u>采集节点管理</u></a>::导出采集规则 $exmsg"; | |||
$win = new OxWindow(); | |||
$win->Init(); | |||
$win->AddTitle("以下为规则 [{$row['notename']}] 的文本配置,你可以共享给你的朋友:"); | |||
$winform = $win->GetWindow("hand","<textarea name='config' style='width:100%;height:450px;word-wrap: break-word;word-break:break-all;'>".$noteconfig."</textarea>"); | |||
$win->Display(); |
@@ -1,31 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集指定节点 | |||
* | |||
* @version $Id: co_gather_start.php$ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/dedecollection.class.php"); | |||
if (!empty($nid)) { | |||
$ntitle = '采集指定节点:'; | |||
$nid = intval($nid); | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
$row = $dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'; "); | |||
if ($row['dd'] == 0) { | |||
$unum = "没有记录或从来没有采集过这个节点!"; | |||
} else { | |||
$unum = "共有 {$row['dd']} 个历史种子网址!<a href='javascript:SubmitNew();'>[<u>更新种子网址,并采集</u>]</a>"; | |||
} | |||
} else { | |||
$nid = ""; | |||
$row['dd'] = ""; | |||
$ntitle = '监控式采集:'; | |||
$unum = "没指定采集节点,将使用检测新内容采集模式!"; | |||
} | |||
include DedeInclude('templets/co_gather_start.htm'); |
@@ -1,71 +0,0 @@ | |||
<?php | |||
/** | |||
* 开始采集指定节点操作 | |||
* | |||
* @version $Id: co_gather_start_action.php$ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
CheckPurview('co_PlayNote'); | |||
require_once(DEDEINC . '/dedecollection.class.php'); | |||
if ($totalnum == 0) { | |||
ShowMsg('获取到的网址为零:可能是规则不对或没发现新内容!', 'javascript:;'); | |||
exit(); | |||
} | |||
if (!isset($oldstart)) $oldstart = $startdd; | |||
if (empty($notckpic)) $notckpic = 0; | |||
if ($totalnum > $startdd + $pagesize) $limitSql = " LIMIT $startdd,$pagesize "; | |||
else $limitSql = " LIMIT $startdd," . ($totalnum - $startdd); | |||
if ($totalnum - $startdd < 1) { | |||
if (empty($nid)) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; "); | |||
} else { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; "); | |||
} | |||
ShowMsg('完成当前下载任务!', 'javascript:;'); | |||
exit(); | |||
} | |||
$co = new DedeCollection(); | |||
if (!empty($nid)) $co->LoadNote($nid); | |||
//没指定采集ID时下载所有内容 | |||
if (!empty($nid)) { | |||
$dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` WHERE nid=$nid $limitSql "); | |||
} else { | |||
$dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` $limitSql "); | |||
} | |||
$dsql->Execute(99); | |||
$tjnum = $startdd; | |||
while ($row = $dsql->GetObject(99)) { | |||
if ($row->isdown == 0) { | |||
if (empty($nid)) $co->LoadNote($row->nid); | |||
$co->DownUrl($row->aid, $row->url, $row->litpic); | |||
} | |||
$tjnum++; | |||
if ($sptime > 0) sleep($sptime); | |||
} | |||
if ($totalnum - $oldstart != 0) { | |||
$tjlen = ceil((($tjnum - $oldstart) / ($totalnum - $oldstart)) * 100); | |||
$dvlen = $tjlen * 2; | |||
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>"; | |||
$tjsta .= "<br/>完成当前任务的:$tjlen %,继续执行任务..."; | |||
} | |||
if ($tjnum < $totalnum) { | |||
ShowMsg($tjsta, "co_gather_start_action.php?notckpic=$notckpic&sptime=$sptime&nid=$nid&oldstart=$oldstart&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize", "", 0); | |||
exit(); | |||
} else { | |||
if (empty($nid)) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; "); | |||
} else { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; "); | |||
} | |||
ShowMsg("完成当前下载任务!", "javascript:;"); | |||
exit(); | |||
} |
@@ -1,99 +0,0 @@ | |||
<?php | |||
/** | |||
* 导入采集规则 | |||
* | |||
* @version $Id: co_get_corule.php 1 17:13 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require(dirname(__FILE__)."/config.php"); | |||
CheckPurview('co_AddNote'); | |||
if(empty($job)) | |||
{ | |||
$job=''; | |||
} | |||
if($job=='') | |||
{ | |||
require_once(DEDEINC."/../include/oxwindow.class.php"); | |||
$wintitle = "导入采集规则"; | |||
$wecome_info = "<a href='co_main.php'><u>采集点管理</u></a>::导入采集规则"; | |||
$win = new OxWindow(); | |||
$win->Init("co_get_corule.php","js/blank.js","POST"); | |||
$win->AddHidden("job","yes"); | |||
$win->AddTitle("请在下面输入你要导入的文本配置:(建议用base64编码[支持不编码的规则,但不兼容旧版规则])"); | |||
$win->AddMsgItem("<textarea name='notes' style='width:100%;height:300px'></textarea>"); | |||
$winform = $win->GetWindow("ok"); | |||
$win->Display(); | |||
exit(); | |||
} | |||
else | |||
{ | |||
CheckPurview('co_AddNote'); | |||
require_once(DEDEINC."/dedetag.class.php"); | |||
$notes = trim($notes); | |||
//对Base64格式的规则进行解码 | |||
if(ereg('^BASE64:',$notes)) | |||
{ | |||
if(!ereg(':END$',$notes)) | |||
{ | |||
ShowMsg('该规则不合法,Base64格式的采集规则为:BASE64:base64编码后的配置:END !','-1'); | |||
exit(); | |||
} | |||
$notess = explode(':',$notes); | |||
$notes = $notess[1]; | |||
$notes = base64_decode(ereg_replace("[\r\n\t ]",'',$notes)) OR die('配置字符串有错误!'); | |||
} | |||
else | |||
{ | |||
$notes = stripslashes($notes); | |||
} | |||
$dtp = new DedeTagParse(); | |||
$dtp->LoadString($notes); | |||
if(!is_array($dtp->CTags)) | |||
{ | |||
ShowMsg('该规则不合法,无法导入!','-1'); | |||
exit(); | |||
} | |||
$ctag1 = $dtp->GetTagByName('listconfig'); | |||
$ctag2 = $dtp->GetTagByName('itemconfig'); | |||
$listconfig = $ctag1->GetInnerText(); | |||
$itemconfig = addslashes($ctag2->GetInnerText()); | |||
$dtp->LoadString($listconfig); | |||
$listconfig = addslashes($listconfig); | |||
$noteinfo = $dtp->GetTagByName('noteinfo'); | |||
if(!is_object($noteinfo)) | |||
{ | |||
ShowMsg("该规则不合法,无法导入!","-1"); | |||
exit(); | |||
} | |||
foreach($noteinfo->CAttribute->Items as $k=>$v) | |||
{ | |||
$$k = addslashes($v); | |||
} | |||
$uptime = time(); | |||
if(empty($freq)) | |||
{ | |||
$freq = 1; | |||
} | |||
if(empty($extypeid)) | |||
{ | |||
$extypeid = 0; | |||
} | |||
if(empty($islisten)) | |||
{ | |||
$islisten = 0; | |||
} | |||
$inquery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`usemore`,`listconfig`,`itemconfig`) | |||
VALUES ('$channelid','$notename','$sourcelang','$uptime','0','0','0','$usemore','$listconfig','$itemconfig'); "; | |||
$rs = $dsql->ExecuteNoneQuery($inquery); | |||
if(!$rs) | |||
{ | |||
ShowMsg("保存信息时出现错误!".$dsql->GetError(),"-1"); | |||
exit(); | |||
} | |||
ShowMsg("成功导入一个规则!","co_main.php"); | |||
exit(); | |||
} |
@@ -1,98 +0,0 @@ | |||
<?php | |||
/** | |||
* 下载种子网址中未下载内容模式 | |||
* | |||
* @version $Id: co_get_corule.php 1 17:13 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
CheckPurview('co_PlayNote'); | |||
require_once(DEDEINC . '/dedecollection.class.php'); | |||
if (empty($islisten)) $islisten = 0; | |||
if (empty($glstart)) $glstart = 0; | |||
if (empty($totalnum)) $totalnum = 0; | |||
if (empty($notckpic)) $notckpic = 0; | |||
$nid = (isset($nid) ? intval($nid) : 0); | |||
//下载种子网址中未下载内容模式 | |||
/*----------------------------- | |||
function Download_not_down() { } | |||
------------------------------*/ | |||
if ($islisten == 0) { | |||
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); | |||
$totalnum = $mrow['dd']; | |||
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; | |||
if ($totalnum <= 0) { | |||
ShowMsg("你指定的模式为:<font color='red'>[下载种子网址中未下载内容]</font>,<br />使用这个模式节点必须已经有种子网址,否则请使用其它模式!", "javascript:;"); | |||
exit(); | |||
} else { | |||
ShowMsg("检测节点正常,现转向网页采集...", $gurl . "&totalnum=$totalnum"); | |||
exit(); | |||
} | |||
} | |||
//监控式采集(检测新内容) | |||
/*----------------------------- | |||
function Download_new() { } | |||
------------------------------*/ else if ($islisten == 1) { | |||
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=1&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; | |||
$gurlList = "co_getsource_url_action.php?islisten=1&nid=0&pagesize=$pagesize&sptime=$sptime"; | |||
//针对专门节点 | |||
if (!empty($nid)) { | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
$limitList = $co->GetSourceUrl(1, 0, 100); | |||
$row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); | |||
$totalnum = $row['dd']; | |||
if ($totalnum == 0) { | |||
ShowMsg("在这节点中没发现有新内容....", "javascript:;"); | |||
exit(); | |||
} else { | |||
ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum"); | |||
exit(); | |||
} | |||
} | |||
//针对所有节点 | |||
else { | |||
$curpos = (isset($curpos) ? intval($curpos) : 0); | |||
$row = $dsql->GetOne("SELECT nid FROM `#@__co_note` ORDER BY nid ASC LIMIT $curpos,1"); | |||
$nnid = $row['nid']; | |||
if (!is_array($row)) { | |||
ShowMsg("完成所有节点检测....", "co_gather_start_action.php?notckpic=0&sptime=0&nid=0&startdd=0&pagesize=5&totalnum=" . $totalnum); | |||
exit(); | |||
} else { | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nnid); | |||
$limitList = $co->GetSourceUrl(1, 0, 100); | |||
$curpos++; | |||
ShowMsg("已检测节点( {$nnid} ),继续下一个节点...", $gurlList . "&curpos=$curpos"); | |||
exit(); | |||
} | |||
} | |||
} | |||
//重新下载所有内容模式 | |||
/*----------------------------- | |||
function Download_all() { } | |||
------------------------------*/ else { | |||
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; | |||
$gurlList = "co_getsource_url_action.php?islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
$limitList = $co->GetSourceUrl($islisten, $glstart, $pagesize); | |||
if ($limitList == 0) { | |||
$row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'"); | |||
$totalnum = $row['dd']; | |||
ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum"); | |||
exit(); | |||
} | |||
if ($limitList > 0) { | |||
ShowMsg("采集列表剩余:{$limitList} 个页面,继续采集...", $gurlList . "&glstart=" . ($glstart + $pagesize), 0, 100); | |||
exit(); | |||
} | |||
} |
@@ -1,32 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集规则管理 | |||
* | |||
* @version $Id: co_main.php 1 17:13 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/datalistcp.class.php"); | |||
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/"); | |||
$sql = "SELECT co.nid,co.channelid,co.notename,co.sourcelang,co.uptime,co.cotime,co.pnum,ch.typename"; | |||
$sql .= " FROM `#@__co_note` co LEFT JOIN `#@__channeltype` ch ON ch.id=co.channelid ORDER BY co.nid DESC"; | |||
$dlist = new DataListCP(); | |||
$dlist->SetTemplet(DEDEADMIN . "/templets/co_main.htm"); | |||
$dlist->SetSource($sql); | |||
$dlist->display(); | |||
function GetDatePage($mktime) | |||
{ | |||
return $mktime == '0' ? '从未采集过' : MyDate('Y-m-d', $mktime); | |||
} | |||
function TjUrlNum($nid) | |||
{ | |||
global $dsql; | |||
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); | |||
return $row['dd']; | |||
} |
@@ -1,18 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集规则测试 | |||
* | |||
* @version $Id: co_test_rule.php 1 17:13 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/dedecollection.class.php"); | |||
$nid = intval($nid); | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
include DedeInclude('templets/co_test_rule.htm'); | |||
exit(); |
@@ -1,57 +0,0 @@ | |||
<?php | |||
/** | |||
* 采集地址 | |||
* | |||
* @version $Id: co_url.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/datalistcp.class.php"); | |||
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/"); | |||
$where = ""; | |||
if (!isset($nid)) $nid = ""; | |||
if (!empty($nid)) $where = " where cu.nid='$nid' "; | |||
if (empty($small)) $small = 0; | |||
if ($nid != '') { | |||
$exportbt = " | |||
<input type='button' name='b0' value='导出内容' class='coolbg np' | |||
style='width:80px' onClick=\"location.href='co_export.php?nid=$nid';\" /> | |||
<input type='button' name='b0' value='采集本节点' class='coolbg np' | |||
style='width:80px' onClick=\"location.href='co_gather_start.php?nid=$nid';\" /> | |||
"; | |||
} else { | |||
$exportbt = ""; | |||
} | |||
$sql = "SELECT cu.aid,cu.nid,cu.isexport AS isex,cu.title,cu.url,cu.dtime,cu.isdown,cn.notename,tp.typename FROM `#@__co_htmls` cu | |||
LEFT JOIN `#@__co_note` cn ON cn.nid=cu.nid | |||
LEFT JOIN `#@__arctype` tp ON tp.id=cu.typeid | |||
$where ORDER BY cu.aid DESC"; | |||
$dlist = new DataListCP(); | |||
$dlist->SetParameter("nid", $nid); | |||
$dlist->SetParameter("small", $small); | |||
if ($small == 0) { | |||
$dlist->SetTemplate(DEDEADMIN . "/templets/co_url.htm"); | |||
} else { | |||
$dlist->SetTemplate(DEDEADMIN . "/templets/co_url_2.htm"); | |||
} | |||
$dlist->SetSource($sql); | |||
$dlist->display(); | |||
function IsDownLoad($isd) | |||
{ | |||
if ($isd == "0") return "未下载"; | |||
else return "已下载"; | |||
} | |||
function IsExData($isex) | |||
{ | |||
if ($isex == 0) return "未导出"; | |||
else return "已导出"; | |||
} |
@@ -1,56 +0,0 @@ | |||
<?php | |||
/** | |||
* @version $Id: co_url.php 1 14:31 2010年7月12日Z tianya $ | |||
* @package DedeBIZ.Administrator | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__) . "/config.php"); | |||
require_once(DEDEINC . "/dedecollection.class.php"); | |||
$backurl = isset($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : "co_url.php"; | |||
if (empty($action)) $action = ''; | |||
if ($aid == '') { | |||
ShowMsg('参数无效!', '-1'); | |||
exit(); | |||
} | |||
//保存更改 | |||
if ($action == "save") { | |||
$result = ''; | |||
for ($i = 0; $i < $endid; $i++) { | |||
$result .= "{dede:field name=\\'" . ${"noteid_$i"} . "\\'}" . ${"value_$i"} . "{/dede:field}\r\n"; | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET result='$result' WHERE aid='$aid'; "); | |||
ShowMsg("成功保存一条记录!", $backurl); | |||
exit(); | |||
} | |||
$dsql->SetSql("SELECT * FROM `#@__co_htmls` WHERE aid='$aid'"); | |||
$dsql->Execute(); | |||
$row = $dsql->GetObject(); | |||
$isdown = $row->isdown; | |||
$nid = $row->nid; | |||
$url = $row->url; | |||
$dtime = $row->dtime; | |||
$body = $row->result; | |||
$litpic = $row->litpic; | |||
$fields = array(); | |||
if ($isdown == 0) { | |||
$co = new DedeCollection(); | |||
$co->LoadNote($nid); | |||
$co->DownUrl($aid, $url, $litpic); | |||
$co->dsql->SetSql("SELECT * FROM `#@__co_htmls` WHERE aid='$aid'"); | |||
$co->dsql->Execute(); | |||
$row = $co->dsql->GetObject(); | |||
$isdown = $row->isdown; | |||
$nid = $row->nid; | |||
$url = $row->url; | |||
$dtime = $row->dtime; | |||
$body = $row->result; | |||
$litpic = $row->litpic; | |||
} | |||
$dtp = new DedeTagParse(); | |||
$dtp->SetNameSpace("dede", "{", "}"); | |||
$dtp->LoadString($body); | |||
include DedeInclude('templets/co_view.htm'); |
@@ -42,19 +42,6 @@ | |||
>a_MyCheck>审核我发布的文档 | |||
>a_Recycling>管理回收站 | |||
>>采集管理 | |||
>co_NewRule>管理数据规则模型 | |||
>co_Switch>导入外部数据 | |||
>co_AddNote>增加采集节点 | |||
>co_EditNote>修改采集节点 | |||
>co_PlayNote>采集数据 | |||
>co_ListNote>列出采集节点 | |||
>co_ViewNote>管理已下载内容 | |||
>co_Export>采集内容入库 | |||
>co_Del>删除采集节点 | |||
>co_GetOut>导入离线数据 | |||
>>模板管理 | |||
>temp_All>管理所有模板 | |||
@@ -461,46 +461,3 @@ $actionSearch[10] = array( | |||
), | |||
) | |||
); | |||
$actionSearch[11] = array( | |||
'toptitle' => '采集', | |||
'title' => '采集管理', | |||
'description' => '内容采集管理操作', | |||
'soniterm' => array( | |||
0 => array( | |||
'title' => '采集节点管理 ', | |||
'description' => '单个采集节点的管理页面,可以添加采集,导入,导出采集节点等', | |||
'purview' => 'co_ListNote', | |||
'linkurl' => 'co_main.php' | |||
), | |||
1 => array( | |||
'title' => '临时内容管理 ', | |||
'description' => '采集的临时内容存放处', | |||
'purview' => 'co_ViewNote', | |||
'linkurl' => 'co_url.php' | |||
), | |||
2 => array( | |||
'title' => '导入采集规则', | |||
'description' => '导入采集的规则', | |||
'purview' => 'co_GetOut', | |||
'linkurl' => 'co_get_corule.php' | |||
), | |||
3 => array( | |||
'title' => '智能标记向导', | |||
'description' => '可以根据需要生成相应的调用标签', | |||
'purview' => 'temp_Other', | |||
'linkurl' => 'mytag_tag_guide.php' | |||
), | |||
4 => array( | |||
'title' => '监控采集模式 ', | |||
'description' => '监控采集模式', | |||
'purview' => 'co_GetOut', | |||
'linkurl' => 'co_gather_start.php' | |||
), | |||
5 => array( | |||
'title' => '采集未下载内容 ', | |||
'description' => '采集没有下载完成的内容', | |||
'purview' => 'co_GetOut', | |||
'linkurl' => 'co_do.php?dopost=coall' | |||
), | |||
) | |||
); |
@@ -108,14 +108,6 @@ $menusMain = " | |||
$adminMenu1 | |||
<m:top item='3_' name='采集管理' display='none' rank='co_NewRule,co_ListNote,co_ViewNote,co_Switch,co_GetOut'> | |||
<m:item name='采集节点管理' link='co_main.php' rank='co_ListNote' target='main' /> | |||
<m:item name='临时内容管理' link='co_url.php' rank='co_ViewNote' target='main' /> | |||
<m:item name='导入采集规则' link='co_get_corule.php' rank='co_GetOut' target='main'/> | |||
<m:item name='监控采集模式' link='co_gather_start.php' rank='co_GetOut' target='main'/> | |||
<m:item name='采集未下载内容' link='co_do.php?dopost=coall' rank='co_GetOut' target='main'/> | |||
</m:top> | |||
<m:top item='1_3_3' name='批量维护' display='block'> | |||
<m:item name='更新系统缓存' link='sys_cache_up.php' rank='sys_ArcBatch' target='main' /> | |||
<m:item name='文档批量维护' link='content_batch_up.php' rank='sys_ArcBatch' target='main' /> | |||
@@ -60,14 +60,6 @@ $menusMain = " | |||
<m:item name='自定义表单' link='diy_main.php' rank='c_List' target='main' /> | |||
</m:top> | |||
<m:top mapitem='3' item='3_' name='采集管理' display='none' rank='co_NewRule,co_ListNote,co_ViewNote,co_Switch,co_GetOut'> | |||
<m:item name='采集节点管理' link='co_main.php' rank='co_ListNote' target='main' /> | |||
<m:item name='临时内容管理' link='co_url.php' rank='co_ViewNote' target='main' /> | |||
<m:item name='导入采集规则' link='co_get_corule.php' rank='co_GetOut' target='main'/> | |||
<m:item name='监控采集模式' link='co_gather_start.php' rank='co_GetOut' target='main'/> | |||
<m:item name='采集未下载内容' link='co_do.php?dopost=coall' rank='co_GetOut' target='main'/> | |||
</m:top> | |||
<m:top mapitem='3' item='1_3_3' name='批量维护' display='block'> | |||
<m:item name='更新系统缓存' link='sys_cache_up.php' rank='sys_ArcBatch' target='main' /> | |||
<m:item name='文档批量维护' link='content_batch_up.php' rank='sys_ArcBatch' target='main' /> | |||
@@ -1,38 +0,0 @@ | |||
<!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=<?php echo $cfg_soft_lang; ?>"> | |||
<title>选择内容模型</title> | |||
<link href="css/base.css" rel="stylesheet" type="text/css"> | |||
</head> | |||
<body background='images/allbg.gif' leftmargin='8' topmargin='8'> | |||
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center"> | |||
<form name="form1" action="co_add.php" method="get"> | |||
<input type='hidden' name='step' value='1' /> | |||
<tr> | |||
<td width="100%" height="28" colspan="3" background='images/tbg.gif' style="padding-left:10px;"><strong>选择内容模型</strong> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="34" colspan="3" bgcolor="#FFFFFF"> | |||
<select name="channelid" id="channelid" style="width:250px"> | |||
<?php | |||
$dsql->SetQuery("Select id,typename From `#@__channeltype` where id in(1,2) order by id asc "); | |||
$dsql->Execute(); | |||
while($row = $dsql->GetObject()) | |||
{ | |||
echo "<option value='{$row->id}'>{$row->typename}</option>\r\n"; | |||
} | |||
?> | |||
</select> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="24" colspan="3" bgcolor="#F9FCEF"> | |||
<input name="imageField" class="np" type="image" src="images/button_ok.gif" width="60" height="22" border="0"> | |||
</td> | |||
</tr> | |||
</form> | |||
</table> | |||
</body> | |||
</html> |
@@ -1,270 +0,0 @@ | |||
<!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=<?php echo $cfg_soft_lang; ?>"> | |||
<title>新增采集节点</title> | |||
<link href="css/base.css" rel="stylesheet" type="text/css" /> | |||
<script language="javascript" type="text/javascript" src="js/co.js"></script> | |||
<style type="text/css"> | |||
<!-- | |||
.STYLE2 { | |||
color: #666666 | |||
} | |||
--> | |||
</style> | |||
</head> | |||
<body> | |||
<div class="bodytitle" style="width:98%"> | |||
<div class="bodytitleleft"></div> | |||
<div class="bodytitletxt" style="padding-left:10px;"><b>新增采集节点:第一步设置基本信息及网址索引页规则</b></div> | |||
<div style='float:right;padding-right:6px;padding-top:3px'> | |||
<input type="button" name="b" value="返回节点管理页" class="coolbg np" style="width:110px;height:20px;" | |||
onclick="location.href='co_main.php';" /> | |||
</div> | |||
</div> | |||
<form name="form1" method="post" action="co_add.php"> | |||
<input type='hidden' name='channelid' value='<?php echo $channelid; ?>' /> | |||
<input type='hidden' name='step' value='2' /> | |||
<input type='hidden' name='dopost' value='test' /> | |||
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center"> | |||
<tr> | |||
<td background="images/tbg.gif" bgcolor="#F2F6E5"> | |||
<table width="400" border="0" cellspacing="0" cellpadding="0"> | |||
<tr class="top" onClick="showHide('sitem');" style="cursor:pointer"> | |||
<td width="26" align="center"><img src="images/file_tt.gif" width="7" height="8"></td> | |||
<td width="374"><b>节点基本信息</b><a name="d1"></a></td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr id="sitem"> | |||
<td bgcolor="#FFFFFF" width="100%"> | |||
<table width="100%" border="0" cellpadding="2" cellspacing="2"> | |||
<tr> | |||
<td width="18%" height="24">节点名称:</td> | |||
<td width="32%"><input name="notename" type="text" id="notename" style="width:250px" /></td> | |||
<td width="18%">目标页面编码:</td> | |||
<td width="32%"> | |||
<input type="radio" name="sourcelang" id='language1' class="np" value="gb2312" checked='1' /> | |||
GB2312 | |||
<input type="radio" name="sourcelang" id='language2' class="np" value="utf-8" /> | |||
UTF8 | |||
<input type="radio" name="sourcelang" id='language3' class="np" value="big5" /> | |||
BIG5 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="24">区域匹配模式:</td> | |||
<td> | |||
<input type="radio" class="np" name="macthtype" value="regex" /> | |||
正则表达式 | |||
<input name="macthtype" class="np" type="radio" value="string" checked='1' /> | |||
字符串 | |||
</td> | |||
<td>内容导入顺序:</td> | |||
<td> | |||
<input type="radio" name="cosort" id="cosort1" value="asc" class='np' checked='1' /> | |||
与目标站一致 | |||
<input type="radio" name="cosort" id="cosort2" class='np' value="desc" /> | |||
与目标站相反 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="24" colspan="4" bgcolor="#FBFCE2"><img src="images/file_tt.gif" width="7" | |||
height="8" />以下选项仅在开启防盗链模式才需设定,如果目标网站没有防盗链功能请不要开启,否则会降低采集速度。</td> | |||
</tr> | |||
<tr> | |||
<td height="24">防盗链模式:</td> | |||
<td> | |||
<input name="isref" type="radio" class="np" value="no" checked='1' /> | |||
不开启 | |||
<input name="isref" type="radio" class="np" value="yes" /> | |||
开启 | |||
</td> | |||
<td>资源下载超时时间:</td> | |||
<td> | |||
<input name="exptime" type="text" id="exptime" value="10" size="3" />秒 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="24">引用网址:</td> | |||
<td colspan="3"> | |||
<input name="refurl" type="text" id="refurl" value="http://" size="30" style='width:250px' /> | |||
(一般为目标网站其中一个文章页的网址) | |||
</td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td background="images/tbg.gif" bgcolor="#F2F6E5"> | |||
<table width="400" border="0" cellspacing="0" cellpadding="0"> | |||
<tr class="top" onClick="showHide('slist');" style="cursor:pointer"> | |||
<td width="26" align="center"><img src="images/file_tt.gif" width="7" height="8"></td> | |||
<td width="374"><b>列表网址获取规则</b></td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr id="slist"> | |||
<td bgcolor="#FFFFFF"> | |||
<table width="100%" border="0"> | |||
<tr> | |||
<td width="18%" height="24">来源属性:</td> | |||
<td> | |||
<input type="radio" name="sourcetype" id="source1" class='np' onclick="selSourceSet()" value="batch" | |||
checked="checked" /> | |||
批量生成列表网址 | |||
<input type="radio" name="sourcetype" id="source2" class='np' onclick="selSourceSet()" value="hand" /> | |||
手工指定列表网址 | |||
<input type="radio" name="sourcetype" id="source3" class='np' onclick="selSourceSet()" value="rss" /> | |||
从RSS中获取 | |||
</td> | |||
</tr> | |||
<tr bgcolor="#F7FCB4" id="rssset" style="display:none"> | |||
<td height="24" bgcolor="#F4FCCB">RSS网址:</td> | |||
<td bgcolor="#F4FCCB"> | |||
<input type="text" name="rssurl" id="rssurl" style="width:350px" value="http://" /> | |||
<input type="button" name="btv2" id="btv2" value="测试" onclick="testRss()" /> | |||
</td> | |||
</tr> | |||
<tr bgcolor="#FBFCE2" id="batchset"> | |||
<td height="77">批量生成地址设置:</td> | |||
<td> | |||
<table width="90%"> | |||
<tr> | |||
<td width="100%" colspan="2"> | |||
匹配网址: | |||
<input type="text" name="regxurl" id="regxurl" style="width:350px" value="http://" /> | |||
<input type="button" name="btv1" id="btv1" value="测试" onclick="testRegx()" /> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td colspan="2"> | |||
<span | |||
class="STYLE2">(如:http://wwws.dedebiz.com/html/test/list_(*).html,如果不能匹配所有网址,可以在手工指定网址的地方输入要追加的网址) | |||
</span> </td> | |||
</tr> | |||
<tr> | |||
<td colspan="2"> | |||
(*)从 | |||
<input type="text" name="startid" id="startid" style="width:30px" value="1" /> | |||
到 | |||
<input type="text" name="endid" id="endid" style="width:30px" value="" /> | |||
(页码或规律数字) | |||
每页递增: | |||
<input type="text" name="addv" id="addv" style="width:30px" value="1" /> | |||
<input type="checkbox" name="usemore" id="usemore" class="np" value="1" onClick="testMore()" /> | |||
启用多栏目通配(#) | |||
</td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr id='handset'> | |||
<td height="171">手工指定网址:<br /> | |||
<span class="STYLE2">在指定了通配规则后有些不能匹配的网址也可以在这里指定。</span><br /></td> | |||
<td><textarea name="addurls" id="addurls" cols="45" rows="5" style="width:80%;height:160px"></textarea> | |||
</td> | |||
</tr> | |||
<tr id='usemoretr' style="display:none"> | |||
<td height="171">多栏目通配规则:<br /> | |||
<span class="STYLE2"> | |||
如果目标网站使用单一模板,可以在匹配网址中用"(#)"表示近似网址的差异,然后在通配规则中设定集合,并且可以指定导出栏目。 | |||
</span> | |||
<br /> | |||
</td> | |||
<td> | |||
<textarea name="batchrule" id="batchrule" cols="45" rows="5" style="width:80%;height:160px"></textarea> | |||
<br /><span style='color:#666666'>格式为:“[(#)=通配字符串; (*)=num-num; typeid=num]换行” | |||
<br />例如:[(#)=>labs/list_3; (*)=>1-25; typeid=>7] 匹配网址:http://www.aaa.com/(#)_(*).html</span> | |||
</td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td background="images/tbg.gif" bgcolor="#F2F6E5"> | |||
<table width="400" border="0" cellspacing="0" cellpadding="0"> | |||
<tr class="top" onClick="showHide('arturl');" style="cursor:pointer"> | |||
<td width="26" align="center"><img src="images/file_tt.gif" width="7" height="8"></td> | |||
<td width="374"><b>文章网址匹配规则</b></td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr id="arturl"> | |||
<td height="76" valign="top" bgcolor="#FFFFFF"> | |||
<table width="100%"> | |||
<!-- //使用与正则匹配链接模式不大稳定,也不适合初级用户,暂时作为保留项 --> | |||
<tr style='display:none'> | |||
<td width="18%">内容网址匹配模式:</td> | |||
<td width="82%"> | |||
<input name="urlrule" type="radio" class="np" id="urlrule1" value="area" onclick="selUrlRuleSet()" | |||
checked="checked" /> | |||
指定包含有文章网址的区域(可以获取区域的网址、标题、图片等信息) | |||
<input type="radio" name="urlrule" id="urlrule2" value="regx" onclick="selUrlRuleSet()" class="np" /> | |||
指定网址正则表达式(仅能获得网址信息) </td> | |||
</tr> | |||
<tr id="regxruletr" style='display:none'> | |||
<td height="84">网址的正则表达式:</td> | |||
<td><textarea name="regxrule" id="regxrule" cols="45" rows="5" style="width:80%;height:60px"></textarea> | |||
</td> | |||
</tr> | |||
<tr id="arearuletr"> | |||
<td height="84">包含有文章网址的区域设置:</td> | |||
<td> | |||
<table width="90%"> | |||
<tr> | |||
<td width="22%" align="center">区域开始的HTML:</td> | |||
<td width="78%"> | |||
<textarea name="areastart" id="areastart" cols="45" rows="5" | |||
style="width:80%;height:60px"></textarea> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td align="center">区域结束的HTML:</td> | |||
<td> | |||
<textarea name="areaend" id="areaend" cols="45" rows="5" style="width:80%;height:60px"></textarea> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td align="center">如果链接中含有图片:</td> | |||
<td> | |||
<input name="listpic" type="radio" class='np' id="listpic1" value="0" /> | |||
不处理 | |||
<input type="radio" name="listpic" id="listpic2" class='np' value="1" checked="checked" /> | |||
采集为缩略图 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td rowspan="2" align="center">对区域网址进行再次筛选:<br /> | |||
(使用正则表达式)</td> | |||
<td>必须包含: | |||
<input type="text" name="musthas" id="musthas" style="width:280px" /> | |||
(优先级高于后者)</td> | |||
</tr> | |||
<tr> | |||
<td>不能包含: | |||
<input type="text" name="nothas" id="nothas" style="width:280px" /></td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="94" align="center" bgcolor="#FFFFFF"> | |||
<input type="submit" name="b12" value="保存信息并进入下一步设置" class="coolbg np" style="width:200px" /> </td> | |||
</tr> | |||
</table> | |||
</form> | |||
</body> | |||
</html> |
@@ -1,77 +0,0 @@ | |||
<!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=<?php echo $cfg_soft_lang; ?>"> | |||
<title>采集节点测试</title> | |||
<link href="css/base.css" rel="stylesheet" type="text/css" /> | |||
<script language="javascript" type="text/javascript" src="js/co.js"></script> | |||
<style type="text/css"> | |||
<!-- | |||
.STYLE2 {color: #666666} | |||
--> | |||
</style> | |||
</head> | |||
<body> | |||
<div class="bodytitle" style="width:98%"> | |||
<div class="bodytitleleft"></div> | |||
<div class="bodytitletxt" style="padding-left:10px;"><b>新增采集节点:测试基本信息及网址索引页规则设置</b></div> | |||
<div style='float:right;padding-right:6px;padding-top:3px'> | |||
<input type="button" name="b" value="返回节点管理页" class="coolbg np" style="width:110px;height:20px;" onclick="location.href='co_main.php';" /> | |||
</div> | |||
</div> | |||
<form name="form1" method="post" action="co_add.php"> | |||
<input type='hidden' name='channelid' value='<?php echo $channelid; ?>' /> | |||
<input type='hidden' name='step' value='2' /> | |||
<input type='hidden' name='dopost' value='preview' /> | |||
<input type='hidden' name='notename' value="<?php echo $notename; ?>" /> | |||
<input type='hidden' name='sourcelang' value="<?php echo $sourcelang; ?>" /> | |||
<input type='hidden' name='usemore' value="<?php echo $usemore; ?>" /> | |||
<input type='hidden' name='islisten' value="<?php echo $islisten; ?>" /> | |||
<input type='hidden' name='listenpage' value="<?php echo $listenpage; ?>" /> | |||
<input type='hidden' name='freq' value="<?php echo $freq; ?>" /> | |||
<input type='hidden' name='extypeid' value="<?php echo $extypeid; ?>" /> | |||
<input type='hidden' name='listconfig' value="<?php echo urlencode($listconfig); ?>" /> | |||
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center"> | |||
<tr> | |||
<td height="25" background="images/tbg.gif" bgcolor="#F2F6E5" style="padding-left:10px;"><strong>网址获取规则测试:</strong></td> | |||
</tr> | |||
<tr> | |||
<td height="26" bgcolor="#FFFFFF"> | |||
测试的列表网址:<?php echo $demopage; ?> | |||
</td> | |||
</tr> | |||
<tr id="sitem"> | |||
<td height="23" bgcolor="#ffffff"> | |||
获得的文章网址(只显示前十条):<br /> | |||
<?php | |||
if(isset($links[0])) | |||
{ | |||
$i = 1; | |||
foreach($links as $arr) | |||
{ | |||
if($i==1) echo "<input type='hidden' name='previewurl' value=\"{$arr['link']}\" />\r\n"; | |||
if($arr['image'] != '') $arr['image'] = "<img src='{$arr['image']}' />\r\n"; | |||
echo "<hr />"; | |||
echo "网址: <a href='{$arr['link']}' target='_blank'>{$arr['link']}</a><br />\r\n标题: {$arr['title']}<br />\r\n图片: {$arr['image']}\r\n"; | |||
$i++; | |||
if($i>10) break; | |||
} | |||
} | |||
else | |||
{ | |||
echo $errmsg; | |||
} | |||
?> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="94" align="center" bgcolor="#FFFFFF"> | |||
<input type="button" name="b2" value="返回上一步进行修改" class="coolbg np" onclick="history.go(-1);" style="width:200px" /> | |||
| |||
<input type="submit" name="b12" value="保存信息并进入下一步设置" class="coolbg np" style="width:200px" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</form> | |||
</body> | |||
</html> |
@@ -1,341 +0,0 @@ | |||
<!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=<?php echo $cfg_soft_lang; ?>"> | |||
<script language="javascript" type="text/javascript" src="js/co.js"></script> | |||
<title>新增采集节点</title> | |||
<link href="css/base.css" rel="stylesheet" type="text/css"> | |||
<style type="text/css"> | |||
<!-- | |||
.STYLE1 { | |||
color: #660000; | |||
font-weight: bold; | |||
} | |||
.adline { | |||
border-bottom:1px solid #cdcdcd; | |||
} | |||
.autotb td{ | |||
padding-left:3px; | |||
} | |||
--> | |||
</style> | |||
</head> | |||
<body> | |||
<div class="bodytitle" style="width:98%"> | |||
<div class="bodytitleleft"></div> | |||
<div class="bodytitletxt" style="padding-left:10px;"><b>新增采集节点:第二步设置内容字段获取规则</b></div> | |||
</div> | |||
<form name="form1" method="post" action="co_add.php"> | |||
<input type='hidden' name='nid' value='<?php echo $nid; ?>' /> | |||
<input type='hidden' name='channelid' value='<?php echo $channelid; ?>' /> | |||
<input type='hidden' name='step' value='5' /> | |||
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center"> | |||
<tr> | |||
<td background="images/tbg.gif" bgcolor="#F2F6E5"> | |||
<table width="400" border="0" cellspacing="0" cellpadding="0"> | |||
<tr class="top" onClick="showHide('sart');" style="cursor:pointer"> | |||
<td width="26" align="center"><img src="images/file_tt.gif" width="7" height="8"></td> | |||
<td width="374"><b>网页内容获取规则</b></td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr id="sart"> | |||
<td height="113" valign="top" bgcolor="#FFFFFF"> | |||
<table width="100%" border="0" cellspacing="0" cellpadding="0"> | |||
<tr id='achelp' style="display:none"> | |||
<td height="60" colspan="3">1、匹配规则:在匹配区域规则中,规则一般为“<font color="#FF0000">起始无重复HTML</font><span class="STYLE1">[内容]</span><font color="#FF0000">结尾无重复HTML</font>”(普通匹配,非正则)。<br/> | |||
2、字段值:如果指定的字段没有指定区域匹配规则,用这个值作为默认值。<br /> | |||
3、过滤规则:如果有多个规则,用<br /><font color='#6B7360'> | |||
{dede:trim replace=""}规则一{/dede:trim}<br /> | |||
{dede:trim replace=""}规则二{/dede:trim}<br /> | |||
...</font>表示,如果要替换成指定的值,在 replace=""里设置即可 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="35">预览网址:</td> | |||
<td><input type="text" name="previewurl" id="previewurl" style="width:90%" value="<?php echo $previewurl; ?>" /></td> | |||
<td> </td> | |||
</tr> | |||
<tr> | |||
<td width="18%" height="60"><a href="#" onclick="showHide('achelp')"><img src="images/help.gif" width="16" height="16" /></a>内容分页导航所在的区域匹配规则:<br/></td> | |||
<td><textarea name="sppage" rows="3" id="sppage" style="width:90%"></textarea></td> | |||
<td width="37%"> | |||
<input name="sptype" type="radio" value="full" class="np" checked='1' /> | |||
全部列出的分页列表<br/> | |||
<input type="radio" name="sptype" class="np" value="next" /> | |||
上下页形式或不完整的分页列表 | |||
<br /> | |||
<input type="radio" name="sptype" class="np" value="diyrule"/> | |||
分页列表规则 开始: | |||
<input name="srul" type="text" value="1" size="4" /> | |||
结束: | |||
<input name="erul" type="text" value="5" size="4" /> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="35" colspan="3" bgcolor="#FBFCE2" id="dyrule">如果设定分页列表规则.可采用地址规则(正则),其中{p}是递增变量,从1开始每次增加1,例如:{path}{file}_{p}{ext}<br /> | |||
<strong>规则说明:{path}</strong>地址+目录 <strong>{file}</strong>文件 <strong>{ext}</strong>文件扩展名<strong>{p}</strong>分页列表数</td> | |||
</tr> | |||
<tr> | |||
<td height="24" colspan="3" bgcolor="#F9FCEF"> | |||
<strong>以下为固定的采集项目:</strong>(项目点击可展开/隐藏,内容摘要、关键字、缩略图系统会用正则进行自动匹配) | |||
</td> | |||
</tr> | |||
</table> | |||
<table width="100%" border="0" cellspacing="0" cellpadding="2"> | |||
<tr> | |||
<td width="50%" valign="top"> | |||
<table width="98%" border="0" cellspacing="0" cellpadding="0"> | |||
<tr> | |||
<td height="24"> | |||
<table width="100%" border="0" cellspacing="0" cellpadding="0"> | |||
<tr> | |||
<td width="18%" height="80">关键字过滤内容:</td> | |||
<td height="20" colspan="2"> | |||
<textarea name="keywordtrim" rows="4" id="keywordtrim" style="width:90%"></textarea> | |||
</td> | |||
</tr> | |||
</table></td> | |||
</tr> | |||
</table> | |||
</td> | |||
<td valign="top"> | |||
<table width="98%" border="0" cellspacing="0" cellpadding="0"> | |||
<tr> | |||
<td height="24"> | |||
<table width="100%" border="0" cellspacing="0" cellpadding="0"> | |||
<tr> | |||
<td width="18%" height="80">摘要过滤内容:</td> | |||
<td height="20" colspan="2"> | |||
<textarea name="descriptiontrim" rows="4" id="descriptiontrim" style="width:90%"></textarea> | |||
</td> | |||
</tr> | |||
</table></td> | |||
</tr> | |||
< |