From db1ba3df77c858b3da994cfdad9f0eed0ca4a639 Mon Sep 17 00:00:00 2001 From: Jason Oster Date: Fri, 29 May 2009 15:30:48 +0000 Subject: Better handling of URLs and email addresses in event descriptions (also strip "blocked" protocols, added by some mail servers) --- functions/template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'functions') diff --git a/functions/template.php b/functions/template.php index 0a0c212..4d7ad72 100644 --- a/functions/template.php +++ b/functions/template.php @@ -90,8 +90,8 @@ class Page { $location = sanitizeForWeb(stripslashes(urldecode($new_val2['location']))); $description = sanitizeForWeb(stripslashes(urldecode($new_val2['description']))); if (!empty($description)) { - $description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'\0', $description); - $description = ereg_replace("[a-zA-Z0-9_.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", '\0', $description); + $description = ereg_replace("(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&)+[[:alnum:]/])", '\2', $description); + $description = ereg_replace("(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})", '\3', $description); } $event_start = $new_val2['event_start']; -- cgit v1.2.3