### Eclipse Workspace Patch 1.0 #P drupal-contrib-cvs Index: modules/winliveid/winliveid.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/winliveid/winliveid.module,v retrieving revision 1.2 diff -u -r1.2 winliveid.module --- modules/winliveid/winliveid.module 19 Sep 2007 18:16:11 -0000 1.2 +++ modules/winliveid/winliveid.module 3 Jan 2008 08:37:02 -0000 @@ -18,7 +18,7 @@ 'title' => 'Windows Live Handler', 'page callback' => 'winliveid_handler', 'access callback' => TRUE - ); + ); $items['user/%user/winliveid'] = array( 'title' => 'Windows Live Indentity', @@ -26,7 +26,8 @@ 'page arguments' => array(1), 'access callback' => 'user_edit_access', 'access arguments' => array(1), - 'type' => MENU_LOCAL_TASK ); + 'type' => MENU_LOCAL_TASK + ); $items['user/%user/winliveid/delete'] = array( 'title' => 'Delete Windows Live ID', @@ -54,26 +55,23 @@ function winliveid_user($op, &$edit, &$account, $category = NULL) { if ($op == 'insert' && isset($_SESSION['winliveid_login'])) { - - //Save the userid - winliveid association in the authmap. - db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','winliveid')", $account->uid, $_SESSION['winliveid_login']); - unset($_SESSION['winlivid_login_activate']); + // Save the userid - winliveid association in the authmap. + db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','winliveid')", $account->uid, $_SESSION['winliveid_login']); + unset($_SESSION['winlivid_login_activate']); } elseif ($op == 'logout' && $_SESSION['winliveid_login']) { - - //Logout user from winlive by jumping to the logout url. - drupal_set_message('logging you out of Windows Live.'); + // Logout user from winlive by jumping to the logout url. + drupal_set_message('logging you out of Windows Live.'); unset($_SESSION['winliveid_login']); - $wll = _get_wll(); + $wll = _get_wll(); drupal_goto($wll->getLogoutURL()); } elseif ($op == 'login' && isset($_SESSION['winliveid_login_activate'])) { - - //first time login after windows live id authentication is successful - //associate the windows live id with the logged in user. - db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','winliveid')", $account->uid, $_SESSION['winliveid_login']); - drupal_set_message('Your account has been activated for Windows Live Login.'); - unset($_SESSION['winlivid_login_activate']); + // First time login after windows live id authentication is successful + // associate the windows live id with the logged in user. + db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','winliveid')", $account->uid, $_SESSION['winliveid_login']); + drupal_set_message('Your account has been activated for Windows Live Login.'); + unset($_SESSION['winlivid_login_activate']); } } @@ -84,41 +82,40 @@ function winliveid_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'user_login_block' || $form_id == 'user_login') { - // Alter the login block and the login page by including a link to windows // live id login url. If this is a first time activation attempt to use - // Windows live login with this account - request user to login or create + // Windows live login with this account - request user to login or create // new account to associate the currently logged in windows live id account // to an account on this site. - if( $_SESSION['winliveid_login_activate'] ) { - + if ($_SESSION['winliveid_login_activate']) { $form['winliveid_link'] = array( - '#value' => winliveid_user_signin_link(t('Login or Create New Account to use and activate Windows Live ID')), - '#weight' => 10); + '#value' => winliveid_user_signin_link(t('Login or Create New Account to use and activate Windows Live ID')), + '#weight' => 10 + ); } else { - - $form['winliveid_link'] = array('#value' => winliveid_user_link(), - '#weight' => 10); + $form['winliveid_link'] = array( + '#value' => winliveid_user_link(), + '#weight' => 10 + ); } } - elseif($form_id == 'user_register' && isset($_SESSION['winliveid_login'])) { - - // alter the registration form only if user has already attempted to login + elseif ($form_id == 'user_register' && isset($_SESSION['winliveid_login'])) { + // alter the registration form only if user has already attempted to login // via windows live id and found themselves not available on this website. - $form['message'] = array('#type'=>'item', - '#value'=> t('Select a profile name and enter in your email address below to continue with registration. You will be able to login with through Windows Live ID after your successful registration.'), - '#weight'=> -10); + $form['message'] = array( + '#type'=>'item', + '#value'=> t('Select a profile name and enter in your email address below to continue with registration. You will be able to login with through Windows Live ID after your successful registration.'), + '#weight'=> -10 + ); // If user_email_verification is off, hide the password field and just fill // with random password to avoid confusion. if (!variable_get('user_email_verification', TRUE)) { - $form['pass']['#type'] = 'hidden'; $form['pass']['#value'] = user_password(); } - $form['winliveid_auth'] = array('#type' => 'hidden', '#value' => $_SESSION['winliveid_login']); }