summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-04-30 08:21:42 +0000
committerthomascube <thomas@roundcube.net>2008-04-30 08:21:42 +0000
commit197601ef5fa2e6aaabfb6e0baaf56179f7cc1ee3 (patch)
tree464b77acd299fa37a753e384b5bc14bda0cd16fa /program/steps/mail
parent0dfae004d84f428f1af1884282d24c32d6fc3173 (diff)
Next step: introduce the application class 'rcmail' and get rid of some global vars
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/compose.inc50
-rw-r--r--program/steps/mail/folders.inc6
-rw-r--r--program/steps/mail/func.inc2
-rw-r--r--program/steps/mail/move_del.inc6
-rw-r--r--program/steps/mail/sendmail.inc2
-rw-r--r--program/steps/mail/show.inc12
6 files changed, 34 insertions, 44 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 1189c991e..d8ade67ad 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -26,7 +26,7 @@ define('RCUBE_COMPOSE_DRAFT', 0x0108);
// remove an attachment
-if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs))
+if ($RCMAIL->action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs))
{
$id = $regs[1];
if (is_array($_SESSION['compose']['attachments'][$id]))
@@ -39,7 +39,7 @@ if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_
}
}
-if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs))
+if ($RCMAIL->action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs))
{
$id = $regs[1];
if (is_array($_SESSION['compose']['attachments'][$id]))
@@ -337,7 +337,7 @@ function rcmail_compose_header_from($attrib)
function rcmail_compose_body($attrib)
{
- global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode;
+ global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode;
list($form_start, $form_end) = get_form_tags($attrib);
unset($attrib['form']);
@@ -410,7 +410,7 @@ function rcmail_compose_body($attrib)
$body = rcmail_create_draft_body($body, $isHtml);
}
- $tinylang = substr($_SESSION['user_lang'], 0, 2);
+ $tinylang = substr($_SESSION['language'], 0, 2);
if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js'))
{
$tinylang = 'en';
@@ -455,14 +455,14 @@ function rcmail_compose_body($attrib)
"googie.setCurrentLanguage('%s');\n".
"googie.decorateTextarea('%s');\n".
"%s.set_env('spellcheck', googie);",
- $GLOBALS['COMM_PATH'],
+ $RCMAIL->comm_path,
JQ(Q(rcube_label('checkspelling'))),
JQ(Q(rcube_label('resumeediting'))),
JQ(Q(rcube_label('close'))),
JQ(Q(rcube_label('revertto'))),
JQ(Q(rcube_label('nospellerrors'))),
$lang_set,
- substr($_SESSION['user_lang'], 0, 2),
+ substr($_SESSION['language'], 0, 2),
$attrib['id'],
JS_OBJECT_NAME), 'foot');
@@ -704,30 +704,21 @@ function rcmail_compose_attachment_list($attrib)
function rcmail_compose_attachment_form($attrib)
{
- global $OUTPUT, $SESS_HIDDEN_FIELD;
+ global $OUTPUT;
// add ID if not given
if (!$attrib['id'])
$attrib['id'] = 'rcmUploadbox';
- // allow the following attributes to be added to the <div> tag
- $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style'));
- $input_field = rcmail_compose_attachment_field(array());
- $label_send = rcube_label('upload');
- $label_close = rcube_label('close');
- $js_instance = JS_OBJECT_NAME;
-
- $out = <<<EOF
-<div$attrib_str>
-<form action="./" method="post" enctype="multipart/form-data">
-$SESS_HIDDEN_FIELD
-$input_field<br />
-<input type="button" value="$label_close" class="button" onclick="document.getElementById('$attrib[id]').style.visibility='hidden'" />
-<input type="button" value="$label_send" class="button" onclick="$js_instance.command('send-attachment', this.form)" />
-</form>
-</div>
-EOF;
-
+ $button = new html_inputfield(array('type' => "button", 'class' => "button"));
+
+ $out = html::div($attrib,
+ $OUTPUT->form_tag(array('name' => "form", 'method' => "post")) .
+ rcmail_compose_attachment_field(array()) . html::br() .
+ $button->show(rcube_label('close'), array('onclick' => "document.getElementById('$attrib[id]').style.visibility='hidden'")) .
+ $button->show(rcube_label('upload'), array('onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)"))
+ );
+
$OUTPUT->add_gui_object('uploadbox', $attrib['id']);
return $out;
@@ -843,16 +834,15 @@ function rcmail_editor_selector($attrib)
function get_form_tags($attrib)
{
- global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD;
+ global $RCMAIL, $MESSAGE_FORM;
$form_start = '';
if (!strlen($MESSAGE_FORM))
{
- $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
+ $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task));
$hiddenfields->add(array('name' => '_action', 'value' => 'send'));
- $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : '';
- $form_start .= "\n$SESS_HIDDEN_FIELD\n";
+ $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : '';
$form_start .= $hiddenfields->show();
}
@@ -860,7 +850,7 @@ function get_form_tags($attrib)
$form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
if (!strlen($MESSAGE_FORM))
- $OUTPUT->add_gui_object('messageform', $form_name);
+ $RCMAIL->output->add_gui_object('messageform', $form_name);
$MESSAGE_FORM = $form_name;
diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index b84398f26..69f3c0e4c 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -21,7 +21,7 @@
$mbox_name = $IMAP->get_mailbox_name();
// send EXPUNGE command
-if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
+if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
{
$success = $IMAP->expunge($mbox);
@@ -29,7 +29,7 @@ if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
if ($success && !empty($_REQUEST['_reload']))
{
$OUTPUT->command('message_list.clear');
- $_action = 'list';
+ $RCMAIL->action = 'list';
return;
}
else
@@ -37,7 +37,7 @@ if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
}
// clear mailbox
-else if ($_action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
+else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
{
// we should only be purging trash and junk
if($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox'])
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 8abda6c74..9a81a00ec 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -74,7 +74,7 @@ if (!$OUTPUT->ajax_call)
rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage');
// set page title
-if (empty($_action) || $_action == 'list')
+if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
$OUTPUT->set_pagetitle(rcmail_localize_foldername($IMAP->get_mailbox_name()));
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 131ad2e4f..dad3ce7ef 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -24,7 +24,7 @@ $old_count = $IMAP->messagecount();
$old_pages = ceil($old_count / $IMAP->page_size);
// move messages
-if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox']))
+if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox']))
{
$count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
$target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
@@ -41,7 +41,7 @@ if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'
}
// delete messages
-else if ($_action=='delete' && !empty($_POST['_uid']))
+else if ($RCMAIL->action=='delete' && !empty($_POST['_uid']))
{
$count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
$del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST));
@@ -89,7 +89,7 @@ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
$mbox = $IMAP->get_mailbox_name();
$OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX'));
-if ($_action=='moveto' && $target)
+if ($RCMAIL->action=='moveto' && $target)
$OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));
$OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota()));
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 2281a9773..72ef9f4d6 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -313,7 +313,7 @@ $MAIL_MIME->setParam(array(
));
// encoding subject header with mb_encode provides better results with asian characters
-if ($MBSTRING && function_exists("mb_encode_mimeheader"))
+if (function_exists("mb_encode_mimeheader"))
{
mb_internal_encoding($message_charset);
$headers['Subject'] = mb_encode_mimeheader($headers['Subject'], $message_charset, 'Q');
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index a530184d8..8062f4598 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -19,7 +19,7 @@
*/
-$PRINT_MODE = $_action=='print' ? TRUE : FALSE;
+$PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE;
// similar code as in program/steps/mail/get.inc
if ($_GET['_uid'])
@@ -35,11 +35,11 @@ if ($_GET['_uid'])
if (!$MESSAGE['headers'])
{
$OUTPUT->show_message('messageopenerror', 'error');
- if ($_action=='preview' && template_exists('messagepreview'))
+ if ($RCMAIL->action=='preview' && template_exists('messagepreview'))
$OUTPUT->send('messagepreview');
else
{
- $_action = 'list';
+ $RCMAIL->action = 'list';
return;
}
}
@@ -78,7 +78,7 @@ if ($_GET['_uid'])
if (!$MESSAGE['headers']->seen)
{
$marked = $IMAP->set_flag($MESSAGE['UID'], 'SEEN');
- if($_action == 'preview' && $marked != -1)
+ if($RCMAIL->action == 'preview' && $marked != -1)
{
$OUTPUT->command('set_unread_count_from_preview', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX'));
$OUTPUT->command('mark_as_read_from_preview', $MESSAGE['UID']);
@@ -203,9 +203,9 @@ $OUTPUT->add_handlers(array(
'blockedobjects' => 'rcmail_remote_objects_msg'));
-if ($_action=='print' && template_exists('printmessage'))
+if ($RCMAIL->action=='print' && template_exists('printmessage'))
$OUTPUT->send('printmessage');
-else if ($_action=='preview' && template_exists('messagepreview'))
+else if ($RCMAIL->action=='preview' && template_exists('messagepreview'))
$OUTPUT->send('messagepreview');
else
$OUTPUT->send('message');