} 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 ($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; }
$maxlength = $cfg_max_face * 1024; $userdir = $cfg_user_dir . '/' . $cfg_ml->M_ID; if (!ereg('^' . $userdir, $oldspacelogo)) { $oldspacelogo = ''; } if (is_uploaded_file($spacelogo)) { if (@filesize($_FILES['spacelogo']['tmp_name']) > $maxlength) { ShowMsg("你上传的Logo文件超过了系统限制大小:{$cfg_max_face} K!", '-1'); exit; } //删除旧图片(防止文件扩展名不同,如:原来的是gif,后来的是jpg) if (eregi("\\.(jpg|gif|png)\$", $oldspacelogo) && file_exists($cfg_basedir . $oldspacelogo)) { @unlink($cfg_basedir . $oldspacelogo); } //上传新工图片 $spacelogo = MemberUploads('spacelogo', '', $cfg_ml->M_ID, 'image', 'mylogo', 200, 50); } else { $spacelogo = $oldspacelogo; } $pagesize = intval($pagesize); $spacename = cn_substrR(HtmlReplace($spacename, 2), 50); $sign = cn_substrR(HtmlReplace($sign), 100); $spacenews = HtmlReplace($spacenews, -1); $query = "update `#@__member_space` set `pagesize` = '{$pagesize}',`spacename`='{$spacename}' , spacelogo='{$spacelogo}', `sign` = '{$sign}' ,`spacenews`='{$spacenews}' where mid='{$cfg_ml->M_ID}' "; $dsql->ExecuteNoneQuery($query); if ($cfg_ml->M_Spacesta >= 0) { $dsql->ExecuteNoneQuery("update `#@__member` set spacesta=1 where mid='{$cfg_ml->M_ID}' And spacesta < 1 "); } ShowMsg('成功更新空间信息!', 'edit_space_info.php'); exit; } else {
if ($catid == 0) { ShowMsg("请指定图书所属栏目!", "-1"); exit; } //获得父栏目 $nrow = $dsql->GetOne("Select * From #@__story_catalog where id='{$catid}' "); $bcatid = $nrow['pid']; $booktype = $nrow['booktype']; $pubdate = GetMkTime($pubdate); $bookname = addslashes(cn_substr(stripslashes($bookname), 50)); if ($keywords != "") { $keywords = trim(addslashes(cn_substr(stripslashes($keywords), 60))); } //处理上传的缩略图 if (!empty($litpic)) { $litpic = MemberUploads('litpic', $litpic, $cfg_ml->M_ID, 'image', '', $cfg_ddimg_width, $cfg_ddimg_height, false); $litpic = " litpic='{$litpic}', "; } else { $litpic = ""; } $userip = getip(); //自动摘要 if ($description == "" && $cfg_auot_description > 0) { $description = stripslashes(cn_substr(html2text($body), $cfg_auot_description)); $description = addslashes($description); } $status = $status == 1 ? 1 : 0; $upQuery = "\r\nUpdate `#@__story_books`\r\nset catid='{$catid}',\r\nbcatid='{$bcatid}',\r\nbookname='{$bookname}',\r\nauthor='{$author}',\r\n{$litpic}\r\npubdate='{$pubdate}',\r\ndescription='{$description}',\r\nstatus = '{$status}',\r\nbody='{$body}',\r\nkeywords='{$keywords}'\r\nwhere id='{$bookid}' and mid='{$cfg_ml->M_ID}'\r\n"; if (!$dsql->ExecuteNoneQuery($upQuery)) { ShowMsg("更新数据库时出错,请检查!" . $dsql->GetError(), "-1"); exit;
} $menutype = 'content'; if ($dopost == '') { include DEDEMEMBER . "/templets/uploads_add.htm"; } else { if ($dopost == 'save') { $cfg_ml->CheckUserSpace(); if ($mediatype == 1) { $utype = 'image'; } else { if ($mediatype == 2) { $utype = 'flash'; } else { if ($mediatype == 3) { $utype = 'media'; } else { $utype = 'addon'; } } } $title = HtmlReplace($title, 2); $filename = MemberUploads('addonfile', '', $cfg_ml->M_ID, $utype, '', -1, -1, true); SaveUploadInfo($title, $filename, $mediatype); $bkurl = "uploads_select.php?f=" . $f . "&mediatype=" . $mediatype . "&keyword=" . urlencode($keyword) . "&filename=" . $filename; if ($filename == '') { ShowMsg("上传文件失败!", "-1"); } else { ShowMsg("成功上传一个文件!", $bkurl); } } }
$maxlength = $cfg_max_face * 1024; $userdir = $cfg_user_dir . '/' . $cfg_ml->M_ID; if (!preg_match("#^" . $userdir . "#", $oldface)) { $oldface = ''; } if (is_uploaded_file($face)) { if (@filesize($_FILES['face']['tmp_name']) > $maxlength) { ShowMsg("你上传的头像文件超过了系统限制大小:{$cfg_max_face} K!", '-1'); exit; } //删除旧图片(防止文件扩展名不同,如:原来的是gif,后来的是jpg) if (preg_match("#\\.(jpg|gif|png)\$#i", $oldface) && file_exists($cfg_basedir . $oldface)) { @unlink($cfg_basedir . $oldface); } //上传新工图片 $face = MemberUploads('face', $oldface, $cfg_ml->M_ID, 'image', 'myface', 180, 180); } else { $face = $oldface; } $query = "UPDATE `#@__member` SET `face` = '{$face}' WHERE mid='{$cfg_ml->M_ID}' "; $dsql->ExecuteNoneQuery($query); // 清除缓存 $cfg_ml->DelCache($cfg_ml->M_ID); ShowMsg('成功更新头像信息!', $backurl); exit; } else { if ($dopost == 'delold') { if (empty($oldface)) { ShowMsg("没有可删除的头像!", "-1"); exit; }
if (empty($urlValue)) { $urlValue = ''; } if (empty($imgsrcValue)) { $imgsrcValue = ''; } 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 {
} } $info = ''; //正常上传 for ($i = 1; $i <= 120; $i++) { //含有图片的条件 if (isset($_FILES['imgfile' . $i]['tmp_name']) && is_uploaded_file($_FILES['imgfile' . $i]['tmp_name'])) { $iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i})); 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;
/** * 处理不同类型的数据 * * @access public * @param string $dvalue 默认值 * @param string $dtype 默认类型 * @param int $aid 文档ID * @param string $job 操作类型 * @param string $addvar 值 * @param string $admintype 管理类型 * @param string $fieldname 变量类型 * @return string */ function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '', $admintype = 'admin', $fieldname = '') { global $cfg_basedir, $cfg_cmspath, $adminid, $cfg_ml, $cfg_cookie_encode; if (!empty($adminid)) { $adminid = $adminid; } else { $adminid = isset($cfg_ml) ? $cfg_ml->M_ID : 1; } if ($dtype == 'int') { if ($dvalue == '') { return 0; } return GetAlabNum($dvalue); } else { if ($dtype == 'stepselect') { $dvalue = trim(preg_replace("#[^0-9\\.]#", "", $dvalue)); return $dvalue; } else { if ($dtype == 'float') { if ($dvalue == '') { return 0; } return GetAlabNum($dvalue); } else { if ($dtype == 'datetime') { if ($dvalue == '') { return 0; } return GetMkTime($dvalue); } else { if ($dtype == 'checkbox') { $okvalue = ''; if (is_array($dvalue)) { $okvalue = join(',', $dvalue); } return $okvalue; } else { if ($dtype == "htmltext") { if ($admintype == 'member' || $admintype == 'diy') { $dvalue = HtmlReplace($dvalue, -1); } return $dvalue; } else { if ($dtype == "multitext") { if ($admintype == 'member' || $admintype == 'diy') { $dvalue = HtmlReplace($dvalue, 0); } return $dvalue; } else { if ($dtype == "textdata") { $ipath = $cfg_cmspath . "/data/textdata"; $tpath = ceil($aid / 5000); if (!is_dir($cfg_basedir . $ipath)) { MkdirAll($cfg_basedir . $ipath, $GLOBALS['cfg_dir_purview']); } if (!is_dir($cfg_basedir . $ipath . '/' . $tpath)) { MkdirAll($cfg_basedir . $ipath . '/' . $tpath, $GLOBALS['cfg_dir_purview']); } $ipath = $ipath . '/' . $tpath; $filename = "{$ipath}/{$aid}-" . cn_substr(md5($cfg_cookie_encode), 0, 16) . ".txt"; //会员投稿内容安全处理 if ($admintype == 'member' || $admintype == 'diy') { $dvalue = HtmlReplace($dvalue, -1); } $fp = fopen($cfg_basedir . $filename, "w"); fwrite($fp, stripslashes($dvalue)); fclose($fp); CloseFtp(); return $filename; } else { if ($dtype == 'img' || $dtype == 'imgfile') { if (preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) { return $dvalue; } if ($admintype == 'diy') { $iurl = MemberUploads($fieldname, '', 0, 'image', '', -1, -1, false); return $iurl; } $iurl = stripslashes($dvalue); if (trim($iurl) == '') { return ''; } $iurl = trim(str_replace($GLOBALS['cfg_basehost'], "", $iurl)); $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; if (preg_match("/^http:\\/\\//i", $iurl) && $GLOBALS['cfg_isUrlOpen']) { //远程图片 $reimgs = ''; if ($GLOBALS['cfg_isUrlOpen']) { $reimgs = GetRemoteImage($iurl, $adminid); if (is_array($reimgs)) { if ($dtype == 'imgfile') { $imgurl = $reimgs[1]; } else { $imgurl = "{dede:img text='' width='" . $reimgs[1] . "' height='" . $reimgs[2] . "'} " . $reimgs[0] . " {/dede:img}"; } } } else { if ($dtype == 'imgfile') { $imgurl = $iurl; } else { $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; } } } else { if ($iurl != '') { //站内图片 $imgfile = $cfg_basedir . $iurl; if (is_file($imgfile)) { $info = ''; $imginfos = GetImageSize($imgfile, $info); if ($dtype == "imgfile") { $imgurl = $iurl; } else { $imgurl = "{dede:img text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}"; } } } } return addslashes($imgurl); } else { if ($dtype == 'addon' && $admintype == 'diy') { if (preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) { return $dvalue; } $dvalue = MemberUploads($fieldname, '', 0, 'addon', '', -1, -1, false); return $dvalue; } else { if ($admintype == 'member' || $admintype == 'diy') { $dvalue = HtmlReplace($dvalue, 1); } return $dvalue; } } } } } } } } } } }
} //文档的默认状态 if ($cInfos['arcsta'] == 0) { $arcrank = 0; } else { if ($cInfos['arcsta'] == 1) { $arcrank = 0; } else { $arcrank = -1; } } //对保存的内容进行处理 $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen); $mid = $cfg_ml->M_ID; //处理上传的缩略图 $litpic = MemberUploads('litpic', $oldlitpic, $mid, 'image', '', $cfg_ddimg_width, $cfg_ddimg_height, FALSE); if ($litpic != '') { SaveUploadInfo($title, $litpic, 1); } else { $litpic = $oldlitpic; } //分析处理附加表数据 $inadd_f = $inadd_m = ''; if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); if (is_array($addonfields)) { foreach ($addonfields as $v) { if ($v == '') { continue; } $vs = explode(',', $v);
$smalltypes = @explode(",", $row['smalltype']); if (!isset($action)) { $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; } } //类目递归
} ShowMsg("成功修改你的资料!", 'edit_fullinfo.php'); exit; } else { if ($cfg_ml->M_MbType == '企业') { $userdir = $cfg_user_dir . '/' . $cfg_ml->M_ID; if (!ereg('^' . $userdir, $oldcomface)) { $oldcomface = ''; } if (is_uploaded_file($comface)) { //删除旧图片(防止文件扩展名不同,如:原来的是gif,后来的是jpg) if ($oldcomface != '' && file_exists($cfg_basedir . $oldcomface)) { @unlink($cfg_basedir . $oldcomface); } //上传新工图片 $comface = MemberUploads('comface', '', $cfg_ml->M_ID, 'image', 'comface', 600, 450); } else { $comface = $oldcomface; } if (empty($city)) { $place = $province; } else { $place = $city; } $tel = GetAlabNum($tel); $fax = GetAlabNum($fax); $mobile = GetAlabNum($mobile); $email = cn_substrR(eregi_replace("[^0-9a-z\\.@-]", '', $email), 50); $url = cn_substrR(eregi_replace("[^0-9a-z\\.:/-]", '', $url), 50); $product = cn_substrR(HtmlReplace($product, 1), 20); $linkman = cn_substrR(HtmlReplace($linkman, 1), 20);