[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.387,1.388

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Tue Oct 19 06:51:21 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv5815

Modified Files:
	lib-common.php 
Log Message:
1. Introduced function COM_formatEmailAddress to encapsulate (mostly) RFC(2)822 compliant formatting of email addresses.
2. Fixed COM_makeClickableLinks not recognizing links at the start of a line.
3. Re-introduced <br> between plugin sections in the What's New block.


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.387
retrieving revision 1.388
diff -C2 -d -r1.387 -r1.388
*** lib-common.php	17 Oct 2004 10:42:24 -0000	1.387
--- lib-common.php	19 Oct 2004 10:51:19 -0000	1.388
***************
*** 3357,3360 ****
--- 3357,3385 ----
  
  /**
+ * Takes a name and an email address and returns a string that vaguely
+ * resembles an email address specification conforming to RFC(2)822 ...
+ *
+ * @param    string  $name       name, e.g. John Doe
+ * @param    string  $address    email address only, e.g. john.doe at example.com
+ * @return   string              formatted email address
+ *
+ */
+ function COM_formatEmailAddress( $name, $address )
+ {
+     $formatted_name = $name;
+ 
+     $formatted_name = str_replace( ':', '', $formatted_name );
+     $formatted_name = str_replace( '"', '\\"', $formatted_name );
+ 
+     if(( $name != $formatted_name ) ||
+         (strpos( $formatted_name, '.' ) !== false ))
+     {
+         $formatted_name = '"' . $formatted_name . '"';
+     }
+ 
+     return $formatted_name . ' <' . $address . '>';
+ }
+ 
+ /**
  * Send an email.
  *
***************
*** 3376,3384 ****
      static $mailobj;
  
-     // According to RFC(2)822, colons can be used in email addresses to address
-     // groups - which is probably not what we have in mind here, so remove them
-     $to = str_replace( ':', '', $to );
-     $from = str_replace( ':', '', $from );
- 
      if( function_exists( 'CUSTOM_mail' ))
      {
--- 3401,3404 ----
***************
*** 3419,3423 ****
      if( empty( $from ))
      {
!         $from = $_CONF['site_name'] . ' <' . $_CONF['site_mail'] . '>';
      }
  
--- 3439,3443 ----
      if( empty( $from ))
      {
!         $from = COM_formatEmailAddress( $_CONF['site_name'], $_CONF['site_mail']);
      }
  
***************
*** 3702,3706 ****
  *
  * @param        array     $A          Block Record
! * @param        bool      $hnoboxes   Set to true if userpref is no blocks
  * @return       string    HTML Formated block
  *
--- 3722,3726 ----
  *
  * @param        array     $A          Block Record
! * @param        bool      $noboxes    Set to true if userpref is no blocks
  * @return       string    HTML Formated block
  *
***************
*** 4679,4682 ****
--- 4699,4704 ----
              $retval .= $LANG01[88] . '<br>' . LB;
          }
+ 
+         $retval .= '<br>';
      }
  
***************
*** 4699,4702 ****
--- 4721,4726 ----
                      $retval .= $content[$i] . '<br>' . LB;
                  }
+ 
+                 $retval .= '<br>';
              }
          }
***************
*** 5649,5653 ****
  function COM_makeClickableLinks( $text )
  {
!     $text = preg_replace( '/([^"])((((ht|f)tps?):(\/\/)|www\.)[a-z0-9%&_\-\+,;=:@~#\/.\?\[\]]+(\/|[+0-9a-z]))/is', '\\1<a href="\\2">\\2</a>', $text );
      $text = str_replace( '<a href="www', '<a href="http://www', $text );
  
--- 5673,5677 ----
  function COM_makeClickableLinks( $text )
  {
!     $text = preg_replace( '/([^"]?)((((ht|f)tps?):(\/\/)|www\.)[a-z0-9%&_\-\+,;=:@~#\/.\?\[\]]+(\/|[+0-9a-z]))/is', '\\1<a href="\\2">\\2</a>', $text );
      $text = str_replace( '<a href="www', '<a href="http://www', $text );
  




More information about the geeklog-cvs mailing list