From: fidian Date: Wed, 31 Jan 2001 18:28:49 +0000 (+0000) Subject: That should fix all the backslashes not being escaped properly. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=5be8bbd8a9b55f9b014fa49608e14d90dd64ce61;ds=sidebyside That should fix all the backslashes not being escaped properly. Changed some "str" to 'str' Changed a couple other things to work a little better Removed commented code. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1016 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/strings.php b/functions/strings.php index 0a5699a8..9b7371de 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -18,7 +18,7 @@ //************************************************************************* function readShortMailboxName($haystack, $needle) { if ($needle == '') return $haystack; - if ($needle == '.') $needle = '\.'; + if ($needle == '.') $needle = '\\.'; ereg("([^$needle]+)$needle?$", $haystack, $regs); return $regs[1]; } @@ -28,7 +28,7 @@ // of the $haystack is reached. $needle is a single character //************************************************************************* function readMailboxParent($haystack, $needle) { - if ($needle == '.') $needle = '\.'; + if ($needle == '.') $needle = '\\.'; ereg("^(.+)$needle([^$needle]+)$needle?$", $haystack, $regs); return $regs[1]; } @@ -52,7 +52,7 @@ // Specifically, ' comes up as 5 characters instead of 1. // This should not add newlines to the end of lines. function sqWordWrap(&$line, $wrap) { - preg_match("/^([\s>]*)([^\s>].*)?$/", $line, $regs); + preg_match('/^([\\s>]*)([^\\s>].*)?$/', $line, $regs); $beginning_spaces = $regs[1]; if (isset($regs[2])) { $words = explode(' ', $regs[2]); @@ -88,7 +88,7 @@ // Go to the next line if we have more to process if ($i < count($words)) { - $line .= "\n$beginning_spaces"; + $line .= "\n" . $beginning_spaces; } } } @@ -102,7 +102,7 @@ $PreviousSpaces = ""; for ($i = 0; $i < count($lines); $i ++) { - preg_match("/^([\s>]*)([^\s>].*)?$/", $lines[$i], $regs); + preg_match('/^([\\s>]*)([^\\s>].*)?$/', $lines[$i], $regs); $CurrentSpaces = $regs[1]; if (isset($regs[2])) $CurrentRest = $regs[2]; @@ -134,7 +134,7 @@ return array(); $text = str_replace(' ', '', $text); $text = ereg_replace('"[^"]*"', '', $text); - $text = ereg_replace("\([^\)]*\)", '', $text); + $text = ereg_replace('\\([^\\)]*\\)', '', $text); $text = str_replace(',', ';', $text); $array = explode(';', $text); for ($i = 0; $i < count ($array); $i++) { @@ -209,18 +209,6 @@ function find_mailbox_name ($mailbox) { -/* - $mailbox = trim($mailbox); - if (substr($mailbox, strlen($mailbox)-1, strlen($mailbox)) == '"') { - $mailbox = substr($mailbox, 0, strlen($mailbox) - 1); - $pos = strrpos ($mailbox, '"')+1; - $box = substr($mailbox, $pos); - } else { - $box = substr($mailbox, strrpos($mailbox, ' ')+1, strlen($mailbox)); - } - return $box; -*/ - if (ereg(" *\"([^\r\n\"]*)\"[ \r\n]*$", $mailbox, $regs)) return $regs[1]; ereg(" *([^ \r\n\"]*)[ \r\n]*$",$mailbox,$regs); @@ -388,7 +376,7 @@ $Str = ''; foreach ($dat as $k => $v) { - $Str .= "$k = $v\n"; + $Str .= $k . $v; } sq_mt_seed(md5($Str)); } @@ -418,7 +406,7 @@ function sqCheckPHPVersion($major, $minor, $release) { $ver = phpversion(); - eregi("^([0-9]+)\.([0-9]+)(.*)", $ver, $regs); + eregi('^([0-9]+)\\.([0-9]+)(.*)', $ver, $regs); // Parse the version string $vmajor = strval($regs[1]);