X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fauth.php;h=72a7b75eca5c6f6b38479f5eb168ac2672e98799;hb=19d01c6b200dfd6317e4a933325d903ba2901726;hp=5f939cccf1d553c7b281f6c2b07e401e8ecf16f1;hpb=8b52a4ca97fc58645d3c922c3642181ba380ea94;p=squirrelmail.git diff --git a/functions/auth.php b/functions/auth.php index 5f939ccc..72a7b75e 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -3,12 +3,12 @@ /** * auth.php * - * Copyright (c) 1999-2003 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$ + * @version $Id$ * @package squirrelmail */ @@ -43,7 +43,7 @@ function is_logged_in() { return; } else { global $PHP_SELF, $session_expired_post, - $session_expired_location; + $session_expired_location, $squirrelmail_language; /* First we store some information in the new session to prevent * information-loss. @@ -58,6 +58,7 @@ function is_logged_in() { sqsession_register($session_expired_location,'session_expired_location'); } include_once( SM_PATH . 'functions/display_messages.php' ); + set_up_language($squirrelmail_language, true); logout_error( _("You must be logged in to access this page.") ); exit; } @@ -218,4 +219,27 @@ function hmac_md5($data, $key='') { return $hmac; } +/** + * Fillin user and password based on SMTP auth settings. + * + * @param string $user Reference to SMTP username + * @param string $pass Reference to SMTP password (unencrypted) + */ +function get_smtp_user(&$user, &$pass) { + global $username, $smtp_auth_mech, + $smtp_sitewide_user, $smtp_sitewide_pass; + + if ($smtp_auth_mech == 'none') { + $user = ''; + $pass = ''; + } elseif ( isset($smtp_sitewide_user) && isset($smtp_sitewide_pass) ) { + $user = $smtp_sitewide_user; + $pass = $smtp_sitewide_pass; + } else { + global $key, $onetimepad; + $user = $username; + $pass = OneTimePadDecrypt($key, $onetimepad); + } +} + ?>