IMP_Compose::maxAttachmentSize PHP Method

maxAttachmentSize() public static method

What is the maximum attachment size?
public static maxAttachmentSize ( ) : integer
return integer The maximum attachment size (in bytes).
    public static function maxAttachmentSize()
    {
        global $browser, $conf;
        $size = $browser->allowFileUploads();
        return empty($conf['compose']['attach_size_limit']) ? $size : min($size, $conf['compose']['attach_size_limit']);
    }

Usage Example

Esempio n. 1
0
 /**
  */
 protected function _compose($base, $view, $args)
 {
     global $injector, $registry, $page_output, $prefs;
     $view->title = $args['title'];
     /* Load Identity. */
     $identity = $injector->getInstance('IMP_Identity');
     $selected_identity = intval($identity->getDefault());
     /* Generate identities list. */
     $this->_addIdentityJs();
     if (IMP_Compose::canHtmlCompose()) {
         $view->compose_html = !empty($args['show_editor']);
         $view->rte = true;
         $page_output->addScriptPackage('IMP_Script_Package_Editor');
         $page_output->addScriptFile('external/base64.js');
     }
     /* Create list for sent-mail selection. */
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS) && !$prefs->isLocked('save_sent_mail')) {
         $view->save_sent_mail = true;
         $view->save_sent_mail_select = !$prefs->isLocked(IMP_Mailbox::MBOX_SENT);
     }
     $view->drafts = $imp_imap->access(IMP_Imap::ACCESS_DRAFTS) && ($draft = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_DRAFTS)) && !$draft->readonly;
     $view->compose_link = $registry->getServiceLink('ajax', 'imp')->url . 'addAttachment';
     $view->resume = !empty($args['resume']);
     $view->is_template = !empty($args['template']);
     $view->read_receipt_set = strcasecmp($prefs->getValue('request_mdn'), 'always') === 0;
     $view->user = $registry->getAuth();
     if (IMP_Compose::canUploadAttachment()) {
         $view->attach = true;
         $view->max_size = IMP_Compose::maxAttachmentSize();
         $view->save_attach_set = strcasecmp($prefs->getValue('save_attachments'), 'always') === 0;
     } else {
         $view->attach = false;
     }
     if ($prefs->getValue('use_pgp') && $prefs->getValue('pgp_public_key')) {
         $view->pgp_pubkey = $prefs->getValue('pgp_attach_pubkey');
     }
     if ($registry->hasMethod('contacts/ownVCard')) {
         $view->vcard_attach = true;
     }
     $view->priority = $prefs->getValue('set_priority');
     if (!$prefs->isLocked('default_encrypt') && (IMP_Pgp::enabled() || IMP_Smime::enabled())) {
         $view->encrypt = $prefs->getValue('default_encrypt');
     }
     $from_list = array();
     foreach ($identity->getSelectList() as $id => $from) {
         $from_list[] = array('label' => $from, 'sel' => $id == $selected_identity, 'val' => $id);
     }
     $view->from_list = $from_list;
     $view->signature = $identity->hasSignature(true);
     $view->sigExpanded = $prefs->getValue('signature_expanded');
 }
All Usage Examples Of IMP_Compose::maxAttachmentSize