Changeset f7221df in github
- Timestamp:
- Dec 28, 2010 2:17:32 AM (2 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- d70c217
- Parents:
- a63b36a
- File:
-
- 1 edited
-
program/include/rcube_imap_generic.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_imap_generic.php
r814bafc rf7221df 2882 2882 } 2883 2883 2884 // ANNOTATEMORE drafts before version 08 require quoted parameters 2884 2885 $entries[] = sprintf('%s (%s %s)', 2885 $this->escape($name ), $this->escape($attr), $value);2886 $this->escape($name, true), $this->escape($attr, true), $value); 2886 2887 } 2887 2888 … … 2933 2934 } 2934 2935 // create entries string 2936 // ANNOTATEMORE drafts before version 08 require quoted parameters 2935 2937 foreach ($entries as $idx => $name) { 2936 $entries[$idx] = $this->escape($name );2938 $entries[$idx] = $this->escape($name, true); 2937 2939 } 2938 2940 $entries = '(' . implode(' ', $entries) . ')'; … … 2943 2945 // create entries string 2944 2946 foreach ($attribs as $idx => $name) { 2945 $attribs[$idx] = $this->escape($name );2947 $attribs[$idx] = $this->escape($name, true); 2946 2948 } 2947 2949 $attribs = '(' . implode(' ', $attribs) . ')'; … … 3238 3240 * Escapes a string when it contains special characters (RFC3501) 3239 3241 * 3240 * @param string $string IMAP string 3242 * @param string $string IMAP string 3243 * @param boolean $force_quotes Forces string quoting 3241 3244 * 3242 3245 * @return string Escaped string 3243 3246 * @todo String literals, lists 3244 3247 */ 3245 static function escape($string )3248 static function escape($string, $force_quotes=false) 3246 3249 { 3247 3250 if ($string === null) { … … 3251 3254 return '""'; 3252 3255 } 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 ) { 3254 3259 // string: special chars: SP, CTL, (, ), {, %, *, ", \, ] 3255 3260 return '"' . strtr($string, array('"'=>'\\"', '\\' => '\\\\')) . '"';
Note: See TracChangeset
for help on using the changeset viewer.
