会员登录 | 注册

来去留技术信息资源

来去留技术信息资源
来去留网 > 去看信息 > 程序系统 > DEDECMS插件如何使用

DEDECMS插件如何使用

2012-04-20 22:03来源:未知发布者:laiquliu 查看:

根据指定的关键词自动抓取,自动分析筛选,自动伪原创,自动导入,自动生成________DEDE插件
当有用户访问你的网站时,触发程序运行,根据所设定的关键字通过搜索引擎(可以自定义)采集网址,然后自动抓取网页内容,
程序通过精确计算分析网页,丢弃掉不是文章内容页的网址,提取出优秀文章内容,最后进行伪原创,导入,生成,这一切操作程序都是全自动完成,
无需人工干预

DEDECMS插件  由http://www.6shell.com从网络收集整理,代码中的收费功能和网站链接均与本站无关。
刚建立http://www.liyigongsi.net/湖州美邦庆典网有感,分享一下啊。
承接网站建设,网站问题修改, 联系QQ593867062 手机 15943281437(请发短息,陌生人电话不接。理解万岁)





<module>
<baseinfo>
name=数据采集器
team=模板科技
time=2010-01-01
email=service@.cn
url=http://www.
hash=67a96a67973dca94b110ebd9f99ea80e
indexname=
indexurl=
ismember=0
autosetup=1
autodel=1
lang=gb2312
moduletype=soft
</baseinfo>
<systemfile>
<menustring>
<m:top name='数据增强采集器' c='6,' display='block' rank=''>
<m:item name='模块安装' link='auto_co_install.php' rank='' target='main' />
<m:item name='节点管理' link='auto_co_show.php' rank='' target='main' />
<m:item name='添加节点' link='auto_co_add.php' rank='' target='main' />
<m:item name='内容管理' link='auto_co_url.php' rank='' target='main' />
<m:item name='基本配置' link='auto_co_main.php' rank='' target='main' />
<m:item name='伪原创设置' link='auto_co_replace.php' rank='' target='main' />
</m:top>
</menustring>
<readme>
<p style='line-height:150%'>本模块由制作<br><br />
官方网站:http://www<br><br />
联系qq:565</p></readme>
<setupsql40>
DROP TABLE IF EXISTS `dede_auto_co_note`;
CREATE TABLE IF NOT EXISTS `dede_auto_co_note` (
  `nid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `notename` varchar(50) NOT NULL,
  `typeid` smallint(5) unsigned NOT NULL,
  `keyword` text,
  `isdown` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`nid`)
) TYPE=MyISAM;

DROP TABLE IF EXISTS `dede_auto_co_htmls`;
CREATE TABLE `dede_auto_co_htmls` (
  `aid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `nid` mediumint(8) unsigned NOT NULL,
  `typeid` smallint(5) unsigned NOT NULL,
  `title` varchar(60)  NOT NULL,
  `litpic` varchar(100) NOT NULL,
  `url` varchar(100) NOT NULL,
  `dtime` int(10) unsigned NOT NULL,
  `isdown` tinyint(1) unsigned NOT NULL,
  `isexport` tinyint(1) NOT NULL,
  `result` mediumtext,
  PRIMARY KEY (`aid`)
) TYPE=MyISAM;

