Ejemplo n.º 1
0
 /**
  *  分析基本节点的及索引配置信息
  *
  * @access    public
  * @param     string  $configString  配置字符串
  * @return    void
  */
 function LoadListConfig($configString)
 {
     $dtp = new DedeTagParse();
     $dtp2 = new DedeTagParse();
     $dtp->LoadString($configString);
     for ($i = 0; $i <= $dtp->Count; $i++) {
         $ctag = $dtp->CTags[$i];
         //item 配置
         //节点基本信息
         if ($ctag->GetName() == "noteinfo") {
             $this->noteInfos['notename'] = $ctag->GetAtt('notename');
             $this->noteInfos['matchtype'] = $ctag->GetAtt('matchtype');
             $this->noteInfos['channelid'] = $ctag->GetAtt('channelid');
             $this->noteInfos['refurl'] = $ctag->GetAtt('refurl');
             $this->noteInfos['sourcelang'] = $ctag->GetAtt('sourcelang');
             $this->noteInfos['cosort'] = $ctag->GetAtt('cosort');
             $this->noteInfos['isref'] = $ctag->GetAtt('isref');
             $this->noteInfos['exptime'] = $ctag->GetAtt('exptime');
         } else {
             if ($ctag->GetName() == "listrule") {
                 $this->lists['sourcetype'] = $ctag->GetAtt('sourcetype');
                 $this->lists['rssurl'] = $ctag->GetAtt('rssurl');
                 $this->lists['regxurl'] = $ctag->GetAtt('regxurl');
                 $this->lists['startid'] = $ctag->GetAtt('startid');
                 $this->lists['endid'] = $ctag->GetAtt('endid');
                 $this->lists['addv'] = $ctag->GetAtt('addv');
                 $this->lists['urlrule'] = $ctag->GetAtt('urlrule');
                 $this->lists['musthas'] = $ctag->GetAtt('musthas');
                 $this->lists['nothas'] = $ctag->GetAtt('nothas');
                 $this->lists['listpic'] = $ctag->GetAtt('listpic');
                 $this->lists['usemore'] = $ctag->GetAtt('usemore');
                 $dtp2->LoadString($ctag->GetInnerText());
                 for ($j = 0; $j <= $dtp2->Count; $j++) {
                     $ctag2 = $dtp2->CTags[$j];
                     $tname = $ctag2->GetName();
                     if ($tname == 'addurls') {
                         $this->lists['addurls'] = trim($ctag2->GetInnerText());
                     } else {
                         if ($tname == 'regxrule') {
                             $this->lists['regxrule'] = trim($ctag2->GetInnerText());
                         } else {
                             if ($tname == 'areastart') {
                                 $this->lists['areastart'] = trim($ctag2->GetInnerText());
                             } else {
                                 if ($tname == 'areaend') {
                                     $this->lists['areaend'] = trim($ctag2->GetInnerText());
                                 } else {
                                     if ($tname == 'batchrule') {
                                         $this->lists['batchrule'] = trim($ctag2->GetInnerText());
                                     }
                                 }
                             }
                         }
                     }
                 }
                 //分析列表网址
                 if ($this->lists['sourcetype'] != 'rss') {
                     $this->lists['url'] = GetUrlFromListRule($this->lists['regxurl'], $this->lists['addurls'], $this->lists['startid'], $this->lists['endid'], $this->lists['addv'], $this->lists['usemore'], $this->lists['batchrule']);
                 } else {
                     $this->lists['url'] = $this->lists['rssurl'];
                 }
             }
         }
     }
     //End Loop
     $dtp->Clear();
     $dtp2->Clear();
 }
Ejemplo n.º 2
0
     $usemore = !isset($usemore) ? 0 : 1;
     $listconfig = "{dede:noteinfo notename=\\\"{$notename}\\\" channelid=\\\"{$channelid}\\\" macthtype=\\\"{$macthtype}\\\"\r\nrefurl=\\\"{$refurl}\\\" sourcelang=\\\"{$sourcelang}\\\" cosort=\\\"{$cosort}\\\" isref=\\\"{$isref}\\\" exptime=\\\"{$exptime}\\\" usemore=\\\"{$usemore}\\\" /}\r\n\r\n{dede:listrule sourcetype=\\\"{$sourcetype}\\\" rssurl=\\\"{$rssurl}\\\" regxurl=\\\"{$regxurl}\\\"\r\nstartid=\\\"{$startid}\\\" endid=\\\"{$endid}\\\" addv=\\\"{$addv}\\\" urlrule=\\\"{$urlrule}\\\"\r\n musthas=\\\"{$musthas}\\\" nothas=\\\"{$nothas}\\\" listpic=\\\"{$listpic}\\\" usemore=\\\"{$usemore}\\\"}\r\n\t{dede:addurls}{$addurls}{/dede:addurls}\r\n\t{dede:batchrule}{$batchrule}{/dede:batchrule}\r\n\t{dede:regxrule}{$regxrule}{/dede:regxrule}\r\n\t{dede:areastart}{$areastart}{/dede:areastart}\r\n\t{dede:areaend}{$areaend}{/dede:areaend}\r\n{/dede:listrule}\r\n";
     $tmplistconfig = stripslashes($listconfig);
     $notename = stripslashes($notename);
     if ($sourcetype == 'rss' && ($refurl = '')) {
         $refurl = $rssurl;
     }
     $refurl = stripslashes($refurl);
     $errmsg = '';
     //测试规则
     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}' ");
Ejemplo n.º 3
0
     $wecome_info = "<a href='co_main.php'>采集管理</a>::RSS地址测试";
     $win = new OxWindow();
     $win->AddMsgItem($msg);
     $winform = $win->GetWindow("hand");
     $win->Display();
     exit;
 } 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;
     } else {
         if ($dopost == "coall") {
             CheckPurview('co_PlayNote');
             $mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` ");