templatehelpers.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package templatehelpers
  2. import (
  3. "github.com/kataras/iris"
  4. "strings"
  5. )
  6. type PageUserParams struct{
  7. NotificationType string
  8. Notification string
  9. ReqDir string
  10. Username string
  11. Admin string
  12. Custom []string
  13. } // TODO outsource
  14. // TODO error handler
  15. func ShowError(options []string, ctx *iris.Context) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
  16. location := strings.TrimLeft(ctx.RequestPath(false), "/")
  17. if len(options) > 1 {
  18. if options[1] != "" {
  19. location = options[1]
  20. }
  21. }
  22. ctx.Render(location + "_box.html", PageUserParams{"1", options[0], location, "", "0", []string{}}) // TODO: Dynamic params
  23. return
  24. }
  25. func ShowNotification(options []string, ctx *iris.Context) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
  26. location := strings.TrimLeft(ctx.RequestPath(false), "/")
  27. if len(options) > 1 {
  28. if options[1] != "" {
  29. location = options[1]
  30. }
  31. }
  32. ctx.Render(location + "_box.html", PageUserParams{"2", options[0], location, "", "0", []string{}}) // TODO: Dynamic params
  33. return
  34. }