本文整理汇总了PHP中IMP_Mailbox::formFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP IMP_Mailbox::formFrom方法的具体用法?PHP IMP_Mailbox::formFrom怎么用?PHP IMP_Mailbox::formFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMP_Mailbox
的用法示例。
在下文中一共展示了IMP_Mailbox::formFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggleMailboxes
/**
* AJAX action: Expand mailboxes (saves expanded state in prefs).
*
* Variables used:
* - action: (string) [REQUIRED] Either 'collapse' or 'expand'.
* - all: (integer) 1 to toggle all mailboxes (mailbox information
* will not be returned).
* - mboxes: (string) The list of mailboxes to process (JSON encoded
* array; mailboxes are base64url encoded); required if 'all'
* is 0.
*
* @return boolean True.
*/
public function toggleMailboxes()
{
$ftree = $GLOBALS['injector']->getInstance('IMP_Ftree');
if ($this->vars->all) {
$old_track = $ftree->eltdiff->track;
$ftree->eltdiff->track = false;
switch ($this->vars->action) {
case 'collapse':
$ftree->collapseAll();
break;
case 'expand':
$ftree->expandAll();
break;
}
$ftree->eltdiff->track = $old_track;
} elseif (!empty($this->vars->mboxes)) {
$mboxes = IMP_Mailbox::formFrom(json_decode($this->vars->mboxes));
switch ($this->vars->action) {
case 'collapse':
$ftree->collapse($mboxes);
break;
case 'expand':
$ftree->expand($mboxes);
break;
}
}
return true;
}
示例2: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
if ($GLOBALS['prefs']->isLocked(IMP_Mailbox::MBOX_TEMPLATES)) {
return false;
}
return $this->_updateSpecialMboxes(IMP_Mailbox::MBOX_TEMPLATES, IMP_Mailbox::formFrom($ui->vars->templates), $ui->vars->templates_new, null, $ui);
}
示例3: __construct
/**
* Constructor.
*
* @param mixed Two possible inputs:
* - 1 argument: Horde_Variables object. These GET/POST parameters are
* reserved in IMP:
* - buid: (string) BUID [Browser UID].
* - mailbox: (string) Base64url encoded mailbox.
* - muid: (string) MUID [Mailbox + UID].
* - uid: (string) UID [Actual mail UID].
* - 2 arguments: IMP_Mailbox object, IMP_Indices argument
*/
public function __construct()
{
$args = func_get_args();
switch (func_num_args()) {
case 1:
if ($args[0] instanceof Horde_Variables) {
if (isset($args[0]->mailbox) && strlen($args[0]->mailbox)) {
$this->mailbox = IMP_Mailbox::formFrom($args[0]->mailbox);
if (isset($args[0]->buid)) {
$this->buids = new IMP_Indices($this->mailbox, $args[0]->buid);
parent::__construct($this->mailbox->fromBuids($this->buids));
} elseif (isset($args[0]->uid)) {
parent::__construct($this->mailbox, $args[0]->uid);
}
}
if (isset($args[0]->muid)) {
parent::__construct($args[0]->muid);
}
}
break;
case 2:
if ($args[0] instanceof IMP_Mailbox && $args[1] instanceof IMP_Indices) {
$this->mailbox = $args[0];
$this->buids = $args[0]->toBuids($args[1]);
parent::__construct($args[1]);
}
break;
}
if (!isset($this->buids)) {
$this->buids = new IMP_Indices();
}
if (!isset($this->mailbox)) {
$this->mailbox = IMP_Mailbox::get('INBOX');
}
}
示例4: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
global $injector;
if (!$this->_updateSpecialMboxes(IMP_Mailbox::MBOX_SPAM, IMP_Mailbox::formFrom($ui->vars->spam), $ui->vars->spam_new, Horde_Imap_Client::SPECIALUSE_JUNK, $ui)) {
return false;
}
$injector->getInstance('IMP_Factory_Imap')->create()->updateFetchIgnore();
return true;
}
示例5: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
global $injector, $prefs;
$imp_search = $injector->getInstance('IMP_Search');
$curr_vtrash = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH)->vtrash;
$trash = IMP_Mailbox::formFrom($ui->vars->trash);
if (!$prefs->isLocked('vfolder')) {
$vtrash = $imp_search['vtrash'];
$vtrash->enabled = $trash->vtrash;
$imp_search['vtrash'] = $vtrash;
}
if (!$this->_updateSpecialMboxes(IMP_Mailbox::MBOX_TRASH, $trash, $ui->vars->trash_new, Horde_Imap_Client::SPECIALUSE_TRASH, $ui)) {
return false;
}
$injector->getInstance('IMP_Factory_Imap')->create()->updateFetchIgnore();
/* Switching to/from Virtual Trash requires us to expire all currently
* cached mailbox lists (hide deleted status may have changed). */
if ($curr_vtrash || $trash->vtrash) {
$injector->getInstance('IMP_Factory_MailboxList')->expireAll();
}
return true;
}
示例6: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
global $injector, $prefs;
$imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
if (!$imp_imap->access(IMP_Imap::ACCESS_FOLDERS) || $prefs->isLocked(IMP_Mailbox::MBOX_SENT)) {
return false;
}
if (!$ui->vars->sent_mail && $ui->vars->sent_mail_new) {
$sent_mail = IMP_Mailbox::get($ui->vars->sent_mail_new)->namespace_append;
} else {
$sent_mail = IMP_Mailbox::formFrom($ui->vars->sent_mail);
if (strpos($sent_mail, self::PREF_SPECIALUSE) === 0) {
$sent_mail = IMP_Mailbox::get(substr($sent_mail, strlen(self::PREF_SPECIALUSE)));
} elseif ($sent_mail == self::PREF_DEFAULT && ($sm_default = $prefs->getDefault(IMP_Mailbox::MBOX_SENT))) {
$sent_mail = IMP_Mailbox::get($sm_default)->namespace_append;
}
}
if ($sent_mail && !$sent_mail->create()) {
return false;
}
return $injector->getInstance('IMP_Identity')->setValue(IMP_Mailbox::MBOX_SENT, $sent_mail);
}
示例7: __construct
/**
* Constructor.
*
* @param mixed Two possible inputs:
* - 1 argument: Horde_Variables object. These GET/POST parameters are
* reserved in IMP:
* - buid: (string) BUID [Browser UID].
* - mailbox: (string) Base64url encoded mailbox.
* - muid: (string) MUID [Mailbox + UID].
* - uid: (string) UID [Actual mail UID].
* - 2 arguments: IMP_Mailbox object, IMP_Indices argument
*/
public function __construct()
{
$args = func_get_args();
switch (func_num_args()) {
case 1:
if ($args[0] instanceof Horde_Variables) {
if (isset($args[0]->mailbox) && strlen($args[0]->mailbox)) {
$this->mailbox = IMP_Mailbox::formFrom($args[0]->mailbox);
if (isset($args[0]->buid)) {
/* BUIDs are always integers. Do conversion here since
* POP3 won't work otherwise. */
$tmp = new Horde_Imap_Client_Ids($args[0]->buid);
$this->buids = new IMP_Indices($this->mailbox, $tmp->ids);
parent::__construct($this->mailbox->fromBuids($this->buids));
} elseif (isset($args[0]->uid)) {
parent::__construct($this->mailbox, $args[0]->uid);
}
}
if (isset($args[0]->muid)) {
parent::__construct($args[0]->muid);
}
}
break;
case 2:
if ($args[0] instanceof IMP_Mailbox && $args[1] instanceof IMP_Indices) {
$this->mailbox = $args[0];
$this->buids = $args[0]->toBuids($args[1]);
parent::__construct($args[1]);
}
break;
}
if (!isset($this->buids)) {
$this->buids = new IMP_Indices($this->_indices);
}
if (!isset($this->mailbox)) {
$this->mailbox = IMP_Mailbox::get('INBOX');
}
}
示例8: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
return $this->_updateSpecialMboxes(IMP_Mailbox::MBOX_DRAFTS, IMP_Mailbox::formFrom($ui->vars->drafts), $ui->vars->drafts_new, Horde_Imap_Client::SPECIALUSE_DRAFTS, $ui);
}
示例9: remoteLogout
/**
* AJAX action: Logout from a remote account.
*
* Variables used:
* - remoteid: (string) Remote server ID (base64url encoded).
*
* @return boolean True.
*/
public function remoteLogout()
{
global $injector, $notification;
$remote = $injector->getInstance('IMP_Remote');
$remoteid = IMP_Mailbox::formFrom($this->vars->remoteid);
$remote_ob = $remote[$remoteid];
$injector->getInstance('IMP_Factory_Imap')->destroy($remoteid);
$ftree = $injector->getInstance('IMP_Ftree');
$ftree->delete($remote_ob);
$ftree->insert($remote_ob);
$notification->push(sprintf(_("Logged out of %s."), $remote_ob->label), 'horde.success');
return true;
}
示例10: _init
/**
* URL Parameters:
* <pre>
* - criteria_form: (string) JSON representation of the search query.
* - edit_query: (integer) If true, edit a search query (contained in
* 'mailbox' parameter).
* - edit_query_filter: (string) The name of the filter being edited.
* - edit_query_vfolder: (string) The name of the virtual folder being
* edited.
* - mailbox: (string) Mailbox parameter.
* - mailbox_list: (array) A list of mailboxes to process (base64url
* encoded) If empty, uses 'mailbox' parameter.
* - mboxes_form: (string) JSON representation of the list of mailboxes
* for the query. Hash containing 2 keys: mbox &
* subfolder. Both values are base64url encoded.
* - search_label: (string) The label to use when saving the search.
* - search_type: (string) The type of saved search ('filter',
* 'vfolder'). If empty, the search should not be saved.
* - subfolder: (boolean) If set, search mailbox will default to
* subfolder search.
* </pre>
*/
protected function _init()
{
global $injector, $notification, $page_output, $prefs, $registry;
/* Define the criteria list. */
$criteria = array('from' => array('label' => _("From"), 'type' => 'header'), 'recip' => array('label' => _("Recipients (To/Cc/Bcc)"), 'type' => 'header'), 'to' => array('label' => _("To"), 'type' => 'header'), 'cc' => array('label' => _("Cc"), 'type' => 'header'), 'bcc' => array('label' => _("Bcc"), 'type' => 'header'), 'subject' => array('label' => _("Subject"), 'type' => 'header'), 'customhdr' => array('label' => _("Custom Header"), 'type' => 'customhdr'), 'body' => array('label' => _("Body"), 'type' => 'text'), 'text' => array('label' => _("Entire Message"), 'type' => 'text'), 'date_range' => array('label' => _("Date"), 'type' => 'date'), 'older' => array('label' => _("Older Than"), 'type' => 'within'), 'younger' => array('label' => _("Younger Than"), 'type' => 'within'), 'size_smaller' => array('label' => _("Size (KB) <"), 'type' => 'size'), 'size_larger' => array('label' => _("Size (KB) >"), 'type' => 'size'));
$filters = array('bulk' => array('label' => _("Bulk Messages"), 'type' => 'filter'), 'attach' => array('label' => _("Contains Attachment(s)"), 'type' => 'filter'), 'mailinglist' => array('label' => _("Mailing List Messages"), 'type' => 'filter'), 'personal' => array('label' => _("Personal Messages"), 'type' => 'filter'));
/* Define some constants. */
$constants = array('within' => array('d' => IMP_Search_Element_Within::INTERVAL_DAYS, 'm' => IMP_Search_Element_Within::INTERVAL_MONTHS, 'y' => IMP_Search_Element_Within::INTERVAL_YEARS));
if (isset($this->vars->mailbox_list)) {
if (is_array($this->vars->mailbox_list)) {
$default_mailbox = IMP_Mailbox::get('INBOX');
$search_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox_list);
} else {
$default_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox_list);
$search_mailbox = array($default_mailbox);
}
} elseif (isset($this->vars->mailbox)) {
$default_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox);
$search_mailbox = array($default_mailbox);
} else {
$default_mailbox = IMP_Mailbox::get('INBOX');
$search_mailbox = array($default_mailbox);
}
/* Check that searching is allowed. */
if (!$injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_SEARCH)) {
$default_mailbox->url('mailbox')->redirect();
}
$imp_flags = $injector->getInstance('IMP_Flags');
$imp_search = $injector->getInstance('IMP_Search');
$dynamic_view = $registry->getView() == Horde_Registry::VIEW_DYNAMIC;
$js_vars = array();
/* Generate the search query if 'criteria_form' is present in the form
* data. */
if ($this->vars->criteria_form) {
$c_list = array();
foreach (json_decode($this->vars->criteria_form) as $val) {
switch ($val->t) {
case 'from':
case 'to':
case 'cc':
case 'bcc':
case 'subject':
$c_list[] = new IMP_Search_Element_Header($val->v, $val->t, $val->n);
break;
case 'recip':
$c_list[] = new IMP_Search_Element_Recipient($val->v, $val->n);
break;
case 'customhdr':
$c_list[] = new IMP_Search_Element_Header($val->v->s, $val->v->h, $val->n);
break;
case 'body':
case 'text':
$c_list[] = new IMP_Search_Element_Text($val->v, $val->t == 'body', $val->n);
break;
case 'date_range':
$c_list[] = new IMP_Search_Element_Daterange($val->b ? new DateTime($val->b) : 0, $val->e ? new DateTime($val->e) : 0, $val->n);
break;
case 'older':
case 'younger':
$c_list[] = new IMP_Search_Element_Within($val->v->v, $constants['within'][$val->v->l], $val->t == 'older');
break;
case 'size_smaller':
case 'size_larger':
$c_list[] = new IMP_Search_Element_Size($val->v, $val->t == 'size_larger');
break;
case 'or':
$c_list[] = new IMP_Search_Element_Or();
break;
case 'bulk':
$c_list[] = new IMP_Search_Element_Bulk($val->n);
break;
case 'attach':
$c_list[] = new IMP_Search_Element_Attachment($val->n);
break;
case 'mailinglist':
$c_list[] = new IMP_Search_Element_Mailinglist($val->n);
break;
case 'personal':
//.........这里部分代码省略.........
示例11: _init
/**
*/
protected function _init()
{
global $injector, $registry;
$this->queue = $injector->getInstance('IMP_Ajax_Queue');
switch ($registry->getView()) {
case $registry::VIEW_BASIC:
case $registry::VIEW_DYNAMIC:
$this->addHandler('IMP_Ajax_Application_Handler_Common');
$this->addHandler('IMP_Ajax_Application_Handler_Contacts');
$this->addHandler('IMP_Ajax_Application_Handler_ComposeAttach');
$this->addHandler('IMP_Ajax_Application_Handler_Draft');
$this->addHandler('IMP_Ajax_Application_Handler_Dynamic');
$this->addHandler('IMP_Ajax_Application_Handler_Mboxtoggle');
$this->addHandler('IMP_Ajax_Application_Handler_Passphrase');
$this->addHandler('IMP_Ajax_Application_Handler_Search');
if ($injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_REMOTE)) {
$this->addHandler('IMP_Ajax_Application_Handler_Remote');
$this->addHandler('IMP_Ajax_Application_Handler_RemotePrefs');
}
break;
case $registry::VIEW_MINIMAL:
case $registry::VIEW_SMARTMOBILE:
$this->addHandler('IMP_Ajax_Application_Handler_Common');
$this->addHandler('IMP_Ajax_Application_Handler_ComposeAttach');
$this->addHandler('IMP_Ajax_Application_Handler_Dynamic');
$this->addHandler('IMP_Ajax_Application_Handler_Draft')->disabled = array('autoSaveDraft', 'saveTemplate');
$this->addHandler('IMP_Ajax_Application_Handler_Smartmobile');
break;
}
$this->addHandler('IMP_Ajax_Application_Handler_ImageUnblock');
$this->addHandler('Horde_Core_Ajax_Application_Handler_Imple');
$this->addHandler('Horde_Core_Ajax_Application_Handler_Prefs');
/* Copy 'view' paramter to 'mailbox', because this is what
* IMP_Indices_Mailbox expects. */
if (isset($this->_vars->view)) {
$this->_vars->mailbox = $this->_vars->view;
}
$this->indices = new IMP_Indices_Mailbox($this->_vars);
/* Make sure the viewport entry is initialized. */
$vp = isset($this->_vars->viewport) ? json_decode($this->_vars->viewport) : new stdClass();
$this->_vars->viewport = new Horde_Support_ObjectStub($vp);
/* GLOBAL TASKS */
/* Check for global msgload task. */
if (isset($this->_vars->msgload)) {
$this->queue->message($this->indices->mailbox->fromBuids(array($this->_vars->msgload)), array('peek' => true, 'preview' => true));
}
/* Check for global poll task. */
if (isset($this->_vars->poll)) {
$poll = json_decode($this->_vars->poll);
$this->queue->poll(empty($poll) ? $injector->getInstance('IMP_Ftree')->poll->getPollList() : IMP_Mailbox::formFrom($poll), true);
}
}
示例12: _init
/**
*/
protected function _init()
{
global $injector, $notification, $page_output, $prefs, $registry, $session;
$mailbox = $this->indices->mailbox;
/* Call the mailbox redirection hook, if requested. */
try {
$redirect = $injector->getInstance('Horde_Core_Hooks')->callHook('mbox_redirect', 'imp', array($mailbox));
if (!empty($redirect)) {
Horde::url($redirect, true)->redirect();
}
} catch (Horde_Exception_HookNotSet $e) {
}
$mailbox_url = Horde::url('basic.php')->add('page', 'mailbox');
$mailbox_imp_url = $mailbox->url('mailbox')->add('newmail', 1);
$imp_flags = $injector->getInstance('IMP_Flags');
$imp_imap = $mailbox->imp_imap;
$imp_search = $injector->getInstance('IMP_Search');
/* Run through the action handlers */
if (($actionID = $this->vars->actionID) && $actionID != 'message_missing') {
try {
$session->checkToken($this->vars->token);
} catch (Horde_Exception $e) {
$notification->push($e);
$actionID = null;
}
}
/* We know we are going to be exclusively dealing with this mailbox,
* so select it on the IMAP server (saves some STATUS calls). Open
* R/W to clear the RECENT flag. This call will catch invalid
* mailboxes. */
$imp_imap->openMailbox($mailbox, Horde_Imap_Client::OPEN_READWRITE);
$imp_mailbox = $mailbox->list_ob;
/* Determine if mailbox is readonly. */
$readonly = $mailbox->readonly;
switch ($actionID) {
case 'change_sort':
$mailbox->setSort($this->vars->sortby, $this->vars->sortdir);
break;
case 'blacklist':
$injector->getInstance('IMP_Filter')->blacklistMessage($this->indices);
break;
case 'whitelist':
$injector->getInstance('IMP_Filter')->whitelistMessage($this->indices);
break;
case 'spam_report':
$injector->getInstance('IMP_Factory_Spam')->create(IMP_Spam::SPAM)->report($this->indices);
break;
case 'innocent_report':
$injector->getInstance('IMP_Factory_Spam')->create(IMP_Spam::INNOCENT)->report($this->indices);
break;
case 'message_missing':
$notification->push(_("Requested message not found."), 'horde.error');
break;
case 'fwd_digest':
case 'redirect_messages':
case 'template_edit':
if (count($this->indices)) {
$compose_actions = array('fwd_digest' => 'fwd_digest', 'redirect_messages' => 'redirect_compose', 'template_edit' => 'template_edit');
$clink = new IMP_Compose_Link($this->vars);
$options = array_merge(array('actionID' => $compose_actions[$actionID], 'muid' => strval($this->indices)), $clink->args);
if ($prefs->getValue('compose_popup')) {
$page_output->addInlineScript(array(Horde::popupJs(IMP_Basic_Compose::url(), array('novoid' => true, 'params' => array_merge(array('popup' => 1), $options)))), true);
} else {
IMP_Basic_Compose::url()->add($options)->redirect();
}
}
break;
case 'delete_messages':
$injector->getInstance('IMP_Message')->delete($this->indices, array('mailboxob' => $imp_mailbox));
break;
case 'undelete_messages':
$injector->getInstance('IMP_Message')->undelete($this->indices);
break;
case 'move_messages':
case 'copy_messages':
if (isset($this->vars->targetMbox) && count($this->indices) && (!$readonly || $actionID == 'copy_messages')) {
$targetMbox = IMP_Mailbox::formFrom($this->vars->targetMbox);
if (!empty($this->vars->newMbox) && $this->vars->newMbox == 1) {
$targetMbox = IMP_Mailbox::get($this->vars->targetMbox)->namespace_append;
$newMbox = true;
} else {
$targetMbox = IMP_Mailbox::formFrom($this->vars->targetMbox);
$newMbox = false;
}
$injector->getInstance('IMP_Message')->copy($targetMbox, $actionID == 'move_messages' ? 'move' : 'copy', $this->indices, array('create' => $newMbox, 'mailboxob' => $imp_mailbox));
}
break;
case 'flag_messages':
if (!$readonly && $this->vars->flag && count($this->indices)) {
$flag = $imp_flags->parseFormId($this->vars->flag);
$injector->getInstance('IMP_Message')->flag(array($flag['set'] ? 'add' : 'remove' => array($flag['flag'])), $this->indices);
}
break;
case 'filter_messages':
if (!$readonly) {
$filter = IMP_Mailbox::formFrom($this->vars->filter);
$q_ob = null;
if (strpos($filter, self::FLAG_FILTER_PREFIX) === 0) {
//.........这里部分代码省略.........
示例13: listMessages
/**
* Returns a list of messages for use with ViewPort.
*
* @var array $args TODO
* - applyfilter: (boolean) If true, apply filters to mailbox.
* - change: (boolean) True if the cache value has changed.
* - initial: (boolean) Is this the initial load of the view?
* - mbox: (string) The mailbox of the view.
* - qsearch: (string) The quicksearch search string.
* - qsearchfield: (string) The quicksearch search criteria.
* - qsearchmbox: (string) The mailbox to do the quicksearch in
* (base64url encoded).
* - qsearchfilter: TODO
*
* @return IMP_Ajax_Application_Viewport Viewport data object.
*/
public function listMessages($args)
{
global $injector, $notification, $prefs;
$is_search = false;
$mbox = IMP_Mailbox::get($args['mbox']);
$sortpref = $mbox->getSort(true);
/* Create the base object. */
$result = new IMP_Ajax_Application_Viewport($mbox);
/* Check for quicksearch request. */
if (strlen($args['qsearchmbox'])) {
$qsearch_mbox = IMP_Mailbox::formFrom($args['qsearchmbox']);
/* Sanity checking: qsearchmbox cannot be a search mailbox
* itself. */
if ($qsearch_mbox->search) {
$notification->push(_("Error in displaying search results."), 'horde.error');
return $result;
}
if (strlen($args['qsearchfilter'])) {
$injector->getInstance('IMP_Search')->applyFilter($args['qsearchfilter'], array($qsearch_mbox), $mbox);
$is_search = true;
} else {
/* Create the search query. */
$c_list = array();
if (strlen($args['qsearchflag'])) {
$c_list[] = new IMP_Search_Element_Flag($args['qsearchflag'], empty($args['qsearchflagnot']));
$is_search = true;
} elseif (strlen($args['qsearch'])) {
$is_search = true;
switch ($args['qsearchfield']) {
case 'all':
case 'body':
$c_list[] = new IMP_Search_Element_Text($args['qsearch'], $args['qsearchfield'] == 'body');
break;
case 'from':
case 'subject':
$c_list[] = new IMP_Search_Element_Header($args['qsearch'], $args['qsearchfield']);
break;
case 'recip':
$c_list[] = new IMP_Search_Element_Recipient($args['qsearch']);
break;
default:
$is_search = false;
break;
}
}
/* Store the search in the session. */
if ($is_search) {
$injector->getInstance('IMP_Search')->createQuery($c_list, array('id' => $mbox, 'mboxes' => array($qsearch_mbox), 'type' => IMP_Search::CREATE_QUERY));
}
}
} else {
$is_search = $mbox->search;
}
/* Run filters now. */
if (!empty($args['applyfilter'])) {
$mbox->filter();
} elseif ($mbox->inbox) {
$mbox->filterOnDisplay();
}
$result->label = $mbox->label;
/* Optimization: saves at least a STATUS and an EXAMINE call since
* we will eventually open mailbox READ-WRITE. */
$imp_imap = $mbox->imp_imap;
$imp_imap->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE);
if ($is_search) {
/* For search mailboxes, we need to invalidate all browser data
* and repopulate on force update, since BUIDs may have
* changed (TODO: only do this if search mailbox has changed?). */
if (!empty($args['change'])) {
$args['cache'] = array();
$args['change'] = true;
$result->data_reset = $result->rowlist_reset = true;
}
} elseif (!$args['initial'] && $args['cacheid'] && $args['cache']) {
/* Check for UIDVALIDITY expiration. If it has changed, we need to
* purge the cached items on the browser. */
$parsed = $imp_imap->parseCacheId($args['cacheid']);
$uid_expire = true;
if ($parsed['date'] == date('z')) {
try {
$imp_imap->sync($mbox, $parsed['token'], array('criteria' => Horde_Imap_Client::SYNC_UIDVALIDITY));
$uid_expire = false;
} catch (Horde_Imap_Client_Exception_Sync $e) {
}
//.........这里部分代码省略.........
示例14: mailboxSize
/**
* AJAX action: Determine the size of a mailbox.
*
* Variables used:
* - mbox: (string) The name of the mailbox to check (base64url
* encoded).
*
* @return object An object with the following properties:
* - size: (string) Formatted size string.
*/
public function mailboxSize()
{
$mbox = IMP_Mailbox::formFrom($this->vars->mbox);
$ret = new stdClass();
$ret->size = $mbox->size;
return $ret;
}
示例15: _init
/**
*/
protected function _init()
{
global $conf, $injector, $notification, $page_output, $prefs, $registry, $session;
$mailbox = $this->indices->mailbox;
$imp_imap = $mailbox->imp_imap;
/* We know we are going to be exclusively dealing with this mailbox,
* so select it on the IMAP server (saves some STATUS calls). Open R/W
* to clear the RECENT flag. */
$imp_imap->openMailbox($mailbox, Horde_Imap_Client::OPEN_READWRITE);
/* Make sure we have a valid index. */
$imp_mailbox = $mailbox->list_ob;
$imp_mailbox->setIndex($this->indices);
if (!$imp_mailbox->isValidIndex()) {
$this->_returnToMailbox(null, 'message_missing');
return;
}
$imp_flags = $injector->getInstance('IMP_Flags');
$imp_identity = $injector->getInstance('IMP_Identity');
$imp_message = $injector->getInstance('IMP_Message');
$imp_ui = $injector->getInstance('IMP_Message_Ui');
/* Run through action handlers. */
if ($this->vars->actionID) {
try {
$session->getToken($this->vars->token);
} catch (Horde_Exception $e) {
$notification->push($e);
$this->vars->actionID = null;
}
}
$readonly = $mailbox->readonly;
$peek = false;
switch ($this->vars->actionID) {
case 'blacklist':
case 'whitelist':
if ($this->vars->actionID == 'blacklist') {
$injector->getInstance('IMP_Filter')->blacklistMessage($this->indices);
} else {
$injector->getInstance('IMP_Filter')->whitelistMessage($this->indices);
}
break;
case 'delete_message':
$imp_message->delete($this->indices, array('mailboxob' => $imp_mailbox));
if ($prefs->getValue('mailbox_return')) {
$this->_returnToMailbox($imp_mailbox->getIndex());
return;
}
if ($imp_ui->moveAfterAction($mailbox)) {
$imp_mailbox->setIndex(1);
}
break;
case 'undelete_message':
$imp_message->undelete($this->indices);
break;
case 'move_message':
case 'copy_message':
if (isset($this->vars->targetMbox) && (!$readonly || $this->vars->actionID == 'copy_message')) {
if ($this->vars->newMbox) {
$targetMbox = IMP_Mailbox::prefFrom($this->vars->targetMbox);
$newMbox = true;
} else {
$targetMbox = IMP_Mailbox::formFrom($this->vars->targetMbox);
$newMbox = false;
}
$imp_message->copy($targetMbox, $this->vars->actionID == 'move_message' ? 'move' : 'copy', $this->indices, array('create' => $newMbox, 'mailboxob' => $imp_mailbox));
if ($prefs->getValue('mailbox_return')) {
$this->_returnToMailbox($imp_mailbox->getIndex());
return;
}
}
break;
case 'innocent_report':
case 'spam_report':
$res = $injector->getInstance('IMP_Factory_Spam')->create($this->vars->actionID == 'spam_report' ? IMP_Spam::SPAM : IMP_Spam::INNOCENT)->report($this->indices, array('mailbox' => $imp_mailbox));
switch ($res) {
case 1:
if ($imp_ui->moveAfterAction($mailbox)) {
$imp_mailbox->setIndex(1);
}
break;
}
if ($prefs->getValue('mailbox_return')) {
$this->_returnToMailbox($imp_mailbox->getIndex());
return;
}
break;
case 'flag_message':
if (!$readonly && isset($this->vars->flag) && count($this->indices)) {
$peek = true;
$flag = $imp_flags->parseFormId($this->vars->flag);
$imp_message->flag(array($flag['set'] ? 'add' : 'remove' => array($flag['flag'])), $this->indices);
if ($prefs->getValue('mailbox_return')) {
$this->_returnToMailbox($imp_mailbox->getIndex());
return;
}
}
break;
case 'add_address':
try {
//.........这里部分代码省略.........