Mercurial > defr > drupal > core
diff modules/openid/openid.pages.inc @ 7:fff6d4c8c043 6.3
Drupal 6.3
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:30:28 +0100 |
parents | c1f4ac30525a |
children |
line wrap: on
line diff
--- a/modules/openid/openid.pages.inc Tue Dec 23 14:30:08 2008 +0100 +++ b/modules/openid/openid.pages.inc Tue Dec 23 14:30:28 2008 +0100 @@ -1,5 +1,5 @@ <?php -// $Id: openid.pages.inc,v 1.5 2008/01/30 22:11:22 goba Exp $ +// $Id: openid.pages.inc,v 1.5.2.1 2008/07/09 21:48:28 goba Exp $ /** * @file @@ -44,7 +44,7 @@ $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid); while ($identity = db_fetch_object($result)) { - $rows[] = array($identity->authname, l(t('Delete'), 'user/'. $account->uid .'/openid/delete/'. $identity->aid)); + $rows[] = array(check_plain($identity->authname), l(t('Delete'), 'user/'. $account->uid .'/openid/delete/'. $identity->aid)); } $output = theme('table', $header, $rows); @@ -80,12 +80,33 @@ } /** - * Menu callback; Delete the specified OpenID identity from the system. + * Present a confirmation form to delete the specified OpenID identity from the system. + * + * @ingroup forms + * @see openid_user_delete_form_submit() */ -function openid_user_delete($account, $aid = 0) { - db_query("DELETE FROM {authmap} WHERE uid=%d AND aid=%d AND module='openid'", $account->uid, $aid); +function openid_user_delete_form($form_state, $account, $aid = 0) { + $authname = db_result(db_query('SELECT authname FROM {authmap} WHERE uid = %d AND aid = %d', $account->uid, $aid)); + + $form = array(); + + $form['uid'] = array( + '#type' => 'value', + '#value' => $account->uid, + ); + + $form['aid'] = array( + '#type' => 'value', + '#value' => $aid, + ); + + return confirm_form($form, t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->uid .'/openid'); +} + +function openid_user_delete_form_submit($form, &$form_state) { + db_query("DELETE FROM {authmap} WHERE uid = %d AND aid = %d AND module = 'openid'", $form_state['values']['uid'], $form_state['values']['aid']); if (db_affected_rows()) { drupal_set_message(t('OpenID deleted.')); } - drupal_goto('user/'. $account->uid .'/openid'); + $form_state['redirect'] = 'user/'. $form_state['values']['uid'] .'/openid'; }