trim spaces from most form inputs
This commit is contained in:
parent
0aa072baf2
commit
dfca8b10f0
37
web.go
37
web.go
|
@ -395,7 +395,7 @@ func inbox(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func ximport(w http.ResponseWriter, r *http.Request) {
|
func ximport(w http.ResponseWriter, r *http.Request) {
|
||||||
u := login.GetUserInfo(r)
|
u := login.GetUserInfo(r)
|
||||||
xid := r.FormValue("xid")
|
xid := strings.TrimSpace(r.FormValue("xid"))
|
||||||
xonk := getxonk(u.UserID, xid)
|
xonk := getxonk(u.UserID, xid)
|
||||||
if xonk == nil {
|
if xonk == nil {
|
||||||
p, _ := investigate(xid)
|
p, _ := investigate(xid)
|
||||||
|
@ -1061,7 +1061,7 @@ func submithonk(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
xid += ".txt"
|
xid += ".txt"
|
||||||
}
|
}
|
||||||
desc := r.FormValue("donkdesc")
|
desc := strings.TrimSpace(r.FormValue("donkdesc"))
|
||||||
if desc == "" {
|
if desc == "" {
|
||||||
desc = name
|
desc = name
|
||||||
}
|
}
|
||||||
|
@ -1096,18 +1096,19 @@ func submithonk(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
memetize(honk)
|
memetize(honk)
|
||||||
|
|
||||||
placename := r.FormValue("placename")
|
placename := strings.TrimSpace(r.FormValue("placename"))
|
||||||
placelat := r.FormValue("placelat")
|
placelat := strings.TrimSpace(r.FormValue("placelat"))
|
||||||
placelong := r.FormValue("placelong")
|
placelong := strings.TrimSpace(r.FormValue("placelong"))
|
||||||
if placename != "" || placelat != "" || placelong != "" {
|
placeurl := strings.TrimSpace(r.FormValue("placeurl"))
|
||||||
|
if placename != "" || placelat != "" || placelong != "" || placeurl != "" {
|
||||||
p := new(Place)
|
p := new(Place)
|
||||||
p.Name = placename
|
p.Name = placename
|
||||||
p.Latitude, _ = strconv.ParseFloat(placelat, 64)
|
p.Latitude, _ = strconv.ParseFloat(placelat, 64)
|
||||||
p.Longitude, _ = strconv.ParseFloat(placelong, 64)
|
p.Longitude, _ = strconv.ParseFloat(placelong, 64)
|
||||||
p.Url = r.FormValue("placeurl")
|
p.Url = placeurl
|
||||||
honk.Place = p
|
honk.Place = p
|
||||||
}
|
}
|
||||||
timestart := r.FormValue("timestart")
|
timestart := strings.TrimSpace(r.FormValue("timestart"))
|
||||||
if timestart != "" {
|
if timestart != "" {
|
||||||
t := new(Time)
|
t := new(Time)
|
||||||
now := time.Now().Local()
|
now := time.Now().Local()
|
||||||
|
@ -1218,11 +1219,11 @@ func showcombos(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func submithonker(w http.ResponseWriter, r *http.Request) {
|
func submithonker(w http.ResponseWriter, r *http.Request) {
|
||||||
u := login.GetUserInfo(r)
|
u := login.GetUserInfo(r)
|
||||||
name := r.FormValue("name")
|
name := strings.TrimSpace(r.FormValue("name"))
|
||||||
url := r.FormValue("url")
|
url := strings.TrimSpace(r.FormValue("url"))
|
||||||
peep := r.FormValue("peep")
|
peep := r.FormValue("peep")
|
||||||
combos := r.FormValue("combos")
|
combos := strings.TrimSpace(r.FormValue("combos"))
|
||||||
combos = " " + strings.TrimSpace(combos) + " "
|
combos = " " + combos + " "
|
||||||
honkerid, _ := strconv.ParseInt(r.FormValue("honkerid"), 10, 0)
|
honkerid, _ := strconv.ParseInt(r.FormValue("honkerid"), 10, 0)
|
||||||
|
|
||||||
defer combocache.Clear(u.UserID)
|
defer combocache.Clear(u.UserID)
|
||||||
|
@ -1351,19 +1352,19 @@ func savehfcs(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
filt := new(Filter)
|
filt := new(Filter)
|
||||||
filt.Name = r.FormValue("name")
|
filt.Name = strings.TrimSpace(r.FormValue("name"))
|
||||||
filt.Date = time.Now().UTC()
|
filt.Date = time.Now().UTC()
|
||||||
filt.Actor = r.FormValue("actor")
|
filt.Actor = strings.TrimSpace(r.FormValue("actor"))
|
||||||
filt.IncludeAudience = r.FormValue("incaud") == "yes"
|
filt.IncludeAudience = r.FormValue("incaud") == "yes"
|
||||||
filt.Text = r.FormValue("filttext")
|
filt.Text = strings.TrimSpace(r.FormValue("filttext"))
|
||||||
filt.IsAnnounce = r.FormValue("isannounce") == "yes"
|
filt.IsAnnounce = r.FormValue("isannounce") == "yes"
|
||||||
filt.AnnounceOf = r.FormValue("announceof")
|
filt.AnnounceOf = strings.TrimSpace(r.FormValue("announceof"))
|
||||||
filt.Reject = r.FormValue("doreject") == "yes"
|
filt.Reject = r.FormValue("doreject") == "yes"
|
||||||
filt.SkipMedia = r.FormValue("doskipmedia") == "yes"
|
filt.SkipMedia = r.FormValue("doskipmedia") == "yes"
|
||||||
filt.Hide = r.FormValue("dohide") == "yes"
|
filt.Hide = r.FormValue("dohide") == "yes"
|
||||||
filt.Collapse = r.FormValue("docollapse") == "yes"
|
filt.Collapse = r.FormValue("docollapse") == "yes"
|
||||||
filt.Rewrite = r.FormValue("filtrewrite")
|
filt.Rewrite = strings.TrimSpace(r.FormValue("filtrewrite"))
|
||||||
filt.Replace = r.FormValue("filtreplace")
|
filt.Replace = strings.TrimSpace(r.FormValue("filtreplace"))
|
||||||
|
|
||||||
if filt.Actor == "" && filt.Text == "" {
|
if filt.Actor == "" && filt.Text == "" {
|
||||||
log.Printf("blank filter")
|
log.Printf("blank filter")
|
||||||
|
|
Loading…
Reference in New Issue