//解析body数据,获得所有图片的绝对地址
function GetPicsTruePath($body,$litpic)
{
$delfiles = array();
//存储图片地址数据
if(!empty($litpic))
{
$litpicpath = GetTruePath();
$litpicpath .= $litpic;
$delfiles[] = $litpicpath;
//缩略图地址
}
preg_match_all("/src=[\"|'|\S|\s]([^ |\/|>]*){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 js_addonarticle.body FROM xmzy_addonarticle WHERE xmzy_addonarticle.aid = '$aid'";
$row = $dsql->GetOne($query);
if(is_array($row))
return $row;
else
return false;
} //mobantianxia.cn修改于2010.01.28
//写入日志文件
function WriteToDelFiles($msg)//删除文章的时候会通过此函数记录日志
{
if(empty($msg)) $savemsg="未获得消息";
else $savemsg = $msg;
$errorFile = dirname(__FILE__).'/../data/del_body_file.txt';//删除记录文件
$fp = @fopen($errorFile, 'a');
@fwrite($fp," {$savemsg}");
@fclose($fp);
}
|