From 10a699759d4f106f29c077a6d65d3b8d212825e5 Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 6 Nov 2005 19:26:45 +0000 Subject: Added localized messages to client and check form input --- program/steps/mail/compose.inc | 4 ++++ program/steps/mail/sendmail.inc | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 0dc450205..d01e399e6 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -32,6 +32,10 @@ if (!is_array($_SESSION['compose'])) $_SESSION['compose'] = array('id' => uniqid(rand())); +// add some labels to client +rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'sendingmessage'); + + if ($_GET['_reply_uid'] || $_GET['_forward_uid']) { $msg_uid = $_GET['_reply_uid'] ? $_GET['_reply_uid'] : $_GET['_forward_uid']; diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 48a5ccc6f..2bafaebc1 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -28,7 +28,7 @@ require_once('Mail/mime.php'); if (!isset($_SESSION['compose']['id'])) { - $_action = 'list'; + rcmail_overwrite_action('list'); return; } @@ -65,6 +65,14 @@ function rcmail_get_identity($id) /****** check submission and compose message ********/ +if (empty($_POST['_to']) && empty($_POST['_subject']) && $_POST['_message']) + { + show_message("sendingfailed", 'error'); + rcmail_overwrite_action('compose'); + return; + } + + $mailto_regexp = array('/,\s*[\r\n]+/', '/[\r\n]+/', '/,\s*$/m'); $mailto_replace = array(' ', ', ', ''); @@ -206,9 +214,8 @@ else // return to compose page if sending failed if (!$sent) { - $_action = 'compose'; - $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); show_message("sendingfailed", 'error'); + rcmail_overwrite_action('compose'); return; } -- cgit v1.2.3