Plugin Directory

Changeset 3127334


Ignore:
Timestamp:
07/29/2024 12:07:06 PM (19 months ago)
Author:
zhengdon
Message:

v2.6.1 add file type validation for file uploads and delete the default password

Location:
keydatas/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • keydatas/trunk/keydatas.php

    r2969579 r3127334  
    33Plugin Name: 简数采集平台
    44Plugin URI: http://www.keydatas.com/caiji/wordpress-cms-caiji
    5 Description: 简数采集器(keydatas.com)是一个通用、简单、智能、在线的网页数据采集器,功能强大,操作简单。支持按关键词采集;集成翻译等服务;图片下载支持存储到阿里云OSS、七牛对象存储、腾讯云对象存储等。
    6 Version: 2.5.2
     5Description: 简数采集器(keydatas.com)是一个通用、简单、智能、在线的网页数据采集器,功能强大,操作简单。支持按关键词采集;集成AI大模型接口、翻译等服务;图片下载支持存储到阿里云OSS、七牛、腾讯云对象存储等。
     6Version: 2.6.1
    77Author: keydatas
    88Author URI: http://www.keydatas.com
     
    1919
    2020function keydatas_rsp($result = 1,$code = 0, $data = "", $msg = "") {
    21     die(json_encode(array("rs" => $result, "code" => $code, "data" => $data, "msg" => urlencode($msg))));
     21    die(wp_json_encode(array("rs" => $result, "code" => $code, "data" => $data, "msg" => urlencode($msg))));
    2222}
    2323function keydatas_genRandomIp(){
    24     $randIP = "".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255);
     24    $randIP = "".wp_rand(0,255).".".wp_rand(0,255).".".wp_rand(0,255).".".wp_rand(0,255);
    2525    return $randIP;
    2626}
     
    4040 */
    4141function keydatas_randFloat($min=0, $max=1){
    42     return $min + mt_rand()/mt_getrandmax() * ($max-$min);
     42    return $min + wp_rand()/mt_getrandmax() * ($max-$min);
    4343}
    4444
     
    6969    if (!empty($kds_flag)){
    7070        //$_REQ = keydatas_mergeRequest();
    71         $kds_password = get_option('keydatas_password', "keydatas.com");
     71        $kds_password = get_option('keydatas_password', '');
     72        if (empty($kds_password)) {
     73            keydatas_failRsp(1403, "password empty", "提交的发布密码为空");
     74        }
    7275        $post_password = keydatas_getPostValSafe('kds_password');
    7376        if (empty($post_password) || $post_password != $kds_password) {
     
    373376
    374377function  keydatas_downloadImages(){
     378 $allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp', 'ico']; 
    375379 try{
    376380    $downloadFlag = keydatas_getPostValSafe("__kds_download_imgs_flag");
     
    382386                $upload_dir = wp_upload_dir();
    383387                foreach ($docImgs as $imgUrl) {
     388                    // 清理和验证URL 
     389                    $imgUrl = filter_var($imgUrl, FILTER_SANITIZE_URL); 
     390                    if (!filter_var($imgUrl, FILTER_VALIDATE_URL)) { 
     391                        continue; // 跳过非法的URL 
     392                    }
     393                    // 尝试获取图片扩展名 
     394                    $parsedUrl = parse_url($imgUrl); 
     395                    $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; 
     396                    $extension = pathinfo($path, PATHINFO_EXTENSION); 
     397
     398                    // 检查扩展名是否在允许的图片格式中
     399                    if (!in_array(strtolower($extension), $allowedExtensions)) { 
     400                        continue; // 跳过非图片格式的URL 
     401                    }
    384402                    $urlItemArr = explode('/',$imgUrl);
    385403                    $itemLen=count($urlItemArr);
     
    392410                            $file = $finalPath . '/' . $imgName;
    393411                            if(!file_exists($file)){
     412                                // 下载图片前,先检查HTTP响应头是否为图片 
     413                                $headers = @get_headers($imgUrl, 1); 
     414                                if (strpos($headers[0], '200 OK') !== false && strpos($headers['Content-Type'], 'image/') !== false) { 
    394415                                $doc_image_data = file_get_contents($imgUrl);
    395                                 file_put_contents($file, $doc_image_data);
     416                                if ($doc_image_data !== false) {
     417                                    file_put_contents($file, $doc_image_data);
     418                                }
     419                                }
    396420                            }
    397421                        }
     
    406430}
    407431
    408 
    409432?>
  • keydatas/trunk/publish-setting.php

    r2968537 r3127334  
    2929</style>
    3030<?php
     31
     32function keydatas_genRandomPassword($length = 32) { 
     33    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
     34    $charactersLength = strlen($characters); 
     35    $randomString = ''; 
     36    for ($i = 0; $i < $length; $i++) { 
     37        $randomString .= $characters[wp_rand(0, $charactersLength - 1)]; 
     38    } 
     39    return $randomString; 
     40
    3141/**
    3242保存处理
    3343*/
    34 $keydatas_password= 'keydatas.com';
     44$keydatas_password= keydatas_genRandomPassword();// 生成默认随机密码
    3545$keydatas_title_unique=false;
    3646$keydatas_tbk_link_enble=false;
     
    5767    $keydatas_tbk_link_enble = get_option('keydatas_tbk_link_enble', $keydatas_tbk_link_enble);
    5868}
     69 
    5970?>
    6071<div class="wrap">
     
    8596          </tr>
    8697          <tr>
    87             <td>插件密码:</td>
    88             <td><input type="text" name="keydatas_password" class="config-input" value="<?php echo esc_textarea($keydatas_password); ?>" />(请注意修改并保管好
     98            <td>插件密码<font color="red">*</font>:</td>
     99            <td><input type="text" name="keydatas_password" class="config-input" value="<?php echo esc_textarea($keydatas_password); ?>" />(重要:请注意修改并保存
    89100            </td>
    90101          </tr>
     
    126137          <div class="feature">4.<strong>全自动化:定时采集+自动发送</strong>;</div>
    127138          <div class="feature">5.支持规则处理,包括:字段补充内容或关键词、关键词内链、简繁体转换、翻译、第三方API等;</div>
    128           <div class="feature">6.支持关键词泛采集;</div>
    129           <div class="feature">7.与WordPress系统无缝结合,数据可轻松发送到WordPress系统中。</div>
     139          <div class="feature">6.<strong>支持对接多种AI大模型API</strong>,轻松进行内容生成创作。支持:百度文心一言、Kimi、豆包、通义千问、讯飞星火大模型等;</div>
     140          <div class="feature">7.支持关键词泛采集;</div>
     141          <div class="feature">8.与WordPress系统无缝结合,数据可轻松发送到WordPress系统中。</div>
    130142          </td>
    131143        </tr>   
  • keydatas/trunk/readme.txt

    r2969579 r3127334  
    55Author URI: http://www.keydatas.com
    66Plugin URI: http://www.keydatas.com/wordpress-plugin
    7 Stable tag: 2.5.2
     7Stable tag: 2.6.1
    88Requires at least: 4.1
    9 Tested up to: 6.3.1
     9Tested up to: 6.6.1
    1010Requires PHP: 5.2.4
    1111License: GPLv2 or later
     
    23234.定时自动采集更新;<br>
    24245.图片支持下载到(阿里云OSS、七牛对象存储、腾讯云COS、又拍云);<br>
    25 6.相比其它采集器,简数采集器更加简单易用,功能同样强大,且没有繁杂的流程;<br>
    26 7.其它相关:火车头、八爪鱼、后羿;<br>
    27 8.realation: caiji,seo,mip,keyword,description,jianshu,weixin,wechat,robot,spider,jinritoutiao,taobaoke,aliyun,qiniu,tengxunyun,baidu,huochetou,houyicaiji,shenjian,CSDN,cnblogs,zhihu,jianshu,wenzhang,gongzhonghao,locoy,bazhuayu,shenjianshou,wpspider,WP-AutoPost(WP-AutoBlog),WP-Jpost,5118,QQWorld.<br>
    28 9.SEO Plugin,huochetou,google XML sitemap,WP Baidu Map,baiduxzh,Sitemap,baidu-submit-link,AutoTags,Github.<br>
     256.支持对接多种AI大模型API,轻松进行内容生成创作。支持:百度文心一言、Kimi、豆包、通义千问、5118、讯飞星火大模型等。
     267.相比其它采集器,简数采集器更加简单易用,功能同样强大,且没有繁杂的流程;<br>
     278.其它相关:火车头、八爪鱼、后羿;<br>
     289.realation: caiji,seo,mip,keyword,description,jianshu,weixin,wechat,robot,spider,jinritoutiao,taobaoke,aliyun,qiniu,tengxunyun,baidu,huochetou,houyicaiji,shenjian,CSDN,cnblogs,zhihu,jianshu,wenzhang,gongzhonghao,locoy,bazhuayu,shenjianshou,wpspider,WP-AutoPost(WP-AutoBlog),WP-Jpost,5118,QQWorld.<br>
     2910.SEO Plugin,huochetou,google XML sitemap,WP Baidu Map,baiduxzh,Sitemap,baidu-submit-link,AutoTags,Github.<br>
    2930autospider,fanyi,Translate,LightSNS,collect<br>
    30 10.wordpress插件推荐:百度熊掌号,百度推送,WordPress HTTPS (SSL),wp encrypt,really simple ssl,WPJAM-Basic,wp-super-cache,WP Rocket,All-in-One SEO Pack,login LockDown,Comments Link Redirect,Add Post URL,BackWPup,DX-auto-publish,Link Manager,No Category Parents,Platinum SEO Pack,WP Keyword Link,Yet Another Related Posts Plugin,Fix image width,Role Manager,Search & Replace,WordPress Database Backup,WP-PostViews,WP PHP widget,Baidu Sitemap Generator,DB Cache Reloaded Fix + Hyper Cache,SEO Friendly Images,BackWPup,Simple URLs,Redirection.
     3111.wordpress插件推荐:百度熊掌号,百度推送,WordPress HTTPS (SSL),wp encrypt,really simple ssl,WPJAM-Basic,wp-super-cache,WP Rocket,All-in-One SEO Pack,login LockDown,Comments Link Redirect,Add Post URL,BackWPup,DX-auto-publish,Link Manager,No Category Parents,Platinum SEO Pack,WP Keyword Link,Yet Another Related Posts Plugin,Fix image width,Role Manager,Search & Replace,WordPress Database Backup,WP-PostViews,WP PHP widget,Baidu Sitemap Generator,DB Cache Reloaded Fix + Hyper Cache,SEO Friendly Images,BackWPup,Simple URLs,Redirection.
    3132
    3233== Installation ==
     
    3839
    3940== Changelog ==
     41= 2.6.1 =
     42* 下载图片做类型的校验
    4043= 2.5.1 =
    4144* 兼容php 8
Note: See TracChangeset for help on using the changeset viewer.