diff --git a/src/admin/article_add.php b/src/admin/article_add.php index 9ab485c7..1fc5a147 100644 --- a/src/admin/article_add.php +++ b/src/admin/article_add.php @@ -24,12 +24,6 @@ if ($dopost != 'save') { $cid = empty($cid) ? 0 : intval($cid); if (empty($geturl)) $geturl = ''; $keywords = $writer = $source = $body = $description = $title = ''; - //采集单个网页 - if (preg_match("#^(http|https):\/\/#", $geturl)) { - require_once(DEDEADMIN."/inc/inc_coonepage.php"); - $redatas = CoOnePage($geturl); - extract((array)$redatas); - } //获得栏目模型id if ($cid > 0 && $channelid == 0) { $row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; "); diff --git a/src/admin/inc/inc_coonepage.php b/src/admin/inc/inc_coonepage.php deleted file mode 100644 index 0be39b93..00000000 --- a/src/admin/inc/inc_coonepage.php +++ /dev/null @@ -1,102 +0,0 @@ - '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => ''); - $redatas['source'] = preg_replace("/(http|https):\/\//i", "", $gurl); - $redatas['source'] = preg_replace("/\/(.*)$/i", "", $redatas['source']); - $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '".$redatas['source']."' "); - $s = $e = ''; - if (is_array($row)) { - list($s, $e) = explode('{@body}', $row['rule']); - $s = trim($s); - $e = trim($e); - if ($row['issource'] == 1) { - $redatas['source'] = $row['title']; - } - } - $htd = new DedeHttpDown(); - $htd->OpenUrl($gurl); - $body = $htd->GetHtml(); - if ($body != '') { - //编码自动转换 - if ($cfg_soft_lang == 'utf-8') { - if ($row['lang'] == 'gb2312') { - $body = gb2utf8($body); - } - } else if ($cfg_soft_lang == 'gb2312') { - if ($row['lang'] == 'utf-8') { - $body = utf82gb($body); - } - } - //获取标题 - $inarr = array(); - preg_match("/(.*)<\/title>/isU", $body, $inarr); - if (isset($inarr[1])) { - $redatas['title'] = $inarr[1]; - } - //获取关键词 - $inarr = array(); - preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr); - if (isset($inarr[1])) { - $redatas['keywords'] = cn_substr(html2text($inarr[1]), 30); - } - //获取摘要 - $inarr = array(); - preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr); - if (isset($inarr[1])) { - $redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description); - } - //获取文档 - if ($s != '' && $e != '') { - $redatas['body'] = GetHtmlAreaA($s, $e, $body); - if ($redatas['body'] != '' && $redatas['description'] == '') { - $redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']); - } - } - } - return $redatas; -} -/** - * 获取特定区域的HTML - * - * @access public - * @param string $s 开始标识符 - * @param string $e 末尾标识符 - * @param string $html 文档信息 - * @return string - */ -function GetHtmlAreaA($s, $e, &$html) -{ - if ($html == "" || $s == "") { - return ""; - } - $posstart = @strpos($html, $s); - if ($posstart === FALSE) { - return ""; - } - $posend = strpos($html, $e, $posstart); - if ($posend > $posstart && $posend !== FALSE) { - return substr($html, $posstart + strlen($s), $posend - $posstart - strlen($s)); - } else { - return ''; - } -} -?> \ No newline at end of file diff --git a/src/admin/js/main.js b/src/admin/js/main.js index 2024d560..cdba201c 100644 --- a/src/admin/js/main.js +++ b/src/admin/js/main.js @@ -575,9 +575,11 @@ var optCropper = { crop: function (e) { $("#cropWidth").text(Math.round(e.detail.height)); $("#cropHeight").text(Math.round(e.detail.width)); - var dataUrl = $(this).cropper("getCroppedCanvas").toDataURL(); - litpicImg = dataUrl; - $("#litPic").attr("src", litpicImg); + if ($(this).cropper("getCroppedCanvas")) { + var dataUrl = $(this).cropper("getCroppedCanvas").toDataURL(); + litpicImg = dataUrl; + $("#litPic").attr("src", litpicImg); + } }, aspectRatio: 4 / 3, //拖动截取缩略图后,截取的缩略图更新到imageItems中