DROP TABLE IF EXISTS `dede_auto_co_replace`;
CREATE TABLE `dede_auto_co_replace` (
  `id` int(11) NOT NULL auto_increment,
  `replace1` varchar(255) NOT NULL,
  `replace2` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;
</setupsql40>
<delsql>
DROP TABLE IF EXISTS `dede_auto_co_note`;
DROP TABLE IF EXISTS `dede_auto_co_htmls`;
DROP TABLE IF EXISTS `dede_auto_co_replace`;
</delsql>
<setup>

</setup>
<uninstall>

</uninstall>
<oldfilelist>
../include/auto_co.class.php
../include/auto_co.func.php
../include/auto_co_config.php
../plus/auto_co.php
templets/auto_co_add.htm
templets/auto_co_main.htm
templets/auto_co_show.htm
templets/auto_co_url.htm
templets/auto_co_install.htm
templets/auto_co_replace.htm
templets/auto_co_active_1.htm
templets/auto_co_active_2.htm
auto_co_main.php
auto_co_show.php
auto_co_url.php
auto_co_add.php
auto_co_install.php
auto_co_replace.php
auto_co_re.php
</oldfilelist>
</systemfile>

<modulefiles>
<file type='file' name='../include/auto_co.class.php'>
<?php
if(!defined('DEDEINC'))
{
    exit('dedecms');
}
require_once(DEDEINC."/dedehttpdown.class.php");
require_once(DEDEINC."/charset.func.php");
require_once(DEDEINC."/image.func.php");
require_once(DEDEINC."/dedehtml2.class.php");
require_once(DEDEINC."/arc.archives.class.php");

class Co_Collection
{
    var $tmpHtml = '';
    
    function __construct()
    {
        $this->dsql = $GLOBALS['dsql'];
        $this->cHttpDown = new DedeHttpDown();
        $this->cDedeHtml = new DedeHtml2();
    }

    function Co_Collection()
    {
        $this->__construct();
    }

    function DownUrl($aid,$dourl)
    {
        $this->tmpHtml = $this->DownOnePage($dourl);
        preg_match("/<title>(.*)<\/title>/isU",$this->tmpHtml,$titlearr);
        $title1 = explode('-',$titlearr[1]);
        $title2 = explode('_',$title1[0]);
        $title = trim(html2text($title2[0]));
        $body = $this->GetPageFields($dourl);
        if(AUTO_REPLACE == 'y')
        {
             $title = auto_replace($title);
             $body = auto_replace($body);
        }        
        if(empty($body) || strlen($title)<10)
        {
            $query = " Update `dede_auto_co_htmls` set title='0' ,dtime='".time()."',result='0',isdown='2',isexport='4' where aid='$aid' ";
        }
        else
        {
            $query = " Update `dede_auto_co_htmls` set title='$title' ,dtime='".time()."',result='".addslashes($body)."',isdown='1' where aid='$aid' ";
        }
        $this->dsql->ExecuteNoneQuery($query);
        return true;
    }

    function GetPageFields($dourl)
    {
        if($this->tmpHtml == '')
        {
            return '';
        }

       $c = preg_replace('/<script[\s\S]*?<\/script>/si','',$this->tmpHtml);   
       $c = preg_replace('/<style[\s\S]*?<\/style>/si','',$c);
       $c = preg_replace('/<form[\s\S]*?<\/form>/si','',$c);       
       $c = str_replace(array("\n","\r"),"",$c);
       $c = trim(strip_tags($c,'<img>,<div>,<a>,<p>,<br>,<span>,<li>'));

       preg_match_all('/([\s\S]*?)<.?div.*?>/si',$c,$t);
       foreach($t[1] as $k)
       {
           $count_li = substr_count($k,'</li>');
           $count_a = substr_count($k,'</a>');
           $k = preg_replace('/<a([^>]*)>(.*?)<\/a>/si','\\2',$k);
           if(strlen(Html2Text($k))>AUTO_TEXTLEN & $count_li<AUTO_LI & $count_a<AUTO_A )
           {
                $v .= $k;
           }
       }
       if(empty($v))
       {
          return;  
       }
       $v = $this->DownMedias($v,$dourl);
       $v = trim($v);
       
        global $cfg_auot_description;
        preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"]([^>]*)['\"]/isU",$this->tmpHtml,$inarr);
        preg_match("/<meta[\s]+content=['\"]([^>]*)['\"] name=['\"]?keywords['\"]/isU",$this->tmpHtml,$inarr2);
        if(!isset($inarr[1]) && isset($inarr2[1]))
        {
            $inarr[1] = $inarr2[1];
        }
        if(isset($inarr[1]))
        {
            $keywords = trim(cn_substr(html2text($inarr[1]),30));
            if(!ereg(',',$keywords))
            {
                $keywords = str_replace(' ',',',$keywords);
            }
            $artitem .= "{dede:field name='keywords'}".$keywords."{/dede:field}\r\n";
        }
        else
        {
            $artitem .= "{dede:field name='keywords'}{/dede:field}\r\n";
        }
        preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"]([^>]*)['\"]/isU",$this->tmpHtml,$inarr);
        preg_match("/<meta[\s]+content=['\"]([^>]*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2);

        if(!isset($inarr[1]) && isset($inarr2[1]))
        {
            $inarr[1] = $inarr2[1];
        }
        if(isset($inarr[1]))
        {
            $description = trim(cn_substr(html2text($inarr[1]),$cfg_auot_description));
            $artitem .= "{dede:field name='description'}".$description."{/dede:field}\r\n";
        }
        else
        {
            $description = trim(cn_substr(html2text($v),$cfg_auot_description));
            $artitem .= "{dede:field name='description'}".$description."{/dede:field}\r\n";
        }
       
        $artitem .= "{dede:field name='body'}$v{/dede:field}\r\n";
        if($litpic!='' && $this->lists['listpic']==1)
        {
            $artitem .= "{dede:field name='litpic'}".$this->DownMedia($litpic,'img',true)."{/dede:field}\r\n";
        }
        else
        {
            $artitem .= "{dede:field name='litpic'}".$this->breImage."{/dede:field}\r\n";
        }
       return $artitem;
    }
    
    //下载内容里的资源
    function DownMedias(&$html,$url)
    {
        $this->cDedeHtml->SetSource($html,$url,'media');

        //下载标记里的图片和flash
        foreach($this->cDedeHtml->Medias as $k=>$v)
        {
            $furl = $this->cDedeHtml->FillUrl($k);
            if($v=='embed' && !eregi("\.(swf)\?(.*)$",$k)&& !eregi("\.(swf)$",$k))
            {
                continue;
            }
            $okurl = $this->DownMedia($furl,$v);
            $html = str_replace($k,$okurl,$html);
        }

        foreach($this->cDedeHtml->Links as $v=>$k)
        {
            if(eregi("\.(jpg|gif|png)\?(.*)$",$v) || eregi("\.(jpg|gif|png)$",$v))
            {
                $m = "img";
            }
            else if(eregi("\.(swf)\?(.*)$",$v) || eregi("\.(swf)$",$v))
            {
                $m = "embed";
            }
            else
            {
                continue;
            }
            $furl = $this->cDedeHtml->FillUrl($v);
            $okurl = $this->DownMedia($furl,$m);
            $html = str_replace($v,$okurl,$html);
        }
        return $html;
    }

    function DownOnePage($dourl)
   {
       $this->cHttpDown->OpenUrl($dourl);
       $html = $this->cHttpDown->GetHtml();
       $this->cHttpDown->Close();
       $encode = mb_detect_encoding($html,array('GB2312','GBK','UTF-8'));    
       if ($encode == false) return '';
       if ($encode == "UTF-8")
       {
          $html = utf82gb($html);
       }
       return $html;
   }
   
    function DownMedia($dourl,$mtype='img',$islitpic=false)
    {        
            $filename = '';
            $filename = $this->GetRndName($dourl,$mtype);
            if(!ereg("^/",$filename))
            {
                $filename = "/".$filename;
            }

            $this->cHttpDown->OpenUrl($dourl);
            $this->cHttpDown->SaveToBin($GLOBALS['cfg_basedir'].$filename);
            $this->cHttpDown->Close();

        if(!file_exists($GLOBALS['cfg_basedir'].$filename))
        {
            return $dourl;
        }

        if($mtype=='img' && !$islitpic && $this->breImage=='')
        {
            $this->breImage = $filename;
            if(!eregi("^http://",$this->breImage) && file_exists($GLOBALS['cfg_basedir'].$filename))
            {
                $filenames = explode('/',$filename);
                $filenamed = $filenames[count($filenames)-1];
                $nfilename = str_replace('.','_lit.',$filenamed);
                $nfilename = str_replace($filenamed,$nfilename,$filename);
                if(@copy($GLOBALS['cfg_basedir'].$filename,$GLOBALS['cfg_basedir'].$nfilename))
                {
                    ImageResize($GLOBALS['cfg_basedir'].$nfilename,$GLOBALS['cfg_ddimg_width'],$GLOBALS['cfg_ddimg_height']);
                    $this->breImage = $nfilename;
                }
            }
        }
        if($mtype=='img' && !$islitpic)
        {
            @WaterImg($GLOBALS['cfg_basedir'].$filename,'collect');
        }
        return $filename;
    }

    //获得下载媒体的随机名称
    function GetRndName($url,$v)
    {
        global $cfg_image_dir,$cfg_dir_purview;
        $this->mediaCount++;
        $mnum = $this->mediaCount;
        $timedir = "c".MyDate("ymd",time());
        //存放路径
        $fullurl = preg_replace("/\/{1,}/","/",$cfg_image_dir."/");
        if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl"))
        {
            MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$cfg_dir_purview);
        }

        $fullurl = $fullurl.$timedir."/";
        if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl"))
        {
            MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$cfg_dir_purview);
        }

        //文件名称
        $timename = str_replace('.','',ExecTime());
        $threadnum = 0;
        if(isset($_GET['threadnum']))
        {
            $threadnum = intval($_GET['threadnum']);
        }
        $filename = dd2char($timename.$threadnum.'-'.$mnum.mt_rand(1000,9999));

        //分配扩展名
        $urls = explode('.',$url);
        if($v=='img')
        {
            $shortname = '.jpg';
            if(eregi("\.gif$",$url))
            {
                $shortname = '.gif';
            }
            else if(eregi("\.png$",$url))
            {
                $shortname = '.png';
            }
        }
        else if($v=='embed')
        {
            $shortname = '.swf';
        }
        else
        {
            $shortname = '';
        }
        $fullname = $fullurl.$filename.$shortname;
        return preg_replace("/\/{1,}/","/",$fullname);
    }

}


