- Fix test for LOGINDISABLED, should only test when the auth_mech actually
is 'login'.
- Update required PHP version to 4.1.0, and remove PHP 4.0.x legacy code.
+ - Make writing of preferences, abook, calendars fail better when disk full
+ (#915527).
Version 1.5.0
--------------------
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 */
}
foreach ($prefs_cache as $Key => $Value) {
if (isset($Value)) {
- if ( @fwrite($file, $Key . '=' . $Value . "\n") === FALSE ) {
+ if ( sq_fwrite($file, $Key . '=' . $Value . "\n") === FALSE ) {
logout_error( sprintf( _("Preference file, %s, could not be written. Contact your system administrator to resolve this issue.") , $filename . '.tmp') );
exit;
}
logout_error( sprintf( _("Signature file, %s, could not be opened. Contact your system administrator to resolve this issue."), $filename . '.tmp') );
exit;
}
- if ( @fwrite($file, $value) === FALSE ) {
+ if ( sq_fwrite($file, $value) === FALSE ) {
logout_error( sprintf( _("Signature file, %s, could not be written. Contact your system administrator to resolve this issue.") , $filename . '.tmp'));
exit;
}
print '</pre>';
}
+/**
+ * version of fwrite which checks for failure
+ */
+function sq_fwrite($fp, $string) {
+ // write to file
+ $count = @fwrite($fp,$string);
+ // the number of bytes written should be the length of the string
+ if($count != strlen($string)) {
+ return FALSE;
+ }
+
+ return $count;
+}
+
+
+
$PHP_SELF = php_self();
?>
//makes events persistant
function writecalendardata() {
- global $calendardata, $username, $data_dir, $year;
+ global $calendardata, $username, $data_dir, $year, $color;
$filetmp = getHashedFile($username, $data_dir, "$username.$year.cal.tmp");
$filename = getHashedFile($username, $data_dir, "$username.$year.cal");
while ( $calbar = each ($calfoo['value'])) {
$calfoobar = $calendardata[$calfoo['key']][$calbar['key']];
$calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n";
- fwrite($fp, $calstr, 4096);
+ if(sq_fwrite($fp, $calstr, 4096) === FALSE) {
+ error_box(_("Could not write calendar file %s", "$username.$year.cal.tmp"), $color);
+ }
}
}