* @return string the escaped string
*/
function quoteimap($str) {
- return ereg_replace('(["\\])', '\\\\1', $str);
+ return preg_replace("/([\"\\\\])/", "\\\\$1", $str);
}
/**
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();
?>