Better email-hidder
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 28 Jan 2007 16:50:43 +0000 (16:50 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 28 Jan 2007 16:50:43 +0000 (16:50 +0000)
Fix transcoding from CP1252 to Latin9

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1420 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/env.php
classes/platalpage.php

index a40538c..22a5b7d 100644 (file)
@@ -176,7 +176,12 @@ if (ini_get('magic_quotes_gpc') && empty($DONT_FIX_GPC)) {
     array_walk($_COOKIE, 'fix_gpc_magic');
     array_walk($_REQUEST, 'fix_gpc_magic');
 }
-array_walk($_POST, 'fix_encoding');
+if (empty($DONT_FIX_ENCODING)) {
+    array_walk($_GET, 'fix_encoding');
+    array_walk($_POST, 'fix_encoding');
+    array_walk($_COOKIE, 'fix_encoding');
+    array_walk($_REQUEST, 'fix_encoding');
+}
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index 26f1ee6..fad9a66 100644 (file)
@@ -315,15 +315,15 @@ function hide_emails($source, &$smarty)
     }
 
     //catch all emails in <a href="mailto:...">
-    preg_match_all("!<a[^>]+href=[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?</a>!is", $source, $ahref);
-    $source = preg_replace("!<a[^>]+href=[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?</a>!is", '&&&ahref&&&', $source);
+    preg_match_all("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?</a>!is", $source, $ahref);
+    $source = preg_replace("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?</a>!is", '&&&ahref&&&', $source);
 
     //prevant replacement in tag attributes
-    preg_match_all("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", $source, $misc);
-    $source = preg_replace("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", '&&&misc&&&', $source);
+    preg_match_all("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+[^>]+>!is", $source, $misc);
+    $source = preg_replace("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+[^>]+>!is", '&&&misc&&&', $source);
 
     //catch !
-    $source = preg_replace('!([-a-z0-9_.]+@[-a-z0-9_.]+)!ie', '_hide_email("\1")', $source); 
+    $source = preg_replace('!([-a-z0-9_+.]+@[-a-z0-9_.]+)!ie', '_hide_email("\1")', $source); 
     $source = preg_replace('!&&&ahref&&&!e', '_hide_email(array_shift($ahref[0]))', $source);
 
     // restore data