From 00877e607c70d6fed02db3a9cebbe17fccbb45be Mon Sep 17 00:00:00 2001 From: tianya Date: Sat, 29 Apr 2023 23:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/static/web/css/style.css | 5 +++ src/system/common.func.php | 1 + src/system/customfields.func.php | 63 ++++++----------------------- src/system/memberlogin.class.php | 16 ++++---- src/user/api.php | 8 ++++ src/user/index.php | 6 +-- src/user/templets/index.htm | 12 ++++++ src/user/templets/widget_litpic.htm | 2 + 9 files changed, 54 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index 9e623288..7f374129 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,4 @@ src/a/baidunews.xml src/data/backupfile* src/data/updatefile* src/data/checksql_* +src/static/media/*/ diff --git a/src/static/web/css/style.css b/src/static/web/css/style.css index 53b660c0..89d0a684 100644 --- a/src/static/web/css/style.css +++ b/src/static/web/css/style.css @@ -477,4 +477,9 @@ input[type=file] { .feedbacks .feedback-action { float:none } +} +.userspace .info{ + font-size: 14px; + font-weight: normal; + color: #545b62; } \ No newline at end of file diff --git a/src/system/common.func.php b/src/system/common.func.php index 61f68e71..56ee57c1 100755 --- a/src/system/common.func.php +++ b/src/system/common.func.php @@ -675,6 +675,7 @@ function GetMimeTypeOrExtension($str, $t = 0) { 'midi' => 'audio/midi', 'mjs' => 'text/javascript', 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', 'mpeg' => 'video/mpeg', 'mpkg' => 'application/vnd.apple.installer+xml', 'odp' => 'application/vnd.oasis.opendocument.presentation', diff --git a/src/system/customfields.func.php b/src/system/customfields.func.php index eeb52667..1b913f22 100755 --- a/src/system/customfields.func.php +++ b/src/system/customfields.func.php @@ -105,11 +105,15 @@ function GetFormItem($ctag, $admintype = 'admin') $innertext = ""; } else if ($fieldType == 'img' || $fieldType == 'imgfile') { $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; - $innertext = " "; + $sstr = $fieldType == 'imgfile'? '' : ""; + $pstr = $fieldType == 'imgfile'? '请填写图片地址' : '请选择图片上传或填写图片地址'; + $innertext = " $sstr"; } else if ($fieldType == 'media') { - $innertext = ""; + $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; + $innertext = " "; } else if ($fieldType == 'addon') { - $innertext = ""; + $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; + $innertext = " "; } else if ($fieldType == 'int' || $fieldType == 'float') { $dfvalue = ($ctag->GetAtt('default') != '' ? $ctag->GetAtt('default') : '0'); $innertext = ""; @@ -219,50 +223,7 @@ function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '', $a CloseFtp(); return $filename; } else if ($dtype == 'img' || $dtype == 'imgfile') { - if (preg_match("#[\\|/]static[\\|/]userup#", $dvalue)) return addslashes($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|https):\/\//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); + return addslashes($dvalue); } else if ($dtype == 'addon' && $admintype == 'diy') { if ($admintype == 'diy') { return addslashes($dvalue); @@ -397,6 +358,7 @@ function GetFormItemValue($ctag, $fvalue, $admintype = 'admin', $fieldname = '') $nowtime = GetDateTimeMk($fvalue); $innertext = ""; } else if ($ftype == "img") { + $tmpValue = $fvalue; $ndtp = new DedeTagParse(); $ndtp->LoadSource($fvalue); if (!is_array($ndtp->CTags)) { @@ -408,18 +370,19 @@ function GetFormItemValue($ctag, $fvalue, $admintype = 'admin', $fieldname = '') $fvalue = trim($ntag->GetInnerText()); } } + $fvalue = empty($fvalue)? $tmpValue : $fvalue; $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; $innertext = " "; } else if ($ftype == "imgfile") { $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; - $innertext = " "; + $innertext = ""; } else if ($ftype == "media") { $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; - $selectStr = defined('DEDEADMIN')? "" : ''; + $selectStr = ""; $innertext = " $selectStr"; } else if ($ftype == "addon") { $fname = defined('DEDEADMIN')? 'form1' : 'addcontent'; - $selectStr = defined('DEDEADMIN')? "" : ""; + $selectStr = ""; $innertext = " $selectStr"; } else if ($ftype == "int" || $ftype == "float") { $innertext = ""; diff --git a/src/system/memberlogin.class.php b/src/system/memberlogin.class.php index aa098394..e8014150 100755 --- a/src/system/memberlogin.class.php +++ b/src/system/memberlogin.class.php @@ -236,23 +236,25 @@ class MemberLogin { $uid = $this->M_ID; $row = $this->dsql->GetOne("SELECT sum(filesize) AS fs FROM `#@__uploads` WHERE mid='$uid';"); - return $row['fs']; + return intval($row['fs']); } /** - * 检查会员空间信息 + * 检查会员空间是否已满 * - * @return void + * @return bool */ - function CheckUserSpace() + function CheckUserSpaceIsFull() { global $cfg_mb_max; - $uid = $this->M_ID; + if ($cfg_mb_max == 0) { + return false; + } $hasuse = $this->GetUserSpace(); $maxSize = $cfg_mb_max * 1024 * 1024; if ($hasuse >= $maxSize) { - ShowMsg('您的空间已满,不允许上传新文件', '-1'); - exit(); + return true; } + return false; } /** * 更新会员信息统计表 diff --git a/src/user/api.php b/src/user/api.php index a96740bc..aaa8609c 100755 --- a/src/user/api.php +++ b/src/user/api.php @@ -67,6 +67,14 @@ if ($action === 'is_need_check_code') { )); exit; } + if ($cfg_ml->CheckUserSpaceIsFull()) { + echo json_encode(array( + "code" => -1, + "msg" => "您的空间已满,不允许上传新文件", + "data" => null, + )); + exit; + } $target_dir = "uploads/";//上传目录 $type = isset($type)? $type : ''; //获取允许的扩展 diff --git a/src/user/index.php b/src/user/index.php index 96d5b282..f9ce277c 100755 --- a/src/user/index.php +++ b/src/user/index.php @@ -20,12 +20,13 @@ if ($uid == '') { } else { $minfos = $dsql->GetOne("SELECT * FROM `#@__member_tj` WHERE mid='".$cfg_ml->M_ID."';"); $minfos['totaluse'] = $cfg_ml->GetUserSpace(); - $minfos['totaluse'] = number_format($minfos['totaluse'] / 1024 / 1024, 2); if ($cfg_mb_max > 0) { - $ddsize = ceil(($minfos['totaluse'] / $cfg_mb_max) * 100); + $ddsize = ceil($minfos['totaluse'] / ($cfg_mb_max * 1024 * 1024) * 100); } else { $ddsize = 0; } + $ddsize = $ddsize > 100? 100 : $ddsize; + $minfos['totaluse'] = number_format($minfos['totaluse'] / 1024 / 1024, 2); require_once(DEDEINC.'/channelunit.func.php'); //显示最新文档 $archives = array(); @@ -42,4 +43,3 @@ if ($uid == '') { $dpl->display(); } } -?> \ No newline at end of file diff --git a/src/user/templets/index.htm b/src/user/templets/index.htm index 19966045..ae0209b5 100755 --- a/src/user/templets/index.htm +++ b/src/user/templets/index.htm @@ -69,6 +69,18 @@ + 0){ ?> +
+
+
+

用户空间MB/MB)

+
+
%
+
+
+
+
+
diff --git a/src/user/templets/widget_litpic.htm b/src/user/templets/widget_litpic.htm index 0bc943a8..74f99a00 100644 --- a/src/user/templets/widget_litpic.htm +++ b/src/user/templets/widget_litpic.htm @@ -17,6 +17,8 @@ if (result.code === 0) { $("#imgLitpic").attr('src', result.data); $("#litpic").val(result.data); + } else { + ShowMsg(result.msg); } }, error: function (xhr, status, error) {