spam spam spam
* tekuti/comment.scm (bad-number?, *new-comment-spec*): * tekuti/page-helpers.scm (comment-form): Lame spam obfuscation. * tekuti/util.scm (emailish?): Allow _ in the before-@ part of the url. (urlish?): Don't require a slash after the host.
This commit is contained in:
parent
4ebd686868
commit
11eed1fbc8
3 changed files with 12 additions and 2 deletions
|
@ -92,11 +92,18 @@
|
||||||
#f
|
#f
|
||||||
`(p "Bad URL. (Only http and https are allowed.)")))
|
`(p "Bad URL. (Only http and https are allowed.)")))
|
||||||
|
|
||||||
|
(define (bad-number? x)
|
||||||
|
(if (string->number x)
|
||||||
|
#f
|
||||||
|
'(p "Bad number. Give me something that Scheme's "
|
||||||
|
(tt "string->number") " will like.")))
|
||||||
|
|
||||||
(define *new-comment-spec*
|
(define *new-comment-spec*
|
||||||
`(("author" ,(lambda (x) #f))
|
`(("author" ,(lambda (x) #f))
|
||||||
("email" ,bad-email?)
|
("email" ,bad-email?)
|
||||||
("url" ,bad-url?)
|
("url" ,bad-url?)
|
||||||
("comment" ,bad-user-submitted-xhtml?)
|
("comment" ,bad-user-submitted-xhtml?)
|
||||||
|
("x" ,bad-number?)
|
||||||
("submit" ,(lambda (x) #f))))
|
("submit" ,(lambda (x) #f))))
|
||||||
|
|
||||||
(define (bad-new-comment-post? post-data)
|
(define (bad-new-comment-post? post-data)
|
||||||
|
|
|
@ -120,6 +120,9 @@
|
||||||
(p (input (@ (type "text") (name "url") (value ,url)
|
(p (input (@ (type "text") (name "url") (value ,url)
|
||||||
(size "22") (tabindex "3")))
|
(size "22") (tabindex "3")))
|
||||||
" " (label (@ (for "url")) (small "Website")))
|
" " (label (@ (for "url")) (small "Website")))
|
||||||
|
(p (input (@ (type "text") (name "x") (value "")
|
||||||
|
(size "22") (tabindex "3")))
|
||||||
|
" " (label (@ (for "x")) (small "What's your favorite number?")))
|
||||||
;(p (small "allowed tags: "))
|
;(p (small "allowed tags: "))
|
||||||
(p (textarea (@ (name "comment") (id "comment") (cols "65")
|
(p (textarea (@ (name "comment") (id "comment") (cols "65")
|
||||||
(rows "10") (tabindex "4"))
|
(rows "10") (tabindex "4"))
|
||||||
|
|
|
@ -39,13 +39,13 @@
|
||||||
list-intersperse with-backtrace with-time-debugging define-memoized))
|
list-intersperse with-backtrace with-time-debugging define-memoized))
|
||||||
|
|
||||||
(define (emailish? x)
|
(define (emailish? x)
|
||||||
(match-bind "^([a-zA-Z0-9.+-]+)@([a-zA-Z0-9-]+\\.)+[a-zA-Z]+$"
|
(match-bind "^([a-zA-Z0-9._+-]+)@([a-zA-Z0-9-]+\\.)+[a-zA-Z]+$"
|
||||||
x (_ . args)
|
x (_ . args)
|
||||||
x
|
x
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
(define (urlish? x)
|
(define (urlish? x)
|
||||||
(match-bind "^https?://([a-zA-Z0-9-]+\\.)+[a-zA-Z]+/[a-zA-Z0-9$_.+!*'(),;/?:@&=-]*$"
|
(match-bind "^https?://([a-zA-Z0-9-]+\\.)+[a-zA-Z]+(/[a-zA-Z0-9$_.+!*'(),;/?:@&=-]*)?$"
|
||||||
x (_ . args)
|
x (_ . args)
|
||||||
x
|
x
|
||||||
#f))
|
#f))
|
||||||
|
|
Loading…
Reference in a new issue