?>
</file>
<file type='file' name='../include/auto_co.func.php'>
<?php
if(!defined('DEDEINC'))
{
    exit('dedecms');
}
require_once(DEDEINC."/auto_co_config.php");

//兼容mb
if(!function_exists('mb_detect_encoding'))
{
    function mb_detect_encoding($html,$arr)
    {
       preg_match("/charset=(.*)['\"]/isU",$html,$inarr);
       $charset_list = array('GB2312','GBK','UTF-8');
       if(in_array(strtoupper($inarr[1]),$charset_list))
       {
            return strtoupper($inarr[1]);
       }
       else
       {
            return false;
       }
    }
}

function GetLinks($url)
{
    global $dsql;
    $row = $dsql->GetOne("Select *  From `dede_auto_co_note` order by rand()");
    $url=str_replace("(w)",$row[keyword],$url);
    $url=str_replace("(p)",$row[isdown]*10,$url);
    require_once(DEDEINC."/dedehttpdown.class.php");
    $dhd = new DedeHttpDown();
    $dhd->OpenUrl($url);
    $html = $dhd->GetHtml();
    $encode = mb_detect_encoding($html,array('GB2312','GBK','UTF-8'));    
    if ($encode == false) exit();
    if ($encode == "UTF-8")
    {
       $html = utf82gb($html);
    }
    
    preg_match_all("/href=[\"']([^\"']*)[\"']/si",$html,$info);
    if(!isset($info[1]))
    {
        return '';
    }
    $i =0;
    $ex_url = explode('.',$url);
    $ex_url2 = explode('/',$ex_url[1].'.'.$ex_url[2]);    
    foreach($info[1] as $k=>$v)
    {
        if(stristr($v,$ex_url2[0])==false & stristr($v,'http')==true & strlen($v)<100 & substr_count($v,'/')>3)
        {
           if(!is_array($dsql->GetOne("Select * From `dede_auto_co_htmls` where url='$v'")))
           {
              $inquery = "INSERT INTO `dede_auto_co_htmls` (`nid` ,`typeid`, `title` , `litpic` , `url` , `dtime` , `isdown` , `isexport` , `result`)
              VALUES ('$row[nid]' , '$row[typeid]', '0' , '0' , '$v' , '".time()."' , '0' , '0' , '0'); ";
              $dsql->ExecuteNoneQuery($inquery);
           }
        }
        
    }
    $nisdown = $row[isdown]+1;    
    if($nisdown > AUTO_NUM) $nisdown=0;
    $dsql->ExecuteNoneQuery("update `dede_auto_co_note` set isdown='$nisdown' where nid='$row[nid]' ");
    return true;
}

function Export($typeid)
{
    require_once(DEDEINC.'/dedecollection.class.php');
    require_once(DEDEINC."/arc.archives.class.php");    
    require_once(DEDEINC."/arc.partview.class.php");
    require_once(DEDEINC."/arc.listview.class.php");
    global $dsql;    
    $tyrow = $dsql->GetOne("Select ch.* From `dede_arctype` tp left join `dede_channeltype` ch on ch.id=tp.channeltype where tp.id='$typeid'; ");
    $channelid = $tyrow['id'];
    $maintable = $tyrow['maintable'];
    $addtable = $tyrow['addtable'];
    if(empty($channelid))
    {
        $dsql->ExecuteNoneQuery("update `dede_auto_co_htmls` set isexport='3' where typeid='$typeid' ");
    }    
    if(empty($maintable))
    {
        $maintable = 'dede_archives';
    }
    if(empty($addtable))
    {
        exit();
    }
    //微索引表
    $indexSqlTemplate = "INSERT INTO `dede_arctiny`(`arcrank`,`typeid`,`channel`,`senddate`,`sortrank`) VALUES ('0','@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@','1','$channelid','$arcrank','0','0','@title@','','','@writer@','@source@','@litpic@','@pubdate@','@senddate@','本站整理','@description@','@keywords@'); ";

    //生成附加表插入的SQL语句
    $inadd_f = $inadd_v = '';
    $dtp = new DedeTagParse();
    $dtp->SetNameSpace('field','<','>');
    $dtp->LoadString($tyrow['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})";
    
    $dtp = new DedeTagParse();
    $dsql->SetQuery("Select * From `dede_auto_co_htmls` where typeid='$typeid' AND isdown='1' AND isexport='0' ");
    $dsql->Execute();

    $archiveid = array();
    while($row = $dsql->GetObject())
    {
        if(trim($row->result==''))
        {
            continue;
        }
        
        $ntypeid = $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;
        $dsql->ExecuteNoneQuery("update `dede_auto_co_htmls` set isexport='1' where aid='$exid' ");
        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(ereg("[^0-9]",$pubdate))
                {
                    $pubdate = $sortrank = GetMkTime($pubdate);
                }
                else
                {
                    $pubdate = $sortrank = time();
                }
            }
            else if($itemName == 'litpic')
            {
                $litpic = trim($ctag->GetInnerText());
            }
        }

        //检测重复标题
        $title = addslashes($title);
        $testrow = $dsql->GetOne("Select count(ID) as dd From `$maintable` where title like '$title'");
        if($testrow['dd']>0)
        {
            $dsql->ExecuteNoneQuery("update `dede_auto_co_htmls` set isexport='2' where aid='$exid' ");
            continue;
        }

        //替换固定的项目
        $senddate = time();
        $flag = '';
        if($litpic!='')
        {
            $flag = 'p';
        }

        //随机推荐
        $rflag = mt_rand(1,20);
        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, 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 = ereg_replace('@([a-z0-9]{1,})@','',$mainSql);
            $addSql = ereg_replace('@([a-z0-9]{1,})@','',$addSql);
            $rs = $dsql->ExecuteNoneQuery($mainSql);
            if(!$rs)
            {
                $dsql->ExecuteNoneQuery("Delete From `dede_arctiny` where id='$aid' ");
            }
            else
            {
                $rs = $dsql->ExecuteNoneQuery($addSql);
                if(!$rs)
                {
                    $dsql->ExecuteNoneQuery("Delete From `dede_arctiny` where id='$aid' ");
                    $dsql->ExecuteNoneQuery("Delete From `$maintable` where id='$aid' ");
                }
            }
        }
        $archiveid[] = $aid;
    }
    foreach($archiveid as $value)
    {
        echo $value;
        $ac = new Archives($value);
        $rurl = $ac->MakeHtml(0);
        
    }    
    
    ob_start();
    $lv = new ListView($typeid);
    $reurl = $lv->MakeHtml(0,5);

    $homeFile = '../index.html';
    $row  = $dsql->GetOne("Select * From dede_homepageset");
    $templet = MfTemplet($row['templet']);
    $pv = new PartView();
    $GLOBALS['_arclistEnv'] = 'index';
    global $cfg_basedir,$cfg_templets_dir;
    $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
    $pv->SaveToHtml($homeFile);
    $pv->Close();
    ob_clean();
}

