|
From: Greg M. <bli...@us...> - 2008-02-11 02:11:53
|
Update of /cvsroot/phpwebsite-comm/modules/openid/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16763/class Modified Files: OpenID_Runtime.php OpenID_User.php Log Message: More testing reveals more defects. Index: OpenID_User.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/openid/class/OpenID_User.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OpenID_User.php 10 Feb 2008 18:33:54 -0000 1.4 --- OpenID_User.php 11 Feb 2008 02:11:51 -0000 1.5 *************** *** 29,32 **** --- 29,34 ---- if (PHPWS_Settings::get('openid', 'allow_openid')) { + $tags = array(); + switch ($action) { *************** *** 173,176 **** --- 175,179 ---- // Send redirect header("Location: " . $redirect_url); + exit(); } *************** *** 323,341 **** $content = User_Action::successfulSignup($user); ! if ($user->id > 0) { /* Need to set password again to no_password_md5 password. The call to ! * successfulSignup above will call md5() on the password before saving. */ ! $user->setPassword(PHPWS_Settings::get('openid', 'no_password_md5'), false); ! $user->saveLocalAuthorization(); $db = new PHPWS_DB('openid_mapping'); ! $values['user_id'] = $user->id; $values['openid_identifier'] = $_SESSION['openid_identifier'][$_POST['session_key']]; $db->addValue($values); ! $db->insert(); ! ! unset($_SESSION['openid_identifier'][$_POST['session_key']]); } } --- 326,350 ---- $content = User_Action::successfulSignup($user); ! /* Need to look up ID of new user since passing $user by reference apparently doesn't work on PHP 4. */ ! $db = new PHPWS_DB('users'); ! $db->addWhere('username', $_POST['username']); ! $db->addColumn('id'); ! $user_id = $db->select('one'); ! if (!PHPWS_Error::logIfError($user_id) && !empty($user_id)) { /* Need to set password again to no_password_md5 password. The call to ! * successfulSignup above will call md5() on the password before saving. */ ! $created_user = new PHPWS_User($user_id); ! $created_user->setPassword(PHPWS_Settings::get('openid', 'no_password_md5'), false); ! $created_user->saveLocalAuthorization(); $db = new PHPWS_DB('openid_mapping'); ! $values['user_id'] = $user_id; $values['openid_identifier'] = $_SESSION['openid_identifier'][$_POST['session_key']]; $db->addValue($values); ! PHPWS_Error::logIfError($db->insert()); } + + unset($_SESSION['openid_identifier'][$_POST['session_key']]); } Index: OpenID_Runtime.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/openid/class/OpenID_Runtime.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OpenID_Runtime.php 10 Feb 2008 21:28:36 -0000 1.2 --- OpenID_Runtime.php 11 Feb 2008 02:11:51 -0000 1.3 *************** *** 93,96 **** --- 93,108 ---- Layout::add(PHPWS_Template::process($tags, 'openid', 'user.tpl')); } + + function clean() + { + if (Current_User::isLogged() && (@$_REQUEST['module'] == 'users') && (@$_REQUEST['action'] == 'admin') && + (@$_REQUEST['command'] == 'deleteUser') && isset($_REQUEST['user_id'])) + { + /* User being deleted. Remove from OpenID mapping table. */ + $db = new PHPWS_DB('openid_mapping'); + $db->addWhere('user_id', $_REQUEST['user_id']); + PHPWS_Error::logIfError($db->delete()); + } + } } |