$writer = cn_substrR($writer, 20); $source = cn_substrR($source, 30); $description = cn_substrR($description, 250); $keywords = trim(cn_substrR($keywords, 60)); $filename = trim(cn_substrR($filename, 40)); $isremote = empty($isremote) ? 0 : $isremote; $serviterm = empty($serviterm) ? "" : $serviterm; if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); //分析body里的内容 $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext'); //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; if (is_array($addonfields)) { foreach ($addonfields as $v) { if ($v == '') { continue; } $vs = explode(',', $v);
if($ishtml==0) $ismake = -1; else $ismake = 0; $title = cn_substr($title,80); $shorttitle = cn_substr($shorttitle,36); $color = cn_substr($color,10); $writer = cn_substr($writer,30); $source = cn_substr($source,50); $description = cn_substr($description,250); if($keywords!="") $keywords = trim(cn_substr($keywords,60))." "; //处理上传的缩略图 if(empty($ddisremote)) $ddisremote = 0; $litpic = GetDDImage('litpic',$picname,$ddisremote); $adminID = $cuserLogin->getUserID(); $dsql = new DedeSql(false); $cts = GetChannelTable($dsql,$channelid); $arcID = GetIndexKey($dsql,$typeid,$channelid); //加入主档案表 //---------------------------------- $inQuery = "INSERT INTO `{$cts['maintable']}`( ID,typeid,typeid2,sortrank,iscommend,ismake,channel, arcrank,click,title,shorttitle,color,writer,source,litpic, pubdate,senddate,arcatt,adminID,memberID,description,keywords,templet) VALUES ('$arcID','$typeid','$typeid2','$sortrank','$iscommend','$ismake','$channelid',
} $dsql = new DedeSql(false); //获得父栏目 $nrow = $dsql->GetOne("Select * From #@__story_catalog where id='$catid' "); $bcatid = $nrow['pid']; $booktype = $nrow['booktype']; $pubdate = GetMkTime($pubdate); $bookname = cn_substr($bookname,50); if($keywords!="") $keywords = trim(cn_substr($keywords,60)); //处理上传的缩略图 $litpic = GetDDImage('litpic',$litpicname,0); $adminID = $cuserLogin->getUserID(); //自动摘要 if($description=="" && $cfg_auot_description>0){ $description = stripslashes(cn_substr(html2text($body),$cfg_auot_description)); $description = addslashes($description); } //---------------------------------- $upQuery = " Update `#@__story_books` set catid='$catid', bcatid='$bcatid', iscommend='$iscommend',
/** * 取第一个图片为缩略图 * * @access public * @param string $body 文档内容 * @return string */ function GetDDImgFromBody(&$body) { $litpic = ''; preg_match_all("/(src)=[\"|'| ]{0,}([^>]*\\.(gif|jpg|bmp|png))/isU", $body, $img_array); $img_array = array_unique($img_array[2]); if (count($img_array) > 0) { $picname = preg_replace("/[\"|'| ]{1,}/", '', $img_array[0]); if (preg_match("#_lit\\.#", $picname)) { $litpic = $picname; } else { $litpic = GetDDImage('ddfirst', $picname, 1); } } return $litpic; }
$userip = GetIP(); $isremote = empty($isremote) ? 0 : $isremote; $serviterm = empty($serviterm) ? "" : $serviterm; if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); //使用第一张图作为缩略图 if ($ddisfirst == 1 && $litpic == '') { if (isset($imgurl1)) { $litpic = GetDDImage('ddfirst', $imgurl1, $isrm); } } //生成文档ID $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid); if (empty($arcID)) { ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit; } $imgurls = "{dede:pagestyle maxwidth='{$maxwidth}' pagepicnum='{$pagepicnum}' ddmaxwidth='{$ddmaxwidth}' row='{$row}' col='{$col}' value='{$pagestyle}'/}\r\n"; $hasone = FALSE; //处理并保存从网上复制的图片 /*--------------------- function _getformhtml() ------------------*/ if ($formhtml == 1) {
function GetDDImgFromBody(&$body) { $litpic = ''; preg_match_all("/(src|SRC)=[\"|'| ]{0,}(.*\.(gif|jpg|jpeg|bmp|png))/isU",$body,$img_array); $img_array = array_unique($img_array[2]); if(count($img_array)>0){ $picname = preg_replace("/[\"|'| ]{1,}/","",$img_array[0]); if(ereg("_lit\.",$picname)) $litpic = $picname; else $litpic = GetDDImage('ddfirst',$picname,0); } return $litpic; }