summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-04-07 17:30:12 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-04-07 17:30:12 +0200
commit0456f728ee3f6312101d0a372b7385fb34fdaf2a (patch)
tree78434f3253dbc04c2791f09bfed5bc25b749563d
parent6dc1a6645168e5e777a3db97b92d360a9e6b0c86 (diff)
Make UID extraction function globally availbale (for plugins)
-rw-r--r--program/include/rcmail.php31
-rw-r--r--program/steps/mail/copy.inc2
-rw-r--r--program/steps/mail/func.inc31
-rw-r--r--program/steps/mail/mark.inc2
-rw-r--r--program/steps/mail/move_del.inc4
-rw-r--r--program/steps/mail/sendmail.inc4
6 files changed, 37 insertions, 37 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 7a6fb89ec..952e8a5f2 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -2010,6 +2010,37 @@ class rcmail extends rcube
return $size;
}
+ /**
+ * Returns message UID(s) and IMAP folder(s) from GET/POST data
+ *
+ * @param string UID value to decode
+ * @param string Default mailbox value (if not encoded in UIDs)
+ * @return array List of message UIDs per folder
+ */
+ public static function get_uids($uids = null, $mbox = null)
+ {
+ // message UID (or comma-separated list of IDs) is provided in
+ // the form of <ID>-<MBOX>[,<ID>-<MBOX>]*
+
+ $_uid = $uids ?: get_input_value('_uid', RCUBE_INPUT_GPC);
+ $_mbox = $mbox ?: (string)get_input_value('_mbox', RCUBE_INPUT_GPC);
+
+ if (is_array($uid)) {
+ return $uid;
+ }
+
+ // create a per-folder UIDs array
+ $result = array();
+ foreach (explode(',', $_uid) as $uid) {
+ list($uid, $mbox) = explode('-', $uid, 2);
+ if (empty($mbox))
+ $mbox = $_mbox;
+ $result[$mbox][] = $uid;
+ }
+
+ return $result;
+ }
+
/************************************************************************
********* Deprecated methods (to be removed) *********
diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc
index 0f7b1a03a..79e207aa7 100644
--- a/program/steps/mail/copy.inc
+++ b/program/steps/mail/copy.inc
@@ -28,7 +28,7 @@ if (!$OUTPUT->ajax_call) {
if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
$target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
- foreach (rcmail_get_uids() as $mbox => $uids) {
+ foreach (rcmail::get_uids() as $mbox => $uids) {
$copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
}
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 4ff8fcb30..7adc06550 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -187,37 +187,6 @@ $RCMAIL->register_action_map(array(
/**
- * Returns message UID(s) and IMAP folder(s) from GET/POST data
- *
- * @param string UID value to decode
- * @param string Default mailbox value (if not encoded in UIDs)
- * @return array List of message UIDs per folder
- */
-function rcmail_get_uids($uids = null, $mbox = null)
-{
- // message UID (or comma-separated list of IDs) is provided in
- // the form of <ID>-<MBOX>[,<ID>-<MBOX>]*
-
- $_uid = $uids ?: get_input_value('_uid', RCUBE_INPUT_GPC);
- $_mbox = $mbox ?: (string)get_input_value('_mbox', RCUBE_INPUT_GPC);
-
- if (is_array($uid)) {
- return $uid;
- }
-
- // create a per-folder UIDs array
- $result = array();
- foreach (explode(',', $_uid) as $uid) {
- list($uid, $mbox) = explode('-', $uid, 2);
- if (empty($mbox))
- $mbox = $_mbox;
- $result[$mbox][] = $uid;
- }
-
- return $result;
-}
-
-/**
* Returns default search mods
*/
function rcmail_search_mods()
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 50243c636..149bc8e05 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -47,7 +47,7 @@ if (($_uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST))
$old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
}
- foreach (rcmail_get_uids() as $mbox => $uids) {
+ foreach (rcmail::get_uids() as $mbox => $uids) {
$marked += (int)$RCMAIL->storage->set_flag($uids, $flag, $mbox);
$count += count($uids);
}
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 26c724597..7df22590a 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -35,7 +35,7 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe
$target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
$trash = $RCMAIL->config->get('trash_mbox');
- foreach (rcmail_get_uids() as $mbox => $uids) {
+ foreach (rcmail::get_uids() as $mbox => $uids) {
$moved += (int)$RCMAIL->storage->move_message($uids, $target, $mbox);
$count += count($uids);
}
@@ -56,7 +56,7 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe
}
// delete messages
else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
- foreach (rcmail_get_uids() as $mbox => $uids) {
+ foreach (rcmail::get_uids() as $mbox => $uids) {
$del += (int)$RCMAIL->storage->delete_message($uids, $mbox);
$count += count($uids);
}
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 4fcc2b5e4..01a32a12c 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -535,12 +535,12 @@ if (!$savedraft) {
// set replied/forwarded flag
if ($COMPOSE['reply_uid']) {
- foreach (rcmail_get_uids($COMPOSE['reply_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
+ foreach (rcmail::get_uids($COMPOSE['reply_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
$RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox);
}
}
else if ($COMPOSE['forward_uid']) {
- foreach (rcmail_get_uids($COMPOSE['forward_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
+ foreach (rcmail::get_uids($COMPOSE['forward_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
$RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox);
}
}