More misc fixes and rewrites (sorry, lame description)
[mailer.git] / inc / libs / html_mail_functions.php
index 3c4e377e93c30aa227bdfea5a662f38790858ed0..ee0f7bde321cda3d1dce7073f6c4a598b57e2a7a 100644 (file)
@@ -95,8 +95,8 @@ function HTML_INSERT_URLS ($text) {
 
        // ... what will the email address be out the @... ;-)
        $PARTS = array();
-       while (ereg("@", $test)) {
-               $pos = strpos($test, "@");
+       while (ereg('@', $test)) {
+               $pos = strpos($test, '@');
                $test2 = substr($test, 0, $pos);
 
                // First check backwards
@@ -106,34 +106,34 @@ function HTML_INSERT_URLS ($text) {
                        if (!in_array($check, $GLOBALS['valid_email_chars'])) {
                                // Char found so we end here
                                break;
-                       }
+                       } // END - if
                        $idx--;
-               }
+               } // END - while
 
                if ($idx > 0) {
                        // Starting mark is found
                        $check2 = substr($test, 0, ($idx + 1));
                        $test = substr($test, ($idx + 1));
-               }
+               } // END - if
 
                // And now go forward...
                $idx = 0;
                while ($idx < strlen($test)) {
                        $check = substr($test, $idx, 1);
-                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
+                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != '@')) {
                                // Char found so end here again
                                break;
-                       }
+                       } // END - if
                        $idx++;
-               }
+               } // END - while
 
                if ($idx > 0) {
                        // Maybe this is the email address?
                        $check = substr($test, 0, $idx);
-               }
+               } // END - if
 
                // Now replace the email against anchor with mailto and pray...
-               $PARTS[] = $check2."<a href=\"mailto:".$check."\">".$check."</a>";
+               $PARTS[] = $check2 . "<a href=\"" . generateEmailLink($check, 'user_data') . "\">" . $check . "</a>";
 
                // Remove email from testing string (see above why...)
                $test = substr($test, strlen($check));