That should fix all the backslashes not being escaped properly.
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Jan 2001 18:28:49 +0000 (18:28 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Jan 2001 18:28:49 +0000 (18:28 +0000)
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

functions/strings.php

index 0a5699a8ed9870f755609426923e2645b4969dc8..9b7371deb2dd7504132066adbd34cec68460a75d 100644 (file)
@@ -18,7 +18,7 @@
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
       if ($needle == '') return $haystack;
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
       if ($needle == '') return $haystack;
-      if ($needle == '.') $needle = '\.';
+      if ($needle == '.') $needle = '\\.';
       ereg("([^$needle]+)$needle?$", $haystack, $regs);
       return $regs[1];
    }
       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) {
    //    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];
    }
       ereg("^(.+)$needle([^$needle]+)$needle?$", $haystack, $regs);
       return $regs[1];
    }
@@ -52,7 +52,7 @@
    // Specifically, &#039 comes up as 5 characters instead of 1.
    // This should not add newlines to the end of lines.
    function sqWordWrap(&$line, $wrap) {
    // Specifically, &#039 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]);
       $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)) {
 
          // Go to the next line if we have more to process            
          if ($i < count($words)) {
-            $line .= "\n$beginning_spaces";
+            $line .= "\n" . $beginning_spaces;
          }
       }
    }
          }
       }
    }
        $PreviousSpaces = "";
        for ($i = 0; $i < count($lines); $i ++)
        {
        $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];
            $CurrentSpaces = $regs[1];
           if (isset($regs[2]))
                $CurrentRest = $regs[2];
          return array();
       $text = str_replace(' ', '', $text);
       $text = ereg_replace('"[^"]*"', '', $text);
          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++) {
       $text = str_replace(',', ';', $text);
       $array = explode(';', $text);
       for ($i = 0; $i < count ($array); $i++) {
 
 
    function find_mailbox_name ($mailbox) {
 
 
    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);
       if (ereg(" *\"([^\r\n\"]*)\"[ \r\n]*$", $mailbox, $regs))
           return $regs[1];
       ereg(" *([^ \r\n\"]*)[ \r\n]*$",$mailbox,$regs);
         $Str = '';
         foreach ($dat as $k => $v)
         {
         $Str = '';
         foreach ($dat as $k => $v)
         {
-            $Str .= "$k = $v\n";
+            $Str .= $k . $v;
         }
         sq_mt_seed(md5($Str));
       }
         }
         sq_mt_seed(md5($Str));
       }
    function sqCheckPHPVersion($major, $minor, $release) {
 
       $ver = phpversion();
    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]);
 
       // Parse the version string
       $vmajor  = strval($regs[1]);