• 联盟
  • 文章
  • 当前位置:排行榜 > 资讯 > 经验学堂 > 列表经验学堂

    火车头dede采集图片加水印,远程图片本地化

    编辑:996评测网 发布时间:2020-05-02 13:27 分类:经验学堂

    <?php
    /*
        [LocoySpider] (C)2005-2010 Lewell Inc.
        火车采集器 DedeCMS 5.7 UTF8 文章发布接口 
       Update content: 图片加水印,远程图片本地化(无后缀的图片也可以本地化)
       Update people :Abner
       Update time : 2017-01-05
    */
    
    /********密码验证***********/
    $password='huarenyuangong';                                //这个密码是登陆验证用的.您需要在模块里设置和这里一样的密码....注意一定需要修改.
    if($password!=$_GET['pw']) exit('验证密码错误');   //安全检测,密码不符则退出
    
    
    
    function logLog( $path, $str)
    {
        $file = fopen( $path, 'w') or die('Unable to open file!');
        fwrite( $file, $str );
        fclose($file);
    }
    
    $path1 = '../'.time().'a.txt';
    $path2 = '../'.time().'b.txt';
    
    /****以下代码非专业人员不建议修改***************/
    if($_POST) $ispost=true;
    //require_once(dirname(__FILE__).'/config.php');
    define('DEDEADMIN', ereg_replace("[/\\]{1,}", '/', dirname(__FILE__) ) );
    require_once(DEDEADMIN.'/../include/common.inc.php');
    require_once(DEDEINC.'/userlogin.class.php');
    header('Cache-Control:private');
    $dsql->safeCheck = false;
    $dsql->SetLongLink();
    
    $cuserLogin = new userLogin();
    $cuserLogin->userID = 1;
    
    //获得当前脚本名称,如果你的系统被禁用了$_SERVER变量,请自行更改这个选项
    $dedeNowurl = $s_scriptName = '';
    $isUrlOpen = @ini_get('allow_url_fopen');
    $dedeNowurl = GetCurUrl();
    $dedeNowurls = explode('?', $dedeNowurl);
    $s_scriptName = $dedeNowurls[0];
    $cfg_remote_site = empty($cfg_remote_site)? 'N' : $cfg_remote_site;
        
    //启用远程站点则创建FTP类
    if($cfg_remote_site=='Y')
    {
        require_once(DEDEINC.'/ftp.class.php');
        if(file_exists(DEDEDATA."/cache/inc_remote_config.php"))
        {
            require_once DEDEDATA."/cache/inc_remote_config.php";
        }
        if(empty($remoteuploads)) $remoteuploads = 0;
        if(empty($remoteupUrl)) $remoteupUrl = '';
        $config = array(
          'hostname' => $GLOBALS['cfg_ftp_host'],
          'username' => $GLOBALS['cfg_ftp_user'],
          'password' => $GLOBALS['cfg_ftp_pwd'],
          'debug' => 'TRUE'
        );
        $ftp = new FTP($config); 
    
        //初始化FTP配置
        if($remoteuploads==1){
            $ftpconfig = array(
                'hostname'=>$rmhost, 
                'port'=>$rmport,
                'username'=>$rmname,
                'password'=>$rmpwd
            );
        }
    }
    
    function UpDateMemberModCache()
    {
        global $dsql;
        $cachefile = DEDEDATA.'/cache/member_model.inc';
    
        $dsql->SetQuery("SELECT * FROM `dede_member_model` WHERE state='1'");
        $dsql->Execute();
        $fp1 = fopen($cachefile,'w');
        $phph = '?';
        $fp1Header = "<{$phph}php\r\nglobal \$_MemberMod;\r\n\$_MemberMod=array();\r\n";
        fwrite($fp1,$fp1Header);
        while($row=$dsql->GetObject())
        {
            fwrite($fp1,"\$_MemberMod[{$row->id}]=array('{$row->name}','{$row->table}');\r\n");
        }
        fwrite($fp1,"{$phph}>");
        fclose($fp1);
    }
    
    
    function DedeInclude($filename,$isabs=false)
    {
        return $isabs ? $filename : DEDEADMIN.'/'.$filename;
    }
    
    //config引用结束
    
    //CheckPurview('a_New,a_AccNew');
    require_once(DEDEINC.'/customfields.func.php');
    require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
    if(file_exists(DEDEDATA.'/template.rand.php'))
    {
        require_once(DEDEDATA.'/template.rand.php');
    }
    
    $dsql->SetSql("Select id as cid,reid as pid,typename as cname,ispart,topid  from `dede_arctype` where channeltype =1 order by sortrank");
    $dsql->Execute();
    while($row=$dsql->GetObject())
    {
        $cates[]=array('cid'=>$row->cid,'pid'=>$row->pid,'cname'=>$row->cname,'ispart'=>$row->ispart,'topid'=>$row->topid);
    }
    
    if(!$ispost)
    {
        echo "<select name='list'>";
        echo maketree($cates,0,'');
        echo '</select>';
        exit();
    }
    
    /*--------------------------------
    function __save(){  }
    -------------------------------*/
    else
    {
        require_once(DEDEINC.'/image.func.php');
        require_once(DEDEINC.'/oxwindow.class.php');
        //检验用户登录状态
        $userinfo=$dsql->GetOne("Select * from `dede_member` where userid='$username'");
        if(!$userinfo) exit("不存在用户$username");
        $uid = isset($userinfo['uid']) ? $userinfo['uid'] : $userinfo['mid'];
    
        //检测栏目信息
        foreach ($cates as $f=>$v)
        {
            if($v['cid']==$typeid)
            {       
                $eid=$v;
                if($v['ispart']!=0) exit("该栏目不能发布内容"); 
            }
        }
        if(!$eid) exit("不存在的栏目id:$typeid");
    
        require_once(DEDEINC.'/image.func.php');
        //require_once(DEDEINC.'/oxwindow.class.php');
        $flag = isset($flags) ? join(',',$flags) : '';
        $notpost = isset($notpost) && $notpost == 1 ? 1: 0;
        
        if(empty($typeid2)) $typeid2 = '';
        if(!isset($autokey)) $autokey = 0;
        if(!isset($remote)) $remote = 0;
        if(!isset($dellink)) $dellink = 0;
        if(!isset($autolitpic)) $autolitpic = 0;
        if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click);
        
        if(empty($typeid))
        {
            ShowMsg("请指定文档的栏目!","-1");
            exit();
        }
        if(empty($channelid))
        {
            ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
            exit();
        }
        if(!CheckChannel($typeid,$channelid))
        {
            ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
            exit();
        }
    
        //对保存的内容进行处理
        if(empty($writer))$writer=$username;
        if(empty($source))$source='未知';
        $pubdate = GetMkTime($pubdate);
        if(!$pubdate) $pubdate=time();
        $senddate = time();
        $sortrank = AddDay($pubdate,$sortup);
        $ismake = $ishtml==0 ? -1 : 0;
        $title = ereg_replace('"', '"', $title);
        $title = htmlspecialchars(cn_substrR($title,$cfg_title_maxlen));
        $shorttitle = cn_substrR($shorttitle,36);
        $color =  cn_substrR($color,7);
        $writer =  cn_substrR($writer,20);
        $source = cn_substrR($source,30);
        $description = cn_substrR($description,$cfg_auot_description);
        $keywords = cn_substrR($keywords,60);
        $filename = trim(cn_substrR($filename,40));
        $userip = GetIP();
        $isremote  = (empty($isremote)? 0  : $isremote);
        $serviterm=empty($serviterm)? "" : $serviterm;
    
        // if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
        // {
            // $arcrank = -1;
        // }
        $adminid = $uid;
    
        //处理上传的缩略图
        if(empty($ddisremote))
        {
            $ddisremote = 0;
        }
        
        $litpic = GetDDImage('none', $picname, $ddisremote);
    
        //生成文档ID
        $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$adminid);
        
        if(empty($arcID))
        {
            ShowMsg("无法获得主键,因此无法进行后续操作!","-1");
            exit();
        }
        if(trim($title) == '')
        {
            ShowMsg('标题不能为空', '-1');
            exit();
        }
    
        //处理body字段自动摘要、自动提取缩略图等
        $body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext');
    
    
        $path = '../uploads/allimg/' . date( 'ymd', time() ) .'/';
        $body =  downloadNoExtImg( $path, $body );
    
        //自动分页
        if($sptype=='auto')
        {
            $body = SpLongBody($body,$spsize*1024,"
    	
    (责任编辑:996top广告联盟评测)
    下级栏目
    最新加入
  • 12020-07-20CPS日结广告联盟
  • 22020-07-15发发广告联盟
  • 32020-07-05团成移动联盟
  • 42020-06-22蜜趣CPS联盟
  • 52020-05-05趣米移动广告
  • 62020-04-28斯巴达联盟
  • 72020-04-28萌新移动联盟
  • 82020-04-22八通广告联盟
  • 92020-04-19998广告联盟
  • 102020-04-15誉见广告平台
  • 热评联盟
  • 1点评[93]铁憨憨广告联盟
  • 2点评[32]非凡广告联盟
  • 3点评[25]誉见广告平台
  • 4点评[22]辉耀移动联盟
  • 5点评[19]巨梦广告联盟
  • 6点评[16]望云广告联盟
  • 7点评[14]晨阳广告传媒
  • 8点评[13]快唯广告联盟
  • 9点评[10]盖亚联盟CPA
  • 10点评[10]亿云联盟
  • 服务排行
    人气排行
  • 1浏览[408]盖亚联盟CPA
  • 2浏览[262]趣米移动广告
  • 3浏览[252]青瓜传媒APP推广
  • 4浏览[213]百度联盟
  • 5浏览[213]小明精准联盟
  • 6浏览[181]CPA唯尚广告联盟
  • 7浏览[151]非凡广告联盟
  • 8浏览[119]易盟广告
  • 9浏览[116]超越广告联盟
  • 10浏览[114]联合云享广告平台
  • 关于996| 版权声明| 联系方式| 广告服务

    Copyright © 版权所有:996评测网 广告联系QQ:2521646590 (请注明:投广告)
    (评论内容只代表网友观点,与996评测网立场无关)