From 5a23e988b6dc4113ad23f5819323f95638ce3999 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 25 Aug 2009 11:00:34 -0600 Subject: [PATCH] Improvements in creating flag form IDs. When dealing with negative set flags, add a slash to distinguish from user-defined flags that begin with 0. --- imp/lib/Imap/Flags.php | 2 +- imp/mailbox.php | 4 ++-- imp/message.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index 0e5f1dc8b..4add4d66a 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -368,7 +368,7 @@ class IMP_Imap_Flags $act2 = ($act1 == 'set') ? 'unset' : 'set'; $ret[$act1][] = $tmp; - $tmp['f'] = '0' . $val['flag']; + $tmp['f'] = '0\\' . $val['flag']; $ret[$act2][] = $tmp; } diff --git a/imp/mailbox.php b/imp/mailbox.php index feca69115..9dfbeeef4 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -168,8 +168,8 @@ case 'flag_messages': $flag = Horde_Util::getPost('flag'); if ($flag && !empty($indices)) { $set = true; - if ($flag[0] == '0') { - $flag = substr($flag, 1); + if (strpos($flag, '0\\') === 0) { + $flag = substr($flag, 2); $set = false; } $imp_message = IMP_Message::singleton(); diff --git a/imp/message.php b/imp/message.php index c7750bb51..a998e27db 100644 --- a/imp/message.php +++ b/imp/message.php @@ -144,8 +144,8 @@ case 'flag_message': $flag = Horde_Util::getFormData('flag'); if ($flag && !empty($indices_array)) { $peek = $set = true; - if ($flag[0] == '0') { - $flag = substr($flag, 1); + if (strpos($flag, '0\\') === 0) { + $flag = substr($flag, 2); $set = false; } $imp_message->flag(array($flag), $indices_array, $set); -- 2.11.0