2015-04-16 21:26:33 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func boolValue(r *http.Request, k string) bool {
|
|
|
|
s := strings.ToLower(strings.TrimSpace(r.FormValue(k)))
|
|
|
|
return !(s == "" || s == "0" || s == "no" || s == "false" || s == "none")
|
|
|
|
}
|
|
|
|
|
2015-04-23 07:40:23 +00:00
|
|
|
func int64ValueOrZero(r *http.Request, k string) int64 {
|
2015-04-16 21:26:33 +00:00
|
|
|
val, err := strconv.ParseInt(r.FormValue(k), 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return val
|
|
|
|
}
|