function prepareMessageList(&$aMailbox, $aProps) {
/* Globalize link attributes so plugins can share in modifying them */
- global $link, $title, $target, $onclick, $link_extra;
+ global $link, $title, $target, $onclick, $link_extra, $preselected;
/* retrieve the properties */
$my_email_address = (isset($aProps['email'])) ? $aProps['email'] : false;
// $onclick, $link_extra, $title, and so forth)
// plugins are responsible for sharing nicely (such as for
// setting the target, etc)
- do_hook('subject_link', $temp=array(&$iPageOffset, &$sSearch, &$aSearch));
+ do_hook('subject_link', $temp=array(&$iPageOffset, &$sSearch, &$aSearch, $aMsg));
}
$value = (trim($value)) ? $value : _("(no subject)");
/* add thread indentation */
$value = (is_array($value) && $value[0] == 'multipart' && $value[1] == 'mixed') ? true : false;
break;
case SQM_COL_CHECK:
- $value = $checkall;
+ $value = ($checkall || in_array($iUid, $preselected));
break;
default : break;
}
* use it i.e. in read_body.php for del move next and update the cache
*
* @param resource $imapConnection imap connection
- * @param array $aMailbox (reference) cached mailbox
- * @param string $sButton fake a submit button
- * @param array $aUid fake the $msg array
+ * @param array $aMailbox (reference) cached mailbox
+ * @param string $sButton fake a submit button
+ * @param array $aUid fake the $msg array
+ * @param string $targetMailbox fake the target mailbox for move operations
+ * @param boolean $bypass_trash fake the bypass trash checkbox for delete operations
* @return string $sError error string in case of an error
* @since 1.5.1
* @author Marc Groot Koerkamp
*/
-function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = array()) {
+function handleMessageListForm($imapConnection, &$aMailbox, $sButton='',
+ $aUid = array(), $targetMailbox='', $bypass_trash=NULL) {
/* incoming formdata */
$sButton = (sqgetGlobalVar('moveButton', $sTmp, SQ_FORM)) ? 'move' : $sButton;
$sButton = (sqgetGlobalVar('copyButton', $sTmp, SQ_FORM)) ? 'copy' : $sButton;
$sButton = (sqgetGlobalVar('markUnread', $sTmp, SQ_FORM)) ? 'unsetSeen' : $sButton;
$sButton = (sqgetGlobalVar('markFlagged', $sTmp, SQ_FORM)) ? 'setFlagged' : $sButton;
$sButton = (sqgetGlobalVar('markUnflagged', $sTmp, SQ_FORM)) ? 'unsetFlagged' : $sButton;
- sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_FORM);
- sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_FORM);
+ if (empty($targetMailbox)) sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_FORM);
+ if (is_null($bypass_trash)) sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_FORM);
sqgetGlobalVar('msg', $msg, SQ_FORM);
if (sqgetGlobalVar('account', $iAccount, SQ_FORM) === false) {
$iAccount = 0;
break;
}
/**
- * Updates messages is an array containing the result of the untagged
+ * $aUpdatedMsgs is an array containing the result of the untagged
* fetch responses send by the imap server due to a flag change. That
- * response is parsed in a array with msg arrays by the parseFetch function
+ * response is parsed in an array with msg arrays by the parseFetch function
*/
if ($aUpdatedMsgs) {
// Update the message headers cache
if (isset($aMailbox['MSG_HEADERS'][$iUid])) {
$aMailbox['MSG_HEADERS'][$iUid]['FLAGS'] = $aMsg['FLAGS'];
}
+ /**
+ * Also update flags in message object
+ */
+//FIXME: WHY are we keeping flags in TWO places?!? This is error-prone and some core code uses the is_xxxx message object values while other code uses the flags array above. That's a mess.
+ if (isset($aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'])) {
+ $message = $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'];
+ $message->is_seen = false;
+ $message->is_answered = false;
+ $message->is_deleted = false;
+ $message->is_flagged = false;
+ $message->is_mdnsent = false;
+ foreach ($aMsg['FLAGS'] as $flag => $value) {
+ if (strtolower($flag) == '\\seen' && $value)
+ $message->is_seen = true;
+ else if (strtolower($flag) == '\\answered' && $value)
+ $message->is_answered = true;
+ else if (strtolower($flag) == '\\deleted' && $value)
+ $message->is_deleted = true;
+ else if (strtolower($flag) == '\\flagged' && $value)
+ $message->is_flagged = true;
+ else if (strtolower($flag) == '$mdnsent' && $value)
+ $message->is_mdnsent = true;
+ }
+ $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'] = $message;
+ }
/**
* Count the messages with the \Delete flag set so we can determine
* if the number of expunged messages equals the number of flagged
$body = implode('', $body_a);
$body .= "\r\n";
+ global $username, $attachment_dir;
$filename = sq_get_attach_tempfile();
- $fp = fopen($filename, 'wb');
+ $fullpath = getHashedDir($username, $attachment_dir) . '/' . $filename;
+ $fp = fopen($fullpath, 'wb');
fwrite ($fp, $body);
fclose($fp);