projects
/
squirrelmail.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bugfix in generate random string.
[squirrelmail.git]
/
functions
/
strings.php
diff --git
a/functions/strings.php
b/functions/strings.php
index 4481bd6ba5643f53cff2b3dafc25b5cb973084dc..e9bac3f31b7cf5a15e41f10bc2627bfdb638060f 100644
(file)
--- a/
functions/strings.php
+++ b/
functions/strings.php
@@
-209,8
+209,9
@@
function translateText(&$body, $wrap_at, $charset) {
$Quotes = 0;
$pos = 0;
$Quotes = 0;
$pos = 0;
+ $j = strlen( $line );
- while ( $
line <> ''
) {
+ while ( $
pos < $j
) {
if ($line[$pos] == ' ') {
$pos ++;
} else if (strpos($line, '>', $pos) === $pos) {
if ($line[$pos] == ' ') {
$pos ++;
} else if (strpos($line, '>', $pos) === $pos) {
@@
-538,14
+539,15
@@
function GenerateRandomString($size, $chars, $flags = 0) {
if (($size < 1) || (strlen($chars) < 1)) {
return '';
}
if (($size < 1) || (strlen($chars) < 1)) {
return '';
}
-
+
sq_mt_randomize(); /* Initialize the random number generator */
sq_mt_randomize(); /* Initialize the random number generator */
-
+
$String = '';
$String = '';
+ $j = strlen( $chars ) - 1;
while (strlen($String) < $size) {
while (strlen($String) < $size) {
- $String .= $chars
[mt_rand(0, strlen($chars))]
;
+ $String .= $chars
{mt_rand(0, $j)}
;
}
}
-
+
return $String;
}
return $String;
}