function auto_replace($str)
{
    $dsql = new DedeSql(false);
    $dsql->SetQuery("SELECT * FROM `dede_auto_co_replace`");
    $dsql->Execute();
    while ($row = $dsql->GetArray())
    {
          $str = str_replace($row['replace1'], "{replace1}", $str);
          $str = str_replace($row['replace2'], $row['replace1'], $str);
          $str = str_replace("{replace1}", $row['replace2'], $str);
    }
    return $str;
}

function time_lock()
{
    $temp_file = DEDEROOT.'/data/cache/time.lock';
    if(!file_exists($temp_file))
    {
        $fp = fopen($temp_file,'w');
        flock($fp,1);
        fwrite($fp,time());
        fclose($fp);
    }
    if(time()-@filemtime($temp_file)>AUTO_CTIME)
    {
       $fp = fopen($temp_file,'w');
       flock($fp,1);
       fwrite($fp,time());
       fclose($fp);
       return true;
    }
   return false;
}
?>
</file>
<file type='file' name='../include/auto_co_config.php'>
PD9waHANCmRlZmluZSgnQVVUT19DVElNRScsICcwJyk7DQpkZWZpbmUoJ0FVVE9fVVJMJywgJ2h0dHA6Ly93d3cuYmFpZHUuY29tL3M/d2Q9KHcpJnBuPShwKScpOw0KZGVmaW5lKCdBVVRPX05VTScsICc1MCcpOw0KZGVmaW5lKCdBVVRPX1RFWFRMRU4nLCAnNTAwJyk7DQpkZWZpbmUoJ0FVVE9fTEknLCAnMicpOw0KZGVmaW5lKCdBVVRPX0EnLCAnMTAnKTsNCmRlZmluZSgnQVVUT19SRVBMQUNFJywgJ3knKTsNCj8+
</file>
<file type='file' name='../plus/auto_co.php'>
<?php
/*****************华丽的分割线******************/
/*         无规则关键字采集伪原创插件          */
/*         来源:         */
/*         伪原创为付费服务 联系QQ:565        */
/*****************华丽的分割线******************/
define('DIR', ereg_replace("[/\\]{1,}", '/', dirname(__FILE__) ) );
require_once(DIR.'/../include/common.inc.php');
require_once(DEDEINC."/auto_co.func.php");
$islock = time_lock();
if($islock)
{
    $row = $dsql->GetOne("Select aid,url From `dede_auto_co_htmls` where isdown='0'");
    if(is_array($row))
    {
        require_once(DEDEINC."/auto_co.class.php");
        $co = new Co_Collection();
        $co->DownUrl($row['aid'],$row['url']);
        exit();
    }
    $Arow = $dsql->GetOne("Select typeid From `dede_auto_co_htmls` where isdown='1' AND isexport='0'");
    if(is_array($Arow))
    {
        $typeid = $Arow['typeid'];
        Export($typeid);
    }
    else
    {
        GetLinks(AUTO_URL);
    }
}
?>
</file>
<file type='file' name='templets/auto_co_add.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
  <form name="form1" action="auto_co_add.php" method="post">
   <input type='hidden' name='dopost' value='<?php echo $dopost?>'>
   <input type='hidden' name='nid' value='<?php echo $nid?>'>
    <tr>
      <td height="20" colspan="2" background="img/tbg.gif"> <b>&nbsp;<a href="auto_co_add.php"><u>数据增强采集器</u></a>
        &gt; 添加节点:</b> </td>
    </tr>
    <tr>
      <td width="19%" align="center" bgcolor="#FFFFFF">节点名称</td>
      <td width="81%" bgcolor="#FFFFFF">
          <input type='text' name='name' style='width:180px' value='<?php echo $row[notename]?>'>
      </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">所属栏目(id)</td>
      <td bgcolor="#FFFFFF">
          <input type='text' name='typeid' style='width:180px' value='<?php echo $row[typeid]?>'>
      </td>
    </tr>
     <tr>
      <td align="center" bgcolor="#FFFFFF">采集关键词<br />(只能填一个)</td>
      <td bgcolor="#FFFFFF">
          <textarea name="keyword" rows="3" id="menustring" style="width:60%"><?php echo $row[keyword]?></textarea>
      </td>
    </tr>
    <tr bgcolor="#F9FDF0">
      <td height="28" colspan="2">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="26%">&nbsp;</td>
            <td width="15%"><input name="imageField" class="np" type="image" src="img/button_ok.gif" width="60" height="22" border="0"></td>
            <td width="59%"><img src="img/button_back.gif" width="60" height="22" onClick="location='auto_co_add.php';" style="cursor:pointer"></td>
          </tr>
        </table>
        </td>
    </tr>
  </form>
</table>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_main.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器修改</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
  <form name="form1" action="auto_co_main.php" method="post">
   <input type='hidden' name='dopost' value='edit'>
    <tr>
      <td height="20" colspan="2" background="img/tbg.gif"> <b>&nbsp;<a href="auto_co_main.php"><u>数据增强采集器</u></a>
        &gt; 修改配置:</b> </td>
    </tr>
        <tr>
       <td colspan="2" align="center"  bgcolor="#F9FDF0"><strong>常规设置</strong></td>
    </tr>
    <tr>
      <td width="19%" align="center" bgcolor="#FFFFFF">间隔时间</td>
      <td width="81%" bgcolor="#FFFFFF">
          <input type='text' name='setings[auto_ctime]' style='width:180px' value='{dede:var.co_setings.auto_ctime/}'>
          <span style="color:#666">建议设在60-3600(秒)范围内</span></td>
    </tr>
