From 9f2215a1f40978a370a7538229ca2f55f55026ee Mon Sep 17 00:00:00 2001 From: nehresma Date: Wed, 12 Apr 2000 03:35:12 +0000 Subject: [PATCH] changed log in method back to using cookies. also session id is now stored in cookies. preliminary caching done too, but commented out for now (not working). git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@412 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/display_messages.php | 13 +++----- functions/imap_general.php | 1 - functions/mailbox_display.php | 59 +++++++++++++++++++++------------- functions/mime.php | 6 ++-- functions/page_header.php | 12 +++---- functions/url_parser.php | 3 +- src/addrbook_popup.php | 4 +-- src/addrbook_search.php | 2 +- src/addressbook.php | 2 +- src/compose.php | 12 +++---- src/download.php | 2 +- src/folders.php | 14 ++++---- src/folders_create.php | 4 +-- src/folders_delete.php | 2 +- src/folders_rename_do.php | 2 +- src/folders_rename_getname.php | 2 +- src/folders_subscribe.php | 2 +- src/left_main.php | 11 +++---- src/login.php | 6 ++-- src/move_messages.php | 4 +-- src/options.php | 2 +- src/options_submit.php | 4 +-- src/read_body.php | 18 +++++------ src/right_main.php | 16 ++++++++- src/signout.php | 7 ++-- src/webmail.php | 28 ++++++---------- 26 files changed, 123 insertions(+), 115 deletions(-) diff --git a/functions/display_messages.php b/functions/display_messages.php index 30f0084f..12e2352d 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -10,15 +10,13 @@ $display_messages_php = true; function error_username_password_incorrect($color) { - global $PHPSESSID; - echo "
"; echo ""; echo " "; echo " "; echo "
"; echo "
ERROR
"; echo "
"; - echo "

". _("Unknown user or password incorrect.") ."
". _("Click here to try again") .".
"; + echo "

". _("Unknown user or password incorrect.") ."
". _("Click here to try again") .".
"; echo "
"; echo ""; @@ -52,7 +50,6 @@ } function messages_deleted_message($mailbox, $sort, $startMessage, $color) { - global $PHPSESSID; $urlMailbox = urlencode($mailbox); echo "
"; @@ -63,7 +60,7 @@ echo " "; echo "

". _("The selected messages were deleted successfully.") ."
\n"; echo "
"; - echo " "; + echo " "; echo " ". _("Click here to return to ") ."$mailbox."; echo "
"; echo " "; @@ -71,7 +68,6 @@ } function messages_moved_message($mailbox, $sort, $startMessage, $color) { - global $PHPSESSID; $urlMailbox = urlencode($mailbox); echo "
"; @@ -82,7 +78,7 @@ echo " "; echo "

". _("The selected messages were moved successfully.") ."
\n"; echo "
"; - echo " "; + echo " "; echo " ". _("Click here to return to ") ."$mailbox."; echo "
"; echo " "; @@ -90,7 +86,6 @@ } function error_message($message, $mailbox, $sort, $startMessage, $color) { - global $PHPSESSID; $urlMailbox = urlencode($mailbox); echo "
"; @@ -101,7 +96,7 @@ echo " "; echo "

$message
\n"; echo "
"; - echo " "; + echo " "; echo " ". _("Click here to return to ") ."$mailbox."; echo "
"; echo " "; diff --git a/functions/imap_general.php b/functions/imap_general.php index 0ed842d3..9e3a514b 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -65,7 +65,6 @@ ******************************************************************************/ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) { global $color; - global $PHPSESSID; $imap_stream = fsockopen ($imap_server_address, $imap_port, &$error_number, &$error_string); $server_info = fgets ($imap_stream, 1024); diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 220458ae..da874a99 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -12,7 +12,7 @@ function printMessageInfo($imapConnection, $t, $msg, $mailbox, $sort, $startMessage) { //require ("../config/config.php"); - global $color, $PHPSESSID; + global $color; $senderName = $msg["FROM"]; $urlMailbox = urlencode($mailbox); @@ -26,7 +26,7 @@ echo " \n"; echo " $bold$flag$senderName$flag_end$bold_end\n"; echo "
$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end
\n"; - echo " $bold$flag$subject$flag_end$ans$bold_end\n"; + echo " $bold$flag$subject$flag_end$ans$bold_end\n"; echo "\n"; } @@ -36,7 +36,6 @@ **/ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color) { include ("../config/config.php"); - global $PHPSESSID; if ($numMessages >= 1) { for ($q = 0; $q < $numMessages; $q++) { @@ -146,6 +145,22 @@ } } +// session_register("messages"); +// $messages = serialize($msgs); + + displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color); + } + + // generic function to convert the msgs array into an HTML table + function displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color) { + // do a check to see if the config stuff has already been included or not + if (!isset($imapServerAddress)) + include("../config/config.php"); + + // if cache isn't already set, do it now +// if (!session_is_registered("messages")) +// session_register("messages"); + if ($startMessage + 24 < $numMessages) { $endMessage = $startMessage + 24; } else { @@ -171,30 +186,30 @@ echo ""; if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { - echo "". _("Previous") ."\n"; - echo "". _("Next") ."\n"; + echo "". _("Previous") ."\n"; + echo "". _("Next") ."\n"; } else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) { - echo "". _("Previous") ."\n"; + echo "". _("Previous") ."\n"; echo "Next\n"; } else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) { echo "Previous\n"; - echo "". _("Next") ."\n"; + echo "". _("Next") ."\n"; } echo "\n"; /** The delete and move options */ echo ""; - echo "\n\n\n
"; + echo "\n\n\n"; echo "\n"; echo " \n"; echo " \n"; + echo " \n"; else if ($sort == 3) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; /** DATE HEADER **/ echo " \n"; + echo " \n"; else if ($sort == 1) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; /** SUBJECT HEADER **/ echo " \n"; + echo " \n"; else if ($sort == 5) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; echo ""; @@ -275,16 +290,16 @@ echo "
\n"; echo " ". _("Move selected to:") .""; echo " ". _("From") .""; if ($sort == 2) - echo " ". _("Date") .""; if ($sort == 0) - echo " ". _("Subject") ."\n"; if ($sort == 4) - echo "
"; if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { - echo "" . _("Previous") . "\n"; - echo "" . _("Next") . "\n"; + echo "" . _("Previous") . "\n"; + echo "" . _("Next") . "\n"; } else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) { - echo "" . _("Previous") . "\n"; + echo "" . _("Previous") . "\n"; echo "" . _("Next") . "\n"; } else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) { echo "Previous\n"; - echo "" . _("Next") . "\n"; + echo "" . _("Next") . "\n"; } echo "
"; /** End of message-list table */ } diff --git a/functions/mime.php b/functions/mime.php index 7e73a65a..ef00957c 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -128,8 +128,6 @@ bottom, etc. **/ function formatBody($message, $color, $wrap_at) { - global $PHPSESSID; - /** this if statement checks for the entity to show as the primary message. To add more of them, just put them in the order that is their priority. @@ -162,7 +160,7 @@ $body = translateText($body, $wrap_at, $charset); - $body .= "
". _("Download this as a file") ."

"; + $body .= "
". _("Download this as a file") ."

"; /** Display the ATTACHMENTS: message if there's more than one part **/ if (count($message["ENTITIES"]) > 1) { @@ -189,7 +187,7 @@ $urlMailbox = urlencode($message["INFO"]["MAILBOX"]); $id = $message["INFO"]["ID"]; - $body .= "   " . $display_filename . "  (TYPE: $type0/$type1)
"; + $body .= "   " . $display_filename . "  (TYPE: $type0/$type1)
"; } $body .= ""; } diff --git a/functions/page_header.php b/functions/page_header.php index 5d78405f..f26e19c7 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -43,25 +43,23 @@ header ("Content-Type: text/html; charset=$default_charset"); function displayPageHeader($color, $mailbox) { - global $PHPSESSID; - /** Here is the header and wrapping table **/ $shortBoxName = readShortMailboxName($mailbox, "."); $shortBoxName = stripslashes($shortBoxName); echo ""; echo " "; echo " "; echo "
"; - echo " " . _("Sign Out") . ""; + echo " " . _("Sign Out") . ""; echo " "; echo "
" . _("Current Folder: ") . "$shortBoxName 
"; echo "
\n"; echo ""; echo " "; diff --git a/functions/url_parser.php b/functions/url_parser.php index 30f95b3d..bdc89b42 100644 --- a/functions/url_parser.php +++ b/functions/url_parser.php @@ -11,8 +11,7 @@ } function parseEmail ($body) { - global $PHPSESSID; - $body = eregi_replace ("([a-z]|[0-9]|_|\.|-)+\@([a-z]|[0-9]|_|-)+(\.([a-z]|[0-9]|_|-)+)*", "\\0", $body); + $body = eregi_replace ("([a-z]|[0-9]|_|\.|-)+\@([a-z]|[0-9]|_|-)+(\.([a-z]|[0-9]|_|-)+)*", "\\0", $body); return $body; } diff --git a/src/addrbook_popup.php b/src/addrbook_popup.php index a403d056..a9bee6e9 100644 --- a/src/addrbook_popup.php +++ b/src/addrbook_popup.php @@ -35,8 +35,8 @@ - + diff --git a/src/addrbook_search.php b/src/addrbook_search.php index 5181632c..c707bd5c 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -67,7 +67,7 @@ // Create search form if($show == "form") { printf("\n", - $PHP_SELF . "?PHPSESSID=$PHPSESSID"); + $PHP_SELF); printf("
"; - echo " " . _("Compose") . "  "; - echo " " . _("Addresses") . "  "; - echo " " . _("Folders") . "  "; - echo " " . _("Options") . "  "; + echo " " . _("Compose") . "  "; + echo " " . _("Addresses") . "  "; + echo " " . _("Folders") . "  "; + echo " " . _("Options") . "  "; echo " "; echo " SquirrelMail"; echo "
"); printf("\n", ($line % 2) ? " bgcolor=\"$color[0]\"" : "", $selected, $row["backend"], $row["nickname"], diff --git a/src/compose.php b/src/compose.php index 988b012b..018650a6 100644 --- a/src/compose.php +++ b/src/compose.php @@ -144,7 +144,7 @@ function showInputForm () { global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body, $passed_body, $color, $use_signature, $signature, $editor_size, - $attachments, $subject, $newmail, $PHPSESSID; + $attachments, $subject, $newmail; $subject = decodeHeader($subject); $reply_subj = decodeHeader($reply_subj); @@ -152,14 +152,14 @@ echo "\n\n\n"; - echo "\n\n"; echo "
\n"); printf(" %s:\n\n", diff --git a/src/addressbook.php b/src/addressbook.php index e46ba62f..1caaee19 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -337,7 +337,7 @@ printf("\n ". "". " %s  %s ". - " %s". + " %s". "  %s
\n"; echo " \n"; @@ -272,10 +272,8 @@ } function showSentForm () { - global $PHPSESSID; - echo "


Message Sent!

"; - echo "You will be automatically forwarded.
If not, click here"; + echo "You will be automatically forwarded.
If not, click here"; echo "
"; } @@ -305,7 +303,7 @@ if(isset($send)) { if (checkInput(false)) { sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body); - header ("Location: right_main.php?PHPSESSID=$PHPSESSID"); + header ("Location: right_main.php"); } else { echo "\n"; $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); diff --git a/src/download.php b/src/download.php index 546bc86c..982c7e0f 100644 --- a/src/download.php +++ b/src/download.php @@ -26,7 +26,7 @@ echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; echo "
"; $urlmailbox = urlencode($mailbox); - echo "
"; + echo "
"; echo _("Download this as a file"); echo "


"; if ($type1 == "html") diff --git a/src/folders.php b/src/folders.php index 1f86f92c..67584317 100644 --- a/src/folders.php +++ b/src/folders.php @@ -41,7 +41,7 @@ sqimap_subscribe($imapConnection, "INBOX"); echo "

"; echo _("Mailboxes Created Successfully!"); - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); @@ -60,7 +60,7 @@ echo "
"; echo _("In order for SquirrelMail to provide the full set of options you need to create the special folders listed below. Just click the check box and hit the create button."); - echo "\n"; + echo "\n"; if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) { echo _("Create Sent") . "
\n"; } @@ -88,7 +88,7 @@ } if ($count_special_folders < count($boxes)) { - echo "\n"; + echo "\n"; echo "
"; - echo "\n"; + echo "\n"; echo "
\n"; echo _("as a subfolder of"); echo "
"; @@ -172,7 +172,7 @@ echo "
"; if ($count_special_folders < count($boxes)) { - echo "\n"; + echo "\n"; echo "
"; if ($count_special_folders < count($boxes)) { - echo "\n"; + echo "\n"; echo ""; for ($i = 0; $i < count($boxes_all); $i++) { $use_folder = true; diff --git a/src/folders_create.php b/src/folders_create.php index 6a0db857..45b1a5db 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -20,7 +20,7 @@ if (strpos($folder_name, "\"") || strpos($folder_name, ".") || strpos($folder_name, "/") || strpos($folder_name, "\\") || strpos($folder_name, "'") || strpos($folder_name, "$dm")) { - plain_error_message(_("Illegal folder name. Please select a different name.")."
"._("Click here to go back").".", $color); + plain_error_message(_("Illegal folder name. Please select a different name.")."
"._("Click here to go back").".", $color); exit; } @@ -51,7 +51,7 @@ echo _("Folder Created!"); echo "

"; echo _("The folder has been successfully created."); - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); diff --git a/src/folders_delete.php b/src/folders_delete.php index c6d06a6d..98bae7a5 100644 --- a/src/folders_delete.php +++ b/src/folders_delete.php @@ -82,7 +82,7 @@ echo _("Folder Deleted!"); echo "

"; echo _("The folder has been successfully deleted."); - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); diff --git a/src/folders_rename_do.php b/src/folders_rename_do.php index fa941d76..31e75657 100644 --- a/src/folders_rename_do.php +++ b/src/folders_rename_do.php @@ -50,7 +50,7 @@ echo _("Folder Renamed!"); echo "

"; echo _("The folder has been successfully renamed."); - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); diff --git a/src/folders_rename_getname.php b/src/folders_rename_getname.php index 7580e316..1c46a2de 100644 --- a/src/folders_rename_getname.php +++ b/src/folders_rename_getname.php @@ -37,7 +37,7 @@ echo _("Rename a folder"); echo "
"; - echo "\n"; + echo "\n"; echo _("New name:"); echo "   
\n"; if ($isfolder) diff --git a/src/folders_subscribe.php b/src/folders_subscribe.php index e92a433d..37994473 100644 --- a/src/folders_subscribe.php +++ b/src/folders_subscribe.php @@ -36,7 +36,7 @@ echo "

"; echo _("You have been successfully unsubscribed."); } - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); diff --git a/src/left_main.php b/src/left_main.php index 36fed66b..f1244e4e 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -32,7 +32,6 @@ function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) { require ("../config/config.php"); - global $PHPSESSID; $mailboxURL = urlencode($real_box); sqimap_mailbox_select ($imapConnection, $real_box); @@ -49,11 +48,11 @@ } if ($special_color == true) { - $line .= ""; + $line .= ""; $line .= replace_spaces($mailbox); $line .= ""; } else { - $line .= ""; + $line .= ""; $line .= replace_spaces($mailbox); $line .= ""; } @@ -68,7 +67,7 @@ if (($move_to_trash == true) && (trim($real_box) == $trash_folder)) { $urlMailbox = urlencode($real_box); $line .= ""; - $line .= "    ("._("purge").")"; + $line .= "    ("._("purge").")"; $line .= "\n"; } @@ -85,7 +84,7 @@ if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) { echo ""; echo ""; - echo ""; + echo ""; } echo ""; @@ -95,7 +94,7 @@ echo "
"; echo _("Folders") . "
"; - echo "("; + echo "("; echo _("refresh folder list"); echo ")

"; $delimeter = sqimap_get_delimiter($imapConnection); diff --git a/src/login.php b/src/login.php index c511fee4..8772933e 100644 --- a/src/login.php +++ b/src/login.php @@ -6,9 +6,9 @@ ** **/ -# setcookie("username", "", time(), "/"); -# setcookie("key", "", time(), "/"); -# setcookie("logged_in", 0, time(), "/"); + setcookie("username", "", time(), "/"); + setcookie("key", "", time(), "/"); + setcookie("logged_in", 0, time(), "/"); if (!isset($config_php)) include("../config/config.php"); diff --git a/src/move_messages.php b/src/move_messages.php index 59b57fc9..005cf2ca 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -63,7 +63,7 @@ sqimap_mailbox_expunge($imapConnection, $mailbox); if ($auto_forward) { - header ("Location: right_main.php?PHPSESSID=$PHPSESSID"); + header ("Location: right_main.php"); } else { echo "\n"; displayPageHeader($color, $mailbox); @@ -96,7 +96,7 @@ sqimap_mailbox_expunge($imapConnection, $mailbox); if ($auto_forward) { - header ("Location: right_main.php?PHPSESSID=$PHPSESSID"); + header ("Location: right_main.php"); } else { echo "\n"; displayPageHeader($color, $mailbox); diff --git a/src/options.php b/src/options.php index ba5a9bd6..d481864d 100644 --- a/src/options.php +++ b/src/options.php @@ -38,7 +38,7 @@ echo "
\n"; - echo "\n"; + echo "\n"; echo "\n"; // FULL NAME echo " "; diff --git a/src/options_submit.php b/src/options_submit.php index 900e8b83..cd93a104 100644 --- a/src/options_submit.php +++ b/src/options_submit.php @@ -32,7 +32,7 @@ setSig($data_dir, $username, stripslashes($signature_edit)); - #setcookie("squirrelmail_language", $language, time()+2592000); + setcookie("squirrelmail_language", $language, time()+2592000); $squirrelmail_language = $language; echo ""; @@ -42,7 +42,7 @@ echo _("Options Saved!"); echo "

"; echo _("Your options have been saved."); - echo "
"; + echo "
"; echo _("Click here"); echo " "; echo _("to continue."); diff --git a/src/read_body.php b/src/read_body.php index 5af3aa06..dc0d9952 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -56,11 +56,11 @@ if (count($to_ary) > 1) { if ($show_more == false) { if ($i == 1) { - $to_string = "$to_string ($echo_more)"; + $to_string = "$to_string ($echo_more)"; $i = count($to_ary); } } else if ($i == 1) { - $to_string = "$to_string ($echo_less)"; + $to_string = "$to_string ($echo_less)"; } } } @@ -80,11 +80,11 @@ if (count($cc_ary) > 1) { if ($show_more_cc == false) { if ($i == 1) { - $cc_string = "$cc_string ($echo_more)"; + $cc_string = "$cc_string ($echo_more)"; $i = count($cc_ary); } } else if ($i == 1) { - $cc_string = "$cc_string ($echo_less)"; + $cc_string = "$cc_string ($echo_less)"; } } } @@ -100,22 +100,22 @@ echo " "; echo "
"; echo " "; - echo " "; + echo " "; echo _("Message List"); echo " | "; - echo " "; + echo " "; echo _("Delete"); echo "  "; echo " "; echo " "; echo " "; - echo " "; + echo " "; echo _("Forward"); echo " | "; - echo " "; + echo " "; echo _("Reply"); echo " | "; - echo " "; + echo " "; echo _("Reply All"); echo "  "; echo " "; diff --git a/src/right_main.php b/src/right_main.php index dd914b7d..bc1cc16b 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -75,7 +75,21 @@ $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox); displayPageHeader($color, $mailbox); - showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color); + // Check to see if we can use cache or not. Currently the only time when you wont use it is + // when a link on the left hand frame is used. Also check to make sure we actually have the + // array in the registered session data. :) +// if (!$use_mailbox_cache || !session_is_registered("msgs")) { +// echo "
not using cache
\n"; +// if (session_is_registered("messages")) +// session_unregister("messages"); + + showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color); +// } else { +// echo "
using cache
\n"; +// $msgs = unserialize($messages); + +// displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color); +// } // close the connection sqimap_logout ($imapConnection); diff --git a/src/signout.php b/src/signout.php index cdd778e4..c90b5962 100644 --- a/src/signout.php +++ b/src/signout.php @@ -20,9 +20,10 @@ include ("../src/load_prefs.php"); -# setcookie("username", "", time(), "/"); -# setcookie("key", "", time(), "/"); -# setcookie("logged_in", 0, time(), "/"); + setcookie("username", "", time(), "/"); + setcookie("key", "", time(), "/"); + setcookie("logged_in", 0, time(), "/"); + session_destroy(); ?> @@ -60,15 +52,15 @@ **/ if ($right_frame == "right_main.php") { $urlMailbox = urlencode($mailbox); - echo ""; - echo ""; + echo ""; + echo ""; } else if ($right_frame == "folders.php") { $urlMailbox = urlencode($mailbox); - echo ""; - echo ""; + echo ""; + echo ""; } else { - echo ""; - echo ""; + echo ""; + echo ""; } ?> -- 2.25.1