예제 #1
0
파일: IMP.php 프로젝트: DSNS-LAB/Dmail
 /**
  * Returns the initial page for IMP.
  *
  * @return object  Object with the following properties:
  * <pre>
  *   - mbox (IMP_Mailbox)
  *   - url (Horde_Url)
  * </pre>
  */
 public static function getInitialPage()
 {
     global $injector, $prefs, $registry;
     $init_url = $prefs->getValue('initial_page');
     if (!$init_url || !$injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_FOLDERS)) {
         $init_url = 'INBOX';
     }
     if ($init_url == IMP::INITIAL_FOLDERS) {
         $mbox = null;
     } else {
         $mbox = IMP_Mailbox::get($init_url);
         if (!$mbox->exists) {
             $mbox = IMP_Mailbox::get('INBOX');
         }
     }
     $result = new stdClass();
     $result->mbox = $mbox;
     switch ($registry->getView()) {
         case Horde_Registry::VIEW_BASIC:
             $result->url = is_null($mbox) ? IMP_Basic_Folders::url() : $mbox->url('mailbox');
             break;
         case Horde_Registry::VIEW_DYNAMIC:
             $result->url = IMP_Dynamic_Mailbox::url(array('mailbox' => is_null($mbox) ? 'INBOX' : $mbox));
             break;
         case Horde_Registry::VIEW_MINIMAL:
             $result->url = is_null($mbox) ? IMP_Minimal_Folders::url() : IMP_Minimal_Mailbox::url(array('mailbox' => $mbox));
             break;
         case Horde_Registry::VIEW_SMARTMOBILE:
             $result->url = is_null($mbox) ? Horde::url('smartmobile.php', true) : $mbox->url('mailbox');
             break;
     }
     return $result;
 }
예제 #2
0
 /**
  */
 public function menu($menu)
 {
     global $injector, $prefs, $registry, $session;
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     if ($imp_imap->access(IMP_Imap::ACCESS_TRASH) && $prefs->getValue('use_trash') && $prefs->getValue('empty_trash_menu') && ($trash = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH)) && ($trash->vtrash || $trash->access_expunge)) {
         $menu->addArray(array('class' => '__noselection', 'icon' => 'imp-empty-trash', 'onclick' => 'return window.confirm(' . json_encode(_("Are you sure you wish to empty your trash mailbox?")) . ')', 'text' => _("Empty _Trash"), 'url' => $trash->url('mailbox')->add(array('actionID' => 'empty_mailbox', 'token' => $session->getToken()))));
     }
     if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS) && $prefs->getValue('empty_spam_menu') && ($spam = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_SPAM)) && $spam->access_expunge) {
         $menu->addArray(array('class' => '__noselection', 'icon' => 'imp-empty-spam', 'onclick' => 'return window.confirm(' . json_encode(_("Are you sure you wish to empty your spam mailbox?")) . ')', 'text' => _("Empty _Spam"), 'url' => $spam->url('mailbox')->add(array('actionID' => 'empty_mailbox', 'token' => $session->getToken()))));
     }
     if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
         $menu->addArray(array('icon' => 'imp-folder', 'text' => _("_Folders"), 'url' => IMP_Basic_Folders::url()));
     }
     if ($imp_imap->access(IMP_Imap::ACCESS_SEARCH)) {
         $menu->addArray(array('icon' => 'imp-search', 'text' => _("_Search"), 'url' => IMP_Basic_Search::url()));
     }
     if ($prefs->getValue('filter_menuitem')) {
         $menu->addArray(array('icon' => 'imp-filters', 'text' => _("Fi_lters"), 'url' => $registry->getServiceLink('prefs', 'imp')->add('group', 'filters')));
     }
 }