<tr>
      <td align="center" bgcolor="#FFFFFF">采集深度</td>
      <td bgcolor="#FFFFFF">
          <input type='text' name='setings[auto_num]' style='width:180px' value='{dede:var.co_setings.auto_num/}'>
          <span style="color:#666">搜索引擎循环抓取页数,建议100内</span>
      </td>
    </tr>
    <tr>
       <td colspan="2" align="center"  bgcolor="#F9FDF0"><strong>高级设置</strong></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">搜索引擎</td>
      <td bgcolor="#FFFFFF">
        <span style="color:#666">搜索引擎配置:搜索词=>(w) 分页=(p)<br>
        如:http://www.google.com.hk/search?ie=gbk&q=(w)&start=(p)</span><br>
          <textarea name="setings[auto_url]" rows="2" id="menustring" style="width:80%">{dede:var.co_setings.auto_url/}</textarea>
      </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">片段最小长度</td>
      <td bgcolor="#FFFFFF">
        <input type='text' name='setings[auto_textlen]' style='width:180px' value='{dede:var.co_setings.auto_textlen/}'>
        <span style="color:#666">当一段连续内容字数小于设定值将被抛弃</span></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">li排除</td>
      <td bgcolor="#FFFFFF">
        <input type='text' name='setings[auto_li]' style='width:180px' value='{dede:var.co_setings.auto_li/}'>
        <span style="color:#666">当一段连续内容中li标签超过设定值时内容将被抛弃</span></td>
    </tr>
     <tr>
      <td align="center" bgcolor="#FFFFFF">链接排除</td>
      <td bgcolor="#FFFFFF">
        <input type='text' name='setings[auto_a]' style='width:180px' value='{dede:var.co_setings.auto_a/}'>
        <span style="color:#666">当一段连续内容中a标签超过设定值时内容将被抛弃</span> </td>
    </tr>
    <tr bgcolor="#F9FDF0">
      <td height="28" colspan="2">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="26%">&nbsp;</td>
            <td width="15%"><input name="imageField" class="np" type="image" src="img/button_ok.gif" width="60" height="22" border="0"></td>
            <td width="59%"><img src="img/button_back.gif" width="60" height="22" onClick="location='auto_co_main.php';" style="cursor:pointer"></td>
          </tr>
        </table>
        </td>
    </tr>
  </form>
</table>
  <br>
 &nbsp; 注:php一种服务器端脚本语言,php是不会自动运行的,插件的工作原理是每当有用户访问你的网站时,触发插件运行运行一次,执行的动作有:到搜索引擎采集网址、下载一个网页、分析网页内容是否符合要求、伪原创、把内容导入栏目、生成相应页面,所以最好的情况下并且设置间隔时间为0秒时,也要有6次访问才会采集到一篇文章,所有请不要来问我为什么采集不到文章了,不会就自己研究,不喜欢就卸载
</body>
</html>
</file>
<file type='file' name='templets/auto_co_show.htm'>
{dede:config.pagesize value="20"/}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>采集节点管理</title>
<script language="javascript" src="js/context_menu.js"></script>
<script language="javascript" src="js/ieemu.js"></script>
<script language="javascript">
if(moz) {
    extendEventObject();
    extendElementModel();
    emulateAttachEvent();
}
//编辑节点
function EditNote(nid)
{
  if(nid=="") nid = getOneItem();
  if(nid==""){ alert("请选择一个节点!"); return;}
  location.href = "auto_co_add.php?nid="+nid;
}
function DelNote(nid)
{
  if(nid=="") nid = getOneItem();
  if(nid==""){ alert("请选择一个节点!"); return;}
  location.href = "auto_co_add.php?dopost=del&nid="+nid;
}
//获得选中其中一个的id
function getOneItem()
{
    var allSel="";
    if(document.form1.nids.value) return document.form1.nids.value;
    for(i=0;i<document.form1.nids.length;i++)
    {
        if(document.form1.nids[i].checked)
        {
                allSel = document.form1.nids[i].value;
                break;
        }
    }
    return allSel;    
}
</script>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body background='img/allbg.gif' leftmargin='8' topmargin='8' onLoad="ContextMenu.intializeContextMenu()">
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA" align="center">
  <tr>
    <td height="20" colspan="7" background='img/tbg.gif'> <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><strong>数据增强采集节点管理:</strong></td>
        </tr>
      </table></td>
  </tr>
  <tr align="center" bgcolor="#FAFAF1">
    <td width="8%">选择</td>
    <td width="8%">编号</td>
    <td width="28%">节点名称</td>
    <td width="10%">所属栏目</td>
    <td width="28%" bgcolor="#FAFAF1">采集关键字</td>
    <td width="18%" bgcolor="#FAFAF1">采集状态</td>
  </tr>
  <form name="form1">
    {dede:datalist}
    <tr bgcolor="#FFFFFF" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';"
         onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" oncontextmenu="ShowMenu(event,this,{dede:field.nid /});">
      <td><input type='checkbox' name='nids' value='{dede:field.nid /}' class='np'></td>
      <td>{dede:field.nid /}</td>
      <td>{dede:field.notename /}</td>
      <td>{dede:field.typeid /}</td>
      <td>{dede:field.keyword /}</td>
      <td>{dede:field.isdown function='chkdown(@me)'/}</td>
    </tr>
    {/dede:datalist}
  </form>
  <tr bgcolor="#FAFAF1">
    <td height="24" colspan="7">
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>
              &nbsp;
              <a href="#" onClick="location='auto_co_add.php';" class='coolbg np'>增加新节点</a>
              <a href="javascript:EditNote('');" class='coolbg np'>更改</a>
            <a href="javascript:DelNote('');" class='coolbg np'>删除</a>
           </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr bgcolor="#FAFAF1">
    <td height="24" colspan="7" align="center">
        {dede:pagelist size='5' /}
    </td>
  </tr>
