Fix URL catcher for events
[platal.git] / modules / events.php
index 35fe2e9..af01c70 100644 (file)
@@ -176,10 +176,10 @@ class EventsModule extends PLModule
         $page->assign('action', strtolower($action));
 
         if ($action == 'Confirmer') {
-            $texte = preg_replace('/((http|ftp)+(s)?:\/\/[^<>\s]+)/i',
-                                  '<a href=\"\\0\">\\0</a>', $texte);
-            $texte = preg_replace('/([^,\s]+@[^,\s]+)/i',
-                                  '<a href=\"mailto:\\0\">\\0</a>', $texte);
+            $texte = preg_replace('/((?:https?|ftp):\/\/(?:\.*,*[a-z@0-9~%$£µ&i#\-+=_\/\?])*)/i',
+                                  '<a href="\\0">\\0</a>', $texte);
+            $texte = preg_replace('/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i',
+                                  '<a href="mailto:\\0">\\0</a>', $texte);
             require_once 'validations.inc.php';
             $evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
                                  $peremption, $valid_mesg, S::v('uid'));