not sure, why message details provides this hook. If it have other effects
[squirrelmail.git] / functions / strings.php
index a73b35dfe6f41d398d339e63628e092c44f7877a..4ff54b898bfeb95e145ed5deb259da559bf41aa0 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * strings.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This code provides various string manipulation functions that are
@@ -17,7 +17,7 @@
  * SquirrelMail version number -- DO NOT CHANGE
  */
 global $version;
-$version = '1.5.1 [CVS}';
+$version = '1.5.1 [CVS]';
 
 /**
  * SquirrelMail internal version number -- DO NOT CHANGE
@@ -458,7 +458,7 @@ function GenerateRandomString($size, $chars, $flags = 0) {
  * @return string the escaped string
  */
 function quoteimap($str) {
-    return ereg_replace('(["\\])', '\\\\1', $str);
+    return preg_replace("/([\"\\\\])/", "\\\\$1", $str);
 }
 
 /**
@@ -541,5 +541,21 @@ function sm_print_r() {
     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();
 ?>