Add phpdoc doc blocks to some files.
[squirrelmail.git] / functions / url_parser.php
index a686dbae1c7aedafb7c2fe7efee9db0f2aa86a4e..eadebd37c9fbe2ba48c418d02fec63cf62baec47 100644 (file)
@@ -3,15 +3,19 @@
 /**
  * url_parser.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This code provides various string manipulation functions that are
  * used by the rest of the Squirrelmail code.
  *
  * $Id$
+ * @package squirrelmail
  */
 
+/**
+ * Undocumented - complain, then patch.
+ */
 function replaceBlock (&$in, $replace, $start, $end) {
     $begin = substr($in,0,$start);
     $end   = substr($in,$end,strlen($in)-$end);
@@ -34,8 +38,14 @@ $Host_RegExp_Match = '(' . $IP_RegExp_Match .
 $Email_RegExp_Match = '[0-9a-z]([-_.+]?[0-9a-z])*(%' . $Host_RegExp_Match .
     ')?@' . $Host_RegExp_Match;
 
+/**
+ * Parses a body and converts all found email addresses to clickable links.
+ *
+ * @param string body the body to process, by ref
+ * @return int the number of unique addresses found
+ */
 function parseEmail (&$body) {
-    global $color, $Email_RegExp_Match, $compose_new_win;
+    global $color, $Email_RegExp_Match;
     $sbody     = $body;
     $addresses = array();
 
@@ -47,12 +57,7 @@ function parseEmail (&$body) {
     }
     /* Replace each email address with a compose URL */
     foreach ($addresses as $email) {
-        $comp_uri = '../src/compose.php?send_to='.urlencode($email);
-        if ($compose_new_win == '1') {
-            $comp_uri  = 'javascript:void(0)" onClick="comp_in_new('
-                       . "'$comp_uri'" . ')';
-        }
-        $comp_uri = '<a href="'.$comp_uri.'">'.$email.'</a>';
+        $comp_uri = makeComposeLink('src/compose.php?send_to='.urlencode($email), $email);
         $body = str_replace($email, $comp_uri, $body);
     }
     /* Return number of unique addresses found */
@@ -78,6 +83,12 @@ $url_parser_poss_ends = array(' ', "\n", "\r", '<', '>', ".\r", ".\n",
     ']', '[', '{', '}', "\240", ', ', '. ', ",\n", ",\r");
 
 
+/**
+ * Parses a body and converts all found URLs to clickable links.
+ *
+ * @param string body the body to process, by ref
+ * @return void
+ */
 function parseUrl (&$body) {
     global $url_parser_poss_ends, $url_parser_url_tokens;;
     $start      = 0;