Fix IMAP PARSE reponse matching. This should get rid of retrival errors
[squirrelmail.git] / functions / strings.php
index 722cedeca8bae5ddf2dac4cf28ee1cb3db17b2d4..7d17332d9f98ff0150d9498bbbfc19a177b45a3b 100644 (file)
@@ -16,7 +16,7 @@
  * SquirrelMail version number -- DO NOT CHANGE
  */
 global $version;
-$version = '1.2.5 [cvs]';
+$version = '1.2.6 [cvs]';
 
 /**
  * If $haystack is a full mailbox name and $needle is the mailbox
@@ -192,9 +192,9 @@ function getLineOfAddrs($array) {
 function translateText(&$body, $wrap_at, $charset) {
     global $where, $what; /* from searching */
     global $color; /* color theme */
-    
+
     require_once('../functions/url_parser.php');
-    
+
     $body_ary = explode("\n", $body);
     $PriorQuotes = 0;
     for ($i=0; $i < count($body_ary); $i++) {
@@ -209,7 +209,7 @@ function translateText(&$body, $wrap_at, $charset) {
 
         $Quotes = 0;
         $pos = 0;
-       $j = strlen( $line );
+        $j = strlen( $line );
 
         while ( $pos < $j ) {
             if ($line[$pos] == ' ') {
@@ -539,14 +539,15 @@ function GenerateRandomString($size, $chars, $flags = 0) {
     if (($size < 1) || (strlen($chars) < 1)) {
         return '';
     }
-    
+
     sq_mt_randomize(); /* Initialize the random number generator */
-    
+
     $String = '';
+    $j = strlen( $chars ) - 1;
     while (strlen($String) < $size) {
-        $String .= $chars[mt_rand(0, strlen($chars))];
+        $String .= $chars{mt_rand(0, $j)};
     }
-    
+
     return $String;
 }