From: pallo Date: Mon, 5 Feb 2001 09:33:01 +0000 (+0000) Subject: Converted some ereg_replace() into str_replace(). X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=16a973d70a51ec3e3a171b87fcf0fc2fd5de5351;hp=12b4ef8b0689e6e2dbcc3c6f7605ca8e7d99e50d Converted some ereg_replace() into str_replace(). 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 --- diff --git a/functions/abook_database.php b/functions/abook_database.php index a9dcc055..8fcb5170 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -108,13 +108,13 @@ 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); @@ -145,7 +145,7 @@ 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); @@ -174,7 +174,7 @@ 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); @@ -211,7 +211,7 @@ $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, @@ -239,12 +239,12 @@ 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'; } diff --git a/functions/abook_local_file.php b/functions/abook_local_file.php index 7699c74e..ab2be30e 100644 --- a/functions/abook_local_file.php +++ b/functions/abook_local_file.php @@ -151,8 +151,8 @@ // 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())