...
|
...
|
@@ -459,21 +459,27 @@ class Home extends Base { |
|
|
$body = db()->first(bodySql::first($id));
|
|
|
if($body){
|
|
|
$data['body'] = json_decode($body['text_html'],true);
|
|
|
$charset = '';
|
|
|
$charset = 'utf-8';
|
|
|
$htmlbody = '';
|
|
|
foreach ($data['body'] as $bd){
|
|
|
if(!empty($bd['charset'])){
|
|
|
$charset = $bd['charset'];
|
|
|
break;
|
|
|
// if(!empty($bd['charset'])){
|
|
|
// $charset = $bd['charset'];
|
|
|
// }
|
|
|
if(($bd['type']??'') == 'text/html'){
|
|
|
$htmlbody = base64_decode($bd['body']);
|
|
|
}
|
|
|
}
|
|
|
foreach ($data['body'] as $bdk=>$bd){
|
|
|
|
|
|
if(!empty($bd['path'])){
|
|
|
|
|
|
if($charset){
|
|
|
$data['body'][$bdk]['name'] = @iconv($charset,'utf-8',@base64_decode($bd['name']));
|
|
|
$data['body'][$bdk]['filename'] = @iconv($charset,'utf-8',@base64_decode($bd['filename']));
|
|
|
}
|
|
|
$data['body'][$bdk]['name'] = @base64_decode($bd['name']);
|
|
|
$data['body'][$bdk]['filename'] = @base64_decode($bd['filename']);
|
|
|
// 进行编码转换 会出现未知bug
|
|
|
// if($charset && strtolower($charset) != 'utf-8' && strtolower($charset) != 'utf8'){
|
|
|
// $data['body'][$bdk]['name'] = @iconv($charset,'utf-8',$data['body'][$bdk]['name']);
|
|
|
// $data['body'][$bdk]['filename'] = @iconv($charset,'utf-8',$data['body'][$bdk]['filename']);
|
|
|
// }
|
|
|
|
|
|
$data['body'][$bdk]['size'] = 0;
|
|
|
$data['body'][$bdk]['url'] = '';
|
...
|
...
|
@@ -484,7 +490,25 @@ class Home extends Base { |
|
|
$data['body'][$bdk]['url'] = APP_HOST.str_replace(PUBLIC_PATH,'',$bd['path']);
|
|
|
}
|
|
|
|
|
|
// 验证编码是否有其他编码字符,这里编辑了未知编码
|
|
|
if(!@json_encode($data['body'][$bdk])){
|
|
|
// 抛弃原有的名字,显示已存储到服务器的名字
|
|
|
$data['body'][$bdk]['name'] = $data['body'][$bdk]['signName'];
|
|
|
$data['body'][$bdk]['filename'] = $data['body'][$bdk]['signName'];
|
|
|
}
|
|
|
|
|
|
unset($data['body'][$bdk]['path']);
|
|
|
|
|
|
// 内容区是有有cid
|
|
|
if ($htmlbody && !empty($bd['content-id'])){
|
|
|
if(!strpos($htmlbody,"\"cid:{$bd['content-id']}\"")){
|
|
|
unset($data['body'][$bdk]['content-id']);
|
|
|
}
|
|
|
}
|
|
|
// 没有html内容,content-id是不可能有的
|
|
|
else if(!$htmlbody){
|
|
|
unset($data['body'][$bdk]['content-id']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return [
|
...
|
...
|
|