From: gustavf Date: Thu, 29 Jun 2000 12:46:49 +0000 (+0000) Subject: Added auth.php to put authentication functions in one place. Added a X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;h=3c13b9fbe25c208d9618b7f2eb2262605ebf6b44;p=squirrelmail.git Added auth.php to put authentication functions in one place. Added a function there to check if the user is logged in without having to connect to the IMAP server. Using this function in compose.php as a test. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@570 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/auth.php b/functions/auth.php new file mode 100644 index 00000000..594567fd --- /dev/null +++ b/functions/auth.php @@ -0,0 +1,22 @@ +\n\n"; + exit; + } else { + return true; + } + } + +?> diff --git a/src/compose.php b/src/compose.php index daae7b63..000b2264 100644 --- a/src/compose.php +++ b/src/compose.php @@ -25,6 +25,8 @@ include("../functions/smtp.php"); if (!isset($display_messages_php)) include("../functions/display_messages.php"); + if (!isset($auth_php)) + include ("../functions/auth.php"); include("../src/load_prefs.php"); @@ -287,7 +289,7 @@ showInputForm(); } } else if ($html_addr_search_done) { - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + is_logged_in(); displayPageHeader($color, $mailbox); $body = stripslashes($body); @@ -314,7 +316,7 @@ //* can think of a better way, please implement it. include ("addrbook_search_html.php"); } else if (isset($attach)) { - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + is_logged_in(); displayPageHeader($color, $mailbox); $localfilename = md5("$attachfile, $attachfile_name, $REMOTE_IP, $REMOTE_PORT, $UNIQUE_ID, and everything else that may add entropy"); @@ -341,7 +343,7 @@ showInputForm(); } else if (isset($do_delete)) { - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + is_logged_in(); displayPageHeader($color, $mailbox); while (list($key, $localname) = each($delete)) { @@ -352,7 +354,7 @@ showInputForm(); } else { - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + is_logged_in(); displayPageHeader($color, $mailbox); $newmail = true; diff --git a/src/webmail.php b/src/webmail.php index 33a0aca7..6a1eae8d 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -27,20 +27,22 @@ include ("../functions/imap.php"); if (!isset($plugin_php)) include ("../functions/plugin.php"); + if (!isset($auth_php)) + include ("../functions/auth.php"); - if ($is_logged_in != true) { + if (session_is_registered("user_is_logged_in")) { do_hook ("login_before"); // verify that username and password are correct $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); do_hook ("login_verified"); } - session_register ("is_logged_in"); - $is_logged_in = true; + session_register ("user_is_logged_in"); + $user_is_logged_in = true; include ("../src/load_prefs.php"); - echo "\n"; echo ""; echo "$org_title"; echo "";