diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/html.php | 7 | ||||
-rw-r--r-- | program/include/rcube_imap.php | 15 | ||||
-rw-r--r-- | program/lib/imap.inc | 36 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 7 |
5 files changed, 47 insertions, 20 deletions
diff --git a/program/include/html.php b/program/include/html.php index 6a8892510..a11a1a4b2 100644 --- a/program/include/html.php +++ b/program/include/html.php @@ -248,7 +248,7 @@ class html_inputfield extends html { protected $tagname = 'input'; protected $type = 'text'; - protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked'); + protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked','onchange'); public function __construct($attrib = array()) { @@ -416,7 +416,7 @@ class html_checkbox extends html_inputfield class html_textarea extends html { protected $tagname = 'textarea'; - protected $allowed = array('name','rows','cols','wrap','tabindex'); + protected $allowed = array('name','rows','cols','wrap','tabindex','onchange'); /** * Get HTML code for this object @@ -473,6 +473,7 @@ class html_select extends html { protected $tagname = 'select'; protected $options = array(); + protected $allowed = array('name','size','tabindex','autocomplete','multiple','onchange'); /** * Add a new option to this drop-down @@ -513,7 +514,7 @@ class html_select extends html $attr = array( 'value' => $option['value'], 'selected' => (in_array($option['value'], $select, true) || - in_array($option['text'], $select, true)) ? 1 : null); + in_array($option['text'], $select, true)) ? 1 : null); $this->content .= self::tag('option', $attr, Q($option['text'])); } diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 395a1b3af..3daea0c06 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -346,6 +346,21 @@ class rcube_imap /** + * Checks the PERMANENTFLAGS capability of the current mailbox + * and returns true if the given flag is supported by the IMAP server + * + * @param string Permanentflag name + * @return mixed True if this flag is supported + * @access public + */ + function check_permflag($flag) + { + $flagsmap = $GLOBALS['IMAP_FLAGS']; + return (($imap_flag = $flagsmap[strtoupper($flag)]) && in_array_nocase($imap_flag, $this->conn->permanentflags)); + } + + + /** * Returns the delimiter that is used by the IMAP server for folder separation * * @return string Delimiter string diff --git a/program/lib/imap.inc b/program/lib/imap.inc index e3df35699..757fbf6e8 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -90,6 +90,16 @@ $GLOBALS['IMAP_MONTHS'] = array("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, $GLOBALS['IMAP_SERVER_TZ'] = date('Z'); +$GLOBALS['IMAP_FLAGS'] = array( + 'SEEN' => '\\Seen', + 'DELETED' => '\\Deleted', + 'RECENT' => '\\Recent', + 'ANSWERED' => '\\Answered', + 'DRAFT' => '\\Draft', + 'FLAGGED' => '\\Flagged', + 'FORWARDED' => '$Forwarded', + 'MDNSENT' => '$MDNSent'); + $iil_error; $iil_errornum; $iil_selected; @@ -113,6 +123,7 @@ class iilConnection var $rootdir; var $delimiter; var $capability = array(); + var $permanentflags = array(); } /** @@ -142,7 +153,7 @@ class iilBasicHeader var $priority; var $mdn_to; var $mdn_sent = false; - var $is_reply = false; + var $is_draft = false; var $seen = false; var $deleted = false; var $recent = false; @@ -716,7 +727,7 @@ function iil_C_Select(&$conn, $mailbox) { return false; } if (strcmp($conn->selected, $mailbox) == 0) { - return true; + return true; } iil_C_LoadCache($conn, $mailbox); @@ -729,9 +740,12 @@ function iil_C_Select(&$conn, $mailbox) { if (strcasecmp($a[2], 'EXISTS') == 0) { $conn->exists = (int) $a[1]; } - if (strcasecmp($a[2], 'RECENT') == 0) { - $conn->recent = (int) $a[1]; - } + if (strcasecmp($a[2], 'RECENT') == 0) { + $conn->recent = (int) $a[1]; + } + } + else if (preg_match('/\[?PERMANENTFLAGS\s+\(([^\)]+)\)\]/U', $line, $match)) { + $conn->permanentflags = explode(' ', $match[1]); } } while (!iil_StartsWith($line, 'sel1')); @@ -1757,6 +1771,8 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false) $result[$id]->answered = true; } else if (strcasecmp($val, '$Forwarded') == 0) { $result[$id]->forwarded = true; + } else if (strcasecmp($val, 'Draft') == 0) { + $result[$id]->is_draft = true; } else if (strcasecmp($val, '$MDNSent') == 0) { $result[$id]->mdn_sent = true; } else if (strcasecmp($val, 'Flagged') == 0) { @@ -1909,15 +1925,7 @@ function iil_C_ModFlag(&$conn, $mailbox, $messages, $flag, $mod) { } $fp = $conn->fp; - $flags = array( - 'SEEN' => '\\Seen', - 'DELETED' => '\\Deleted', - 'RECENT' => '\\Recent', - 'ANSWERED' => '\\Answered', - 'DRAFT' => '\\Draft', - 'FLAGGED' => '\\Flagged', - 'FORWARDED' => '$Forwarded', - 'MDNSENT' => '$MDNSent'); + $flags = $GLOBALS['IMAP_FLAGS']; $flag = strtoupper($flag); $flag = $flags[$flag]; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 02419bea8..6ba3d1664 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1069,7 +1069,7 @@ function rcmail_send_mdn($uid) $message = new rcube_message($uid); - if ($message->headers->mdn_to && !$message->headers->mdn_sent) + if ($message->headers->mdn_to && !$message->headers->mdn_sent && $IMAP->check_permflag('MDNSENT')) { $identity = $RCMAIL->user->get_identity(); $sender = format_email_recipient($identity['email'], $identity['name']); diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index bff4e6861..ef88c7baf 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -82,8 +82,11 @@ if ($_GET['_uid']) { $OUTPUT->set_env('sender', $MESSAGE->sender['string']); // check for unset disposition notification - if ($MESSAGE->headers->mdn_to && !$MESSAGE->headers->mdn_sent && - $mbox_name != $CONFIG['drafts_mbox'] && $mbox_name != $CONFIG['sent_mbox']) + if ($MESSAGE->headers->mdn_to && + !$MESSAGE->headers->mdn_sent && + $IMAP->check_permflag('MDNSENT') && + $mbox_name != $CONFIG['drafts_mbox'] && + $mbox_name != $CONFIG['sent_mbox']) { if (intval($CONFIG['mdn_requests']) === 1) { |