summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Andy Wingo2008-03-11 23:58:12 +0100
committerGravatar Andy Wingo2008-03-11 23:58:12 +0100
commit11eed1fbc8e7a97f81d6e1d706978db7050df75d (patch)
tree9eae8587ac441d2a3cf3f5e3c60fb8a86e2a313c
parent4ebd68686897356b813dd73553b16cabe3ddad95 (diff)
downloadtekuti-11eed1fbc8e7a97f81d6e1d706978db7050df75d.tar.gz
tekuti-11eed1fbc8e7a97f81d6e1d706978db7050df75d.zip
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.
-rw-r--r--tekuti/comment.scm7
-rw-r--r--tekuti/page-helpers.scm3
-rw-r--r--tekuti/util.scm4
3 files changed, 12 insertions, 2 deletions
diff --git a/tekuti/comment.scm b/tekuti/comment.scm
index f177082..fbcff6b 100644
--- a/tekuti/comment.scm
+++ b/tekuti/comment.scm
@@ -92,11 +92,18 @@
#f
`(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*
`(("author" ,(lambda (x) #f))
("email" ,bad-email?)
("url" ,bad-url?)
("comment" ,bad-user-submitted-xhtml?)
+ ("x" ,bad-number?)
("submit" ,(lambda (x) #f))))
(define (bad-new-comment-post? post-data)
diff --git a/tekuti/page-helpers.scm b/tekuti/page-helpers.scm
index bb998d0..b82f0ad 100644
--- a/tekuti/page-helpers.scm
+++ b/tekuti/page-helpers.scm
@@ -120,6 +120,9 @@
(p (input (@ (type "text") (name "url") (value ,url)
(size "22") (tabindex "3")))
" " (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 (textarea (@ (name "comment") (id "comment") (cols "65")
(rows "10") (tabindex "4"))
diff --git a/tekuti/util.scm b/tekuti/util.scm
index 81a4d0b..dcef7a2 100644
--- a/tekuti/util.scm
+++ b/tekuti/util.scm
@@ -39,13 +39,13 @@
list-intersperse with-backtrace with-time-debugging define-memoized))
(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
#f))
(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
#f))