X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fabook_database.php;h=3788bfe5b209986d27eebf2a80a1fb427fd5810c;hp=bc9fede25bec2e15dc348007908d8caf23729046;hb=2ba138034e8cf69a80201035e0abdb51af93083d;hpb=b9bfd165b055eac4f5e62438ae78eaab01cbb90e diff --git a/functions/abook_database.php b/functions/abook_database.php index bc9fede2..3788bfe5 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -3,8 +3,11 @@ /** ** abook_database.php ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** ** Backend for personal addressbook stored in a database, - ** accessed using the DB-casses in PEAR. + ** accessed using the DB-classes in PEAR. ** ** IMPORTANT: The PEAR modules must be in the include path ** for this class to work. @@ -108,13 +111,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 +148,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 +177,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 +214,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 +242,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'; }