From 32f4e3189ac2f04956d07af63d9cea44c3393fc5 Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 28 Jan 2002 18:33:33 +0000 Subject: [PATCH] Fixed formatting on these files. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2264 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/folders_subscribe.php | 92 ++++++-------- src/options_identities.php | 129 +++++++++---------- src/options_order.php | 219 +++++++++++++++----------------- src/printer_friendly_bottom.php | 180 ++++++++++++-------------- src/retrievalerror.php | 204 +++++++++++++---------------- src/signout.php | 80 +++++------- 6 files changed, 397 insertions(+), 507 deletions(-) diff --git a/src/folders_subscribe.php b/src/folders_subscribe.php index af5e2737..a887fde6 100644 --- a/src/folders_subscribe.php +++ b/src/folders_subscribe.php @@ -12,64 +12,48 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/imap.php'); require_once('../functions/display_messages.php'); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - $location = get_location(); - if ($method == 'sub') { - for ($i=0; $i < count($mailbox); $i++) { - $mailbox[$i] = trim($mailbox[$i]); - sqimap_subscribe ($imapConnection, $mailbox[$i]); - header("Location: $location/folders.php?success=subscribe"); - } - } else { - for ($i=0; $i < count($mailbox); $i++) { - $mailbox[$i] = trim($mailbox[$i]); - sqimap_unsubscribe ($imapConnection, $mailbox[$i]); - header("Location: $location/folders.php?success=unsubscribe"); - } - } - if (!isset($mailbox)) { - header("Location: $location/folders.php"); - } - sqimap_logout($imapConnection); +$location = get_location(); +if ($method == 'sub') { + for ($i=0; $i < count($mailbox); $i++) { + $mailbox[$i] = trim($mailbox[$i]); + sqimap_subscribe ($imapConnection, $mailbox[$i]); + header("Location: $location/folders.php?success=subscribe"); + } +} else { + for ($i=0; $i < count($mailbox); $i++) { + $mailbox[$i] = trim($mailbox[$i]); + sqimap_unsubscribe ($imapConnection, $mailbox[$i]); + header("Location: $location/folders.php?success=unsubscribe"); + } +} +if (!isset($mailbox)) { + header("Location: $location/folders.php"); +} +sqimap_logout($imapConnection); - /* - displayPageHeader($color, 'None'); - echo "


"; - if ($method == "sub") { - echo _("Subscribed Successfully!"); - echo "

"; - echo _("You have been successfully subscribed."); - } else { - echo _("Unsubscribed Successfully!"); - echo "

"; - echo _("You have been successfully unsubscribed."); - } - echo "
"; - echo _("Click here"); - echo " "; - echo _("to continue."); - echo "
"; - echo ""; - */ +/* +displayPageHeader($color, 'None'); +echo "


"; +if ($method == "sub") { + echo _("Subscribed Successfully!"); + echo "

"; + echo _("You have been successfully subscribed."); +} else { + echo _("Unsubscribed Successfully!"); + echo "

"; + echo _("You have been successfully unsubscribed."); +} +echo "
"; +echo _("Click here"); +echo " "; +echo _("to continue."); +echo "
"; +echo ""; +*/ ?> diff --git a/src/options_identities.php b/src/options_identities.php index 80913f45..53f3cc0b 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -11,44 +11,30 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/display_messages.php'); - if (isset($return)) { - SaveUpdateFunction(); - header('Location: options_personal.php'); - exit(); - } - - displayPageHeader($color, 'None'); - - $Info = do_hook('options_identities_process', 0); - if ($Info[1]) - SaveUpdateFunction(); - - if (CheckAndDoDefault() || CheckAndDoPromote()) { - SaveUpdateFunction(); - } - if (isset($update) || CheckForDelete()) - SaveUpdateFunction(); - - LoadInfo($full_name, $email_address, $reply_to, ''); + if (isset($return)) { + SaveUpdateFunction(); + header('Location: options_personal.php'); + exit(); + } + + displayPageHeader($color, 'None'); + + $Info = do_hook('options_identities_process', 0); + if ($Info[1]) { + SaveUpdateFunction(); + } + + if (CheckAndDoDefault() || CheckAndDoPromote()) { + SaveUpdateFunction(); + } + if (isset($update) || CheckForDelete()) + SaveUpdateFunction(); + } + + LoadInfo($full_name, $email_address, $reply_to, ''); ?>
@@ -60,38 +46,37 @@ require_once('../functions/display_messages.php'); '. ''; } -?> +?> \ No newline at end of file diff --git a/src/options_order.php b/src/options_order.php index f0de44f7..1d55b975 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -11,35 +11,18 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/display_messages.php'); require_once('../functions/imap.php'); require_once('../functions/array.php'); require_once('../functions/plugin.php'); - - if (! isset($action)) { $action = ''; } - if ($action == 'delete' && isset($theid)) { - removePref($data_dir, $username, "highlight$theid"); - } else if ($action == 'save') { - } - displayPageHeader($color, 'None'); +if (! isset($action)) { $action = ''; } +if ($action == 'delete' && isset($theid)) { + removePref($data_dir, $username, "highlight$theid"); +} elseif ($action == 'save') { +} +displayPageHeader($color, 'None'); ?>
-

