Changeset f7221df in github


Ignore:
Timestamp:
Dec 28, 2010 2:17:32 AM (2 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
d70c217
Parents:
a63b36a
Message:
  • Fix for ANNOTATEMORE drafts below 08 version (use quoted parameters)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap_generic.php

    r814bafc rf7221df  
    28822882            } 
    28832883 
     2884            // ANNOTATEMORE drafts before version 08 require quoted parameters 
    28842885            $entries[] = sprintf('%s (%s %s)', 
    2885                 $this->escape($name), $this->escape($attr), $value); 
     2886                $this->escape($name, true), $this->escape($attr, true), $value); 
    28862887        } 
    28872888 
     
    29332934        } 
    29342935        // create entries string 
     2936        // ANNOTATEMORE drafts before version 08 require quoted parameters 
    29352937        foreach ($entries as $idx => $name) { 
    2936             $entries[$idx] = $this->escape($name); 
     2938            $entries[$idx] = $this->escape($name, true); 
    29372939        } 
    29382940        $entries = '(' . implode(' ', $entries) . ')'; 
     
    29432945        // create entries string 
    29442946        foreach ($attribs as $idx => $name) { 
    2945             $attribs[$idx] = $this->escape($name); 
     2947            $attribs[$idx] = $this->escape($name, true); 
    29462948        } 
    29472949        $attribs = '(' . implode(' ', $attribs) . ')'; 
     
    32383240     * Escapes a string when it contains special characters (RFC3501) 
    32393241     * 
    3240      * @param string $string IMAP string 
     3242     * @param string  $string       IMAP string 
     3243     * @param boolean $force_quotes Forces string quoting 
    32413244     * 
    32423245     * @return string Escaped string 
    32433246     * @todo String literals, lists 
    32443247     */ 
    3245     static function escape($string) 
     3248    static function escape($string, $force_quotes=false) 
    32463249    { 
    32473250        if ($string === null) { 
     
    32513254            return '""'; 
    32523255        } 
    3253         else if (preg_match('/([\x00-\x20\x28-\x29\x7B\x25\x2A\x22\x5C\x5D\x7F]+)/', $string)) { 
     3256        else if ($force_quotes || 
     3257            preg_match('/([\x00-\x20\x28-\x29\x7B\x25\x2A\x22\x5C\x5D\x7F]+)/', $string) 
     3258        ) { 
    32543259            // string: special chars: SP, CTL, (, ), {, %, *, ", \, ] 
    32553260            return '"' . strtr($string, array('"'=>'\\"', '\\' => '\\\\')) . '"'; 
Note: See TracChangeset for help on using the changeset viewer.