[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.340,1.341

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Sun Jul 18 08:02:35 EDT 2004


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

Modified Files:
	lib-common.php 
Log Message:
Fixed compilation error if the regexp for a search query contained a space (bug #251). Remove colons from email addresses, as they have a special meaning that we didn't intend (bug #6).


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.340
retrieving revision 1.341
diff -C2 -d -r1.340 -r1.341
*** lib-common.php	18 Jul 2004 03:52:44 -0000	1.340
--- lib-common.php	18 Jul 2004 12:02:31 -0000	1.341
***************
*** 2433,2437 ****
              if( SEC_hasrights( 'event.edit' ))
              {
!                 $num += DB_count ($_TABLES['eventsubmission'] );
              }
  
--- 2433,2437 ----
              if( SEC_hasrights( 'event.edit' ))
              {
!                 $num += DB_count( $_TABLES['eventsubmission'] );
              }
  
***************
*** 3071,3075 ****
                         . "WHERE c.uid = u.uid AND c.cid = $pid";
                  } else {
!                     $count = DB_count($_TABLES['comments'], "sid", $sid);
              
                      $q = "SELECT c.*, u.username, u.fullname, u.photo, " 
--- 3071,3075 ----
                         . "WHERE c.uid = u.uid AND c.cid = $pid";
                  } else {
!                     $count = DB_count( $_TABLES['comments'], 'sid', $sid );
              
                      $q = "SELECT c.*, u.username, u.fullname, u.photo, " 
***************
*** 3114,3118 ****
                      if ( $pid == 0 ) {
                          // count the total number of applicable comments
!                         $count = DB_count($_TABLES['comments'], "sid", $sid);
  
                          $q = "SELECT c.*, u.username, u.fullname, u.photo, 0 as pindent, " 
--- 3114,3118 ----
                      if ( $pid == 0 ) {
                          // count the total number of applicable comments
!                         $count = DB_count( $_TABLES['comments'], 'sid', $sid );
  
                          $q = "SELECT c.*, u.username, u.fullname, u.photo, 0 as pindent, " 
***************
*** 3416,3419 ****
--- 3416,3424 ----
      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' ))
      {
***************
*** 5657,5676 ****
  
      // escape all the other PCRE special characters
!     $query = str_replace( '\\', '\\\\', $query );
!     $query = str_replace( '.', '\.', $query ); 
!     $query = str_replace( '*', '\*', $query );
!     $query = str_replace( '?', '\?', $query );
!     $query = str_replace( '^', '\^', $query );
!     $query = str_replace( '$', '\$', $query );
!     $query = str_replace( '(', '\(', $query );
!     $query = str_replace( ')', '\)', $query );
!     $query = str_replace( ']', '\]', $query );
!     $query = str_replace( '{', '\{', $query );
!     $query = str_replace( '}', '\}', $query );
  
      $mywords = explode( ' ', $query );
      foreach( $mywords as $searchword )
      {
!         $text = preg_replace( '/(\>(((?>[^><]+)|(?R))*)\<)/ie', "preg_replace('/(?>$searchword+)/i','<span class=\"highlight\">$searchword</span>','\\0')", '<x>' . $text . '<x>' );
      }
  
--- 5662,5674 ----
  
      // escape all the other PCRE special characters
!     $query = preg_quote( $query );
  
      $mywords = explode( ' ', $query );
      foreach( $mywords as $searchword )
      {
!         if( !empty( $searchword ))
!         {
!             $text = preg_replace( '/(\>(((?>[^><]+)|(?R))*)\<)/ie', "preg_replace('/(?>$searchword+)/i','<span class=\"highlight\">$searchword</span>','\\0')", '<x>' . $text . '<x>' );
!         }
      }
  




More information about the geeklog-cvs mailing list