/**
* compose.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This code sends a mail.
require_once(SM_PATH . 'functions/display_messages.php');
require_once(SM_PATH . 'class/deliver/Deliver.class.php');
require_once(SM_PATH . 'functions/addressbook.php');
+require_once(SM_PATH . 'functions/set_language_align.php');
/* --------------------- Get globals ------------------------------------- */
$username = $_SESSION['username'];
$base_uri = $_SESSION['base_uri'];
$delimiter = $_SESSION['delimiter'];
+$language_align = set_language_align();
+
if (isset($_POST['return'])) {
$html_addr_search_done = 'Use Addresses';
}
if (!isset($mailbox)) {
$mailbox = '';
}
-
if ($compose_new_win == '1') {
compose_Header($color, $mailbox);
} else {
$AttachFailure = saveAttachedFiles($session);
}
if (checkInput(false) && !isset($AttachFailure)) {
+ if ($mailbox == "All Folders") {
+ /* We entered compose via the search results page */
+ $mailbox="INBOX"; /* Send 'em to INBOX, that's safe enough */
+ }
$urlMailbox = urlencode (trim($mailbox));
if (! isset($passed_id)) {
$passed_id = 0;
}
function showInputForm ($session, $values=false) {
- global $send_to, $send_to_cc, $body,
+ global $send_to, $send_to_cc, $body, $language_align,
$passed_body, $color, $use_signature, $signature, $prefix_sig,
$editor_size, $attachments, $subject, $newmail,
$use_javascript_addr_book, $send_to_bcc, $passed_id, $mailbox,
$subject = $values['subject'];
$mailprio = $values['mailprio'];
$body = $values['body'];
- $identity = $values['identity'];
+ $identity = (int) $values['identity'];
}
if ($use_javascript_addr_book) {
'// --></SCRIPT>' . "\n\n";
}
+
echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
'ENCTYPE="multipart/form-data"';
do_hook("compose_form");
if ($mail_sent == 'yes') {
echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
}
- echo '<TABLE ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
+ echo '<TABLE dir="' . $language_align['dir'] . '" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
if ($compose_new_win == '1') {
- echo '<TABLE ALIGN=CENTER BGCOLOR="'.$color[0].'" WIDTH="100%" BORDER=0>'."\n" .
- ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
+ echo '<TABLE dir="' . $language_align['dir'] . '" ALIGN=CENTER BGCOLOR="'.$color[0].'" WIDTH="100%" BORDER=0>'."\n" .
+ ' <TR dir="' . $language_align['dir'] . '"><TD dir="' . $language_align['dir'] . '"></TD><TD dir="' . $language_align['dir'] . '" ALIGN="' . $language_align['right'] . '"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
}
if ($location_of_buttons == 'top') {
showComposeButtonRow();
$idents = getPref($data_dir, $username, 'identities', 0);
if ($idents > 1) {
- echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
+ echo ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN="' . $language_align['right'] . '">' .
_("From:") . '</TD>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="90%" ALIGN="' . $language_align['left'] . '">' . "\n" .
' <select name=identity>' . "\n" .
' <option value=default>' .
htmlspecialchars(getPref($data_dir, $username, 'full_name'));
' </TD>' . "\n" .
' </TR>' . "\n";
}
- echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
+ echo ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN="' . $language_align['right'] . '">' .
_("To:") . '</TD>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="90%" ALIGN="' . $language_align['left'] . '">' . "\n" .
' <INPUT TYPE=text NAME="send_to" VALUE="' .
htmlspecialchars($send_to) . '" SIZE=60><BR>' . "\n" .
' </TD>' . "\n" .
' </TR>' . "\n" .
- ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+ ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
_("CC:") . '</TD>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n" .
' <INPUT TYPE=text NAME="send_to_cc" SIZE=60 VALUE="' .
htmlspecialchars($send_to_cc) . '"><BR>' . "\n" .
' </TD>' . "\n" .
' </TR>' . "\n" .
- ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+ ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
_("BCC:") . '</TD>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n" .
' <INPUT TYPE=text NAME="send_to_bcc" VALUE="' .
htmlspecialchars($send_to_bcc) . '" SIZE=60><BR>' . "\n" .
' </TD>' . "\n" .
' </TR>' . "\n" .
- ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+ ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
_("Subject:") . '</TD>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n";
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n";
echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
htmlspecialchars($subject) . '">' . "\n" .
' </TD>' . "\n" .
}
if ($compose_new_win == '1') {
- echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[0] . '" COLSPAN=2 ALIGN=CENTER>' . "\n" .
+ echo ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[0] . '" COLSPAN=2 ALIGN=CENTER>' . "\n" .
' <TEXTAREA NAME=body ROWS=20 COLS="' .
$editor_size . '" WRAP="VIRTUAL">';
}
else {
- echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
+ echo ' <TR dir="' . $language_align['dir'] . '">' . "\n" .
+ ' <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
' <TEXTAREA NAME=body ROWS=20 COLS="' .
$editor_size . '" WRAP="VIRTUAL">';
}
if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
+ if ($idents > 1) {
+ if ($identity == 'default') {
+ $no = 'g';
+ } else {
+ $no = $identity;
+ }
+ $signature = getSig($data_dir, $username, $no);
+ }
+
if ($sig_first == '1') {
if ($default_charset == 'iso-2022-jp') {
echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
if ((bool) ini_get('file_uploads')) {
echo ' <TR>' . "\n" .
' <TD COLSPAN=2>' . "\n" .
- ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.
+ ' <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="1" cellspacing="0" align="center"'.
' border="0" bgcolor="'.$color[9].'">' . "\n" .
' <TR>' . "\n" .
' <TD>' . "\n" .
- ' <table width="100%" cellpadding="3" cellspacing="0" align="center"'.
+ ' <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="3" cellspacing="0" align="center"'.
' border="0">' . "\n" .
' <TR>' . "\n" .
' <TD VALIGN=MIDDLE ALIGN=RIGHT>' .
$attached_filename = decodeHeader($attachment->mime_header->getParameter('name'));
$type = $attachment->mime_header->type0.'/'.
$attachment->mime_header->type1;
- $s_a[] = '<input type="checkbox" name="delete[]" value="' .
- $key . "\">\n" . $attached_filename . ' - ' . $type .
- ' ('.show_readable_size( filesize( $attached_file ) )
- . ')<br>'."\n";
+ $s_a[] = '<table><tr><td><input type="checkbox" name="delete[]" value="' .
+ $key . "\"></td><td>\n" . $attached_filename . '</td><td>-</td><td> ' . $type . '</td><td>('.show_readable_size( filesize( $attached_file ) ) . ')</td></tr></table>'."\n";
}
}
}
if (count($s_a)) {
- foreach ($s_a as $s) {
- echo '<tr><td align=left colspan="2" bgcolor="' . $color[0] . '">'.$s.'</td></tr>';
+ foreach ($s_a as $s) {
+ echo '<tr><td align="' . $language_align['left'] . '" colspan="2" bgcolor="' . $color[0] . '">'.$s.'</td></tr>';
}
echo '<tr><td colspan="2"><input type="submit" name="do_delete" value="' .
_("Delete selected attachments") . "\">\n" .
$full_localfilename = "$hashed_attachment_dir/$localfilename";
}
+ // FIXME: we SHOULD prefer move_uploaded_file over rename because
+ // m_u_f works better with restricted PHP installes (safe_mode, open_basedir)
if (!@rename($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
- if (function_exists("move_uploaded_file")) {
if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
return true;
}
- } else {
- if (!@copy($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
- return true;
- }
- }
}
$message = $compose_messages[$session];
$type = strtolower($_FILES['attachfile']['type']);
$succes = $deliver->finalizeStream($stream);
}
if (!$succes) {
- $msg = $deliver->dlv_msg . '<br>Server replied: '.$deliver->dlv_ret_nr;
+ $msg = $deliver->dlv_msg . '<br>' .
+ _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+ $deliver->dlv_server_msg;
plain_error_message($msg, $color);
} else {
unset ($deliver);