comparison 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
comparison
equal deleted inserted replaced
6:2cfdc3c92142 7:fff6d4c8c043
1 <?php 1 <?php
2 // $Id: openid.pages.inc,v 1.5 2008/01/30 22:11:22 goba Exp $ 2 // $Id: openid.pages.inc,v 1.5.2.1 2008/07/09 21:48:28 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * User page callbacks for the openid module. 6 * User page callbacks for the openid module.
7 */ 7 */
42 $header = array(t('OpenID'), t('Operations')); 42 $header = array(t('OpenID'), t('Operations'));
43 $rows = array(); 43 $rows = array();
44 44
45 $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid); 45 $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid);
46 while ($identity = db_fetch_object($result)) { 46 while ($identity = db_fetch_object($result)) {
47 $rows[] = array($identity->authname, l(t('Delete'), 'user/'. $account->uid .'/openid/delete/'. $identity->aid)); 47 $rows[] = array(check_plain($identity->authname), l(t('Delete'), 'user/'. $account->uid .'/openid/delete/'. $identity->aid));
48 } 48 }
49 49
50 $output = theme('table', $header, $rows); 50 $output = theme('table', $header, $rows);
51 $output .= drupal_get_form('openid_user_add'); 51 $output .= drupal_get_form('openid_user_add');
52 return $output; 52 return $output;
78 openid_begin($form_state['values']['openid_identifier'], $return_to); 78 openid_begin($form_state['values']['openid_identifier'], $return_to);
79 } 79 }
80 } 80 }
81 81
82 /** 82 /**
83 * Menu callback; Delete the specified OpenID identity from the system. 83 * Present a confirmation form to delete the specified OpenID identity from the system.
84 *
85 * @ingroup forms
86 * @see openid_user_delete_form_submit()
84 */ 87 */
85 function openid_user_delete($account, $aid = 0) { 88 function openid_user_delete_form($form_state, $account, $aid = 0) {
86 db_query("DELETE FROM {authmap} WHERE uid=%d AND aid=%d AND module='openid'", $account->uid, $aid); 89 $authname = db_result(db_query('SELECT authname FROM {authmap} WHERE uid = %d AND aid = %d', $account->uid, $aid));
90
91 $form = array();
92
93 $form['uid'] = array(
94 '#type' => 'value',
95 '#value' => $account->uid,
96 );
97
98 $form['aid'] = array(
99 '#type' => 'value',
100 '#value' => $aid,
101 );
102
103 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');
104 }
105
106 function openid_user_delete_form_submit($form, &$form_state) {
107 db_query("DELETE FROM {authmap} WHERE uid = %d AND aid = %d AND module = 'openid'", $form_state['values']['uid'], $form_state['values']['aid']);
87 if (db_affected_rows()) { 108 if (db_affected_rows()) {
88 drupal_set_message(t('OpenID deleted.')); 109 drupal_set_message(t('OpenID deleted.'));
89 } 110 }
90 drupal_goto('user/'. $account->uid .'/openid'); 111 $form_state['redirect'] = 'user/'. $form_state['values']['uid'] .'/openid';
91 } 112 }