</table>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_url.htm'>
{dede:config.pagesize value="20"/}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>采集节点管理</title>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body background='img/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA" align="center">
  <tr>
    <td height="20" colspan="7" background='img/tbg.gif'> <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><strong>数据增强采集节点管理:</strong></td>
        </tr>
      </table></td>
  </tr>
  <tr align="center" bgcolor="#FAFAF1">
    <td width="25%">标题</td>  
    <td width="10%">栏目id</td>
    <td width="45%" bgcolor="#FAFAF1">采集地址</td>
    <td width="10%" bgcolor="#FAFAF1">下载</td>
    <td width="10%" bgcolor="#FAFAF1">导出</td>
  </tr>
    {dede:datalist}
    <tr bgcolor="#FFFFFF" align="center">
      <td>{dede:field.title function='chktitle(@me)' /}</td>
      <td>{dede:field.typeid /}</td>
      <td>{dede:field.url /}</td>
      <td>{dede:field.isdown function='chkdown(@me)'/}</td>
      <td>{dede:field.isexport function='chkexport(@me)'/}</td>
    </tr>
    {/dede:datalist}
 
  <tr bgcolor="#FAFAF1">
    <td height="24" colspan="7" align="center">
        {dede:pagelist size='5' /}
    </td>
  </tr>
</table>
<br>
<strong>&nbsp; 本列表仅提供查看,你无需进行任何操作,没有标题和已抛弃说明该网页不是内容页或者内容不符合要求以被自动筛选抛弃不予采集,该列表内容也无需删除,数据不会占用过多空间,系统需要保留记录,以避免重复采集</strong>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_install.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器安装</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
    <tr>
      <td height="20" background="img/tbg.gif"> <b>&nbsp;<a href="auto_co_main.php"><u>数据增强采集器</u></a>
        &gt; 模块安装:</b> </td>
    </tr>
        <tr>
       <td align="center"  bgcolor="#F9FDF0"><strong>模块安装</strong></td>
    </tr>
<tr>
      <td height="50" align="center" bgcolor="#FFFFFF"><a href="auto_co_install.php?action=install" class='coolbg np'>安装初始化</a></td>
    </tr>
    <tr>
       <td align="center"  bgcolor="#F9FDF0"><strong>模块卸载</strong></td>
    </tr>
     <tr>
      <td height="50" align="center" bgcolor="#FFFFFF"><a href="auto_co_install.php?action=uninstall" class='coolbg np'>一键卸载模块</a></td>
    </tr>
    <tr>
      <td height="25" bgcolor="#FFFFFF"><span style="color:#666">注:安装和卸载的作用是在模板index.htm内添加删除采集触发js代码,安装和卸载前建议先备份一下模板<br />
如果安装失败,请手工到模板内&lt;/body&gt;前添加
&lt;script src=&quot;plus/auto_co.php&quot;&gt;&lt;/script&gt;</span></td>
  </tr>
</table>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_replace.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器修改</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
  <form name="form1" action="auto_co_replace.php" method="post">
   <input type='hidden' name='dopost' value='save'>
    <tr>
      <td height="20" colspan="3" background="img/tbg.gif"> <b>&nbsp;<a href="auto_co_main.php"><u>数据增强采集器</u></a>
        &gt; 修改配置:</b> </td>
    </tr>
        
    <tr>
       <td colspan="3" align="center"  bgcolor="#F9FDF0"><strong>伪原创设置</strong></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF">是否开启伪原创功能:</td>
      <td bgcolor="#FFFFFF"  colspan="3">
     <?php
    $c1='';
    $c2 = '';
    AUTO_REPLACE=='y' ? $c1=" checked" : $c2=" checked";
    ?>
          <input name="isreplace" type="radio" value="y" <?php echo $c1?> />是
        <input name="isreplace" type="radio" value="n" <?php echo $c2?> />否
      </td>
    </tr>
    <tr>
      <td width="20%" align="right" bgcolor="#FFFFFF">同义词词库:</td>
      <td width="40%" bgcolor="#FFFFFF">
<textarea name="replace_text" cols="10" rows="20" id="menustring" style="width:100%">
<?php
echo $replace_text;
?>
</textarea>
      </td>
      <td width="40%" bgcolor="#FFFFFF"><span style="color:#666">每一对同义词一行,用','号分开<br /><br />不得出现除汉字和英文外特殊字符<br /><br />每一对同义词会自动互换替换,无需重复<br><br>温馨提示:<br />词条越多会导致消耗系统资源越大</span></td>
    </tr>
    <tr bgcolor="#F9FDF0">
      <td height="28" colspan="3">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="15%" align="center"><input name="imageField" class="np" type="image" src="img/button_ok.gif" width="60" height="22" border="0"></td>
          </tr>
        </table>
        </td>
    </tr>
  </form>
</table>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_active_1.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器安装</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
    <tr>
      <td height="20" background="img/tbg.gif"> <b>&nbsp;<a href="#"><u>数据增强采集器</u></a>
        &gt; 模块激活:</b> </td>
    </tr>
     <tr>
    <td height='30' class='dtb' bgcolor='#FCFE9C' colspan='2'>
    <b>模块说明:</b>伪原创为收费功能,激活需要支付19元费用,即可永久使用。激活与域名绑定,请直接在服务器上操作。</td>
  </tr>

        <tr>
       <td align="center"  bgcolor="#F9FDF0"><strong>伪原创激活</strong></td>
    </tr>
<tr>
      <td height="50" align="center" bgcolor="#FFFFFF"><a href="auto_co_replace.php?action=setting" class='coolbg np'>初始化功能</a></td>
    </tr>
</table>
</body>
</html>
</file>
<file type='file' name='templets/auto_co_active_2.htm'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级采集器安装</title>
<style type="text/css">
<!--
body {
    background-image: url(img/allbg.gif);
}
-->
</style>
<link href="img/base.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="8">
<table width="98%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
    <tr>
      <td height="20" background="img/tbg.gif"> <b>&nbsp;<a href="#"><u>数据增强采集器</u></a>
        &gt; 模块激活:</b> </td>
    </tr>
     <tr>
    <td height='30' class='dtb' bgcolor='#FCFE9C' colspan='2'>
    <b>模块说明:</b>伪原创为收费功能,激活需要支付19元费用,即可永久使用。激活与域名绑定,请直接在服务器上操作。</td>
  </tr>

        <tr>
       <td align="center"  bgcolor="#F9FDF0"><strong>在线支付(<span style="color:#F00">支付完成后刷新本页面即进入设置页面)</span></strong></td>
    </tr>
<tr>
      <td height="50" align="center" bgcolor="#FFFFFF">
      <div style="width:200px; margin:0 auto;">
      <?php
      echo $data;
      ?>
      </div>
      </td>
    </tr>
</table>
</body>
</html></file>
<file type='file' name='auto_co_main.php'>
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC.'/common.inc.php');
require_once(DEDEINC.'/dedetemplate.class.php');

