//解析body数据,获得所有图片的绝对地址
function GetPicsTruePath($body,$litpic)
{
$delfiles = array();//存储图片地址数据
if(!empty($litpic))
{
$litpicpath = GetTruePath();
$litpicpath .= $litpic;
$delfiles[] = $litpicpath;//缩略图地址
}
preg_match_all("/src=[\"|'|\S|\s]([^ title="liehuo.net" |\/|>]*){0,}(([^>]*)\.(gif|jpg|png))/isU",$body,$tmpdata);
$picspath = array_unique($tmpdata[2]);//body中所有图片的地址
foreach($picspath as $tmppath)
{
$path = GetTruePath();//获得绝对路径
$picpath = preg_replace("/[a-zA-z]+:\/\/[^ |\/|\s]*/",'',$tmppath);//去掉网址部分
$path .=$picpath;
$delfiles[] = $path;//保存处理后的数据
}
return $delfiles;
}
//获得文章Body数据
function GetArcBody($aid)
{
global $dsql;
$query = "SELECT [url=mailto:dede_addonarticle.body]dede_addonarticle.body[/url] FROM [url=mailto:%60dede_addonarticle]`dede_addonarticle[/url]` WHERE [url=mailto:dede_addonarticle.aid]dede_addonarticle.aid[/url] = '$aid'";
$row = $dsql->GetOne($query);
if(is_array($row))
return $row;
else
return false;
}
//写入日志文件
function WriteToDelFiles($msg)//删除文章的时候会通过此函数记录日志
{
if(empty($msg)) $savemsg="未获得消息";
else $savemsg = $msg;
$errorFile = dirname(__FILE__).'/../data/del_body_file.txt';//删除记录文件
$fp = @fopen($errorFile, 'a');
@fwrite($fp,"\r\n{$savemsg}");
@fclose($fp);
}
标签:body,39,url,dede,addonarticle,织梦,&#,文档,Dede From: https://www.cnblogs.com/hwrex/p/18355182