aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2009-05-26 20:50:57 +0000
committerJason Oster <parasytic@users.sourceforge.net>2009-05-26 20:50:57 +0000
commit1dc4188ce211c760549bea8fa4e982f2fb02ca46 (patch)
tree3b36db28b48d7c1b1f037c248aa5d9107930351f
parent9a320266804890028d660a08a0a79e1456b0571c (diff)
downloadphpicalendar-1dc4188ce211c760549bea8fa4e982f2fb02ca46.tar.gz
phpicalendar-1dc4188ce211c760549bea8fa4e982f2fb02ca46.tar.bz2
phpicalendar-1dc4188ce211c760549bea8fa4e982f2fb02ca46.zip
Hyperlink email addresses
-rw-r--r--functions/template.php5
-rw-r--r--includes/event.php5
2 files changed, 8 insertions, 2 deletions
diff --git a/functions/template.php b/functions/template.php
index 79ada79..3b3bf78 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -89,7 +89,10 @@ class Page {
$event_text = sanitizeForWeb(stripslashes(urldecode($new_val2['event_text'])));
$location = sanitizeForWeb(stripslashes(urldecode($new_val2['location'])));
$description = sanitizeForWeb(stripslashes(urldecode($new_val2['description'])));
- if (!empty($description)) $description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>', $description);
+ if (!empty($description)) {
+ $description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>', $description);
+ $description = ereg_replace("[a-zA-Z0-9_.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", '<a href="mailto:\0">\0</a>', $description);
+ }
$event_start = $new_val2['event_start'];
$event_end = $new_val2['event_end'];
diff --git a/includes/event.php b/includes/event.php
index 8152942..ab62337 100644
--- a/includes/event.php
+++ b/includes/event.php
@@ -30,7 +30,10 @@ if ($_POST['time'] == -1) {
$event['event_text'] = sanitizeForWeb(urldecode($event['event_text']));
$event['description'] = sanitizeForWeb(urldecode($event['description']));
$event['location'] = sanitizeForWeb(urldecode($event['location']));
-if (isset($event['description'])) $event['description'] = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>',$event['description']);
+if (isset($event['description'])) {
+ $event['description'] = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\0">\0</a>', $event['description']);
+ $event['description'] = ereg_replace("[a-zA-Z0-9_.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", '<a href="mailto:\0">\0</a>', $event['description']);
+}
if (isset($organizer) && is_array($organizer)) {
$i=0;

© 2014-2024 Faster IT GmbH | imprint | privacy policy