同步历史版本代码

This commit is contained in:
2026-03-03 09:32:22 -08:00
parent 7d46b31866
commit 4d8516b2e1
140 changed files with 8399 additions and 489 deletions
+2
View File
@@ -50,6 +50,8 @@ func MultiPasswordVerify(algo, salt, password, hash string) bool {
// Bcrypt (corresponding to PHP's password_hash/password_verify)
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
case "default": // PPanel's default algorithm
return VerifyPassWord(password, hash)
default:
return VerifyPassWord(password, hash)
}
+14 -10
View File
@@ -24,22 +24,26 @@ func SystemConfigSliceReflectToStruct(slice []*system.System, structType any) {
}
if field.IsValid() && field.CanSet() {
switch config.Type {
case "string":
switch field.Kind() {
case reflect.String:
field.SetString(config.Value)
case "bool":
case reflect.Bool:
boolValue, _ := strconv.ParseBool(config.Value)
field.SetBool(boolValue)
case "int":
intValue, _ := strconv.Atoi(config.Value)
field.SetInt(int64(intValue))
case "int64":
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
intValue, _ := strconv.ParseInt(config.Value, 10, 64)
field.SetInt(intValue)
case "interface":
_ = json.Unmarshal([]byte(config.Value), field.Addr().Interface())
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
uintValue, _ := strconv.ParseUint(config.Value, 10, 64)
field.SetUint(uintValue)
case reflect.Float32, reflect.Float64:
floatValue, _ := strconv.ParseFloat(config.Value, 64)
field.SetFloat(floatValue)
default:
break
// For interface, struct, map, slice, array - try JSON unmarshal
if config.Value != "" {
_ = json.Unmarshal([]byte(config.Value), field.Addr().Interface())
}
}
}
}