Page MenuHomePhorge

No OneTemporary

Size
16 KB
Referenced Files
None
Subscribers
None
diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc
index d97b9c413..d0808d080 100644
--- a/program/steps/mail/attachments.inc
+++ b/program/steps/mail/attachments.inc
@@ -1,152 +1,152 @@
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/mail/attachments.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Upload, remove, display attachments in compose form |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
- $Id: compose.inc 2081 2008-11-23 12:38:44Z thomasb $
+ $Id$
*/
if (!$_SESSION['compose']) {
die("Invalid session var!");
}
// remove an attachment
if ($RCMAIL->action=='remove-attachment')
{
$id = 'undefined';
if (preg_match('/^rcmfile(\w+)$/', $_POST['_file'], $regs))
$id = $regs[1];
if ($attachment = $_SESSION['compose']['attachments'][$id])
$attachment = $RCMAIL->plugins->exec_hook('remove_attachment', $attachment);
if ($attachment['status']) {
if (is_array($_SESSION['compose']['attachments'][$id])) {
unset($_SESSION['compose']['attachments'][$id]);
$OUTPUT->command('remove_from_attachment_list', "rcmfile$id");
}
}
$OUTPUT->send();
exit;
}
if ($RCMAIL->action=='display-attachment')
{
$id = 'undefined';
if (preg_match('/^rcmfile(\w+)$/', $_GET['_file'], $regs))
$id = $regs[1];
if ($attachment = $_SESSION['compose']['attachments'][$id])
$attachment = $RCMAIL->plugins->exec_hook('display_attachment', $attachment);
if ($attachment['status']) {
$size = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']);
header('Content-Type: ' . $attachment['mimetype']);
header('Content-Length: ' . $size);
if ($attachment['data'])
echo $attachment['data'];
else if ($attachment['path'])
readfile($attachment['path']);
}
exit;
}
// attachment upload action
if (!is_array($_SESSION['compose']['attachments'])) {
$_SESSION['compose']['attachments'] = array();
}
// clear all stored output properties (like scripts and env vars)
$OUTPUT->reset();
$uploadid = get_input_value('_uploadid', RCUBE_INPUT_GET);
if (is_array($_FILES['_attachments']['tmp_name'])) {
foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) {
$attachment = array(
'path' => $filepath,
'name' => $_FILES['_attachments']['name'][$i],
'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i])
);
$attachment = $RCMAIL->plugins->exec_hook('upload_attachment', $attachment);
if ($attachment['status'] && !$attachment['abort']) {
$id = $attachment['id'];
// store new attachment in session
unset($attachment['status'], $attachment['abort']);
$_SESSION['compose']['attachments'][$id] = $attachment;
if (($icon = $_SESSION['compose']['deleteicon']) && is_file($icon)) {
$button = html::img(array(
'src' => $icon,
'alt' => rcube_label('delete')
));
}
else {
$button = Q(rcube_label('delete'));
}
$content = html::a(array(
'href' => "#delete",
'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id),
'title' => rcube_label('delete'),
), $button);
$content .= Q($attachment['name']);
$OUTPUT->command('add2attachment_list', "rcmfile$id", array(
'html' => $content,
'name' => $attachment['name'],
'mimetype' => $attachment['mimetype'],
'complete' => true), $uploadid);
}
else { // upload failed
$err = $_FILES['_attachments']['error'][$i];
if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
$msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))));
}
else if ($attachment['error']) {
$msg = $attachment['error'];
}
else {
$msg = rcube_label('fileuploaderror');
}
$OUTPUT->command('display_message', $msg, 'error');
$OUTPUT->command('remove_from_attachment_list', $uploadid);
}
}
}
else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// if filesize exceeds post_max_size then $_FILES array is empty,
// show filesizeerror instead of fileuploaderror
if ($maxsize = ini_get('post_max_size'))
$msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes($maxsize)))));
else
$msg = rcube_label('fileuploaderror');
$OUTPUT->command('display_message', $msg, 'error');
$OUTPUT->command('remove_from_attachment_list', $uploadid);
}
// send html page with JS calls as response
$OUTPUT->command('auto_save_start', false);
$OUTPUT->send('iframe');
?>
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 4b8427358..753304018 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -1,83 +1,83 @@
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/mail/check_recent.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Check for recent messages, in all mailboxes |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
- $Id: check_recent.inc 233 2006-06-26 17:31:20Z richs $
+ $Id$
*/
$a_mailboxes = $IMAP->list_mailboxes();
$check_all = (bool)$RCMAIL->config->get('check_all_folders');
foreach ($a_mailboxes as $mbox_name) {
if ($mbox_name == $IMAP->get_mailbox_name()) {
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) {
// refresh saved search set
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && isset($_SESSION['search'][$search_request])) {
$_SESSION['search'][$search_request] = $IMAP->refresh_search();
$all_count = $IMAP->messagecount();
} else {
$all_count = $IMAP->messagecount(NULL, 'ALL', TRUE);
}
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
$_SESSION['unseen_count'][$mbox_name] = $unread_count;
$OUTPUT->set_env('messagecount', $all_count);
$OUTPUT->set_env('pagesize', $IMAP->page_size);
$OUTPUT->set_env('pagecount', ceil($all_count/$IMAP->page_size));
$OUTPUT->command('set_unread_count', $mbox_name, $unread_count, ($mbox_name == 'INBOX'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($all_count));
if (rcmail::get_instance()->config->get('focus_on_new_message',true))
$OUTPUT->command('new_message_focus');
if (!empty($_GET['_quota']))
$OUTPUT->command('set_quota', rcmail_quota_content());
// trigger plugin hook
$RCMAIL->plugins->exec_hook('new_messages', array('mailbox' => $mbox_name, 'count' => $unread_count));
// "No-list" mode, don't get messages
if (empty($_GET['_list']))
continue;
// use SEARCH/SORT to find recent messages
$search_str = 'RECENT';
if ($search_request)
$search_str .= ' '.$IMAP->search_string;
$result = $IMAP->search($mbox_name, $search_str, NULL, 'date');
if ($result) {
// get the headers
$result_h = $IMAP->list_headers($mbox_name, 1, 'date', 'DESC');
// add to the list
rcmail_js_message_list($result_h, true, false);
}
}
else {
rcmail_send_unread_count($mbox_name, true);
}
}
else if ($check_all) {
rcmail_send_unread_count($mbox_name, true);
}
}
$OUTPUT->send();
?>
diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc
index 247827afc..946a688e9 100644
--- a/program/steps/mail/headers.inc
+++ b/program/steps/mail/headers.inc
@@ -1,47 +1,47 @@
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/mail/headers.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Fetch message headers in raw format for display |
| |
+-----------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-----------------------------------------------------------------------+
- $Id: mark.inc 1580 2008-06-30 09:36:18Z alec $
+ $Id$
*/
if ($uid = get_input_value('_uid', RCUBE_INPUT_POST))
{
$source = $IMAP->get_raw_headers($uid);
if ($source)
{
$source = htmlspecialchars(trim($source));
$source = preg_replace(
array(
'/\n[\t\s]+/',
'/^([a-z0-9_:-]+)/im',
'/\r?\n/'
),
array(
"\n&nbsp;&nbsp;&nbsp;&nbsp;",
'<font class="bold">\1</font>',
'<br />'
), $source);
$OUTPUT->command('set_headers', $source);
$OUTPUT->send();
}
}
exit;
?>
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 9f054f938..6a1c8c471 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -1,132 +1,134 @@
<?php
/*
+-----------------------------------------------------------------------+
| steps/mail/search.inc |
| |
| Search functions for rc webmail |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
| Author: Benjamin Smith <defitro@gmail.com> |
| Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
+ $Id$
+
*/
$REMOTE_REQUEST = TRUE;
// reset list_page and old search results
$IMAP->set_page(1);
$IMAP->set_search_set(NULL);
$_SESSION['page'] = 1;
// using encodeURI with javascript "should" give us
// a correctly encoded query string
$imap_charset = RCMAIL_CHARSET;
// get search string
$str = get_input_value('_q', RCUBE_INPUT_GET);
$filter = get_input_value('_filter', RCUBE_INPUT_GET);
$mbox = get_input_value('_mbox', RCUBE_INPUT_GET);
$headers = get_input_value('_headers', RCUBE_INPUT_GET);
$search_request = md5($mbox.$filter.$str);
// add list filter string
$search_str = $filter && $filter != 'ALL' ? $filter : '';
$_SESSION['search_filter'] = $filter;
// Check the search string for type of search
if (preg_match("/^from:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['from'] = "HEADER FROM";
}
else if (preg_match("/^to:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['to'] = "HEADER TO";
}
else if (preg_match("/^cc:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['cc'] = "HEADER CC";
}
else if (preg_match("/^bcc:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['bcc'] = "HEADER BCC";
}
else if (preg_match("/^subject:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['subject'] = "HEADER SUBJECT";
}
else if (preg_match("/^body:.*/i", $str))
{
list(,$srch) = explode(":", $str);
$subject['text'] = "TEXT";
}
else if(trim($str))
{
if ($headers) {
$headers = explode(',', $headers);
foreach($headers as $header)
switch ($header) {
case 'text': $subject['text'] = 'TEXT'; break;
default: $subject[$header] = 'HEADER '.$header;
}
} else {
// search in subject by default
$subject['subject'] = 'HEADER SUBJECT';
}
}
$search = $srch ? trim($srch) : trim($str);
if ($subject) {
$search_str .= str_repeat(' OR', count($subject)-1);
foreach ($subject as $sub)
$search_str .= sprintf(" %s {%d}\r\n%s", $sub, strlen($search), $search);
$_SESSION['search_mods'] = $subject;
}
$search_str = trim($search_str);
// execute IMAP search
if ($search_str)
$result = $IMAP->search($mbox, $search_str, $imap_charset, $_SESSION['sort_col']);
// Get the headers
$result_h = $IMAP->list_headers($mbox, 1, $_SESSION['sort_col'], $_SESSION['sort_order']);
$count = $IMAP->messagecount();
// save search results in session
if (!is_array($_SESSION['search']))
$_SESSION['search'] = array();
if ($search_str) {
$_SESSION['search'][$search_request] = $IMAP->get_search_set();
$_SESSION['last_text_search'] = $str;
}
// Make sure we got the headers
if (!empty($result_h))
{
rcmail_js_message_list($result_h);
if ($search_str)
$OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count));
}
else
{
$OUTPUT->show_message('searchnomatch', 'notice');
}
// update message count display
$OUTPUT->set_env('search_request', $search_str ? $search_request : -1);
$OUTPUT->set_env('messagecount', $count);
$OUTPUT->set_env('pagecount', ceil($count/$IMAP->page_size));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1));
$OUTPUT->send();
?>
diff --git a/program/steps/mail/sendmdn.inc b/program/steps/mail/sendmdn.inc
index f1fb79296..ba6d37f0c 100644
--- a/program/steps/mail/sendmdn.inc
+++ b/program/steps/mail/sendmdn.inc
@@ -1,44 +1,44 @@
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/mail/sendmdn.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2008-2009, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Send a message disposition notification for a specific mail |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
- $Id: sendmail.inc 930 2007-11-25 17:34:19Z thomasb $
+ $Id$
*/
// only process ajax requests
if (!$OUTPUT->ajax_call)
return;
if (!empty($_POST['_uid'])) {
$sent = rcmail_send_mdn(get_input_value('_uid', RCUBE_INPUT_POST), $smtp_error);
}
// show either confirm or error message
if ($sent) {
$OUTPUT->set_env('mdn_request', false);
$OUTPUT->show_message('receiptsent', 'confirmation');
}
else if ($smtp_error) {
$OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']);
}
else {
$OUTPUT->show_message('errorsendingreceipt', 'error');
}
$OUTPUT->send();
?>
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Mon, Sep 7, 6:07 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1357609
Default Alt Text
(16 KB)

Event Timeline