{"id":2003,"date":"2018-11-08T16:00:06","date_gmt":"2018-11-08T08:00:06","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2003"},"modified":"2021-11-15T17:06:11","modified_gmt":"2021-11-15T09:06:11","slug":"%e7%bb%87%e6%a2%a6dedecms%e5%88%a0%e9%99%a4%e6%96%87%e7%ab%a0%e6%97%b6%e8%87%aa%e5%8a%a8%e5%88%a0%e9%99%a4%e8%af%a5%e6%96%87%e7%ab%a0%e4%b8%8a%e4%bc%a0%e7%9a%84%e5%9b%be%e7%89%87","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2003.html","title":{"rendered":"\u7ec7\u68a6dedecms\u5220\u9664\u6587\u7ae0\u65f6\u81ea\u52a8\u5220\u9664\u8be5\u6587\u7ae0\u4e0a\u4f20\u7684\u56fe\u7247"},"content":{"rendered":"
\u7ec7\u68a6dedecms\u5220\u9664\u6587\u7ae0\u65f6\uff0c\u4e0d\u4f1a\u5220\u9664\u8be5\u6587\u7ae0\u4e0a\u4f20\u7684\u56fe\u7247\uff0c\u4e0b\u9762\u662f\u89e3\u51b3\u65b9\u6cd5\uff0c\u6ce8\u610f\uff1a\u4fee\u6539\u4e4b\u524d\u8bf7\u5907\u4efd\u4e00\u4e0b\u6587\u4ef6\uff0c\u4ee5\u9632\u51fa\u9519\u3002<\/p>\n
function GetPicsTruePath( $body, $litpic ) \/\/\u89e3\u6790body\u6570\u636e\uff0c\u83b7\u5f97\u6240\u6709\u56fe\u7247\u7684\u7edd\u5bf9\u5730\u5740\r\n{\r\n$delfiles = array(); \/\/\u5b58\u50a8\u56fe\u7247\u5730\u5740\u6570\u636e\r\nif ( !empty( $litpic ) )\r\n{\r\n$litpicpath = GetTruePath();\r\n$litpicpath .= $litpic;\r\n$delfiles[] = $litpicpath; \/\/\u7f29\u7565\u56fe\u5730\u5740\r\n}\r\npreg_match_all( \"\/src=[\\\"|'|\\S|\\s]([^ |\\\/|>]*){0,}(([^>]*)\\.(gif|jpg|png))\/isU\", $body, $tmpdata );\r\n$picspath = array_unique( $tmpdata[ 2 ] ); \/\/body\u4e2d\u6240\u6709\u56fe\u7247\u7684\u5730\u5740\r\nforeach ( $picspath as $tmppath )\r\n{\r\n$path = GetTruePath(); \/\/\u83b7\u5f97\u7edd\u5bf9\u8def\u5f84\r\n$picpath = preg_replace( \"\/[a-zA-z]+:\\\/\\\/[^ |\\\/|\\s]*\/\", '', $tmppath ); \/\/\u53bb\u6389\u7f51\u5740\u90e8\u5206\r\n$path .= $picpath;\r\n$delfiles[] = $path; \/\/\u4fdd\u5b58\u5904\u7406\u540e\u7684\u6570\u636e\r\n}\r\nreturn $delfiles;\r\n}\r\nfunction WriteToDelFiles( $msg ) \/\/\u5220\u9664\u6587\u7ae0\u7684\u65f6\u5019\u4f1a\u901a\u8fc7\u6b64\u51fd\u6570\u8bb0\u5f55\u65e5\u5fd7\r\n{\r\nif ( empty( $msg ) )$savemsg = \"\u672a\u83b7\u5f97\u6d88\u606f\";\r\nelse $savemsg = $msg;\r\n$errorFile = dirname( __FILE__ ) . '\/..\/data\/del_body_file.txt'; \/\/\u5220\u9664\u8bb0\u5f55\u6587\u4ef6\r\n$fp = @fopen( $errorFile, 'a' );\r\n@fwrite( $fp, \"\\r\\n{$savemsg}\" );\r\n@fclose( $fp );\r\n}\r\n\/\/\u83b7\u5f97\u6587\u7ae0Body\u6570\u636e\r\nfunction GetArcBody( $aid )\r\n{\r\nglobal $dsql;\r\n$query = \"SELECT dede_addonarticle.body FROM dede_addonarticle WHERE dede_addonarticle.aid = '$aid'\";\r\n$row = $dsql->GetOne( $query );\r\nif ( is_array( $row ) ) return $row;\r\nelse return false;\r\n}<\/pre>\n\u4e8c\u3001\u6253\u5f00dede\/inc\/inc_batchup.php\u6587\u4ef6\uff0c<\/h2>\n
\u7528\u4e0b\u9762\u4ee3\u7801\u5168\u90e8\u66ff\u6362<\/p>\n
<?php\r\nfunction DelArc($aid,$type='ON',$onlyfile=false)\r\n{\r\nglobal $dsql,$cfg_cookie_encode,$cfg_multi_site,$cfg_medias_dir;\r\nglobal $cuserLogin,$cfg_upload_switch,$cfg_delete,$cfg_basedir;\r\nglobal $admin_catalogs, $cfg_admin_channel;\r\nif($cfg_delete == 'N') $type = 'OK';\r\nif(empty($aid)) return ;\r\n$aid = ereg_replace(\"[^0-9]\", '', $aid);\r\n$arctitle = $arcurl = '';\r\n\/\/\u67e5\u8be2\u8868\u4fe1\u606f\r\n$query = \"Select ch.maintable,ch.addtable,ch.nid,ch.issystem From `dede_arctiny` arc\r\nleft join `dede_arctype` tp on tp.id=arc.typeid\r\nleft join `dede_channeltype` ch on ch.id=arc.channel where arc.id='$aid' \";\r\n$row = $dsql->GetOne($query);\r\n$nid = $row['nid'];\r\n$maintable = (trim($row['maintable'])=='' ? 'dede_archives' : trim($row['maintable']));\r\n$addtable = trim($row['addtable']);\r\n$issystem = $row['issystem'];\r\n\/\/\u67e5\u8be2\u6863\u6848\u4fe1\u606f\r\nif($issystem==-1)\r\n{\r\n$arcQuery = \"Select arc.*,tp.* from `$addtable` arc left join `dede_arctype` tp on arc.typeid=tp.id where arc.aid='$aid' \";\r\n}\r\nelse\r\n{\r\n$arcQuery = \"Select arc.*,tp.*,arc.id as aid from `$maintable` arc left join `dede_arctype` tp on arc.typeid=tp.id where arc.id='$aid' \";\r\n}\r\n$arcRow = $dsql->GetOne($arcQuery);\r\n$arcBodyRow = GetArcBody($aid);\r\n\/\/\u68c0\u6d4b\u6743\u9650\r\nif(!TestPurview('a_Del,sys_ArcBatch'))\r\n{\r\nif(TestPurview('a_AccDel'))\r\n{\r\nif( !in_array($arcRow['typeid'], $admin_catalogs) && (count($admin_catalogs) != 0 || $cfg_admin_channel != 'all') )\r\n{\r\nreturn false;\r\n}\r\n}\r\nelse if(TestPurview('a_MyDel'))\r\n{\r\nif($arcRow['mid'] != $cuserLogin->getUserID())\r\n{\r\nreturn false;\r\n}\r\n}\r\nelse\r\n{\r\nreturn false;\r\n}\r\n}\r\n\/\/$issystem==-1 \u662f\u5355\u8868\u6a21\u578b\uff0c\u4e0d\u4f7f\u7528\u56de\u6536\u7ad9\r\nif($issystem == -1) $type = 'OK';\r\nif(!is_array($arcRow)) return false;\r\n\/** \u5220\u9664\u5230\u56de\u6536\u7ad9 **\/\r\nif($cfg_delete == 'Y' && $type == 'ON')\r\n{\r\n$dsql->ExecuteNoneQuery(\"Update `$maintable` set arcrank='-2' where id='$aid' \");\r\n$dsql->ExecuteNoneQuery(\"Update `dede_arctiny` set `arcrank` = '-2' where id = '$aid'; \");\r\n}\r\nelse\r\n{\r\n\/\/\u5220\u9664\u6570\u636e\u5e93\u8bb0\u5f55\r\nif(!$onlyfile)\r\n{\r\n\/\/\u5220\u9664\u7f29\u7565\u56fe\r\nif($arcRow['litpic']!=\"\"){\r\n$dsql->ExecuteNoneQuery(\"Delete From dede_uploads where url='$arcRow[litpic]'\");\r\n$truedir = GetTruePath($arcRow['siterefer'],$arcRow['sitepath']);\r\n$litpicfile = $truedir.$arcRow['litpic'];\r\n@unlink($litpicfile);\r\n}\r\n\/\/\u5220\u9664\u76f8\u5173\u9644\u4ef6\r\nif($cfg_upload_switch == 'Y')\r\n{\r\n$dsql->Execute(\"me\", \"SELECT * FROM `dede_uploads` WHERE arcid = '$aid'\");\r\nwhile($row = $dsql->GetArray('me'))\r\n{\r\n$addfile = $row['url'];\r\n$aid = $row['aid'];\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_uploads` where aid = '$aid' \");\r\n$upfile = $cfg_basedir.$addfile;\r\nif(@file_exists($upfile)) @unlink($upfile);\r\n}\r\n}\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_arctiny` where id='$aid'\");\r\nif($addtable != '')\r\n{\r\n$dsql->ExecuteNoneQuery(\"Delete From `$addtable` where aid='$aid' \");\r\n}\r\nif($issystem != -1)\r\n{\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_archives` where id='$aid' \");\r\n}\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_feedback` where aid='$aid' \");\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_member_stow` where aid='$aid' \");\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_taglist` where aid='$aid' \");\r\n$dsql->ExecuteNoneQuery(\"Delete From `dede_erradd` where aid='$aid' \");\r\n}\r\n\/\/\u5220\u9664\u6587\u672c\u6570\u636e\r\n$filenameh = DEDEDATA.\"\/textdata\/\".(ceil($aid\/5000)).\"\/{$aid}-\".substr(md5($cfg_cookie_encode),0,16).\".txt\";\r\nif(@is_file($filenameh)) @unlink($filenameh);\r\n}\r\nif(empty($arcRow['money'])) $arcRow['money'] = 0;\r\nif(empty($arcRow['ismake'])) $arcRow['ismake'] = 1;\r\nif(empty($arcRow['arcrank'])) $arcRow['arcrank'] = 0;\r\nif(empty($arcRow['filename'])) $arcRow['filename'] = '';\r\n\/\/\u5220\u9664HTML\r\nif($arcRow['ismake']==-1 || $arcRow['arcrank']!=0 || $arcRow['typeid']==0 || $arcRow['money']>0)\r\n{\r\nreturn true;\r\n}\r\n\/\/\u5f3a\u5236\u8f6c\u6362\u975e\u591a\u7ad9\u70b9\u6a21\u5f0f\uff0c\u4ee5\u4fbf\u7edf\u4e00\u65b9\u5f0f\u83b7\u5f97\u5b9e\u9645HTML\u6587\u4ef6\r\n$GLOBALS['cfg_multi_site'] = 'N';\r\n$arcurl = GetFileUrl($arcRow['aid'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],\r\n$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']);\r\nif(!ereg(\"\\?\", $arcurl))\r\n{\r\n$htmlfile = GetTruePath().str_replace($GLOBALS['cfg_basehost'],'',$arcurl);\r\nif(file_exists($htmlfile) && !is_dir($htmlfile))\r\n{\r\n@unlink($htmlfile);\r\n$arcurls = explode(\".\", $htmlfile);\r\n$sname = $arcurls[count($arcurls)-1];\r\n$fname = ereg_replace(\"(\\.$sname)$\", \"\", $htmlfile);\r\nfor($i=2; $i<=100; $i++)\r\n{\r\n$htmlfile = $fname.\"_{$i}.\".$sname;\r\nif( @file_exists($htmlfile) ) @unlink($htmlfile);\r\nelse break;\r\n}\r\n}\r\n}\r\n\/\/\u89e3\u6790Body\u4e2d\u7684\u8d44\u6e90\uff0c\u5e76\u5220\u9664\r\n$willDelFiles = GetPicsTruePath($arcBodyRow['body'],$arcRow['litpic']);\r\n$nowtime = time();\r\n$executetime = MyDate('Y-m-d H:i:s',$nowtime);\/\/\u83b7\u5f97\u6267\u884c\u65f6\u95f4\r\n$msg = \"\\r\\n\u6587\u7ae0\u6807\u9898\uff1a$arcRow[title]\";\r\nWriteToDelFiles($msg);\r\nif(!empty($willDelFiles))\r\n{\r\nforeach($willDelFiles as $file)\r\n{\r\nif(file_exists($file) && !is_dir($file))\r\n{\r\nif(unlink($file)) $msg = \"\\r\\n\u4f4d\u7f6e\uff1a$file\\r\\n\u7ed3\u679c\uff1a\u5220\u9664\u6210\u529f\uff01\\r\\n\u65f6\u95f4\uff1a$executetime\";\r\nelse $msg = \"\\r\\n\u4f4d\u7f6e\uff1a$file\\r\\n\u7ed3\u679c\uff1a\u5220\u9664\u5931\u8d25\uff01\\r\\n\u65f6\u95f4\uff1a$executetime\";\r\n}\r\nelse $msg = \"\\r\\n\u4f4d\u7f6e\uff1a$file\\r\\n\u7ed3\u679c\uff1a\u6587\u4ef6\u4e0d\u5b58\uff01\\r\\n\u65f6\u95f4\uff1a$executetime\";\r\nWriteToDelFiles($msg);\r\n}\/\/END foreach\r\n}\r\nelse\r\n{\r\n$msg = \"\\r\\n\u672a\u5728Body\u4e2d\u89e3\u6790\u5230\u6570\u636e\\r\\nBody\u539f\u59cb\u6570\u636e\uff1a$arcBodyRow[body]\\r\\n\u65f6\u95f4\uff1a$executetime\";\r\nWriteToDelFiles($msg);\r\n}\r\nreturn true;\r\n}\r\n\/\/\u83b7\u53d6\u771f\u5b9e\u8def\u5f84\r\nfunction GetTruePath($siterefer='', $sitepath='')\r\n{\r\n$truepath = $GLOBALS['cfg_basedir'];\r\nreturn $truepath;\r\n}\r\n?>\r\n<\/code><\/pre>\n
2021-11-15\u65e5\u66f4\u65b0<\/p>\n","protected":false},"excerpt":{"rendered":"
\u7ec7\u68a6dedecms\u5220\u9664\u6587\u7ae0\u65f6\uff0c\u4e0d\u4f1a\u5220\u9664\u8be5\u6587\u7ae0\u4e0a\u4f20\u7684\u56fe\u7247\uff0c\u4e0b\u9762\u662f\u89e3\u51b3\u65b9\u6cd5\uff0c\u6ce8\u610f\uff1a\u4fee\u6539\u4e4b\u524d\u8bf7\u5907\u4efd\u4e00\u4e0b\u6587\u4ef6\uff0c\u4ee5\u9632\u51fa\u9519 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[43,667,180,668],"class_list":["post-2003","post","type-post","status-publish","format-standard","hentry","category-web","tag-dedecms","tag-667","tag-180","tag-668"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=2003"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2003\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}