当前位置: 首页>>代码示例>>PHP>>正文


PHP IMP_Mailbox::get方法代码示例

本文整理汇总了PHP中IMP_Mailbox::get方法的典型用法代码示例。如果您正苦于以下问题:PHP IMP_Mailbox::get方法的具体用法?PHP IMP_Mailbox::get怎么用?PHP IMP_Mailbox::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMP_Mailbox的用法示例。


在下文中一共展示了IMP_Mailbox::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Renames the old sent-mail mailboxes.
  *
  * Mailbox name: sent-mail-month-year
  *   month = English:         3 letter abbreviation
  *           Other Languages: Month value (01-12)
  *   year  = 4 digit year
  *
  * The mailbox name needs to be in this specific format (as opposed to a
  * user-defined one) to ensure that 'delete_sentmail_monthly' processing
  * can accurately find all the old sent-mail mailboxes.
  *
  * @return boolean  Whether all sent-mail mailboxes were renamed.
  */
 public function execute()
 {
     global $notification;
     $date_format = substr($GLOBALS['language'], 0, 2) == 'en' ? 'M-Y' : 'm-Y';
     $datetime = new DateTime();
     $now = $datetime->format($date_format);
     foreach ($this->_getSentmail() as $sent) {
         /* Display a message to the user and rename the mailbox.
          * Only do this if sent-mail mailbox currently exists. */
         if ($sent->exists) {
             $notification->push(sprintf(_("\"%s\" mailbox being renamed at the start of the month."), $sent->display), 'horde.message');
             $query = new Horde_Imap_Client_Fetch_Query();
             $query->imapDate();
             $query->uid();
             $imp_imap = $sent->imp_imap;
             $res = $imp_imap->fetch($sent, $query);
             $msgs = array();
             foreach ($res as $val) {
                 $date_string = $val->getImapDate()->format($date_format);
                 if (!isset($msgs[$date_string])) {
                     $msgs[$date_string] = $imp_imap->getIdsOb();
                 }
                 $msgs[$date_string]->add($val->getUid());
             }
             unset($msgs[$now]);
             foreach ($msgs as $key => $val) {
                 $new_mbox = IMP_Mailbox::get(strval($sent) . '-' . Horde_String::lower($key));
                 $imp_imap->copy($sent, $new_mbox, array('create' => true, 'ids' => $val, 'move' => true));
             }
         }
     }
     return true;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:47,代码来源:RenameSentmailMonthly.php

示例2: __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');
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:47,代码来源:Mailbox.php

示例3: execute

 /**
  * Purge the old sent-mail mailboxes.
  *
  * @return boolean  Whether any mailboxes were deleted.
  */
 public function execute()
 {
     global $injector, $notification, $prefs;
     $iterator = new IMP_Ftree_IteratorFilter($injector->getInstance('IMP_Ftree'));
     $iterator->add($iterator::CONTAINERS);
     $mbox_list = array();
     /* Get list of all mailboxes, parse through and get the list of all
      * old sent-mail mailboxes. Then sort this array according to the
      * date. */
     $sent_mail = $injector->getInstance('IMP_Identity')->getAllSentmail();
     foreach (array_map('strval', $iterator) as $k) {
         foreach ($sent_mail as $mbox) {
             if (preg_match('/^' . preg_quote($mbox, '/') . '-([^-]+)-([0-9]{4})$/i', $k, $regs)) {
                 $mbox_list[$k] = is_numeric($regs[1]) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("{$regs['1']} 1, {$regs['2']}");
             }
         }
     }
     arsort($mbox_list, SORT_NUMERIC);
     $return_val = false;
     /* See if any mailboxes need to be purged. */
     $purge = array_slice(array_keys($mbox_list), $prefs->getValue('delete_sentmail_monthly_keep'));
     if (count($purge)) {
         $notification->push(_("Old sent-mail mailboxes being purged."), 'horde.message');
         /* Delete the old mailboxes now. */
         foreach (IMP_Mailbox::get($purge) as $val) {
             if ($val->delete()) {
                 $return_val = true;
             }
         }
     }
     return $return_val;
 }
开发者ID:horde,项目名称:horde,代码行数:37,代码来源:DeleteSentmailMonthly.php

示例4: url

 /**
  * @param array $opts  Options:
  *   - buid: (string) BUID of message.
  *   - full: (boolean) Full URL?
  *   - mailbox: (string) Mailbox of message.
  */
 public static function url(array $opts = array())
 {
     $url = Horde::url('basic.php')->add('page', 'listinfo')->unique()->setRaw(!empty($opts['full']));
     if (!empty($opts['mailbox'])) {
         $url->add(array('buid' => $opts['buid'], 'mailbox' => IMP_Mailbox::get($opts['mailbox'])->form_to));
     }
     return $url;
 }
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:Listinfo.php

示例5: shutdown

 /**
  * Tasks to perform on shutdown.
  */
 public function shutdown()
 {
     foreach ($this->_instances as $key => $val) {
         if ($val->changed) {
             $this->_getCache(IMP_Mailbox::get($key))->set($key, serialize($val));
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:11,代码来源:MailboxList.php

示例6: _init

 /**
  */
 protected function _init()
 {
     global $injector, $notification;
     if (!$this->indices->mailbox->access_search) {
         $notification->push(_("Searching is not available."), 'horde.error');
         $this->indices->mailbox->url('mailbox')->redirect();
     }
     $imp_flags = $injector->getInstance('IMP_Flags');
     $imp_search = $injector->getInstance('IMP_Search');
     /* If search_basic is set, we are processing the search query. */
     if ($this->vars->search_basic) {
         $c_list = array();
         if ($this->vars->search_criteria_text) {
             switch ($this->vars->search_criteria) {
                 case 'from':
                 case 'subject':
                     $c_list[] = new IMP_Search_Element_Header($this->vars->search_criteria_text, $this->vars->search_criteria, $this->vars->search_criteria_not);
                     break;
                 case 'recip':
                     $c_list[] = new IMP_Search_Element_Recipient($this->vars->search_criteria_text, $this->vars->search_criteria_not);
                     break;
                 case 'body':
                 case 'text':
                     $c_list[] = new IMP_Search_Element_Text($this->vars->search_criteria_text, $this->vars->search_criteria == 'body', $this->vars->search_criteria_not);
                     break;
             }
         }
         if ($this->vars->search_criteria_flag) {
             $formdata = $imp_flags->parseFormId($this->vars->search_criteria_flag);
             $c_list[] = new IMP_Search_Element_Flag($formdata['flag'], $formdata['set'] && !$this->vars->search_criteria_flag_not);
         }
         if (empty($c_list)) {
             $notification->push(_("No search criteria specified."), 'horde.error');
         } else {
             /* Store the search in the session. */
             $q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Search::BASIC_SEARCH, 'mboxes' => array($this->indices->mailbox), 'type' => IMP_Search::CREATE_QUERY));
             /* Redirect to the mailbox screen. */
             IMP_Mailbox::get($q_ob)->url('mailbox')->redirect();
         }
     }
     $flist = $imp_flags->getList(array('imap' => true, 'mailbox' => $this->indices->mailbox));
     $flag_set = array();
     foreach ($flist as $val) {
         $flag_set[] = array('val' => $val->form_set, 'label' => $val->label);
     }
     /* Prepare the search template. */
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/basic/search'));
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->action = self::url();
     $view->advsearch = Horde::link($this->indices->mailbox->url(IMP_Basic_Search::url()));
     $view->mbox = $this->indices->mailbox->form_to;
     $view->search_title = sprintf(_("Search %s"), $this->indices->mailbox->display_html);
     $view->flist = $flag_set;
     $this->title = _("Search");
     $this->output = $view->render('search-basic');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:59,代码来源:Searchbasic.php

示例7: quota

 /**
  * Returns data needed to output quota.
  *
  * @param string $mailbox  Mailbox to query.
  * @param boolean $force   If true, ignore 'interval' config option and
  *                         force quota display.
  *
  * @return array|boolean  Array with these keys: class, message, percent.
  *                        Returns false if no updated quota information.
  */
 public function quota($mailbox = null, $force = true)
 {
     global $injector, $session;
     $qconfig = $injector->getInstance('IMP_Factory_Imap')->create()->config->quota;
     if (!$qconfig) {
         return false;
     }
     $qlist = array();
     if (!is_null($mailbox)) {
         $mailbox = IMP_Mailbox::get($mailbox);
         if ($mailbox->nonimap) {
             return false;
         }
         if (!$force) {
             $qlist = $session->get('imp', self::SESSION_INTERVAL_KEY, $session::TYPE_ARRAY);
             if (isset($qlist[strval($mailbox)]) && time() < $qlist[strval($mailbox)]) {
                 return false;
             }
         }
     }
     try {
         $quotaDriver = $injector->getInstance('IMP_Quota');
         $quota = $quotaDriver->getQuota($mailbox);
     } catch (IMP_Exception $e) {
         Horde::log($e, 'ERR');
         return false;
     }
     $qlist[strval($mailbox)] = $qconfig['params']['interval'] + time();
     $session->set('imp', self::SESSION_INTERVAL_KEY, $qlist);
     if (empty($quota)) {
         return false;
     }
     $strings = $quotaDriver->getMessages();
     list($calc, $unit) = $quotaDriver->getUnit();
     $ret = array('class' => '', 'percent' => 0);
     if ($quota['limit'] != 0) {
         $quota['usage'] = $quota['usage'] / $calc;
         $quota['limit'] = $quota['limit'] / $calc;
         $ret['percent'] = $quota['usage'] * 100 / $quota['limit'];
         if ($ret['percent'] >= 90) {
             $ret['class'] = 'quotaalert';
         } elseif ($ret['percent'] >= 75) {
             $ret['class'] = 'quotawarn';
         }
         $ret['message'] = sprintf($strings['short'], $ret['percent'], $quota['limit'], $unit);
         $ret['percent'] = sprintf("%.2f", $ret['percent']);
     } elseif ($quotaDriver->isHiddenWhenUnlimited()) {
         return false;
     } elseif ($quota['usage'] != 0) {
         $quota['usage'] = $quota['usage'] / $calc;
         $ret['message'] = sprintf($strings['nolimit_short'], $quota['usage'], $unit);
     } else {
         $ret['message'] = _("No limit");
     }
     return $ret;
 }
开发者ID:horde,项目名称:horde,代码行数:66,代码来源:Ui.php

示例8: gc

 /**
  * Garbage collection.
  */
 public function gc()
 {
     foreach (IMP_Mailbox::get(array_keys($this->_sortpref)) as $val) {
         /* Purge if mailbox doesn't exist or this is a search query (not
          * a virtual folder). */
         if (!$val->exists || $val->query) {
             unset($this[strval($val)]);
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:Sort.php

示例9: generate

 /**
  * Generates a string that can be saved out to an mbox format mailbox file
  * for a mailbox (or set of mailboxes), optionally including all
  * subfolders of the selected mailbox(es) as well. All mailboxes will be
  * output in the same string.
  *
  * @param mixed $mboxes  A mailbox name (UTF-8), or list of mailbox names,
  *                       to generate a mbox file for.
  *
  * @return resource  A stream resource containing the text of a mbox
  *                   format mailbox file.
  */
 public function generate($mboxes)
 {
     $body = fopen('php://temp', 'r+');
     if (!is_array($mboxes)) {
         if (!strlen($mboxes)) {
             return $body;
         }
         $mboxes = array($mboxes);
     }
     if (empty($mboxes)) {
         return $body;
     }
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->envelope();
     $query->imapDate();
     $query->headerText(array('peek' => true));
     $query->bodyText(array('peek' => true));
     foreach (IMP_Mailbox::get($mboxes) as $val) {
         $imp_imap = $val->imp_imap;
         $slices = $imp_imap->getSlices($val, $imp_imap->getIdsOb(Horde_Imap_Client_Ids::ALL, true));
         foreach ($slices as $slice) {
             try {
                 $res = $imp_imap->fetch($val, $query, array('ids' => $slice, 'nocache' => true));
             } catch (IMP_Imap_Exception $e) {
                 continue;
             }
             foreach ($res as $ptr) {
                 $from_env = $ptr->getEnvelope()->from;
                 $from = count($from_env) ? $from_env[0]->bare_address : '<>';
                 /* We need this long command since some MUAs (e.g. pine)
                  * require a space in front of single digit days. */
                 $imap_date = $ptr->getImapDate();
                 $date = sprintf('%s %2s %s', $imap_date->format('D M'), $imap_date->format('j'), $imap_date->format('H:i:s Y'));
                 fwrite($body, 'From ' . $from . ' ' . $date . "\r\n");
                 /* Remove spurious 'From ' line in headers. */
                 $stream = $ptr->getHeaderText(0, Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
                 while (!feof($stream)) {
                     $line = fgets($stream);
                     if (substr($line, 0, 5) != 'From ') {
                         fwrite($body, $line);
                     }
                 }
                 fwrite($body, "\r\n");
                 /* Add Body text. */
                 $stream = $ptr->getBodyText(0, true);
                 while (!feof($stream)) {
                     fwrite($body, fread($stream, 8192));
                 }
                 fwrite($body, "\r\n");
             }
         }
     }
     return $body;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:66,代码来源:Generate.php

示例10: 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);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:Sentmail.php

示例11: __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');
     }
 }
开发者ID:horde,项目名称:horde,代码行数:50,代码来源:Mailbox.php

示例12: _content

 /**
  */
 protected function _content()
 {
     $inbox = IMP_Mailbox::get('INBOX');
     /* Filter on INBOX display, if requested. */
     $inbox->filterOnDisplay();
     $query = new Horde_Imap_Client_Search_Query();
     $query->flag(Horde_Imap_Client::FLAG_SEEN, false);
     $ids = $inbox->runSearchQuery($query, Horde_Imap_Client::SORT_SEQUENCE, 1);
     $indices = $ids['INBOX'];
     $html = '<table cellspacing="0" width="100%">';
     $text = _("Go to your Inbox...");
     if (empty($indices)) {
         $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
     } else {
         $imp_ui = new IMP_Mailbox_Ui($inbox);
         $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->envelope();
         try {
             $imp_imap = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create($inbox);
             $fetch_ret = $imp_imap->fetch($inbox, $query, array('ids' => $imp_imap->getIdsOb(array_slice($indices, 0, $shown))));
         } catch (IMP_Imap_Exception $e) {
             $fetch_ret = new Horde_Imap_Client_Fetch_Results();
         }
         foreach ($fetch_ret as $uid => $ob) {
             $envelope = $ob->getEnvelope();
             $date = $imp_ui->getDate(isset($envelope->date) ? $envelope->date : null);
             $from = $imp_ui->getFrom($envelope);
             $subject = $imp_ui->getSubject($envelope->subject, true);
             $html .= '<tr style="cursor:pointer" class="text"><td>' . $inbox->url('message', $uid)->link() . '<strong>' . htmlspecialchars($from['from'], ENT_QUOTES, 'UTF-8') . '</strong><br />' . $subject . '</a></td>' . '<td>' . htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '</td></tr>';
         }
         $more_msgs = count($indices) - $shown;
         if ($more_msgs > 0) {
             $text = sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs);
         }
     }
     return $html . '<tr><td colspan="2" style="cursor:pointer" align="right">' . $inbox->url('mailbox')->link() . $text . '</a></td></tr>' . '</table>';
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:40,代码来源:Newmail.php

示例13: _content

 /**
  */
 protected function _content()
 {
     global $injector;
     /* Filter on INBOX display.  INBOX is always polled. */
     IMP_Mailbox::get('INBOX')->filterOnDisplay();
     /* Get list of mailboxes to poll. */
     $poll = $injector->getInstance('IMP_Ftree')->poll->getPollList(true);
     $status = $injector->getInstance('IMP_Factory_Imap')->create()->status($poll, Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_RECENT_TOTAL);
     $anyUnseen = false;
     $out = '';
     foreach ($poll as $mbox) {
         $mbox_str = strval($mbox);
         if (isset($status[$mbox_str]) && (empty($this->_params['show_unread']) || !empty($status[$mbox_str]['unseen']))) {
             $mbox_status = $status[$mbox_str];
             $label = $mbox->url('mailbox')->link() . $mbox->display_html . '</a>';
             if (!empty($mbox_status['unseen'])) {
                 $label = '<strong>' . $label . '</strong>';
                 $anyUnseen = true;
             }
             $out .= '<tr><td>' . $label . '</td>';
             if (empty($mbox_status['unseen'])) {
                 $out .= '<td>-</td>';
             } else {
                 $out .= '<td><strong>' . intval($mbox_status['unseen']) . '</strong>';
                 if (!empty($mbox_status['recent_total'])) {
                     $out .= ' (<span style="color:red">' . sprintf(ngettext("%d new", "%d new", $mbox_status['recent_total']), $mbox_status['recent_total']) . '</span>)';
                 }
                 $out .= '</td>';
             }
             $out .= '<td>' . intval($mbox_status['messages']) . '</td></tr>';
         }
     }
     if (!empty($this->_params['show_unread']) && !$anyUnseen) {
         return '<em>' . _("No mailboxes with unseen messages") . '</em>';
     }
     return '<table class="impBlockSummary"><thead><tr><th>' . _("Mailbox") . '</th><th>' . _("Unseen") . '</th><th>' . _("Total") . '</th></tr></thead><tbody>' . $out . '</tbody></table>';
 }
开发者ID:horde,项目名称:horde,代码行数:39,代码来源:Summary.php

示例14: display

 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $injector, $notification, $page_output;
     $page_output->addScriptFile('acl.js');
     $acl = $injector->getInstance('IMP_Imap_Acl');
     $mbox = isset($ui->vars->mbox) ? IMP_Mailbox::formFrom($ui->vars->mbox) : IMP_Mailbox::get('INBOX');
     try {
         $curr_acl = $acl->getACL($mbox);
         if (!($canEdit = $acl->canEdit($mbox))) {
             $notification->push(_("You do not have permission to change access to this mailbox."), 'horde.warning');
         }
     } catch (IMP_Exception $e) {
         $notification->push($e);
         $canEdit = false;
         $curr_acl = array();
     }
     $rightslist = $acl->getRights();
     $iterator = new IMP_Ftree_IteratorFilter($injector->getInstance('IMP_Ftree'));
     $iterator->add($iterator::NONIMAP);
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->addHelper('Text');
     $view->canedit = $canEdit;
     $view->current = sprintf(_("Current access to %s"), $mbox->display_html);
     $view->hasacl = count($curr_acl);
     $view->mbox = $mbox->form_to;
     $view->options = new IMP_Ftree_Select(array('basename' => true, 'iterator' => $iterator, 'selected' => $mbox));
     if ($view->hasacl) {
         $cval = array();
         foreach ($curr_acl as $index => $rule) {
             $entry = array('index' => $index, 'rule' => array());
             if ($rule instanceof Horde_Imap_Client_Data_AclNegative) {
                 $entry['negative'] = substr($index, 1);
             }
             /* Create table of each ACL option for each user granted
              * permissions; enabled indicates the right has been given to
              * the user. */
             $rightsmbox = $acl->getRightsMbox($mbox, $index);
             foreach (array_keys($rightslist) as $val) {
                 $entry['rule'][] = array('disable' => !$canEdit || !$rightsmbox[$val], 'on' => $rule[$val], 'val' => $val);
             }
             $cval[] = $entry;
         }
         $view->curr_acl = $cval;
     }
     $current_users = array_keys($curr_acl);
     $new_user = array();
     try {
         $auth_imap = $injector->getInstance('IMP_AuthImap');
         foreach (array('anyone') + $auth_imap->listUsers() as $user) {
             if (!in_array($user, $current_users)) {
                 $new_user[] = htmlspecialchars($user);
             }
         }
         $view->new_user = $new_user;
     } catch (IMP_Exception $e) {
         /* Ignore - admin user is not available. */
     } catch (Horde_Exception $e) {
         $notification->push('Could not authenticate as admin user to obtain ACLs. Perhaps your admin configuration is incorrect in config/backends.local.php?', 'horde.warning');
     }
     $rights = array();
     foreach ($rightslist as $key => $val) {
         $val['val'] = $key;
         $rights[] = $val;
     }
     $view->rights = $rights;
     $view->width = round(100 / (count($rights) + 2)) . '%';
     return $view->render('acl');
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:72,代码来源:Acl.php

示例15: emptyMailbox

 /**
  * Empties the entire mailbox.
  */
 public function emptyMailbox()
 {
     global $notification, $prefs;
     if (!$this->access_empty) {
         $notification->push(sprintf(_("Could not delete messages from %s. This mailbox is read-only."), $this->display), 'horde.error');
         return;
     }
     if ($this->vtrash) {
         foreach (IMP_Mailbox::get($this->getSearchOb()->mboxes) as $val) {
             $val->expunge();
         }
         $notification->push(_("Emptied all messages from Virtual Trash Folder."), 'horde.success');
         return;
     }
     /* Make sure there is at least 1 message before attempting to
      * delete. */
     try {
         $imp_imap = $this->imp_imap;
         $status = $imp_imap->status($this, Horde_Imap_Client::STATUS_MESSAGES);
         if (empty($status['messages'])) {
             $notification->push(sprintf(_("The mailbox %s is already empty."), $this->display), 'horde.message');
             return;
         }
         $trash = $prefs->getValue('use_trash') ? IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH) : null;
         if (!$trash || $trash == $this) {
             $imp_imap->store($this, array('add' => array(Horde_Imap_Client::FLAG_DELETED)));
             $this->expunge();
         } else {
             $ret = $imp_imap->search($this);
             $this->getIndicesOb($ret['match'])->delete();
         }
         $notification->push(sprintf(_("Emptied all messages from %s."), $this->display), 'horde.success');
     } catch (IMP_Imap_Exception $e) {
     }
 }
开发者ID:Gomez,项目名称:horde,代码行数:38,代码来源:Mailbox.php


注:本文中的IMP_Mailbox::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。