Changeset 2969579
- Timestamp:
- 09/21/2023 08:41:47 AM (2 years ago)
- Location:
- keydatas/trunk
- Files:
-
- 2 edited
-
keydatas.php (modified) (17 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
keydatas/trunk/keydatas.php
r2968537 r2969579 4 4 Plugin URI: http://www.keydatas.com/caiji/wordpress-cms-caiji 5 5 Description: 简数采集器(keydatas.com)是一个通用、简单、智能、在线的网页数据采集器,功能强大,操作简单。支持按关键词采集;集成翻译等服务;图片下载支持存储到阿里云OSS、七牛对象存储、腾讯云对象存储等。 6 Version: 2.5. 16 Version: 2.5.2 7 7 Author: keydatas 8 8 Author URI: http://www.keydatas.com … … 24 24 $randIP = "".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255); 25 25 return $randIP; 26 } 27 28 function keydatas_getPostValSafe($paraName = ""){ 29 $postVal=""; 30 if(isset($_POST[$paraName])){ 31 $postVal=sanitize_text_field($_POST[$paraName]); 32 } 33 return $postVal; 26 34 } 27 35 /** … … 62 70 //$_REQ = keydatas_mergeRequest(); 63 71 $kds_password = get_option('keydatas_password', "keydatas.com"); 64 $post_password = sanitize_text_field($_POST['kds_password']);72 $post_password = keydatas_getPostValSafe('kds_password'); 65 73 if (empty($post_password) || $post_password != $kds_password) { 66 74 keydatas_failRsp(1403, "password error", "提交的发布密码错误"); … … 70 78 if ($kds_flag == "post") { 71 79 72 $title = sanitize_text_field($_POST["post_title"]);80 $title = keydatas_getPostValSafe("post_title"); 73 81 if (empty($title)) { 74 82 keydatas_failRsp(1404, "title is empty", "标题不能为空"); 75 83 } 76 84 77 $content =wp_kses_post($_POST["post_content"]); 85 $content=''; 86 if(isset($_POST["post_content"])){ 87 $content =wp_kses_post($_POST["post_content"]); 88 } 78 89 if (empty($content)) { 79 90 $content=''; … … 81 92 82 93 //文章摘要 83 $excerpt = sanitize_textarea_field($_POST["post_excerpt"]);94 $excerpt = keydatas_getPostValSafe("post_excerpt"); 84 95 if (empty($excerpt)) { 85 96 $excerpt=''; 86 97 } 87 98 //文章类型 88 $postType = sanitize_text_field($_POST["post_type"]);99 $postType = keydatas_getPostValSafe("post_type"); 89 100 if (empty($postType)) { 90 101 $postType = 'post'; … … 96 107 } 97 108 */ 98 $postStatus = sanitize_text_field($_POST["post_status"]);109 $postStatus = keydatas_getPostValSafe("post_status"); 99 110 if (empty($postStatus) || !in_array($postStatus, array('publish', 'draft'))) { 100 111 $postStatus = 'publish'; … … 102 113 103 114 // 104 $commentStatus = sanitize_text_field($_POST["comment_status"]);115 $commentStatus = keydatas_getPostValSafe("comment_status"); 105 116 if (empty($commentStatus) || !in_array($commentStatus, array('open', 'closed'))) { 106 117 $commentStatus = 'open'; 107 118 } 108 119 //文章密码,文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改 109 $postPassword = sanitize_text_field($_POST["post_password"]);120 $postPassword = keydatas_getPostValSafe("post_password"); 110 121 //if (isset($_POST["post_password"]) && $_POST["post_password"]) { 111 122 if(empty($postPassword)){ … … 132 143 } 133 144 //文章别名 134 $postName = sanitize_text_field($_POST["post_name"]);145 $postName = keydatas_getPostValSafe("post_name"); 135 146 if (!empty($postName)) { 136 147 $my_post['post_name'] = $postName; … … 138 149 139 150 ///////////////目前主要用于lightsns 140 $post_parent = sanitize_text_field($_POST["__kdsExt_post_parent"]);//default 0151 $post_parent = keydatas_getPostValSafe("__kdsExt_post_parent");//default 0 141 152 if(!empty($post_parent)){ 142 153 try{ … … 162 173 } 163 174 } 164 $post_date= sanitize_text_field($_POST["post_date"]);175 $post_date=keydatas_getPostValSafe("post_date"); 165 176 if (!empty($post_date)) { 166 177 $post_date = intval($post_date); … … 170 181 } 171 182 172 $author = sanitize_text_field($_POST["post_author"]);183 $author = keydatas_getPostValSafe("post_author"); 173 184 if (!empty($author)) { 174 185 //$author = htmlspecialchars_decode($author); … … 206 217 }//.. post_author end 207 218 //分类目录 208 $category = sanitize_text_field($_POST["post_category"]);219 $category = keydatas_getPostValSafe("post_category"); 209 220 if (!empty($category)) { 210 221 $cates = explode(',',$category); … … 240 251 } 241 252 242 $post_tag = sanitize_text_field($_POST["post_tag"]);253 $post_tag = keydatas_getPostValSafe("post_tag"); 243 254 if (!empty($post_tag)) { 244 255 $tags = explode(',',$post_tag); … … 269 280 } 270 281 //缩略图处理 271 $image_url = sanitize_text_field($_POST["__kds_feature_url"]);282 $image_url =keydatas_getPostValSafe("__kds_feature_url"); 272 283 if (empty($image_url)) { 273 $image_url = sanitize_text_field($_POST["post_thumbnail"]);284 $image_url = keydatas_getPostValSafe("post_thumbnail"); 274 285 } 275 286 if (!empty($post_id) && !empty($image_url)) { … … 316 327 $keydatas_tbk_link_enble = get_option('keydatas_tbk_link_enble', false); 317 328 if($keydatas_tbk_link_enble){ 318 $tbk_link = sanitize_text_field($_POST["tbk_link"]);329 $tbk_link = keydatas_getPostValSafe("tbk_link"); 319 330 if (!empty($tbk_link)) { 320 331 add_post_meta($post_id, 'tbk_link', $tbk_link, true); … … 339 350 //获取分类目录 340 351 $ret = array(); 341 $postType = sanitize_text_field($_POST["type"]);352 $postType = keydatas_getPostValSafe("type"); 342 353 if (!empty($postType) && $postType === "cate") { 343 354 $cates = get_terms('category', 'orderby=count&hide_empty=0'); … … 363 374 function keydatas_downloadImages(){ 364 375 try{ 365 $downloadFlag = sanitize_text_field($_POST["__kds_download_imgs_flag"]);376 $downloadFlag = keydatas_getPostValSafe("__kds_download_imgs_flag"); 366 377 if (!empty($downloadFlag) && $downloadFlag== "true") { 367 $docImgsStr = sanitize_text_field($_POST["__kds_docImgs"]);378 $docImgsStr = keydatas_getPostValSafe("__kds_docImgs"); 368 379 if (!empty($docImgsStr)) { 369 380 $docImgs = explode(',',$docImgsStr); -
keydatas/trunk/readme.txt
r2968537 r2969579 5 5 Author URI: http://www.keydatas.com 6 6 Plugin URI: http://www.keydatas.com/wordpress-plugin 7 Stable tag: 2.5. 17 Stable tag: 2.5.2 8 8 Requires at least: 4.1 9 9 Tested up to: 6.3.1
Note: See TracChangeset
for help on using the changeset viewer.