mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-21 11:27:26 +08:00
1、解决分页BUG
2、解决切换文档上传附件混乱的BUG 3、无法清空文档标识的BUG 4、实现上传文件不限制后缀 5、实现上传文件大小限制 6、实现自动发布功能 7、优化登录时密码框错误提示不消失问题 8、优化网站首页限制网站title
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// 登录用户的Session名
|
||||
@@ -12,7 +13,7 @@ const LoginSessionName = "LoginSessionName"
|
||||
|
||||
const CaptchaSessionName = "__captcha__"
|
||||
|
||||
const RegexpEmail = `^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$`
|
||||
const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
|
||||
|
||||
//允许用户名中出现点号
|
||||
|
||||
@@ -101,6 +102,30 @@ func GetUploadFileExt() []string {
|
||||
}
|
||||
return exts
|
||||
}
|
||||
// 获取上传文件允许的最大值
|
||||
func GetUploadFileSize() int64 {
|
||||
size := beego.AppConfig.DefaultString("upload_file_size","0")
|
||||
|
||||
if strings.HasSuffix(size,"MB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
return s * 1024 * 1024
|
||||
}
|
||||
}
|
||||
if strings.HasSuffix(size,"GB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
return s * 1024 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
if strings.HasSuffix(size,"KB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
return s * 1024
|
||||
}
|
||||
}
|
||||
if s,e := strconv.ParseInt(size, 10, 64);e == nil {
|
||||
return s * 1024
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//判断是否是允许商城的文件类型.
|
||||
func IsAllowUploadFileExt(ext string) bool {
|
||||
|
Reference in New Issue
Block a user