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


PHP IMP_Mailbox类代码示例

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


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

示例1: __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

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

示例3: smartmobileFolderTree

 /**
  * AJAX action: Check access rights for creation of a submailbox.
  *
  * Variables used:
  *   - all: (integer) If 1, return all mailboxes. Otherwise, return only
  *          INBOX, special mailboxes, and polled mailboxes.
  *
  * @return string  HTML to use for the folder tree.
  */
 public function smartmobileFolderTree()
 {
     $ftree = $GLOBALS['injector']->getInstance('IMP_Ftree');
     /* Poll all mailboxes on initial display. */
     $this->_base->queue->poll($ftree->poll->getPollList(), true);
     $iterator = new AppendIterator();
     /* Add special mailboxes explicitly. INBOX should appear first. */
     $special = new ArrayIterator();
     $special->append($ftree['INBOX']);
     foreach (IMP_Mailbox::getSpecialMailboxesSort() as $val) {
         if (isset($ftree[$val])) {
             $special->append($ftree[$val]);
         }
     }
     $iterator->append($special);
     /* Now add polled mailboxes. */
     $filter = new IMP_Ftree_IteratorFilter($ftree);
     $filter->add(array($filter::CONTAINERS, $filter::REMOTE, $filter::SPECIALMBOXES));
     if (!$this->vars->all) {
         $filter->add($filter::POLLED);
     }
     $filter->mboxes = array('INBOX');
     $iterator->append($filter);
     return $ftree->createTree($this->vars->all ? 'smobile_folders_all' : 'smobile_folders', array('iterator' => $iterator, 'render_type' => 'IMP_Tree_Jquerymobile'))->getTree(true);
 }
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:Smartmobile.php

示例4: 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

示例5: execute

 /**
  * Autocreate special mailboxes on login.
  */
 public function execute()
 {
     foreach (IMP_Mailbox::getSpecialMailboxes() as $key => $val) {
         if (is_null($val)) {
             continue;
         }
         switch ($key) {
             case IMP_Mailbox::SPECIAL_COMPOSETEMPLATES:
                 $val->create();
                 break;
             case IMP_Mailbox::SPECIAL_DRAFTS:
                 $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_DRAFTS)));
                 break;
             case IMP_Mailbox::SPECIAL_SENT:
                 foreach ($val as $mbox) {
                     $mbox->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_SENT)));
                 }
                 break;
             case IMP_Mailbox::SPECIAL_SPAM:
                 $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_JUNK)));
                 break;
             case IMP_Mailbox::SPECIAL_TRASH:
                 $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_TRASH)));
                 break;
         }
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:30,代码来源:Autocreate.php

示例6: 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

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

示例8: 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

示例9: 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

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

示例11: __construct

 /**
  * Constructor.
  *
  * @param array $opts  Optional parameters:
  *   - abbrev: (boolean) Abbreviate long mailbox names by replacing the
  *             middle of the name with '...'?
  *             DEFAULT: Yes
  *   - basename: (boolean)  Use raw basename instead of abbreviated label?
  *               DEFAULT: false
  *   - heading: (string) The label for an empty-value option at the top of
  *              the list.
  *              DEFAULT: ''
  *   - inc_notepads: (boolean) Include user's editable notepads in list?
  *                   DEFAULT: No
  *   - inc_tasklists: (boolean) Include user's editable tasklists in list?
  *                    DEFAULT: No
  *   - inc_vfolder: (boolean) Include user's virtual folders in list?
  *                  DEFAULT: No
  *   - iterator: (Iterator) Tree iterator to use.
  *   - new_mbox: (boolean) Display an option to create a new mailbox?
  *               DEFAULT: No
  *   - optgroup: (boolean) Whether to use <optgroup> elements to group
  *               mailbox types.
  *               DEFAULT: false
  *   - selected: (string) The mailbox to have selected by default.
  *               DEFAULT: None
  */
 public function __construct(array $opts = array())
 {
     global $injector;
     $this->_tree = $injector->getInstance('IMP_Ftree')->createTree(strval(new Horde_Support_Randomid()), array('basename' => !empty($opts['basename']), 'iterator' => empty($opts['iterator']) ? null : $opts['iterator'], 'render_type' => 'IMP_Tree_Flist'));
     if (!empty($opts['selected'])) {
         $this->_tree->addNodeParams(IMP_Mailbox::formTo($opts['selected']), array('selected' => true));
     }
     $this->_tree->setOption($opts);
 }
开发者ID:horde,项目名称:horde,代码行数:36,代码来源:Select.php

示例12: _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

示例13: 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

示例14: 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

示例15: 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


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