From f3d17401a7a558f09baac5c349324c9cf372c705 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Thu, 6 Jan 2000 20:54:06 +0000 Subject: [PATCH] Pref file now isn't created if the login failed git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@117 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap.php | 3 ++- src/left_main.php | 10 ++++++---- src/load_prefs.php | 10 ++++++++-- src/right_main.php | 10 ++++++---- src/webmail.php | 2 -- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/functions/imap.php b/functions/imap.php index eaffda33..2780f4b0 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -106,6 +106,7 @@ echo "SERVER SAYS: $read
"; } + /** If the login attempt was UNsuccessful, lets see why **/ if (substr($read, 0, 7) != "a001 OK") { if (!$hide) { if (substr($read, 0, 8) == "a001 BAD") { @@ -113,7 +114,7 @@ exit; } else if (substr($read, 0, 7) == "a001 NO") { - echo "
"; + echo "
"; echo ""; echo " "; echo "
"; diff --git a/src/left_main.php b/src/left_main.php index dea9fd58..db84533b 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -20,8 +20,6 @@ include("../functions/imap.php"); include("../functions/mailbox.php"); - include("../src/load_prefs.php"); - function formatMailboxName($imapConnection, $mailbox, $delimeter, $color) { require ("../config/config.php"); @@ -67,11 +65,15 @@ return $line; } - echo ""; - echo ""; // open a connection on the imap port (143) $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output + /** If it was a successful login, lets load their preferences **/ + include("../src/load_prefs.php"); + checkForPrefs($data_dir, $username); + echo ""; + echo ""; + getFolderList($imapConnection, $boxes); echo "
"; diff --git a/src/load_prefs.php b/src/load_prefs.php index 973ae4ab..5b580355 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -4,9 +4,15 @@ $chosen_theme = getPref($data_dir, $username, "chosen_theme"); - if (isset($chosen_theme)) { + if ((isset($chosen_theme)) && (file_exists($chosen_theme))) { require("$chosen_theme"); } else { - require($theme[0]["PATH"]); + if (file_exists($theme[0]["PATH"])) { + require($theme[0]["PATH"]); + } else { + echo "Theme: " . $theme[0]["PATH"] . " was not found.
"; + echo "Exiting abnormally"; + exit; + } } ?> \ No newline at end of file diff --git a/src/right_main.php b/src/right_main.php index 988267b3..288ce90d 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -29,10 +29,6 @@ include("../functions/mailbox_display.php"); include("../functions/display_messages.php"); - include("../src/load_prefs.php"); - - echo "\n"; - echo ""; ///////////////////////////////////////////////////////////////////////////////// // // incoming variables from URL: @@ -51,6 +47,12 @@ // open a connection on the imap port (143) $imapConnection = loginToImapServer($username, $key, $imapServerAddress); + /** If it was a successful login, lets load their preferences **/ + include("../src/load_prefs.php"); + checkForPrefs($data_dir, $username); + echo "\n"; + echo ""; + // If the page has been loaded without a specific mailbox, // just show a page of general info. if (!isset($mailbox)) { diff --git a/src/webmail.php b/src/webmail.php index ed6df33c..05601d9e 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -36,8 +36,6 @@ This was done to create a pure HTML way of refreshing the folder list since we would like to use as little Javascript as possible. **/ - checkForPrefs($data_dir, $username); - if ($right_frame == "right_main.php") { $urlMailbox = urlencode($mailbox); echo ""; -- 2.25.1