* Properly retains the mailbox when you use the HTML addressbook
[squirrelmail.git] / functions / abook_local_file.php
index 8bc02405d6be3df8f7bf851e7501331864e74fbd..26588d117801eeea8cae662b9c7f49d72f26384b 100644 (file)
 
      // Overwrite the file with data from $rows
      // NOTE! Previous locks are broken by this function
-     function overwrite($rows) {
+     function overwrite(&$rows) {
        $newfh = @fopen($this->filename, 'w');
        if(!$newfh)
         return $this->set_error("$file: " . _("Open failed"));
        // To be replaced by advanded search expression parsing
        if(is_array($expr)) return;
 
-       // Make regexp from glob'ed expression 
-       $expr = ereg_replace('\?', '.', $expr);
-       $expr = ereg_replace('\*', '.*', $expr);
+       // Make regexp from glob'ed expression
+       // May want to quote other special characters like (, ), -, [, ], etc.
+       $expr = str_replace('?', '.', $expr);
+       $expr = str_replace('*', '.*', $expr);
 
        $res = array();
        if(!$this->open())
        }
 
        // Write data back
-       if(!$this->overwrite(&$rows)) {
+       if(!$this->overwrite($rows)) {
         $this->unlock();
         return false;
        }
        }
 
        // Write data back
-       if(!$this->overwrite(&$rows)) {
+       if(!$this->overwrite($rows)) {
         $this->unlock();
         return false;
        }