X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fauth.php;h=0765e7e2b92a2b89fcbedf2034b5467acf874c77;hb=bb50b50818e1eb3b2ff8f8c49883c1a7f19707e5;hp=b7ad374a4618b68a09b8bdc45065afc49b2261e2;hpb=4d2c9f705592bd76b10ba4ffa02aa51da117e976;p=squirrelmail.git diff --git a/functions/auth.php b/functions/auth.php index b7ad374a..0765e7e2 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -3,49 +3,243 @@ /** * auth.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Copyright (c) 1999-2004 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * Contains functions used to do authentication. * * $Id$ + * @package squirrelmail */ -require_once( '../functions/page_header.php' ); +/** Put in a safety net here, in case a naughty admin didn't run conf.pl when they upgraded */ -/* If a user opens a new session then comes back to this one, - * $base_uri isn't set because it the session is invalid. - */ +if (! isset($smtp_auth_mech)) { + $smtp_auth_mech = 'none'; +} -if (! isset($base_uri)) { - ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs); - $base_uri = $regs[1]; - +if (! isset($imap_auth_mech)) { + $imap_auth_mech = 'login'; } -function is_logged_in () { - global $squirrelmail_language, $frame_top, $base_uri; +if (! isset($use_imap_tls)) { + $use_imap_tls = false; +} - if ( session_is_registered('user_is_logged_in') ) { +if (! isset($use_smtp_tls)) { + $use_smtp_tls = false; +} + +/** + * Check if user has previously logged in to the Squirrelmail session. If user + * has not logged in, execution will stop inside this function. + * + * @return int A positive value is returned if user has previously logged in + * successfully. + */ +function is_logged_in() { + + if ( sqsession_is_registered('user_is_logged_in') ) { return; } else { + global $PHP_SELF, $session_expired_post, + $session_expired_location; - if (!isset($frame_top) || $frame_top == '' ) { - $frame_top = '_top'; + /* First we store some information in the new session to prevent + * information-loss. + */ + + $session_expired_post = $_POST; + $session_expired_location = $PHP_SELF; + if (!sqsession_is_registered('session_expired_post')) { + sqsession_register($session_expired_post,'session_expired_post'); + } + if (!sqsession_is_registered('session_expired_location')) { + sqsession_register($session_expired_location,'session_expired_location'); } - - set_up_language($squirrelmail_language, true); - - displayHtmlHeader( _("You must be logged in to access this page.") ); - - echo "
\n" . - '