func (ph *PageHelper) NotFound(res *wcg.Response, req *wcg.Request) { res.TemplatesWithStatus( 404, nil, "404.html", "header.html", "footer.html", ) }
func (ph *PageHelper) Forbidden(res *wcg.Response, req *wcg.Request) { res.SetLocal("Ref", req.URL().RequestURI()) res.TemplatesWithStatus( 403, nil, "403.html", "header.html", "footer.html", ) }
func (ph *PageHelper) InternalError(res *wcg.Response, req *wcg.Request, e error) { req.Logger.Error("Internal Server Error: %v", e) res.SetLocal("error", e) res.TemplatesWithStatus( 500, nil, "500.html", "header.html", "footer.html", ) }
func Redirect(res *wcg.Response, req *wcg.Request) { urlStr := req.Query("u") if urlobj, err := url.Parse(urlStr); err == nil && validateUrl(urlobj) { // TODO: Check blacklist res.Redirect(urlStr, 302) return } res.TemplatesWithStatus( 404, nil, "404.html", "header.html", "footer.html", ) return }