$dopost = co_gpc('dopost','R');

$co = new auto_co($dopost);
class auto_co
{
    var $action;
    var $dtp;
    var $config;
    
    function __construct($ac = '')
    {
        $action = 'co_'.(empty($ac) ? 'show' : trim($ac));
        $this->dtp = new DedeTemplate();
        $this->config =  DEDEINC.'/auto_co_config.php';
        $this->$action();
        
    }
    
    function auto_co($ac = '')
    {
        $this->__construct($ac);
    }

    function co_show(){
        include_once($this->config);
        $co_setings=array('auto_ctime' => AUTO_CTIME,'auto_url' => AUTO_URL,'auto_num' => AUTO_NUM,'auto_textlen' => AUTO_TEXTLEN,'auto_li' => AUTO_LI,'auto_a' => AUTO_A,'auto_textlen' => AUTO_TEXTLEN);
        $this->dtp->Assign('co_setings',$co_setings);
        $this->dtp->LoadTemplate(DEDEADMIN.'/templets/auto_co_main.htm');
        $this->dtp->Display();
        exit();
    }

    function co_edit(){    
        $setings = co_gpc('setings','P');
        $fp = fopen($this->config, 'r');
        $content = fread($fp, filesize($this->config));
        $content = trim($content);
        $content = substr($content, -2) == '?>' ? substr($content, 0, -2) : $content;
        $content = strstr($content, '_|cfg_|GLOBALS') ? str_replace('_|cfg_|GLOBALS','cfg_|GLOBALS',$content) : $content;
        fclose($fp);
        $content = co_insert_config($content, "/define\('AUTO_CTIME',\s*'.*?'\);/i", "define('AUTO_CTIME', '".$setings['auto_ctime']."');");
        $content = co_insert_config($content, "/define\('AUTO_URL',\s*'.*?'\);/i", "define('AUTO_URL', '".$setings['auto_url']."');");
        $content = co_insert_config($content, "/define\('AUTO_NUM',\s*'.*?'\);/i", "define('AUTO_NUM', '".$setings['auto_num']."');");
        $content = co_insert_config($content, "/define\('AUTO_TEXTLEN',\s*'.*?'\);/i", "define('AUTO_TEXTLEN', '".$setings['auto_textlen']."');");
        $content = co_insert_config($content, "/define\('AUTO_LI',\s*'.*?'\);/i", "define('AUTO_LI', '".$setings['auto_li']."');");
        $content = co_insert_config($content, "/define\('AUTO_A',\s*'.*?'\);/i", "define('AUTO_A', '".$setings['auto_a']."');");
        $content .= '?>';
    
        if($fp = @fopen($this->config, 'w'))
        {
            @fwrite($fp, trim($content));
            @fclose($fp);
            ShowMsg('配置已经更改!',-1);
            exit();
        }else{
            ShowMsg('写入配置数据失败!'.$this->config.' 请设置可写权限!',-1);
            exit();
        }
    }
}
function co_insert_config($s, $find, $replace){
     if(preg_match($find, $s))
    {
        $s = preg_replace($find, $replace, $s);
    }else{
        $s .= "\r\n".$replace;
    }
    return $s;
}
function co_gpc($k, $var='R')
{
    switch($var)
    {
        case 'G': $var = &$_GET; break;
        case 'P': $var = &$_POST; break;
        case 'C': $var = &$_COOKIE; break;
        case 'R': $var = &$_REQUEST; break;
    }
    return isset($var[$k]) ? $var[$k] : NULL;
}
?>
</file>
<file type='file' name='auto_co_show.php'>
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");

$sql  = "Select * From `dede_auto_co_note` order by nid desc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/auto_co_show.htm");
$dlist->SetSource($sql);
$dlist->display();

function chkdown($data)
{
    if($data>'0') return '<span style="color:red">采集中</span>';
    else return '节点正常';
}
?>
</file>
<file type='file' name='auto_co_url.php'>
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
$sql  = "Select * From `dede_auto_co_htmls` order by aid desc ";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/auto_co_url.htm");
$dlist->SetSource($sql);
$dlist->display();

function chkdown($data)
{
    if($data=='0') return '<span style="color:red">未下载</span>';
    if($data=='1') return '已下载';
    if($data=='2') return '<span style="color:red">已抛弃</span>';
}

function chkexport($data)
{
    if($data=='0') return '<span style="color:red">未导出</span>';
    if($data=='1') return '已导出';
    if($data=='2') return '<span style="color:red">已存在</span>';
    if($data=='3') return '<span style="color:red">栏目id错误</span>';
    if($data=='4') return '无需导出';
}

function chktitle($data)
{
    if($data=='0') return '<span style="color:#ccc">未下载或已抛弃</span>';
    else return $data;
}

?>
</file>
<file type='file' name='auto_co_add.php'>
<?php

require_once(dirname(__FILE__)."/config.php");
if(empty($dopost))
{
if(empty($nid))
{
$dopost = 'add';
require_once(DEDEADMIN."/templets/auto_co_add.htm");
exit();
}
else
{
$dopost = 'edit';
$row = $dsql->GetOne("Select * From `dede_auto_co_note` WHERE nid = '$nid' ");
require_once(DEDEADMIN."/templets/auto_co_add.htm");
exit();
}
}
if($dopost=='add')
{
if(file_exists('../data/key.php')==false)
{
$row = $dsql->GetOne("Select count(nid) as num From `dede_auto_co_note`");
if($row['num']>=30)
{
ShowMsg("免费用户暂时只能添加30个节点,敬请关注!","auto_co_show.php");
exit();
}
}
$inquery = " INSERT INTO `dede_auto_co_note`(`notename`,`typeid`,`keyword`) VALUES ('$name','$typeid','$keyword'); ";
$rs = $dsql->ExecuteNoneQuery($inquery);
if(!$rs)
{
ShowMsg("保存信息时出现错误!".$dsql->GetError(),"-1");
exit();
}
ShowMsg("成功添加一个节点!","auto_co_show.php");
}
if($dopost=='edit')
{
$dsql->ExecuteNoneQuery("Update `dede_auto_co_note` set notename='$name',typeid='$typeid',keyword='$keyword' where nid='$nid' ");
ShowMsg("成功更改一个节点!","auto_co_show.php");
}
if($dopost=='del')
{
$nid = intval($nid);
$dsql->ExecuteNoneQuery("Delete From `dede_auto_co_note` where nid='$nid'");
ShowMsg("成功删除一个节点!","auto_co_show.php");
}
?>
</file>
<file type='file' name='auto_co_install.php'>
<?php
require_once(dirname(__FILE__)."/config.php");

