canUploadAttachment() public static method

Can attachments be uploaded?
public static canUploadAttachment ( ) : boolean
return boolean True if attachments can be uploaded.
コード例 #1
0
ファイル: Smartmobile.php プロジェクト: DSNS-LAB/Dmail
 /**
  */
 protected function _initPages()
 {
     global $injector, $registry, $session;
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     $this->view->allowFolders = $imp_imap->access(IMP_Imap::ACCESS_FOLDERS);
     $this->view->canInnocent = !empty($imp_imap->config->innocent_params);
     $this->view->canSearch = $imp_imap->access(IMP_Imap::ACCESS_SEARCH);
     $this->view->canSpam = !empty($imp_imap->config->spam_params);
     if ($this->view->canCompose = IMP_Compose::canCompose()) {
         /* Setting up identities. */
         $identity = $injector->getInstance('IMP_Identity');
         $this->view->identities = array();
         foreach ($identity->getSelectList() as $id => $from) {
             $this->view->identities[] = array('label' => $from, 'sel' => $id == $identity->getDefault(), 'val' => $id);
         }
         $this->view->user = $registry->getAuth();
         $this->view->draft = $imp_imap->access(IMP_Imap::ACCESS_DRAFTS) && ($draft = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_DRAFTS)) && !$draft->readonly;
         if (IMP_Compose::canUploadAttachment()) {
             $this->view->attach = true;
             $this->view->max_size = $session->get('imp', 'file_upload');
         }
     }
 }
コード例 #2
0
ファイル: Common.php プロジェクト: horde/horde
 /**
  * Add compose javascript variables to the page.
  */
 protected function _addComposeVars($base)
 {
     global $browser, $conf, $injector, $prefs, $registry;
     /* Context menu definitions. */
     $base->js_context['ctx_other'] = new stdClass();
     if (!$prefs->isLocked('request_mdn')) {
         $base->js_context['ctx_other']->rr = _("Read Receipt");
     }
     $base->js_context['ctx_atc'] = new stdClass();
     if (IMP_Compose::canUploadAttachment()) {
         if (!$prefs->isLocked('save_attachments') && (!$prefs->isLocked('save_sent_mail') || $prefs->getValue('save_sent_mail'))) {
             $base->js_context['ctx_atc']->save = _("Save Attachments in Sent Mailbox");
         }
         $atcfile = new stdClass();
         $atcfile->delete = _("Delete");
         $base->js_context['ctx_atcfile'] = $atcfile;
     }
     if ($prefs->getValue('use_pgp') && $prefs->getValue('pgp_public_key')) {
         $base->js_context['ctx_atc']->pgppubkey = _("Attach Personal PGP Public Key");
     }
     if ($registry->hasMethod('contacts/ownVCard')) {
         $base->js_context['ctx_atc']->vcard = _("Attach contact information");
     }
     /* Variables used in compose page. */
     $compose_cursor = $prefs->getValue('compose_cursor');
     $templates_mbox = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TEMPLATES);
     $base->js_conf += array_filter(array('compose_cursor' => $compose_cursor ? $compose_cursor : 'top', 'rte_avail' => intval($browser->hasFeature('rte')), 'spellcheck' => intval($prefs->getValue('compose_spellcheck')), 'templates_mbox' => $templates_mbox ? $templates_mbox->form_to : null));
     if ($injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_DRAFTS) && ($drafts_mbox = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_DRAFTS)) && !$drafts_mbox->readonly) {
         $base->js_conf += array_filter(array('auto_save_interval_val' => intval($prefs->getValue('auto_save_drafts')), 'close_draft' => intval($prefs->getValue('close_draft')), 'drafts_mbox' => $drafts_mbox->form_to));
     }
     if ($registry->hasMethod('contacts/search')) {
         $base->js_conf['URI_ABOOK'] = strval(IMP_Basic_Contacts::url()->setRaw(true));
         $base->js_conf['ac_delete'] = strval(Horde_Themes::img('delete-small.png'));
         $base->js_conf['ac_minchars'] = intval($conf['compose']['ac_threshold']) ?: 1;
     }
     if ($prefs->getValue('set_priority')) {
         $base->js_conf['priority'] = array(array('l' => _("High"), 'v' => 'high'), array('l' => _("Normal"), 's' => true, 'v' => 'normal'), array('l' => _("Low"), 'v' => 'low'));
     }
     if (!$prefs->isLocked('default_encrypt')) {
         $encrypt = array();
         foreach ($injector->getInstance('IMP_Compose_Ui')->encryptList(null, true) as $key => $val) {
             $encrypt[] = array('l' => htmlspecialchars($val), 'v' => $key);
         }
         if (!empty($encrypt)) {
             $base->js_conf['encrypt'] = $encrypt;
         }
     }
     /* Gettext strings used in compose page. */
     $base->js_text += array('change_identity' => _("You have edited your signature. Change the identity and lose your changes?"), 'compose_cancel' => _("Cancelling this message will permanently discard its contents and will delete auto-saved drafts.\nAre you sure you want to do this?"), 'compose_close' => _("Compose action completed. You may now safely close this window."), 'data' => _("Data"), 'dragdropimg_error' => _("Could not add %d file(s) to message: only images are supported."), 'group_expand' => _("Expand Group"), 'image_data' => _("Image Data"), 'loading' => _("Loading..."), 'max_atc_size' => _("Your attachment(s) are too large and cannot be uploaded."), 'max_atc_num' => _("You have reached the limit for the number of attachments in this message."), 'noresults' => _("No Results Found"), 'nosubject' => _("The message does not have a subject entered.") . "\n" . _("Send message without a subject?"), 'paste_error' => _("Could not paste image as the clipboard data is invalid."), 'replyall' => _("%d recipients"), 'spell_noerror' => _("No spelling errors found."), 'toggle_html' => _("Discard all text formatting information (by converting from HTML to plain text)? This conversion cannot be reversed."), 'uploading' => _("Uploading..."));
 }