+
- + - - + + - + -
@@ -240,28 +225,28 @@ require_once('../functions/display_messages.php'); if (isset($$name) && $i > 1) { do_hook('options_identities_renumber', $i, $i - 1); - $nameA = 'full_name' . $i; - $nameB = 'full_name' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; - - $nameA = 'email_address' . $i; - $nameB = 'email_address' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; - - $nameA = 'reply_to' . $i; - $nameB = 'reply_to' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; + $nameA = 'full_name' . $i; + $nameB = 'full_name' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; + + $nameA = 'email_address' . $i; + $nameB = 'email_address' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; + + $nameA = 'reply_to' . $i; + $nameB = 'reply_to' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; - return true; + return true; } $i ++; @@ -327,4 +312,4 @@ function ShowTableInfo($full_name, $email_address, $reply_to, $post) { echo '
 
@@ -50,101 +33,101 @@ require_once('../functions/plugin.php');
@@ -152,4 +135,4 @@ require_once('../functions/plugin.php');

1) { - $prev = $num-1; - $tmp = $index_order[$prev]; - $index_order[$prev] = $index_order[$num]; - $index_order[$num] = $tmp; - } else if ($method == 'down' && $num < count($index_order)) { - $next = $num++; - $tmp = $index_order[$next]; - $index_order[$next] = $index_order[$num]; - $index_order[$num] = $tmp; - } else if ($method == 'remove' && $num) { - for ($i=1; $i < 8; $i++) { - removePref($data_dir, $username, "order$i"); - } - for ($j=1,$i=1; $i <= count($index_order); $i++) { - if ($i != $num) { - $new_ary[$j] = $index_order[$i]; - $j++; - } - } - $index_order = array(); - $index_order = $new_ary; - if (count($index_order) < 1) { - include_once('../src/load_prefs.php'); - } - } else if ($method == 'add' && $add) { - // User should not be able to insert PHP-code here - $add = str_replace ('', '..', $add); - $add = str_replace ('<%', '..', $add); - $index_order[count($index_order)+1] = $add; - } - - if ($method) { - for ($i=1; $i <= count($index_order); $i++) { - setPref($data_dir, $username, "order$i", $index_order[$i]); - } - } - echo '
' . "\n"; - echo _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs."); - echo '

'; - - if (count($index_order)) - { - echo '' . "\n"; - for ($i=1; $i <= count($index_order); $i++) { - $tmp = $index_order[$i]; - echo ''; - echo "\n"; - echo '' . "\n"; - echo "\n"; - echo '' . "\n"; - echo '\n"; - echo '' . "\n"; - echo '\n"; - echo "\n"; - } - echo "
". _("up") ." | ". _("down") . " | '; - // Always show the subject - if ($tmp != 4) - echo "" . _("remove") . ''; - echo " - ' . $available[$tmp] . "
\n"; - } - - if (count($index_order) != count($available)) { - echo '
'; - echo '
' . "\n"; + echo _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs."); + echo '

'; + + if (count($index_order)) + { + echo '' . "\n"; + for ($i=1; $i <= count($index_order); $i++) { + $tmp = $index_order[$i]; + echo ''; + echo "\n"; + echo '' . "\n"; + echo "\n"; + echo '' . "\n"; + echo '\n"; + echo '' . "\n"; + echo '\n"; + echo "\n"; + } + echo "
". _("up") ." | ". _("down") . " | '; + /* Always show the subject */ + if ($tmp != 4) + echo "" . _("remove") . ''; + echo " - ' . $available[$tmp] . "
\n"; + } + + if (count($index_order) != count($available)) { + echo ''; + echo ''; - echo ''; - echo ''; - echo '
'; - } - - echo '

