} //文档的默认状态 if ($cInfos['arcsta'] == 0) { $ismake = 0; $arcrank = 0; } else { if ($cInfos['arcsta'] == 1) { $ismake = -1; $arcrank = 0; } else { $ismake = 0; $arcrank = -1; } } //对保存的内容进行处理 $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen); $writer = cn_substrR(HtmlReplace($writer, 1), 20); if (empty($description)) { $description = ''; } $description = cn_substrR(HtmlReplace($description, 1), 250); $keywords = cn_substrR(HtmlReplace($tags, 1), 30); $mid = $cfg_ml->M_ID; $isadmin = $cfg_ml->fields['matt'] == 10 ? true : false; //处理上传的缩略图 $litpic = MemberUploads('litpic', $oldlitpic, $mid, 'image', '', $cfg_ddimg_width, $cfg_ddimg_height, false, $isadmin); if ($litpic != '') { SaveUploadInfo($title, $litpic, 1); } else { $litpic = $oldlitpic; }
} if ($arow['mid'] != $cfg_ml->M_ID) { ShowMsg("你没有修改这个附件的权限!", "-1"); exit; } include DEDEMEMBER . "/templets/uploads_edit.htm"; exit; } else { if ($dopost == 'save') { $title = HtmlReplace($title, 2); if ($mediatype == 1) { $utype = 'image'; } else { if ($mediatype == 2) { $utype = 'flash'; } else { if ($mediatype == 3) { $utype = 'media'; } else { $utype = 'addon'; } } } $title = HtmlReplace($title, 2); $exname = preg_replace("#(.*)/#", "", $oldurl); $exname = preg_replace("#\\.(.*)\$#", "", $exname); $filename = MemberUploads('addonfile', $oldurl, $cfg_ml->M_ID, $utype, $exname, -1, -1, TRUE); SaveUploadInfo($title, $filename, $mediatype); ShowMsg("成功修改文件!", "uploads_edit.php?aid={$aid}"); } }
if (empty($imgurl)) { $imgurl = ''; } if (empty($dd)) { $dd = ''; } if ($dopost == 'upload') { $ntime = time(); $cfg_ml->CheckUserSpace(); $filename = MemberUploads('imgfile', '', $cfg_ml->M_ID, 'image', '', -1, -1, true); $dfilename = ereg_replace("(.*)/", "", $filename); SaveUploadInfo("对话框上传 {$dfilename} ", $filename, 1); if ($dd == "yes") { $litfilename = str_replace(".", "-lit.", $filename); copy($cfg_basedir . '/' . $filename, $cfg_basedir . '/' . $litfilename); SaveUploadInfo("对话框上传 {$dfilename} 的小图", $litfilename, 1); ImageResize($cfg_basedir . '/' . $litfilename, $w, $h); $urlValue = $filename; $imgsrcValue = $litfilename; $info = ''; $sizes = getimagesize($cfg_basedir . '/' . $litfilename, $info); $imgwidthValue = $sizes[0]; $imgheightValue = $sizes[1]; $imgsize = filesize($cfg_basedir . '/' . $litfilename); } else { $imgsrcValue = $filename; $urlValue = $filename; $info = ''; $sizes = getimagesize($cfg_basedir . '/' . $filename, $info); $imgwidthValue = $sizes[0]; $imgheightValue = $sizes[1];
if (!is_uploaded_file($_FILES['imgfile' . $i]['tmp_name'])) { continue; } else { $sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp"); if (!in_array($_FILES['imgfile' . $i]['type'], $sparr)) { continue; } $filename = MemberUploads('imgfile' . $i, '', $cfg_ml->M_ID, 'image', '', 0, 0, false); if ($filename != '') { SaveUploadInfo($title, $filename, 1); } //缩图 if ($pagestyle > 2) { $litpicname = GetImageMapDD($filename, $ddmaxwidth); if ($litpicname != '') { SaveUploadInfo($title . ' 小图', $litpicname, 1); } } else { $litpicname = $filename; } $imgfile = $cfg_basedir . $filename; if (is_file($imgfile)) { $iurl = $filename; $info = ''; $imginfos = @getimagesize($imgfile, $info); $imgurls .= "{dede:img ddimg='{$litpicname}' text='{$iinfo}' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}\r\n"; } } if (!$hasone && $litpic == '' && !empty($litpicname)) { $litpic = $litpicname; $hasone = true;
$action = ''; } if ($action == "save") { $groupname = cn_substrR($groupname, 75); $storeid = ereg_replace("[^0-9]", "", $store); $description = cn_substrR($des, 100); $row = $db->GetOne("SELECT tops FROM #@__store_groups WHERE storeid='{$storeid}'"); if ($row['tops'] > 0) { $rootstoreid = $row['tops']; } else { $rootstoreid = $storeid; } //处理上传的缩略图 $litpic = MemberUploads('litpic', '', $cfg_ml->M_ID, 'image', '', 100, 70, false); if ($litpic != '') { SaveUploadInfo($groupname, $litpic, 1); } $inQuery = "UPDATE #@__groups SET groupname='" . $groupname . "',des='" . $description . "',groupimg='" . $litpic . "',rootstoreid='{$rootstoreid}',storeid='{$storeid}' WHERE groupid='{$id}' AND uid='" . $cfg_ml->M_ID . "';"; $db->SetQuery($inQuery); if (!$db->ExecuteNoneQuery()) { echo $db->GetError(); ShowMsg("把数据更新到数据库groups表时出错,请检查!", "-1"); exit; } else { ShowMsg("成功更改圈子设置!", "-1"); exit; } } //类目递归 $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops=0 ORDER BY orders ASC"); $db->Execute(1);
/** * 获得文章body里的外部资源 * * @access public * @param string $body 内容 * @return string */ function GetCurContent(&$body) { global $cfg_multi_site, $cfg_basehost, $cfg_basedir, $cfg_user_dir, $title, $cfg_ml; include_once DEDEINC . "/dedecollection.func.php"; $htd = new DedeHttpDown(); $basehost = "http://" . $_SERVER["HTTP_HOST"]; $img_array = array(); preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\\/\\/([^>]*)\\.(gif|jpg|png))/isU", $body, $img_array); $img_array = array_unique($img_array[2]); $imgUrl = $cfg_user_dir . "/" . $cfg_ml->M_ID; $imgPath = $cfg_basedir . $imgUrl; if (!is_dir($imgPath . "/")) { MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']); CloseFtp(); } $milliSecond = MyDate("ymdHis", time()); foreach ($img_array as $key => $value) { if (preg_match("#" . $basehost . "#i", $value)) { continue; } if ($cfg_basehost != $basehost && preg_match("#" . $cfg_basehost . "#i", $value)) { continue; } if (!preg_match("#^http:\\/\\/#i", $value)) { continue; } $htd->OpenUrl($value); $itype = $htd->GetHead("content-type"); $itype = substr($value, -4, 4); if (!preg_match("#\\.(jpg|gif|png)#i", $itype)) { if ($itype == 'image/gif') { $itype = ".gif"; } else { if ($itype == 'image/png') { $itype = ".png"; } else { $itype = '.jpg'; } } } $milliSecondN = dd2char($milliSecond . '-' . mt_rand(1000, 8000)); $value = trim($value); $rndFileName = $imgPath . "/" . $milliSecondN . '-' . $key . $itype; $fileurl = $imgUrl . "/" . $milliSecondN . '-' . $key . $itype; $rs = $htd->SaveToBin($rndFileName); if ($rs) { $body = str_replace($value, $fileurl, $body); @WaterImg($rndFileName, 'down'); } $info = ''; $imginfos = GetImageSize($rndFileName, $info); SaveUploadInfo($title, $fileurl, 1, $imginfos); } $htd->Close(); return $body; }
function GetUpImage($litpic,$isdd=false,$exitErr=false,$iw=0,$ih=0,$iname='') { global $cfg_ml,$cfg_ddimg_width,$cfg_ddimg_height; global $cfg_basedir,$cfg_user_dir,$title,$cfg_mb_upload_size,$cfg_photo_typenames; if($iw==0) $iw = $cfg_ddimg_width; if($ih==0) $ih = $cfg_ddimg_height; $ntime = $nowtme = mytime(); if(!isset($_FILES[$litpic])) return ""; if(is_uploaded_file($_FILES[$litpic]['tmp_name'])) { //超过限定大小的文件不给上传 if($_FILES[$litpic]['size'] > $cfg_mb_upload_size*1024){ @unlink($_FILES[$litpic]['tmp_name']); return ""; } $sparr = $cfg_photo_typenames; $_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type'])); if(!in_array($_FILES[$litpic]['type'],$sparr)){ if($exitErr){ ShowMsg("上传的缩略图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1"); exit(); }else{ return ""; } } $savepath = $cfg_user_dir."/".$cfg_ml->M_ID; CreateDir($savepath); if($iname=='') $itname = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999)).'-lit'; else $itname = $iname; $fullUrl = $savepath."/".$itname; //强制检测文件类型 if($iname==''){ if(strtolower($_FILES[$litpic]['type'])=="image/gif") $fullUrl = $fullUrl.".gif"; else if(strtolower($_FILES[$litpic]['type'])=="image/png") $fullUrl = $fullUrl.".png"; else $fullUrl = $fullUrl.".jpg"; }else{ $fullUrl = $fullUrl.'.jpg'; } @move_uploaded_file($_FILES[$litpic]['tmp_name'],$cfg_basedir.$fullUrl); $litpic = $fullUrl; if($isdd) @ImageResize($cfg_basedir.$fullUrl,$iw,$ih); else @WaterImg($cfg_basedir.$fullUrl,'up'); //保存用户上传的记录到数据库 if($title==''){ if($isdd) $title = '用户上传的图片'; else $title = '用户上传的略略图'; } $info = ""; $datas[0] = 0; $datas[1] = 0; $datas = GetImageSize($cfg_basedir.$fullUrl,$info); $addinfos[0] = $datas[0]; $addinfos[1] = $datas[1]; $addinfos[2] = filesize($cfg_basedir.$fullUrl); SaveUploadInfo($title,$fullUrl,1,$addinfos); return $litpic; }else{ return ""; } }