X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fabook_local_file.php;h=a37368a73dee6924bd849191a366e97b4b013e91;hb=6b76cffa6afb885fc54c385527ea18e1e7d46dcb;hp=d29474f6d4cdd8cae463283e6bb53af96d9cc88f;hpb=0a496c763fc9c26c8d5915ad64dbf1e9bdba62b3;p=squirrelmail.git diff --git a/functions/abook_local_file.php b/functions/abook_local_file.php index d29474f6..a37368a7 100644 --- a/functions/abook_local_file.php +++ b/functions/abook_local_file.php @@ -3,7 +3,7 @@ /** * abook_local_file.php * - * @copyright © 1999-2007 The SquirrelMail Project Team + * @copyright 1999-2010 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -252,6 +252,7 @@ class abook_local_file extends addressbook_backend { return $this->set_error($this->filename . ':' . _("Unable to update")); } @unlink($this->filename . '.tmp'); + @chmod($this->filename, 0600); $this->unlock(); $this->open(true); return true; @@ -299,8 +300,8 @@ class abook_local_file extends addressbook_backend { * TODO: regexp search is supported only in local_file backend. * Do we check format of regexp or ignore errors? */ - // errors on eregi call are suppressed in order to prevent display of regexp compilation errors - if(@eregi($expr, $line)) { + // errors on preg_match call are suppressed in order to prevent display of regexp compilation errors + if(@preg_match('/' . $expr . '/i', $line)) { array_push($res, array('nickname' => $row[0], 'name' => $this->fullname($row[1], $row[2]), 'firstname' => $row[1], @@ -432,7 +433,8 @@ class abook_local_file extends addressbook_backend { $this->quotevalue((!empty($userdata['label'])?$userdata['label']:'')); /* Strip linefeeds */ - $data = ereg_replace("[\r\n]", ' ', $data); + $nl_str = array("\r","\n"); + $data = str_replace($nl_str, ' ', $data); /** * Make sure that entry fits into allocated record space. @@ -587,7 +589,7 @@ class abook_local_file extends addressbook_backend { function quotevalue($value) { /* Quote the field if it contains | or ". Double quotes need to * be replaced with "" */ - if(ereg("[|\"]", $value)) { + if(stristr($value, '"') || stristr($value, '|')) { $value = '"' . str_replace('"', '""', $value) . '"'; } return $value;