Converted some ereg_replace() into str_replace().
authorpallo <pallo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2001 09:33:01 +0000 (09:33 +0000)
committerpallo <pallo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2001 09:33:01 +0000 (09:33 +0000)
Fixed some SQL queries in the database backend.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1053 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/abook_database.php
functions/abook_local_file.php

index a9dcc055ed4ad2171f2d4e9bce662ffed2982d6c..8fcb5170a000d6794bcbb79b8c463ebac1316dc7 100644 (file)
          if(is_array($expr)) return;
 
          // Make regexp from glob'ed expression 
-         $expr = ereg_replace('\\?', '_', $expr);
-         $expr = ereg_replace('\\*'. '%', $expr);
+         $expr = str_replace('?', '_', $expr);
+         $expr = str_replace('*', '%', $expr);
          $expr = $this->dbh->quoteString($expr);
          $expr = "%$expr%";
 
-         $query = sprintf('SELECT * FROM %s WHERE owner=\'%s\' AND ' .
-                          '(firstname LIKE \'%s\' OR lastname LIKE \'%s\')',
+         $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND " .
+                          "(firstname LIKE '%s' OR lastname LIKE '%s')",
                           $this->table, $this->owner, $expr, $expr);
          $res = $this->dbh->query($query);
 
          if(!$this->open())
             return false;
          
-         $query = sprintf('SELECT * FROM %s WHERE owner=\'%s\' AND nickname=\'%s\'',
+         $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND nickname='%s'",
                           $this->table, $this->owner, $alias);
 
          $res = $this->dbh->query($query);
          if(!$this->open())
             return false;
 
-         $query = sprintf(;SELECT * FROM %s WHERE owner=\'%s\';,
+         $query = sprintf("SELECT * FROM %s WHERE owner='%s'",
                           $this->table, $this->owner);
 
          $res = $this->dbh->query($query);
                                             $ret['nickname']));
 
          // Create query
-         $query = sprintf('INSERT INTO %s (owner, nickname, firstname, ' .
+         $query = sprintf("INSERT INTO %s (owner, nickname, firstname, " .
                           "lastname, email, label) VALUES('%s','%s','%s'," .
                           "'%s','%s','%s')",
                           $this->table, $this->owner,
             return false;
          
          // Create query
-         $query = sprintf('DELETE FROM %s WHERE owner=\'%s\' AND (',
+         $query = sprintf("DELETE FROM %s WHERE owner='%s' AND (",
                           $this->table, $this->owner);
 
          $sepstr = '';
          while(list($undef, $nickname) = each($alias)) {
-            $query .= sprintf('%s nickname=\'%s\' ', $sepstr,
+            $query .= sprintf("%s nickname='%s' ", $sepstr,
                               $this->dbh->quoteString($nickname));
             $sepstr = 'OR';
          }
index 7699c74eb861dd6569d8f388a26efff9631bd8dc..ab2be30eb6c6159c7e90058f5f9e6cf8e80a82b9 100644 (file)
 
        // Make regexp from glob'ed expression
        // May want to quote other special characters like (, ), -, [, ], etc.
-       $expr = ereg_replace('\\?', '.', $expr);
-       $expr = ereg_replace('\\*', '.*', $expr);
+       $expr = str_replace('?', '.', $expr);
+       $expr = str_replace('*', '.*', $expr);
 
        $res = array();
        if(!$this->open())