public function moveMessages()
{
$indices = new IMP_Indices($this->_vars->uid);
- if (!$this->_vars->mboxto || !$indices->count()) {
+ if (!$this->_vars->mboxto || !count($indices)) {
return false;
}
public function copyMessages()
{
$indices = new IMP_Indices($this->_vars->uid);
- if (!$this->_vars->mboxto || !$indices->count()) {
+ if (!$this->_vars->mboxto || !count($indices)) {
return false;
}
public function flagMessages()
{
$indices = new IMP_Indices($this->_vars->uid);
- if (!$this->_vars->flags || !$indices->count()) {
+ if (!$this->_vars->flags || !count($indices)) {
return false;
}
public function deleteMessages()
{
$indices = new IMP_Indices($this->_vars->uid);
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
public function blacklist()
{
$indices = new IMP_Indices($this->_vars->uid);
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
$expunged = $GLOBALS['injector']->getInstance('IMP_Message')->expungeMailbox(array($this->_vars->view => 1), array('list' => true));
- if (!($expunge_count = $expunged->count())) {
+ if (!($expunge_count = count($expunged))) {
return false;
}
public function stripAttachment()
{
$indices = new IMP_Indices($this->_vars->uid);
- if ($indices->count() != 1) {
+ if (count($indices) != 1) {
return false;
}
*/
public function attachIMAPMessage($indices)
{
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
*/
protected function _processBWlist($indices, $descrip, $reg1, $reg2, $link)
{
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
* @license http://www.fsf.org/copyleft/gpl.html GPL
* @package IMP
*/
-class IMP_Indices implements Iterator
+class IMP_Indices implements Countable, Iterator
{
/**
* The indices list.
/* Go through the message list and delete the messages. */
if ($imp_message->delete($msg_ids, array('nuke' => true))) {
- $msgcount = $msg_ids->count();
+ $msgcount = count($msg_ids);
if ($msgcount == 1) {
$GLOBALS['notification']->push(sprintf(_("Purging 1 message from sent-mail folder %s."), IMP::displayFolder($mbox)), 'horde.message');
} else {
/* Go through the message list and delete the messages. */
if ($GLOBALS['injector']->getInstance('IMP_Message')->delete($msg_ids, array('nuke' => true))) {
- $msgcount = $msg_ids->count();
+ $msgcount = count($msg_ids);
$GLOBALS['notification']->push(sprintf(ngettext("Purging %d message from Trash folder.", "Purging %d messages from Trash folder.", $msgcount), $msgcount), 'horde.message');
return true;
}
return;
}
- if (!$indices->count()) {
+ if (!count($indices)) {
return;
}
{
global $conf, $notification, $prefs;
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
{
global $conf, $notification, $prefs;
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
*/
public function flag($flags, $indices, $action = true)
{
- if (!$indices->count()) {
+ if (!count($indices)) {
return false;
}
/* If not able to find the other parts of the message, prepare a
* status message. */
- $msg_count = $indices->count();
+ $msg_count = count($indices);
if ($msg_count != $total) {
self::$_statuscache[$this->_mimepart->getMimeId()] = array(
'icon' => Horde::img('alerts/error.png', _("Error")),
/* Abort immediately if spam reporting has not been enabled, or if
* there are no messages. */
if (empty($GLOBALS['conf'][$action]['reporting']) ||
- !$indices->count()) {
+ !count($indices)) {
return 0;
}
break;
case 'fwd_digest':
- if ($indices->count()) {
+ if (count($indices)) {
$options = array_merge(array(
'actionID' => 'fwd_digest',
'fwddigest' => strval($indices)
case 'move_messages':
case 'copy_messages':
- if (isset($vars->targetMbox) && $indices->count()) {
+ if (isset($vars->targetMbox) && count($indices)) {
if (!empty($vars->newMbox) && ($vars->newMbox == 1)) {
$targetMbox = IMP::folderPref($vars->targetMbox, true);
$newMbox = true;
case 'flag_messages':
$flag = Horde_Util::getPost('flag');
- if ($flag && $indices->count()) {
+ if ($flag && count($indices)) {
$flag = $imp_flags->parseFormId($flag);
$injector->getInstance('IMP_Message')->flag(array($flag['flag']), $indices, $flag['set']);
}
break;
case 'flag_message':
- if (isset($vars->flag) && $indices->count()) {
+ if (isset($vars->flag) && count($indices)) {
$peek = true;
$flag = $imp_flags->parseFormId($vars->flag);
$imp_message->flag(array($flag['flag']), $indices, $flag['set']);
}
$ids = $imp_search->runSearchQuery($query, $mailbox, Horde_Imap_Client::SORT_ARRIVAL, 1);
-if ($ids->count()) {
+if (count($ids)) {
$imp_ui = new IMP_Ui_Mailbox(IMP::$mailbox);
$overview = $imp_mailbox->getMailboxArray(array_slice(reset($ids->indices()), 0, 20), array('preview' => $prefs->getValue('preview_enabled')));
} else {
/* MSGVIEW MODE: Make sure we have a valid list of messages. */
$imp_indices = new IMP_Indices($vars->msglist);
- if (!$imp_indices->count()) {
+ if (!count($imp_indices)) {
$error = true;
}
}