$imp_message = &IMP_Message::singleton();
- $result = $imp_message->copy($to, ($action == 'MoveMessage') ? IMP_MESSAGE::MOVE : IMP_MESSAGE::COPY, $indices);
+ $result = $imp_message->copy($to, ($action == 'MoveMessage') ? 'move' : 'copy', $indices);
if ($result) {
if ($action == 'MoveMessage') {
*/
class IMP_Message
{
- /* Constants used in copy(). */
- const MOVE = 1;
- const COPY = 2;
-
/**
* Using POP to access mailboxes?
*
*
* @param string $targetMbox The mailbox to move/copy messages to
* (UTF7-IMAP).
- * @param integer $action Either IMP_Message::MOVE or
- * IMP_Message::COPY.
+ * @param string $action Either 'copy' or 'move'.
* @param mixed $indices See IMP::parseIndicesList().
* @param boolean $new Whether the target mailbox has to be created.
*
{
global $conf, $imp_imap, $notification, $prefs;
- if (($action == self::MOVE) && $imp_imap->isReadOnly($targetMbox)) {
+ if (($action == 'move') && $imp_imap->isReadOnly($targetMbox)) {
return false;
}
$return_value = true;
switch ($action) {
- case self::MOVE:
+ case 'move':
$imap_move = true;
$message = _("There was an error moving messages from \"%s\" to \"%s\". This is what the server said");
break;
- case self::COPY:
+ case 'copy':
$message = _("There was an error copying messages from \"%s\" to \"%s\". This is what the server said");
break;
}
foreach ($msgList as $mbox => $msgIndices) {
- if (($action == self::MOVE) && $imp_imap->isReadOnly($mbox)) {
+ if (($action == 'move') && $imp_imap->isReadOnly($mbox)) {
$notification->push(sprintf($message, IMP::displayFolder($mbox), IMP::displayFolder($targetMbox)) . ': ' . _("The target directory is read-only."), 'horde.error');
$return_value = false;
continue;
* Copies or moves a list of messages to a tasklist or notepad.
* Handles use of the IMP::SEARCH_MBOX mailbox and the Trash folder.
*
- * @param string $list The list in which the task or note will be
- * created.
- * @param integer $action Either IMP_Message::MOVE or IMP_Message::COPY.
- * @param mixed $indices See IMP::parseIndicesList().
- * @param string $type The object type to create, defaults to task.
+ * @param string $list The list in which the task or note will be
+ * created.
+ * @param string $action Either 'copy' or 'move'.
+ * @param mixed $indices See IMP::parseIndicesList().
+ * @param string $type The object type to create, defaults to task.
*
* @return boolean True if successful, false if not.
*/
}
/* Delete the original messages if this is a "move" operation. */
- if ($action == self::MOVE) {
+ if ($action == 'move') {
$this->delete($indices);
}
case 2:
$targetMbox = ($action == 'spam') ? IMP::folderPref($GLOBALS['prefs']->getValue('spam_folder'), true) : 'INBOX';
if ($targetMbox) {
- if ($imp_message->copy($targetMbox, IMP_Message::MOVE, $indices, true) === false) {
+ if ($imp_message->copy($targetMbox, 'move', $indices, true) === false) {
$delete_spam = 0;
}
} else {
case 'copy_messages':
if (!empty($indices) && !empty($targetMbox)) {
$imp_message = &IMP_Message::singleton();
- $action = ($actionID == 'move_messages') ? IMP_Message::MOVE : IMP_Message::COPY;
if (!empty($newMbox) && ($newMbox == 1)) {
$targetMbox = IMP::folderPref($targetMbox, true);
$newMbox = true;
} else {
$newMbox = false;
}
- $imp_message->copy($targetMbox, $action, $indices, $newMbox);
+ $imp_message->copy($targetMbox, ($actionID == 'move_messages') ? 'move' : 'copy', $indices, $newMbox);
}
break;
if (($targetMbox = Util::getFormData('targetMbox')) !== null) {
$imp_message = &IMP_Message::singleton();
- $action = ($actionID == 'move_message') ? IMP_Message::MOVE : IMP_Message::COPY;
-
if (Util::getFormData('newMbox', 0) == 1) {
$targetMbox = IMP::folderPref($targetMbox, true);
$newMbox = true;
} else {
$newMbox = false;
}
- $imp_message->copy($targetMbox, $action, $indices_array, $newMbox);
+ $imp_message->copy($targetMbox, ($actionID == 'move_message') ? 'move' : 'copy', $indices_array, $newMbox);
if ($prefs->getValue('mailbox_return')) {
_returnToMailbox($imp_mailbox->getMessageIndex());
require IMP_BASE . '/mailbox.php';