| | |
| | | |
| | | function rcmail_quota_display($attrib) |
| | | { |
| | | global $IMAP, $OUTPUT, $JS_OBJECT_NAME; |
| | | global $IMAP, $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH; |
| | | |
| | | if (!$attrib['id']) |
| | | $attrib['id'] = 'rcmquotadisplay'; |
| | |
| | | |
| | | // allow the following attributes to be added to the <span> tag |
| | | $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); |
| | | |
| | | |
| | | if (!$IMAP->get_capability('QUOTA')) |
| | | $quota_text = rcube_label('unknown'); |
| | | else if (!($quota_text = $IMAP->get_quota())) |
| | | else if ($quota = $IMAP->get_quota()) |
| | | { |
| | | $quota_text = sprintf("%s / %s (%.0f%%)", |
| | | show_bytes($quota["used"] * 1024), |
| | | show_bytes($quota["total"] * 1024), |
| | | $quota["percent"]); |
| | | |
| | | // show quota as image (by Brett Patterson) |
| | | if ($attrib['display'] == 'image' && function_exists('imagegif')) |
| | | { |
| | | $attrib += array('width' => 100, 'height' => 14); |
| | | $quota_text = sprintf('<img src="%s&_action=quotaimg&u=%s&q=%d&w=%d&h=%d" width="%d" height="%d" alt="%s" title="%s / %s" />', |
| | | $COMM_PATH, |
| | | $quota['used'], $quota['total'], |
| | | $attrib['width'], $attrib['height'], |
| | | $attrib['width'], $attrib['height'], |
| | | $quota_text, |
| | | show_bytes($quota["used"] * 1024), |
| | | show_bytes($quota["total"] * 1024)); |
| | | } |
| | | } |
| | | else |
| | | $quota_text = rcube_label('unlimited'); |
| | | |
| | | |
| | | $out = '<span' . $attrib_str . '>'; |
| | | $out .= $quota_text; |
| | |
| | | { |
| | | global $IMAP; |
| | | |
| | | if (!is_array($message_struct['parts'])) |
| | | return FALSE; |
| | | |
| | | if (empty($message_struct['parts'])) |
| | | return $message_struct['UID'] ? $IMAP->get_body($message_struct['UID']) : false; |
| | | |
| | | // check all message parts |
| | | foreach ($message_struct['parts'] as $pid => $part) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | // create temp dir for attachments |
| | | function rcmail_create_compose_tempdir() |
| | | { |
| | | global $CONFIG; |
| | | |
| | | if ($_SESSION['compose']['temp_dir']) |
| | | return $_SESSION['compose']['temp_dir']; |
| | | |
| | | if (!empty($CONFIG['temp_dir'])) |
| | | $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '').$_SESSION['compose']['id']; |
| | | |
| | | // create temp-dir for uploaded attachments |
| | | if (!empty($CONFIG['temp_dir']) && is_writeable($CONFIG['temp_dir'])) |
| | | { |
| | | mkdir($temp_dir); |
| | | $_SESSION['compose']['temp_dir'] = $temp_dir; |
| | | } |
| | | |
| | | return $_SESSION['compose']['temp_dir']; |
| | | } |
| | | |
| | | |
| | | // clear message composing settings |
| | | function rcmail_compose_cleanup() |
| | | { |
| | | if (!isset($_SESSION['compose'])) |
| | | return; |
| | | |
| | | |
| | | // remove attachment files from temp dir |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | foreach ($_SESSION['compose']['attachments'] as $attachment) |
| | | @unlink($attachment['path']); |
| | | |
| | | // kill temp dir |
| | | if ($_SESSION['compose']['temp_dir']) |
| | | @rmdir($_SESSION['compose']['temp_dir']); |
| | | |
| | | unset($_SESSION['compose']); |
| | | } |