/**
* abook_local_file.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Backend for addressbook as a pipe separated file
* NOTE. This class should not be used directly. Use the
* "AddressBook" class instead.
*
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage addressbook
*/
+/**
+ * Store the addressbook in a local file
+ * @package squirrelmail
+ */
class abook_local_file extends addressbook_backend {
var $btype = 'local';
var $bname = 'local_file';
for($j = 0, $cnt_part=count($rows[$i]) ; $j < $cnt_part ; $j++) {
$rows[$i][$j] = $this->quotevalue($rows[$i][$j]);
}
- $tmpwrite = @fwrite($newfh, join('|', $rows[$i]) . "\n");
- if ($tmpwrite == -1) {
+ $tmpwrite = sq_fwrite($newfh, join('|', $rows[$i]) . "\n");
+ if ($tmpwrite === FALSE) {
return $this->set_error($this->filename . '.tmp:' . _("Write failed"));
}
}
}
/* Write */
- $r = fwrite($this->filehandle, $data);
+ $r = sq_fwrite($this->filehandle, $data);
/* Unlock file */
$this->unlock();
- /* Test write result and exit if OK */
- if($r > 0) return true;
+ /* Test write result */
+ if($r === FALSE) {
+ /* Fail */
+ $this->set_error(_("Write to addressbook failed"));
+ return FALSE;
+ }
- /* Fail */
- $this->set_error(_("Write to addressbook failed"));
- return false;
+ return TRUE;
}
/* Delete address */
}
} /* End of class abook_local_file */
-?>
\ No newline at end of file
+?>