From: antipode Date: Wed, 26 Dec 2001 21:35:11 +0000 (+0000) Subject: Partial code cleanup. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=78a35fcdb727a20613987e852f5121eeab9ab041 Partial code cleanup. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1967 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/compose.php b/src/compose.php index ab57e266..72d1d209 100644 --- a/src/compose.php +++ b/src/compose.php @@ -85,7 +85,8 @@ function newMail () { mime_fetch_body($imapConnection, $id, 1), $message->header->encoding); } - } else { + } + else { $body = ''; } @@ -105,12 +106,13 @@ function newMail () { if ($reply_id) { if (ereg('^[ >]+', $body_ary[$i])) { $body_ary[$i] = '>' . $body_ary[$i]; - } else { + } + else { $body_ary[$i] = '> ' . $body_ary[$i]; } } if (!$draft_id) { - sqWordWrap($body_ary[$i], $editor_size - 1); + sqWordWrap($body_ary[$i], $editor_size - 1); } $body .= $body_ary[$i] . "\n"; unset($body_ary[$i]); @@ -119,25 +121,27 @@ function newMail () { $bodyTop = '-------- ' . _("Original Message") . " --------\n" . _("Subject") . ': ' . $orig_header->subject . "\n" . _("From") . ': ' . $orig_header->from . "\n" . - _("Date") . ': ' . getLongDateString( $orig_header->date ). "\n" . + _("Date") . ': ' . + getLongDateString( $orig_header->date ). "\n" . _("To") . ': ' . $orig_header->to[0] . "\n"; - if (count($orig_header->to) > 1) { - for ($x=1; $x < count($orig_header->to); $x++) { - $bodyTop .= ' ' . $orig_header->to[$x] . "\n"; - } - } - $bodyTop .= "\n"; - $body = $bodyTop . $body; - } else if ($reply_id) { - $orig_from = decodeHeader($orig_header->from); - $body = getReplyCitation($orig_from) . $body; - } + if (count($orig_header->to) > 1) { + for ($x=1; $x < count($orig_header->to); $x++) { + $bodyTop .= ' ' . $orig_header->to[$x] . "\n"; + } + } + $bodyTop .= "\n"; + $body = $bodyTop . $body; + } + elseif ($reply_id) { + $orig_from = decodeHeader($orig_header->from); + $body = getReplyCitation($orig_from) . $body; + } - return; + return; } if (!$send_to) { - $send_to = sqimap_find_email($send_to); + $send_to = sqimap_find_email($send_to); } /* This formats a CC string if they hit "reply all" */ @@ -176,9 +180,10 @@ function getAttachments($message) { $ent_num, $forward_id, $draft_id, $username; if (isset($draft_id)) { - $id = $draft_id; - } else { - $id = $forward_id; + $id = $draft_id; + } + else { + $id = $forward_id; } if (!$message) { @@ -206,7 +211,7 @@ function getAttachments($message) { $newAttachment['localfilename'] = $localfilename; $newAttachment['remotefilename'] = $filename; $newAttachment['type'] = strtolower($message->header->type0 . - '/' . $message->header->type1); + '/' . $message->header->type1); /* Write Attachment to file */ $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w'); @@ -217,7 +222,8 @@ function getAttachments($message) { $attachments[] = $newAttachment; } - } else { + } + else { for ($i = 0; $i < count($message->entities); $i++) { getAttachments($message->entities[$i]); } @@ -232,7 +238,7 @@ function showInputForm () { $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox, $from_htmladdr_search, $location_of_buttons, $attachment_dir, $username, $data_dir, $identity, $draft_id, $delete_draft, - $mailprio; + $mailprio; $subject = decodeHeader($subject); $reply_subj = decodeHeader($reply_subj); @@ -263,7 +269,9 @@ function showInputForm () { echo '' . "\n"; - if ($location_of_buttons == 'top') { showComposeButtonRow(); } + if ($location_of_buttons == 'top') { + showComposeButtonRow(); + } $idents = getPref($data_dir, $username, 'identities'); if ($idents != '' && $idents > 1) { @@ -282,13 +290,13 @@ function showInputForm () { for ($i = 1; $i < $idents; $i ++) { echo '' . "\n" . ' ' . "\n"; } - + /* This code is for attachments */ echo ' ' . "\n" . ' \n"; - echo " \n\n"; - } + do_hook('compose_button_row'); - function checkInput ($show) { - /** I implemented the $show variable because the error messages - were getting sent before the page header. So, I check once - using $show=false, and then when i'm ready to display the - error message, show=true **/ - global $body, $send_to, $subject, $color; + echo " \n"; + echo " \n\n"; +} - if ($send_to == "") { - if ($show) +function checkInput ($show) +{ + /* + * I implemented the $show variable because the error messages + * were getting sent before the page header. So, I check once + * using $show=false, and then when i'm ready to display the error + * message, show=true + */ + global $body, $send_to, $subject, $color; + + if ($send_to == "") { + if ($show) { plain_error_message(_("You have not filled in the \"To:\" field."), $color); - return false; - } - return true; - } // function checkInput() + } + return false; + } + return true; +} /* function checkInput() */ // True if FAILURE
' . "\n" . @@ -367,7 +380,7 @@ function showInputForm () { echo '
 
' . "\n" . @@ -409,61 +422,65 @@ function showInputForm () { } +function showComposeButtonRow() +{ + global $use_javascript_addr_book, $save_as_draft, + $default_use_priority, $mailprio; + echo "
\n \n"; + if ($use_javascript_addr_book) { + echo " \n"; + } + else { + echo " "; + } + echo "\n \n"; - - - - function showComposeButtonRow() { - global $use_javascript_addr_book, $save_as_draft, - $default_use_priority, $mailprio; - - echo "
\n \n"; - if ($use_javascript_addr_book) { - echo " \n"; - } else { - echo " "; - } - echo "\n \n"; - - if ($save_as_draft) { - echo '\n"; - } - if ($default_use_priority) { + if ($save_as_draft) { + echo '\n"; + } + if ($default_use_priority) { if(!isset($mailprio)) { - $mailprio = "3"; + $mailprio = "3"; + } + echo "\n\t". _("Priority") .':"; } - echo "\n\t". _("Priority") .":"; - } - - do_hook("compose_button_row"); - echo "