maxAttachmentSize() public static method

What is the maximum attachment size?
public static maxAttachmentSize ( ) : integer
return integer The maximum attachment size (in bytes).
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');
 }
Esempio n. 2
0
 /**
  */
 protected function _initPages()
 {
     global $injector, $prefs, $registry;
     $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->canPurge = !$prefs->getValue('use_trash');
     $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 = IMP_Compose::maxAttachmentSize();
         }
     }
 }
Esempio n. 3
0
 /**
  * Generates AJAX response task data from the queue.
  *
  * For compose autocomplete address error data (key: 'compose-addr'), an
  * array with keys as the autocomplete DOM element and the values as
  * arrays. The value arrays have keys as the autocomplete address ID, and
  * the value is a space-separated list of classnames to add.
  *
  * For compose attachment data (key: 'compose-atc'), an array of objects
  * with these properties:
  *   - icon: (string) Data url string containing icon information.
  *   - name: (string) The attachment name
  *   - num: (integer) The current attachment number
  *   - size: (string) The size of the attachment
  *   - type: (string) The MIME type of the attachment
  *   - view: (boolean) Link to attachment preivew page
  *
  * For compose cacheid data (key: 'compose'), an object with these
  * properties:
  *   - atclimit: (integer) If set, the number of further attachments
  *               that are allowed.
  *   - atcmax: (integer) The maximum size (in bytes) of an attachment.
  *   - cacheid: (string) Current cache ID of the compose message.
  *   - hmac: (string) HMAC string used to validate draft in case of
  *           session timeout.
  *
  * For flag data (key: 'flag'), an array of objects with these properties:
  *   - add: (array) The list of flags that were added.
  *   - buids: (string) Indices of the messages that have changed (IMAP
  *            sequence string; mboxes are base64url encoded).
  *   - remove: (array) The list of flags that were removed.
  *   - replace: (array) Replace the flag list with these flags.
  *
  * For flag configuration data (key: 'flag-config'), an array containing
  * flag data. All flags returned in dynamic mode; only flags labeled below
  * as [sm] are returned in smartmobile mode:
  *   - a: (boolean) Indicates a flag that can be *a*ltered.
  *   - b: (string) Background color [sm].
  *   - c: (string) CSS class.
  *   - f: (string) Foreground color [sm].
  *   - i: (string) CSS icon [sm].
  *   - id: (string) Flag ID (IMAP flag id).
  *   - l: (string) Flag label [sm].
  *   - s: (boolean) Indicates a flag that can be *s*earched for [sm].
  *   - u: (boolean) Indicates a *u*ser flag.
  *
  * For mailbox data (key: 'mailbox'), an array with these keys:
  *   - a: (array) Mailboxes that were added (base64url encoded).
  *   - all: (integer) If true, all mailboxes should be shown.
  *   - base: (string) Base mailbox (base64url encoded).
  *   - c: (array) Mailboxes that were changed (base64url encoded).
  *   - d: (array) Mailboxes that were deleted (base64url encoded).
  *   - expand: (integer) Expand subfolders on load.
  *   - switch: (string) Load this mailbox (base64url encoded).
  *
  * For maillog data (key: 'maillog'), an object with these properties:
  *   - buid: (integer) BUID.
  *   - log: (array) List of log entries.
  *   - mbox: (string) Mailbox.
  *
  * For message preview data (key: 'message'), an object with these
  * properties:
  *   - buid: (integer) BUID.
  *   - data: (object) Message viewport data.
  *   - mbox: (string) Mailbox.
  *
  * For poll data (key: 'poll'), an array with keys as base64url encoded
  * mailbox names, values as the number of unseen messages.
  *
  * For quota data (key: 'quota'), an array with these keys:
  *   - m: (string) Quota message.
  *   - p: (integer) Quota percentage.
  *
  * @param IMP_Ajax_Application $ajax  The AJAX object.
  */
 public function add(IMP_Ajax_Application $ajax)
 {
     global $injector;
     /* Add autocomplete address error information. */
     if (!empty($this->_addr)) {
         $ajax->addTask('compose-addr', $this->_addr);
         $this->_addr = array();
     }
     /* Add compose attachment information. */
     if (!empty($this->_atc)) {
         $ajax->addTask('compose-atc', $this->_atc);
         $this->_atc = array();
     }
     /* Add compose information. */
     if (!is_null($this->_compose)) {
         $compose = new stdClass();
         if (($addl = $this->_compose->additionalAttachmentsAllowed()) !== true) {
             $compose->atclimit = $addl;
         }
         $compose->atcmax = IMP_Compose::maxAttachmentSize();
         $compose->cacheid = $this->_compose->getCacheId();
         $compose->hmac = $this->_compose->getHmac();
         $ajax->addTask('compose', $compose);
         $this->_compose = null;
     }
     /* Add flag information. */
     if (!empty($this->_flag)) {
         $ajax->addTask('flag', array_unique($this->_flag, SORT_REGULAR));
         $this->_flag = array();
     }
     /* Add flag configuration. */
     switch ($this->_flagconfig) {
         case Horde_Registry::VIEW_DYNAMIC:
         case Horde_Registry::VIEW_MINIMAL:
         case Horde_Registry::VIEW_SMARTMOBILE:
             $flags = array();
             foreach ($injector->getInstance('IMP_Flags')->getList() as $val) {
                 $tmp = array('b' => $val->bgdefault ? null : $val->bgcolor, 'f' => $val->fgcolor, 'id' => $val->id, 'l' => $val->label, 's' => intval($val instanceof IMP_Flag_Imap));
                 if ($this->_flagconfig === Horde_Registry::VIEW_DYNAMIC) {
                     $tmp += array('a' => $val->canset, 'c' => $val->css, 'i' => $val->css ? null : $val->cssicon, 'u' => intval($val instanceof IMP_Flag_User));
                 }
                 $flags[] = array_filter($tmp);
             }
             $ajax->addTask('flag-config', $flags);
             break;
     }
     /* Add folder tree information. */
     $this->_addFtreeInfo($ajax);
     /* Add maillog information. */
     $this->_addMaillogInfo($ajax);
     /* Add message information. */
     if (!empty($this->_messages)) {
         $ajax->addTask('message', $this->_messages);
         $this->_messages = array();
     }
     /* Add poll information. */
     $poll = $poll_list = array();
     if (!empty($this->_poll)) {
         foreach ($this->_poll as $val) {
             $poll_list[strval($val)] = 1;
         }
     }
     if (count($poll_list)) {
         $imap_ob = $injector->getInstance('IMP_Factory_Imap')->create();
         if ($imap_ob->init) {
             try {
                 foreach ($imap_ob->status(array_keys($poll_list), Horde_Imap_Client::STATUS_UNSEEN) as $key => $val) {
                     $poll[IMP_Mailbox::formTo($key)] = intval($val['unseen']);
                 }
             } catch (Exception $e) {
                 // Ignore errors in status() calls.
             }
         }
         if (!empty($poll)) {
             $ajax->addTask('poll', $poll);
             $this->_poll = array();
         }
     }
     /* Add quota information. */
     if ($this->_quota && ($quotadata = $injector->getInstance('IMP_Quota_Ui')->quota($this->_quota[0], $this->_quota[1]))) {
         $ajax->addTask('quota', array('m' => $quotadata['message'], 'p' => round($quotadata['percent']), 'l' => $quotadata['percent'] >= 90 ? 'alert' : ($quotadata['percent'] >= 75 ? 'warn' : '')));
         $this->_quota = false;
     }
 }