* New Feature #0000341: New option "ascii" for spamProtectEmailAddresses (very cool...
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_fe.php
index 3e09822..f8d8cbe 100755 (executable)
@@ -3027,10 +3027,17 @@ if (version == "n3") {
         */
        function encryptEmail($string,$back=0)  {
                $out = '';
-               for ($a=0; $a<strlen($string); $a++)    {
-                       $charValue = ord(substr($string,$a,1));
-                       $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
-                       $out.= chr($charValue);
+
+               if ($this->spamProtectEmailAddresses == 'ascii') {
+                       for ($a=0; $a<strlen($string); $a++) {
+                               $out .= '&#'.ord(substr($string, $a, 1)).';';
+                       }
+               } else  {
+                       for ($a=0; $a<strlen($string); $a++)    {
+                               $charValue = ord(substr($string,$a,1));
+                               $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
+                               $out.= chr($charValue);
+                       }
                }
                return $out;
        }