' . _("Return to options page") . '


'; + if (!$found) { + echo ""; + } + } + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '

' . _("Return to options page") . '


'; ?>
- + \ No newline at end of file diff --git a/src/printer_friendly_bottom.php b/src/printer_friendly_bottom.php index abc0cc52..b5b19310 100644 --- a/src/printer_friendly_bottom.php +++ b/src/printer_friendly_bottom.php @@ -14,22 +14,6 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/strings.php'); require_once('../config/config.php'); @@ -37,109 +21,102 @@ require_once('../src/load_prefs.php'); require_once('../functions/imap.php'); require_once('../functions/page_header.php'); - $pf_cleandisplay = getPref($data_dir, $username, 'pf_cleandisplay'); - - $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imap_stream, $mailbox); - $message = sqimap_get_message($imap_stream, $passed_id, $mailbox); - - -// --start display setup-- - - // From and Date are usually fine as they are... - $from = decodeHeader($message->header->from); - $date = getLongDateString($message->header->date); - - // we can clean these up if the list is too long... - $cc = decodeHeader(getLineOfAddrs($message->header->cc)); - $to = decodeHeader(getLineOfAddrs($message->header->to)); - - // and Body and Subject could easily stream off the page... - $id = $message->header->id; - $ent_num = findDisplayEntity ($message, 0); - $body_message = getEntity($message, $ent_num); - if (($body_message->header->type0 == 'text') || - ($body_message->header->type0 == 'rfc822')) { - $body = mime_fetch_body ($imap_stream, $id, $ent_num); - $body = decodeBody($body, $body_message->header->encoding); - $hookResults = do_hook("message_body", $body); - $body = $hookResults[1]; - if ($body_message->header->type1 == 'html') { - if( $show_html_default <> 1 ) { - $body = strip_tags( $body ); - translateText($body, $wrap_at, $body_message->header->charset); - } else { - $body = MagicHTML( $body, $id ); - } - } else { +$pf_cleandisplay = getPref($data_dir, $username, 'pf_cleandisplay'); + +$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +sqimap_mailbox_select($imap_stream, $mailbox); +$message = sqimap_get_message($imap_stream, $passed_id, $mailbox); + +/* --start display setup-- */ + +/* From and Date are usually fine as they are... */ +$from = decodeHeader($message->header->from); +$date = getLongDateString($message->header->date); + +/* we can clean these up if the list is too long... */ +$cc = decodeHeader(getLineOfAddrs($message->header->cc)); +$to = decodeHeader(getLineOfAddrs($message->header->to)); + +/* and Body and Subject could easily stream off the page... */ +$id = $message->header->id; +$ent_num = findDisplayEntity ($message, 0); +$body_message = getEntity($message, $ent_num); +if (($body_message->header->type0 == 'text') || + ($body_message->header->type0 == 'rfc822')) { + $body = mime_fetch_body ($imap_stream, $id, $ent_num); + $body = decodeBody($body, $body_message->header->encoding); + $hookResults = do_hook('message_body', $body); + $body = $hookResults[1]; + if ($body_message->header->type1 == 'html') { + if( $show_html_default <> 1 ) { + $body = strip_tags( $body ); translateText($body, $wrap_at, $body_message->header->charset); - } } else { - $body = _("Message not printable"); + $body = MagicHTML( $body, $id ); } + } else { + translateText($body, $wrap_at, $body_message->header->charset); + } +} else { + $body = _("Message not printable"); +} - $subject = trim(decodeHeader($message->header->subject)); - - // now, if they choose to, we clean up the display a bit... - /* - if ( empty($pf_cleandisplay) || $pf_cleandisplay != 'no' ) { - - $num_leading_spaces = 9; // nine leading spaces for indentation - - // sometimes I see ',,' instead of ',' seperating addresses *shrug* - $cc = pf_clean_string(str_replace(',,', ',', $cc), $num_leading_spaces); - $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces); +$subject = trim(decodeHeader($message->header->subject)); - // the body should have no leading zeros - $body = pf_clean_string($body, 0); + /* now, if they choose to, we clean up the display a bit... */ + /* +if ( empty($pf_cleandisplay) || $pf_cleandisplay != 'no' ) { - // clean up everything else... - $subject = pf_clean_string($subject, $num_leading_spaces); - $from = pf_clean_string($from, $num_leading_spaces); - $date = pf_clean_string($date, $num_leading_spaces); + $num_leading_spaces = 9; // nine leading spaces for indentation - } // end cleanup - */ - // --end display setup-- + // sometimes I see ',,' instead of ',' seperating addresses *shrug* + $cc = pf_clean_string(str_replace(',,', ',', $cc), $num_leading_spaces); + $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces); + // the body should have no leading zeros + $body = pf_clean_string($body, 0); - // --start browser output-- - displayHtmlHeader( _("Printer Friendly"), '', FALSE ); + // clean up everything else... + $subject = pf_clean_string($subject, $num_leading_spaces); + $from = pf_clean_string($from, $num_leading_spaces); + $date = pf_clean_string($date, $num_leading_spaces); - echo "\n" . - // headers (we use table becasue translations are not all the same width) - ''. - '\n". - '\n"; - if ( strlen($cc) > 0 ) { // only show CC: if it's there... - echo '\n"; - } - echo '\n". - '\n". - '
' . _("From") . ':' . htmlentities($from) . "
' . _("To") . ':' . htmlentities($to) . "
' . _("CC") . ':' . htmlentities($cc) . "
' . _("Date") . ':' . htmlentities($date) . "
' . _("Subject") . ':' . htmlentities($subject) . "
'. - "\n"; - // body - echo "
\n"; - echo $body; +} // end cleanup +*/ +// --end display setup-- -// --end browser output-- +/* --start browser output-- */ +displayHtmlHeader( _("Printer Friendly"), '', FALSE ); -?> - - +echo "\n" . + /* headers (we use table becasue translations are not all the same width) */ + ''. + '\n". + '\n"; +if ( strlen($cc) > 0 ) { /* only show CC: if it's there... */ + echo '\n"; +} +echo '\n". + '\n". + '
' . _("From") . ':' . htmlentities($from) . "
' . _("To") . ':' . htmlentities($to) . "
' . _("CC") . ':' . htmlentities($cc) . "
' . _("Date") . ':' . htmlentities($date) . "
' . _("Subject") . ':' . htmlentities($subject) . "
'. + "\n"; +/* body */ +echo "
\n"; +echo $body; -'; +/* --start pf-specific functions-- */ - // $string = pf_clean_string($string, 9); +/* $string = pf_clean_string($string, 9); */ function pf_clean_string ( $unclean_string, $num_leading_spaces ) { global $data_dir, $username; $wrap_at = getPref($data_dir, $username, 'wrap_at', 86); - $wrap_at = $wrap_at - $num_leading_spaces; // header stuff + $wrap_at = $wrap_at - $num_leading_spaces; /* header stuff */ $leading_spaces = ''; while ( strlen($leading_spaces) < $num_leading_spaces ) @@ -149,7 +126,7 @@ function pf_clean_string ( $unclean_string, $num_leading_spaces ) { while ( strlen($unclean_string) > $wrap_at ) { $this_line = substr($unclean_string, 0, $wrap_at); - if ( strrpos( $this_line, "\n" ) ) // this should NEVER happen with anything but the $body + if ( strrpos( $this_line, "\n" ) ) /* this should NEVER happen with anything but the $body */ { $clean_string .= substr( $this_line, 0, strrpos( $this_line, "\n" )); $clean_string .= $leading_spaces; @@ -162,11 +139,12 @@ function pf_clean_string ( $unclean_string, $num_leading_spaces ) { $unclean_string = substr($unclean_string, (1+strrpos( $this_line, ' ' ))); } } + $clean_string .= $unclean_string; return $clean_string; -} // end pf_clean_string() function +} /* end pf_clean_string() function */ -// --end pf-specific functions +/* --end pf-specific functions */ ?> \ No newline at end of file diff --git a/src/retrievalerror.php b/src/retrievalerror.php index 712fcee2..edce30cf 100644 --- a/src/retrievalerror.php +++ b/src/retrievalerror.php @@ -14,118 +14,94 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); -require_once("../functions/imap.php"); -require_once("../functions/smtp.php"); -require_once("../functions/page_header.php"); -require_once("../src/load_prefs.php"); - - $destination = "retrievalerror@squirrelmail.org"; - - $attachments = array(); - - - function ClearAttachments() { - global $attachments, $attachment_dir, $username; - - $hashed_attachment_dir = getHashedDir($username, $attachment_dir); - foreach ($attachments as $info) { - $attached_file = "$hashed_attachment_dir/$info[localfilename]"; - if (file_exists($attached_file)) { - unlink($attached_file); - } - } - - $attachments = array(); - } - - $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imap_stream, $mailbox); - $sid = sqimap_session_id(); - fputs ($imap_stream, "$sid FETCH $passed_id BODY[]\r\n"); - $data = sqimap_read_data ($imap_stream, $sid, true, $response, $message); - sqimap_logout($imap_stream); - $topline2 = array_shift($data); - $thebastard = implode('', $data); - - - $hashed_attachment_dir = getHashedDir($username, $attachment_dir); - $localfilename = GenerateRandomString(32, '', 7); - $full_localfilename = "$hashed_attachment_dir/$localfilename"; - while (file_exists($full_localfilename)) { - $localfilename = GenerateRandomString(32, '', 7); - $full_localfilename = "$hashed_attachment_dir/$localfilename"; - } - - // Write Attachment to file - $fp = fopen ($full_localfilename, 'w'); - fputs ($fp, $thebastard); - fclose ($fp); - - $newAttachment = array(); - $newAttachment['localfilename'] = $localfilename; - $newAttachment['remotefilename'] = 'message.duh'; - $newAttachment['type'] = 'application/octet-stream'; - $attachments[] = $newAttachment; - - - $body = "Response: $response\n" . - "Message: $message\n" . - "FETCH line: $topline\n" . - "Server Type: $imap_server_type\n"; - - $imap_stream = fsockopen ($imapServerAddress, $imapPort, &$error_number, &$error_string); - $server_info = fgets ($imap_stream, 1024); - if ($imap_stream) - { - $body .= " Server info: $server_info"; - fputs ($imap_stream, "a001 CAPABILITY\r\n"); - $read = fgets($imap_stream, 1024); - $list = explode(' ', $read); - array_shift($list); - array_shift($list); - $read = implode(' ', $list); - $body .= " Capabilities: $read"; - fputs ($imap_stream, "a002 LOGOUT\r\n"); - fclose($imap_stream); - } - - $body .= "\nFETCH line for gathering the whole message: $topline2\n"; - - - sendMessage($destination, "", "", "submitted message", $body, 0); - - - - - displayPageHeader($color, $mailbox); - - $par = "mailbox=".urlencode($mailbox)."&passed_id=$passed_id"; - if (isset($where) && isset($what)) { - $par .= "&where=".urlencode($where)."&what=".urlencode($what); - } else { - $par .= "&startMessage=$startMessage&show_more=0"; - } - - echo '
The message has been submitted to the developers knowledgebase!
' . - 'Thank you very much
' . - 'Please submit every message only once
' . - "View the message
"; - -?> +require_once('../functions/imap.php'); +require_once('../functions/smtp.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +$destination = 'retrievalerror@squirrelmail.org'; + +$attachments = array(); + +function ClearAttachments() { + global $attachments, $attachment_dir, $username; + + $hashed_attachment_dir = getHashedDir($username, $attachment_dir); + foreach ($attachments as $info) { + $attached_file = "$hashed_attachment_dir/$info[localfilename]"; + if (file_exists($attached_file)) { + unlink($attached_file); + } + } + + $attachments = array(); +} + +$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +sqimap_mailbox_select($imap_stream, $mailbox); +$sid = sqimap_session_id(); +fputs ($imap_stream, "$sid FETCH $passed_id BODY[]\r\n"); +$data = sqimap_read_data ($imap_stream, $sid, true, $response, $message); +sqimap_logout($imap_stream); +$topline2 = array_shift($data); +$thebastard = implode('', $data); + +$hashed_attachment_dir = getHashedDir($username, $attachment_dir); +$localfilename = GenerateRandomString(32, '', 7); +$full_localfilename = "$hashed_attachment_dir/$localfilename"; +while (file_exists($full_localfilename)) { + $localfilename = GenerateRandomString(32, '', 7); + $full_localfilename = "$hashed_attachment_dir/$localfilename"; +} + +/* Write Attachment to file */ +$fp = fopen ($full_localfilename, 'w'); +fputs ($fp, $thebastard); +fclose ($fp); + +$newAttachment = array(); +$newAttachment['localfilename'] = $localfilename; +$newAttachment['remotefilename'] = 'message.duh'; +$newAttachment['type'] = 'application/octet-stream'; +$attachments[] = $newAttachment; + +$body = "Response: $response\n" . + "Message: $message\n" . + "FETCH line: $topline\n" . + "Server Type: $imap_server_type\n"; + +$imap_stream = fsockopen ($imapServerAddress, $imapPort, &$error_number, &$error_string); +$server_info = fgets ($imap_stream, 1024); +if ($imap_stream) { + $body .= " Server info: $server_info"; + fputs ($imap_stream, "a001 CAPABILITY\r\n"); + $read = fgets($imap_stream, 1024); + $list = explode(' ', $read); + array_shift($list); + array_shift($list); + $read = implode(' ', $list); + $body .= " Capabilities: $read"; + fputs ($imap_stream, "a002 LOGOUT\r\n"); + fclose($imap_stream); +} + +$body .= "\nFETCH line for gathering the whole message: $topline2\n"; + +sendMessage($destination, '', '', 'submitted message', $body, 0); + +displayPageHeader($color, $mailbox); + +$par = 'mailbox='.urlencode($mailbox)."&passed_id=$passed_id"; +if (isset($where) && isset($what)) { + $par .= '&where='.urlencode($where).'&what='.urlencode($what); +} else { + $par .= "&startMessage=$startMessage&show_more=0"; +} + +echo '
The message has been submitted to the developers knowledgebase!
' . + 'Thank you very much
' . + 'Please submit every message only once
' . + "View the message
"; + +?> \ No newline at end of file diff --git a/src/signout.php b/src/signout.php index c8f07cd5..fae6ce9c 100644 --- a/src/signout.php +++ b/src/signout.php @@ -11,69 +11,53 @@ * $Id$ */ -/*****************************************************************/ -/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ -/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ -/*** + Base level indent should begin at left margin, as ***/ -/*** the require_once below looks. ***/ -/*** + All identation should consist of four space blocks ***/ -/*** + Tab characters are evil. ***/ -/*** + all comments should use "slash-star ... star-slash" ***/ -/*** style -- no pound characters, no slash-slash style ***/ -/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ -/*** ALWAYS USE { AND } CHARACTERS!!! ***/ -/*** + Please use ' instead of ", when possible. Note " ***/ -/*** should always be used in _( ) function calls. ***/ -/*** Thank you for your help making the SM code more readable. ***/ -/*****************************************************************/ - require_once('../src/validate.php'); require_once('../functions/prefs.php'); require_once('../functions/plugin.php'); require_once('../functions/strings.php'); - // Erase any lingering attachments - if (! isset($attachments)) { - $attachments = array(); - } - $hashed_attachment_dir = getHashedDir($username, $attachment_dir); - foreach ($attachments as $info) { - $attached_file = "$hashed_attachment_dir/$info[localfilename]"; - if (file_exists($attached_file)) { - unlink($attached_file); - } - } +/* Erase any lingering attachments */ +if (! isset($attachments)) { + $attachments = array(); +} +$hashed_attachment_dir = getHashedDir($username, $attachment_dir); +foreach ($attachments as $info) { + $attached_file = "$hashed_attachment_dir/$info[localfilename]"; + if (file_exists($attached_file)) { + unlink($attached_file); + } +} - if (!isset($frame_top)) { - $frame_top = '_top'; - } +if (!isset($frame_top)) { + $frame_top = '_top'; +} - // If a user hits reload on the last page, $base_uri isn't set - // because it was deleted with the session. - if (! isset($base_uri)) { - ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs); - $base_uri = $regs[1]; - } +/* If a user hits reload on the last page, $base_uri isn't set + * because it was deleted with the session. */ +if (! isset($base_uri)) { + ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs); + $base_uri = $regs[1]; +} - do_hook('logout'); - setcookie('username', '', 0, $base_uri); - setcookie('key', '', 0, $base_uri); - session_destroy(); +do_hook('logout'); +setcookie('username', '', 0, $base_uri); +setcookie('key', '', 0, $base_uri); +session_destroy(); - if ($signout_page) { - header("Status: 303 See Other"); - header("Location: $signout_page"); - exit; /* we send no content if we're redirecting. */ - } +if ($signout_page) { + header('Status: 303 See Other'); + header("Location: $signout_page"); + exit; /* we send no content if we're redirecting. */ +} ?> <?php echo $org_title ?> - Signout @@ -104,4 +88,4 @@ CELLPADDING="2" ALIGN="CENTER"> - + \ No newline at end of file -- 2.25.1