From 5e46cb6fc5475a092cca1e4e067cda9ae9e0bded Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 20 Jun 2017 16:12:10 +0800 Subject: [PATCH] * adjust code. --- module/file/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/file/model.php b/module/file/model.php index 2868f85804..ce11d2e478 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -394,7 +394,7 @@ class fileModel extends model $content = preg_replace('/ src="(' . $readLinkReg . ')" /', ' onload="setImageSize(this,' . $maxSize . ')" src="$1" ', $content); preg_match_all('/ src="{([0-9]+)}" /', $content, $matchs); - if($matchs[1]) + if(!empty($matchs[1])) { $files = $this->dao->select('id,extension')->from(TABLE_FILE)->where('id')->in($matchs[1])->fetchPairs('id', 'extension'); foreach($matchs[0] as $i => $match) @@ -751,7 +751,7 @@ class fileModel extends model { if(empty($field) or empty($data->$field)) continue; preg_match_all('/ src="{([0-9]+)}" /', $data->$field, $matchs); - if($matchs[1]) + if(!empty($matchs[1])) { $files = $this->dao->select('id,extension')->from(TABLE_FILE)->where('id')->in($matchs[1])->fetchPairs('id', 'extension'); foreach($matchs[0] as $i => $match)