summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc68
1 files changed, 66 insertions, 2 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 7ea4ae20f..6d4e19c36 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1314,8 +1314,13 @@ function rcmail_mailbox_select($p = array())
$p += array('maxlength' => 100, 'realnames' => false);
$a_mailboxes = array();
-
- foreach ($RCMAIL->imap->list_mailboxes() as $folder)
+
+ if ($p['unsubscribed'])
+ $list = $RCMAIL->imap->list_unsubscribed();
+ else
+ $list = $RCMAIL->imap->list_mailboxes();
+
+ foreach ($list as $folder)
if (empty($p['exceptions']) || !in_array($folder, $p['exceptions']))
rcmail_build_folder_tree($a_mailboxes, $folder, $RCMAIL->imap->get_hierarchy_delimiter());
@@ -1551,6 +1556,65 @@ function rcmail_localize_foldername($name)
}
+function rcmail_quota_display($attrib)
+{
+ global $OUTPUT;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmquotadisplay';
+
+ if(isset($attrib['display']))
+ $_SESSION['quota_display'] = $attrib['display'];
+
+ $OUTPUT->add_gui_object('quotadisplay', $attrib['id']);
+
+ $quota = rcmail_quota_content($attrib);
+
+ $OUTPUT->add_script('$(document).ready(function(){
+ rcmail.set_quota('.json_serialize($quota).')});', 'foot');
+
+ return html::span($attrib, '');
+}
+
+
+function rcmail_quota_content($attrib=NULL)
+{
+ global $RCMAIL;
+
+ $quota = $RCMAIL->imap->get_quota();
+ $quota = $RCMAIL->plugins->exec_hook('quota', $quota);
+
+ $quota_result = (array) $quota;
+ $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
+
+ if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
+ $quota_result['title'] = rcube_label('unlimited');
+ $quota_result['percent'] = 0;
+ }
+ else if ($quota['total']) {
+ if (!isset($quota['percent']))
+ $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
+
+ $title = sprintf('%s / %s (%.0f%%)',
+ show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
+ $quota_result['percent']);
+
+ $quota_result['title'] = $title;
+
+ if ($attrib['width'])
+ $quota_result['width'] = $attrib['width'];
+ if ($attrib['height'])
+ $quota_result['height'] = $attrib['height'];
+ }
+ else {
+ $quota_result['title'] = rcube_label('unknown');
+ $quota_result['percent'] = 0;
+ }
+
+ return $quota_result;
+}
+
+
/**
* Output HTML editor scripts
*