From: <par...@us...> - 2009-02-09 16:10:20
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22725/functions Modified Files: userauth_functions.php Log Message: Return username and password (if available) when using HTTP auth Index: userauth_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/userauth_functions.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** userauth_functions.php 5 Feb 2009 22:30:49 -0000 1.9 --- userauth_functions.php 9 Feb 2009 16:10:11 -0000 1.10 *************** *** 5,9 **** function login_querys() { global $QUERY_STRING; ! // Remove the username, password, and action values. $querys = preg_replace('/(username|password|action)=[^&]+/', '', $QUERY_STRING); --- 5,9 ---- function login_querys() { global $QUERY_STRING; ! // Remove the username, password, and action values. $querys = preg_replace('/(username|password|action)=[^&]+/', '', $QUERY_STRING); *************** *** 19,30 **** function logout_querys() { global $QUERY_STRING; ! // Make sure the action is logout. $querys = preg_replace('/action=[^&]+/', 'action=logout', $QUERY_STRING); if ($querys == $QUERY_STRING) $querys .= '&action=logout'; ! // Remove references to the username or password. $querys = preg_replace('/(username|password)=[^&]+/', '', $querys); ! // Return the logout query string. $querys = preg_replace('/&&/', '', $querys); --- 19,30 ---- function logout_querys() { global $QUERY_STRING; ! // Make sure the action is logout. $querys = preg_replace('/action=[^&]+/', 'action=logout', $QUERY_STRING); if ($querys == $QUERY_STRING) $querys .= '&action=logout'; ! // Remove references to the username or password. $querys = preg_replace('/(username|password)=[^&]+/', '', $querys); ! // Return the logout query string. $querys = preg_replace('/&&/', '', $querys); *************** *** 45,55 **** function user_login() { global $phpiCal_config, $locked_map; ! // Initialize return values. $invalid_login = false; $username = ''; $password = ''; ! // If not HTTP authenticated, try login via cookies or the web page. if (isset($_SERVER['PHP_AUTH_USER'])) { return array($username, $password, $invalid_login); } --- 45,58 ---- function user_login() { global $phpiCal_config, $locked_map; ! // Initialize return values. $invalid_login = false; $username = ''; $password = ''; ! // If not HTTP authenticated, try login via cookies or the web page. if (isset($_SERVER['PHP_AUTH_USER'])) { + $username = $_SERVER['PHP_AUTH_USER']; + if (isset($_SERVER['PHP_AUTH_PW'])) $password = $_SERVER['PHP_AUTH_PW']; + return array($username, $password, $invalid_login); } *************** *** 63,67 **** } } ! // Look for session authentication. if ($phpiCal_config->login_cookies != 'yes') { --- 66,70 ---- } } ! // Look for session authentication. if ($phpiCal_config->login_cookies != 'yes') { *************** *** 75,91 **** } } ! // Look for a new username and password. ! # Should only take these from post? # if (isset($_GET['username'], $_GET['password'])){ # $username = $_GET['username']; # $password = $_GET['password']; ! # } else ! if (isset($_POST['username'], $_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; } ! // Check to make sure the username and password is valid. if (!array_key_exists("$username:$password", $locked_map)) { --- 78,94 ---- } } ! // Look for a new username and password. ! # Should only take these from post? # if (isset($_GET['username'], $_GET['password'])){ # $username = $_GET['username']; # $password = $_GET['password']; ! # } else ! if (isset($_POST['username'], $_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; } ! // Check to make sure the username and password is valid. if (!array_key_exists("$username:$password", $locked_map)) { *************** *** 94,98 **** return array($username, $password, true); } ! // Set the login cookie or session authentication values. if ($login_cookies == 'yes') { --- 97,101 ---- return array($username, $password, true); } ! // Set the login cookie or session authentication values. if ($login_cookies == 'yes') { *************** *** 103,107 **** $_SESSION['password'] = $password; } ! // Return the username and password. return array($username, $password, $invalid_login); --- 106,110 ---- $_SESSION['password'] = $password; } ! // Return the username and password. return array($username, $password, $invalid_login); *************** *** 114,118 **** function user_logout() { global $phpiCal_config; ! // Clear the login cookie or session authentication values. if ($phpiCal_config->login_cookies == 'yes') { --- 117,121 ---- function user_logout() { global $phpiCal_config; ! // Clear the login cookie or session authentication values. if ($phpiCal_config->login_cookies == 'yes') { *************** *** 124,133 **** setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0); } ! // Clear the session authentication values. unset($_SESSION['username']); unset($_SESSION['password']); } ! // Return empty username and password. return array('', ''); --- 127,136 ---- setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0); } ! // Clear the session authentication values. unset($_SESSION['username']); unset($_SESSION['password']); } ! // Return empty username and password. return array('', ''); |