if($action=='install')
{
        $fp = fopen('../templets/'.$cfg_df_style.'/index.htm', 'r');
        $content = fread($fp, filesize('../templets/'.$cfg_df_style.'/index.htm'));
        fclose($fp);
        $content = trim($content);
        if(!strstr($content, 'auto_co.php'))
        {
             $content = strstr($content, '</body>') ? str_replace('</body>','<script src="plus/auto_co.php"></script></body>',$content) : $content.'<script src="plus/auto_co.php"></script>';
             if($fp = @fopen('../templets/'.$cfg_df_style.'/index.htm', 'w'))
             {
                  @fwrite($fp, trim($content));
                  @fclose($fp);
              }
        }
        showmsg('安装完成,请生成首页','javascript:;');
        exit();
}

if($action=='uninstall')
{
        $fp = fopen('../templets/'.$cfg_df_style.'/index.htm', 'r');
        $content = fread($fp, filesize('../templets/'.$cfg_df_style.'/index.htm'));
        fclose($fp);
        $content = trim($content);
        if(strstr($content, 'auto_co.php'))
        {
             $content = str_replace('<script src="plus/auto_co.php"></script>','',$content);
             if($fp = @fopen('../templets/'.$cfg_df_style.'/index.htm', 'w'))
             {
                  @fwrite($fp, trim($content));
                  @fclose($fp);
              }
        }
        showmsg('卸载完成,如果模板内的js没有成功去掉,请手工删除','javascript:;');
        exit();
}

include DedeInclude('templets/auto_co_install.htm');
?>
</file>
<file type='file' name='auto_co_replace.php'>
<?php
require_once(dirname(__FILE__)."/config.php");

if(get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend_extension_ts")||get_cfg_var("zend_extension"))
{
     $zend = true;
}
else
{
     ShowMsg('很抱歉,本功能需要空间安装zend优化器<br>你的空间暂不支持,详情请与我们联系','-1',2);    
     exit();
}


require_once(DEDEINC."/auto_co_config.php");
require_once(dirname(__FILE__)."/auto_co_re.php");
?>
</file>
<file type='file' name='auto_co_re.php'>
<?php

function co_insert_config($s,$find,$replace){
if(preg_match($find,$s))
{
$s = preg_replace($find,$replace,$s);
}else{
$s .= "\r\n".$replace;
}
return $s;
}
if(!function_exists('file_get_contents'))
{
function file_get_contents($fname)
{
if(!file_exists($fname) ||is_dir($fname))
{
return '';
}
else
{
$fp = fopen($fname,'r');
$ct = fread($fp,filesize($fname));
fclose($fp);
return $ct;
}
}
}
if (preg_match('%http://([a-z0-9.\-]+)%',$cfg_basehost,$regs))
{
$domain = $regs[1];
}
else
{
ShowMsg('网站地址配置有误,请更正...','-1',2);
}
if(file_exists('../data/key.php'))
{
include_once('../data/key.php');
if(@filemtime('../data/key.php') == $Expiration)
{
if($dopost=='save')
{
$query = "truncate table `dede_auto_co_replace`;";
$dsql->ExecuteNoneQuery($query);
$count = 0;
$r = explode("\r\n",$replace_text);
foreach($r as $k)
{
$word = explode(',',$k);
$word1 = $word[0];
$word2 = $word[1];
if($word1!=''and $word2!='')
{
$query = "Insert Into `dede_auto_co_replace`(`replace1`,`replace2`) Values('$word1','$word2');";
$dsql->ExecuteNoneQuery($query);
$count++;
}
}
$fp = fopen(DEDEINC.'/auto_co_config.php','r');
$content = fread($fp,filesize(DEDEINC.'/auto_co_config.php'));
$content = trim($content);
fclose($fp);
$content = co_insert_config($content,"/define\('AUTO_REPLACE',\s*'.*?'\);/i","define('AUTO_REPLACE', '".$isreplace."');");
if($fp = @fopen(DEDEINC.'/auto_co_config.php','w'))
{
@fwrite($fp,trim($content));
@fclose($fp);
}else{
ShowMsg('写入配置数据失败!'.DEDEINC.'/auto_co_config.php 请设置可写权限!',-1);
exit();
}
showmsg('本次成功更新'.$count.'条同义词!','-1');
exit();
}
$dsql = "Select * FROM `dede_auto_co_replace`;";
$db->SetQuery($dsql);
$db->Execute();
while($arr = $db->GetArray())
{
$replace_text .= $arr['replace1'].",".$arr['replace2']."\r\n";
}
include DedeInclude('templets/auto_co_replace.htm');
exit();
}
$sign= md5($siteid.$domain);
$chk = @file_get_contents("http://www.kejicenter.cn/auto_co.php?action=check&siteid=$siteid&domain=$domain&sign=".$sign);
if(trim($chk)=='success')
{
$c = "<?php\r\n";
$c .= '$siteid='.$siteid.';';
$c .= '$Expiration='.time().';';
$c .= "\r\n?>";
file_put_contents("../data/key.php",$c);
}
else
{
$data = @file_get_contents("http://www.kejicenter.cn/auto_co.php?action=pay&siteid=".$siteid);
include DedeInclude('templets/auto_co_active_2.htm');
}
}
else
{
if($action=='setting')
{
if(preg_match("/^[0-9.]{7,15}$/",@gethostbyname('www.kejicenter.cn')))
{
$data = @file_get_contents("http://www.kejicenter.cn/auto_co.php?action=start");
$c = "<?php\r\n";
$c .= '$siteid='.$data.';';
$c .= "\r\n?>";
file_put_contents("../data/key.php",$c);
showmsg("初始化完成","auto_co_replace.php");
exit();
}
else
{
showmsg("您的服务器无法解析域名www.kejicenter.cn,请检测服务器相关设置","-1",2);
exit();
}
}
include DedeInclude('templets/auto_co_active_1.htm');
}
?>
</file>
</modulefiles>
</module>





DEDECMS插件  由http://www.6shell.com从网络收集整理,代码中的收费功能和网站链接均与本站无关。
代码仅供学习参考,禁止用商业用途。
请不要随意修改作者代码,请尊重作者劳动。
(责任编辑:laiquliu)

关注技术,信息,资源,扫描来去留网微信二维码交流。

来去留我李俊

搜索

------分隔线----------------------------
相关栏目

热点推荐
来去留技术信息资源
来去留网为您提供平台咨询交流学习方法及各类热门技术;电器,服装,保健,行业快讯等二十几个类别的资讯