/[drupal]/contributions/modules/openid/openid.module
ViewVC logotype

Diff of /contributions/modules/openid/openid.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2.2.7, Wed Jan 30 20:43:20 2008 UTC revision 1.2.2.8, Wed Jul 9 19:46:44 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: openid.module,v 1.2.2.6 2007/10/14 20:29:27 walkah Exp $  // $Id: openid.module,v 1.2.2.7 2008/01/30 20:43:20 walkah Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 39  function openid_menu($may_cache) { Line 39  function openid_menu($may_cache) {
39          $items[] = array(          $items[] = array(
40            'path' => 'user/'. arg(1) .'/openid/delete',            'path' => 'user/'. arg(1) .'/openid/delete',
41            'title' => t('Delete OpenID'),            'title' => t('Delete OpenID'),
42            'callback' => 'openid_user_delete',            'callback' => 'drupal_get_form',
43            'callback arguments' => array($account),            'callback arguments' => array('openid_user_delete_form', $account),
44            'access' => $access,            'access' => $access,
45            'type' => MENU_CALLBACK            'type' => MENU_CALLBACK
46            );            );
# Line 170  function openid_user_identities($account Line 170  function openid_user_identities($account
170    
171    $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid);    $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid);
172    while ($identity = db_fetch_object($result)) {    while ($identity = db_fetch_object($result)) {
173      $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));
174    }    }
175    
176    $output = theme('table', $header, $rows);    $output = theme('table', $header, $rows);
# Line 199  function openid_user_add_validate($form_ Line 199  function openid_user_add_validate($form_
199    }    }
200  }  }
201    
202  function openid_user_delete($account, $aid = 0) {  /**
203    db_query("DELETE FROM {authmap} WHERE uid=%d AND aid=%d AND module='openid'", $account->uid, $aid);   * Present a confirmation form to delete the specified OpenID identity.
204     *
205     */
206    function openid_user_delete_form($account, $aid = 0) {
207      $authname = db_result(db_query('SELECT authname FROM {authmap} WHERE uid = %d AND aid = %d', $account->uid, $aid));
208    
209      $form = array();
210    
211      $form['uid'] = array(
212        '#type' => 'value',
213        '#value' => $account->uid,
214      );
215    
216      $form['aid'] = array(
217        '#type' => 'value',
218        '#value' => $aid,
219      );
220    
221      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');
222    }
223    
224    
225    function openid_user_delete_form_submit($form_id, $form_values) {
226      db_query("DELETE FROM {authmap} WHERE uid=%d AND aid=%d AND module='openid'", $form_values['uid'], $form_values['aid']);
227    if (db_affected_rows()) {    if (db_affected_rows()) {
228      drupal_set_message(t('OpenID deleted.'));      drupal_set_message(t('OpenID deleted.'));
229    }    }
230    drupal_goto('user/'. $account->uid .'/openid');    return 'user/'. $form_values['uid'] .'/openid';
231  }  }
232    
233  /**  /**

Legend:
Removed from v.1.2.2.7  
changed lines
  Added in v.1.2.2.8

  ViewVC Help
Powered by ViewVC 1.1.2