summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.php14
-rw-r--r--program/lib/imap.inc13
2 files changed, 11 insertions, 16 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 7da209ff6..0af494e8c 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1568,7 +1568,6 @@ class rcube_imap
*/
function save_message($mbox_name, &$message)
{
- $mbox_name = stripslashes($mbox_name);
$mailbox = $this->_mod_mailbox($mbox_name);
// make sure mailbox exists
@@ -1595,9 +1594,7 @@ class rcube_imap
*/
function move_message($uids, $to_mbox, $from_mbox='')
{
- $to_mbox_in = stripslashes($to_mbox);
- $from_mbox = stripslashes($from_mbox);
- $to_mbox = $this->_mod_mailbox($to_mbox_in);
+ $to_mbox = $this->_mod_mailbox($to_mbox);
$from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox;
// make sure mailbox exists
@@ -1672,7 +1669,6 @@ class rcube_imap
*/
function delete_message($uids, $mbox_name='')
{
- $mbox_name = stripslashes($mbox_name);
$mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
// convert the list of uids to array
@@ -1729,7 +1725,6 @@ class rcube_imap
*/
function clear_mailbox($mbox_name=NULL)
{
- $mbox_name = stripslashes($mbox_name);
$mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
$msg_count = $this->_messagecount($mailbox, 'ALL');
@@ -1762,7 +1757,6 @@ class rcube_imap
*/
function expunge($mbox_name='', $clear_cache=TRUE)
{
- $mbox_name = stripslashes($mbox_name);
$mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
return $this->_expunge($mailbox, $clear_cache);
}
@@ -1881,9 +1875,6 @@ class rcube_imap
{
$result = FALSE;
- // replace backslashes
- $name = preg_replace('/[\\\]+/', '-', $name);
-
// reduce mailbox name to 100 chars
$name = substr($name, 0, 100);
@@ -1912,9 +1903,6 @@ class rcube_imap
{
$result = FALSE;
- // replace backslashes
- $name = preg_replace('/[\\\]+/', '-', $new_name);
-
// encode mailbox name and reduce it to 100 chars
$name = substr($new_name, 0, 100);
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 1390653ed..cca499b09 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -53,7 +53,7 @@
- Removed some debuggers (echo ...)
File altered by Aleksander Machniak <alec@alec.pl>
- trim(chop()) replaced by trim()
- - added iil_Escape() with support for " and \ in folder names
+ - added iil_Escape()/iil_UnEscape() with support for " and \ in folder names
- support \ character in username in iil_C_Login()
- fixed iil_MultLine(): use iil_ReadBytes() instead of iil_ReadLine()
- fixed iil_C_FetchStructureString() to handle many literal strings in response
@@ -338,6 +338,11 @@ function iil_Escape($string)
return strtr($string, array('"'=>'\\"', '\\' => '\\\\'));
}
+function iil_UnEscape($string)
+{
+ return strtr($string, array('\\"'=>'"', '\\\\' => '\\'));
+}
+
function iil_C_GetCapability(&$conn, $name)
{
if (in_array($name, $conn->capability)) {
@@ -497,6 +502,7 @@ function iil_C_NameSpace(&$conn) {
$line = iil_ReadLine($conn->fp, 1024);
if (iil_StartsWith($line, '* NAMESPACE')) {
$i = 0;
+ $line = iil_UnEscape($line);
$data = iil_ParseNamespace2(substr($line,11), $i, 0, 0);
}
} while (!iil_StartsWith($line, 'ns1', true));
@@ -2199,7 +2205,7 @@ function iil_C_GetHierarchyDelimiter(&$conn) {
$line=iil_ReadLine($fp, 500);
if ($line[0] == '*') {
$line = rtrim($line);
- $a=iil_ExplodeQuotedString(' ', $line);
+ $a=iil_ExplodeQuotedString(' ', iil_UnEscape($line));
if ($a[0] == '*') {
$delimiter = str_replace('"', '', $a[count($a)-2]);
}
@@ -2209,7 +2215,7 @@ function iil_C_GetHierarchyDelimiter(&$conn) {
if (strlen($delimiter)>0) {
return $delimiter;
}
-
+
//if that fails, try namespace extension
//try to fetch namespace data
iil_PutLine($conn->fp, "ns1 NAMESPACE");
@@ -2217,6 +2223,7 @@ function iil_C_GetHierarchyDelimiter(&$conn) {
$line = iil_ReadLine($conn->fp, 1024);
if (iil_StartsWith($line, '* NAMESPACE')) {
$i = 0;
+ $line = iil_UnEscape($line);
$data = iil_ParseNamespace2(substr($line,11), $i, 0, 0);
}
} while (!iil_StartsWith($line, 'ns1', true));