|
@@ -378,7 +378,7 @@ function GetDDImage($litpic, $picname, $isremote) |
|
|
$img = $cfg_basedir.$litpic; |
|
|
$img = $cfg_basedir.$litpic; |
|
|
} else { |
|
|
} else { |
|
|
$picname = trim($picname); |
|
|
$picname = trim($picname); |
|
|
if ($isremote == 1 && preg_match("#^(http|https):\/\/#i", $picname)) { |
|
|
|
|
|
|
|
|
if ($isremote == 1 && preg_match("#^http:\/\/#i", $picname)) { |
|
|
$litpic = $picname; |
|
|
$litpic = $picname; |
|
|
$ddinfos = GetRemoteImage($litpic, $cuserLogin->getUserID()); |
|
|
$ddinfos = GetRemoteImage($litpic, $cuserLogin->getUserID()); |
|
|
if (!is_array($ddinfos)) { |
|
|
if (!is_array($ddinfos)) { |
|
@@ -390,7 +390,7 @@ function GetDDImage($litpic, $picname, $isremote) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if ($litpic == 'ddfirst' && !preg_match("#^(http|https):\/\/#i", $picname)) { |
|
|
|
|
|
|
|
|
if ($litpic == 'ddfirst' && !preg_match("#^http:\/\/#i", $picname)) { |
|
|
$oldpic = $cfg_basedir.$picname; |
|
|
$oldpic = $cfg_basedir.$picname; |
|
|
$litpic = str_replace('.', '-ty.', $picname); |
|
|
$litpic = str_replace('.', '-ty.', $picname); |
|
|
@ImageResizeNew($oldpic, $cfg_ddimg_width, $cfg_ddimg_height, $cfg_basedir.$litpic); |
|
|
@ImageResizeNew($oldpic, $cfg_ddimg_width, $cfg_ddimg_height, $cfg_basedir.$litpic); |
|
@@ -509,15 +509,14 @@ function PrintAutoFieldsEdit(&$fieldset, &$fieldValues, $loadtype = 'all') |
|
|
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '') |
|
|
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '') |
|
|
{ |
|
|
{ |
|
|
global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_bizcore_appid, $cfg_bizcore_key; |
|
|
global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_bizcore_appid, $cfg_bizcore_key; |
|
|
$autolitpic = empty($autolitpic) ? '' : $autolitpic; |
|
|
|
|
|
$autokey = empty($autokey) ? '' : $autokey; |
|
|
|
|
|
|
|
|
$autolitpic = (empty($autolitpic) ? '' : $autolitpic); |
|
|
$body = stripslashes($body); |
|
|
$body = stripslashes($body); |
|
|
//远程图片本地化 |
|
|
//远程图片本地化 |
|
|
if ($remote === '1') { |
|
|
|
|
|
|
|
|
if ($remote == 1) { |
|
|
$body = GetCurContent($body); |
|
|
$body = GetCurContent($body); |
|
|
} |
|
|
} |
|
|
//删除非站内链接 |
|
|
//删除非站内链接 |
|
|
if ($dellink === '1') { |
|
|
|
|
|
|
|
|
if ($dellink == 1) { |
|
|
$allow_urls = array($_SERVER['HTTP_HOST']); |
|
|
$allow_urls = array($_SERVER['HTTP_HOST']); |
|
|
//读取允许的超链接设置 |
|
|
//读取允许的超链接设置 |
|
|
if (file_exists(DEDEDATA."/admin/allowurl.txt")) { |
|
|
if (file_exists(DEDEDATA."/admin/allowurl.txt")) { |
|
@@ -526,17 +525,17 @@ function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '' |
|
|
$body = Replace_Links($body, $allow_urls); |
|
|
$body = Replace_Links($body, $allow_urls); |
|
|
} |
|
|
} |
|
|
//自动摘要 |
|
|
//自动摘要 |
|
|
if ($cfg_auot_description > 0 && $description === '') { |
|
|
|
|
|
|
|
|
if ($cfg_auot_description > 0 && $description == '') { |
|
|
$description = cn_substr(html2text($body), $cfg_auot_description); |
|
|
$description = cn_substr(html2text($body), $cfg_auot_description); |
|
|
$description = trim(preg_replace('/#p#|#e#/', '', $description)); |
|
|
$description = trim(preg_replace('/#p#|#e#/', '', $description)); |
|
|
$description = addslashes($description); |
|
|
$description = addslashes($description); |
|
|
} |
|
|
} |
|
|
//自动获取缩略图 |
|
|
//自动获取缩略图 |
|
|
if ($autolitpic === '1' && $litpic === '') { |
|
|
|
|
|
|
|
|
if ($autolitpic == 1 && $litpic == '') { |
|
|
$litpic = GetDDImgFromBody($body); |
|
|
$litpic = GetDDImgFromBody($body); |
|
|
} |
|
|
} |
|
|
//自动获取关键词 |
|
|
//自动获取关键词 |
|
|
if ($autokey === '1') { |
|
|
|
|
|
|
|
|
if ($autokey == 1) { |
|
|
$subject = $title." ".Html2Text($body); |
|
|
$subject = $title." ".Html2Text($body); |
|
|
//采用DedeBIZ Core分词组件分词 |
|
|
//采用DedeBIZ Core分词组件分词 |
|
|
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { |
|
|
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { |
|
@@ -657,7 +656,7 @@ function UploadOneImage($upname, $handurl = '', $isremote = 1, $ntitle = '') |
|
|
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1"); |
|
|
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1"); |
|
|
exit(); |
|
|
exit(); |
|
|
} |
|
|
} |
|
|
if (!empty($handurl) && !preg_match("#^(http|https):\/\/#i", $handurl) && file_exists($cfg_basedir.$handurl)) { |
|
|
|
|
|
|
|
|
if (!empty($handurl) && !preg_match("#^http:\/\/#i", $handurl) && file_exists($cfg_basedir.$handurl)) { |
|
|
if (!is_object($dsql)) { |
|
|
if (!is_object($dsql)) { |
|
|
$dsql = new DedeSqli(); |
|
|
$dsql = new DedeSqli(); |
|
|
} |
|
|
} |
|
|