Index: openid_ax.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_ax/openid_ax.install,v retrieving revision 1.6 diff -u -r1.6 openid_ax.install --- openid_ax.install 10 Aug 2008 18:33:57 -0000 1.6 +++ openid_ax.install 23 Sep 2008 19:37:05 -0000 @@ -53,17 +53,17 @@ 'fields' => array( 'uid' => array( 'type' => 'int', - 'size'=>'normal', + 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('{users}.uid') ), 'persona_id' => array( 'type' => 'int', - 'size'=>'normal', + 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, - 'default'=>0, + 'default' => 0, 'description' => t('Id of the persona') ), 'persona_name' => array( @@ -75,7 +75,7 @@ ), ), 'indexes' => array('uid' => array('uid')), - 'primary key' => array('uid','persona_name') + 'primary key' => array('uid', 'persona_name') ); $schema['openid_ax_values'] = array( @@ -87,26 +87,26 @@ 'not null' => TRUE, 'description' => t('Primary key: Unique value id') ), - 'ax_id' => array( + 'ax_id' => array( 'type' => 'int', - 'size'=>'normal', + 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('ax_id from {openid_ax_attributes}.ax_id') ), 'uid' => array( 'type' => 'int', - 'size'=>'normal', + 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('uid from {users}.uid') ), 'persona_id' => array( 'type' => 'int', - 'size'=>'normal', + 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, - 'default'=>0, + 'default' => 0, 'description' => t('persona_id from {openid_ax_persona}.persona_id') ), 'ax_values' => array( @@ -117,8 +117,8 @@ ), 'server' => array( 'type' => 'int', - 'size'=>'tiny', - 'length'=>1, + 'size' => 'tiny', + 'length' => 1, 'not null' => TRUE, 'default' => 1 ) @@ -134,7 +134,7 @@ */ function _openid_ax_attributes_fill() { $identifiers = _openid_ax_attributes_identifiers(); - $identifiers_string = implode("'),('",$identifiers); + $identifiers_string = implode("'),('", $identifiers); $query = "INSERT INTO {openid_ax_attributes} (identifier) VALUES ('$identifiers_string') "; db_query($query); return; @@ -148,70 +148,70 @@ */ function _openid_ax_attributes_identifiers() { $identifiers = array( - 'http://openid.net/schema/namePerson/prefix', - 'http://openid.net/schema/namePerson/first', - 'http://openid.net/schema/namePerson/last', - 'http://openid.net/schema/namePerson/middle', - 'http://openid.net/schema/namePerson/suffix', - 'http://openid.net/schema/namePerson/friendly', - 'http://openid.net/schema/person/guid', - 'http://openid.net/schema/birthDate/birthYear', - 'http://openid.net/schema/birthDate/birthMonth', - 'http://openid.net/schema/birthDate/birthday', - 'http://openid.net/schema/gender', - 'http://openid.net/schema/language/pref', - 'http://openid.net/schema/contact/phone/default', - 'http://openid.net/schema/contact/phone/home', - 'http://openid.net/schema/contact/phone/business', - 'http://openid.net/schema/contact/phone/cell', - 'http://openid.net/schema/contact/phone/fax', - 'http://openid.net/schema/contact/postaladdress/home', - 'http://openid.net/schema/contact/postaladdressadditional/home', - 'http://openid.net/schema/contact/city/home', - 'http://openid.net/schema/contact/state/home', - 'http://openid.net/schema/contact/country/home', - 'http://openid.net/schema/contact/postalcode/home', - 'http://openid.net/schema/contact/postaladdress/business', - 'http://openid.net/schema/contact/postaladdressadditional/business', - 'http://openid.net/schema/contact/city/business', - 'http://openid.net/schema/contact/state/business', - 'http://openid.net/schema/contact/country/business', - 'http://openid.net/schema/contact/postalcode/business', - 'http://openid.net/schema/contact/IM/default', - 'http://openid.net/schema/contact/IM/AIM', - 'http://openid.net/schema/contact/IM/ICQ', - 'http://openid.net/schema/contact/IM/MSN', - 'http://openid.net/schema/contact/IM/Yahoo', - 'http://openid.net/schema/contact/IM/Jabber', - 'http://openid.net/schema/contact/IM/Skype', - 'http://openid.net/schema/contact/internet/email', - 'http://openid.net/schema/contact/web/default', - 'http://openid.net/schema/contact/web/blog', - 'http://openid.net/schema/contact/web/Linkedin', - 'http://openid.net/schema/contact/web/Amazon', - 'http://openid.net/schema/contact/web/Flickr', - 'http://openid.net/schema/contact/web/Delicious', - 'http://openid.net/schema/company/name', - 'http://openid.net/schema/company/title', - 'http://openid.net/schema/media/spokenname', - 'http://openid.net/schema/media/greeting/audio', - 'http://openid.net/schema/media/greeting/video', - 'http://openid.net/schema/media/biography', - 'http://openid.net/schema/media/image', - 'http://openid.net/schema/media/image/16x16', - 'http://openid.net/schema/media/image/32x32', - 'http://openid.net/schema/media/image/48x48', - 'http://openid.net/schema/media/image/64x64', - 'http://openid.net/schema/media/image/80x80', - 'http://openid.net/schema/media/image/128x128', - 'http://openid.net/schema/media/image/160x120', - 'http://openid.net/schema/media/image/320x240', - 'http://openid.net/schema/media/image/640x480', - 'http://openid.net/schema/media/image/120x160', - 'http://openid.net/schema/media/image/240x320', - 'http://openid.net/schema/media/image/480x640', - 'http://openid.net/schema/media/image/favicon', - 'http://openid.net/schema/timezone' + 'http://openid.net/schema/namePerson/prefix', + 'http://openid.net/schema/namePerson/first', + 'http://openid.net/schema/namePerson/last', + 'http://openid.net/schema/namePerson/middle', + 'http://openid.net/schema/namePerson/suffix', + 'http://openid.net/schema/namePerson/friendly', + 'http://openid.net/schema/person/guid', + 'http://openid.net/schema/birthDate/birthYear', + 'http://openid.net/schema/birthDate/birthMonth', + 'http://openid.net/schema/birthDate/birthday', + 'http://openid.net/schema/gender', + 'http://openid.net/schema/language/pref', + 'http://openid.net/schema/contact/phone/default', + 'http://openid.net/schema/contact/phone/home', + 'http://openid.net/schema/contact/phone/business', + 'http://openid.net/schema/contact/phone/cell', + 'http://openid.net/schema/contact/phone/fax', + 'http://openid.net/schema/contact/postaladdress/home', + 'http://openid.net/schema/contact/postaladdressadditional/home', + 'http://openid.net/schema/contact/city/home', + 'http://openid.net/schema/contact/state/home', + 'http://openid.net/schema/contact/country/home', + 'http://openid.net/schema/contact/postalcode/home', + 'http://openid.net/schema/contact/postaladdress/business', + 'http://openid.net/schema/contact/postaladdressadditional/business', + 'http://openid.net/schema/contact/city/business', + 'http://openid.net/schema/contact/state/business', + 'http://openid.net/schema/contact/country/business', + 'http://openid.net/schema/contact/postalcode/business', + 'http://openid.net/schema/contact/IM/default', + 'http://openid.net/schema/contact/IM/AIM', + 'http://openid.net/schema/contact/IM/ICQ', + 'http://openid.net/schema/contact/IM/MSN', + 'http://openid.net/schema/contact/IM/Yahoo', + 'http://openid.net/schema/contact/IM/Jabber', + 'http://openid.net/schema/contact/IM/Skype', + 'http://openid.net/schema/contact/internet/email', + 'http://openid.net/schema/contact/web/default', + 'http://openid.net/schema/contact/web/blog', + 'http://openid.net/schema/contact/web/Linkedin', + 'http://openid.net/schema/contact/web/Amazon', + 'http://openid.net/schema/contact/web/Flickr', + 'http://openid.net/schema/contact/web/Delicious', + 'http://openid.net/schema/company/name', + 'http://openid.net/schema/company/title', + 'http://openid.net/schema/media/spokenname', + 'http://openid.net/schema/media/greeting/audio', + 'http://openid.net/schema/media/greeting/video', + 'http://openid.net/schema/media/biography', + 'http://openid.net/schema/media/image', + 'http://openid.net/schema/media/image/16x16', + 'http://openid.net/schema/media/image/32x32', + 'http://openid.net/schema/media/image/48x48', + 'http://openid.net/schema/media/image/64x64', + 'http://openid.net/schema/media/image/80x80', + 'http://openid.net/schema/media/image/128x128', + 'http://openid.net/schema/media/image/160x120', + 'http://openid.net/schema/media/image/320x240', + 'http://openid.net/schema/media/image/640x480', + 'http://openid.net/schema/media/image/120x160', + 'http://openid.net/schema/media/image/240x320', + 'http://openid.net/schema/media/image/480x640', + 'http://openid.net/schema/media/image/favicon', + 'http://openid.net/schema/timezone' ); return $identifiers; -} +} \ No newline at end of file Index: openid_ax.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_ax/openid_ax.module,v retrieving revision 1.8 diff -u -r1.8 openid_ax.module --- openid_ax.module 10 Aug 2008 18:33:57 -0000 1.8 +++ openid_ax.module 23 Sep 2008 19:37:05 -0000 @@ -15,56 +15,61 @@ 'type' => MENU_CALLBACK, 'file' => 'openid_ax.pages.inc', 'access callback' => TRUE - ); + ); $items['openid/ax/continue'] = array( 'title' => 'OpenID Attribute Exchange', 'page callback' => 'openid_ax_continue', 'access callback' => TRUE, 'type' => MENU_CALLBACK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['openid/ax/send'] = array( 'title' => 'OpenID Attribute Exchange', 'page callback' => 'openid_ax_send', 'access callback' => TRUE, 'type' => MENU_CALLBACK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['user/%user/persona'] = array( 'title' => 'OpenID AX Personas', 'page callback' => 'openid_ax_persona', + 'page arguments' => array(1), 'access callback' => TRUE, 'type' => MENU_LOCAL_TASK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['user/%user/persona/create'] = array( 'title' => 'Create OpenID AX Personas', 'page callback' => 'openid_ax_create_persona', + 'page arguments' => array(1), 'access callback' => TRUE, 'type' => MENU_LOCAL_TASK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['user/%user/persona/manage'] = array( 'title' => 'Manage OpenID AX Personas', 'page callback' => 'openid_ax_manage_personas', + 'page arguments' => array(1), 'access callback' => TRUE, 'type' => MENU_LOCAL_TASK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['user/%user/persona/rename'] = array( 'title' => 'Rename OpenID AX Personas', 'page callback' => 'openid_ax_rename_personas', + 'page arguments' => array(1), 'access callback' => TRUE, 'type' => MENU_CALLBACK, 'file' => 'openid_ax.pages.inc' - ); + ); $items['user/%user/persona/delete'] = array( 'title' => 'Delete OpenID AX Personas', 'page callback' => 'openid_ax_persona_delete', + 'page arguments' => array(1), 'access callback' => TRUE, 'type' => MENU_CALLBACK, 'file' => 'openid_ax.pages.inc' - ); + ); return $items; } Index: openid_ax.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_ax/openid_ax.inc,v retrieving revision 1.13 diff -u -r1.13 openid_ax.inc --- openid_ax.inc 10 Aug 2008 18:33:57 -0000 1.13 +++ openid_ax.inc 23 Sep 2008 19:37:05 -0000 @@ -11,10 +11,12 @@ * TODO ANSHU Check at the end of code if we need this function */ function openid_ax_required($request) { - if(in_array('http://openid.net/srv/ax/1.0',$request)) - return TRUE; - else - return FALSE; + if (in_array('http://openid.net/srv/ax/1.0', $request)) { + return TRUE; + } + else { + return FALSE; + } } /** @@ -29,17 +31,17 @@ function openid_ax_process($request) { $alias = _openid_ax_namespace_alias($request); $request_ax = _openid_ax_namespace_request($request); - if(isset($request_ax[openid.$alias.mode])) { - switch($request_ax[openid.$alias.mode]) { - case 'fetch_request': - $response_ax = openid_ax_fetch_request($request_ax); - module_load_include('pages.inc','openid_ax'); - return drupal_get_form('openid_ax_form',$response_ax); - break; - case 'store_request': - return openid_ax_store_request($request_ax); - break; - } + if (isset($request_ax['openid'. $alias .'mode'])) { + switch ($request_ax['openid'. $alias .'mode']) { + case 'fetch_request': + $response_ax = openid_ax_fetch_request($request_ax); + module_load_include('pages.inc', 'openid_ax'); + return drupal_get_form('openid_ax_form', $response_ax); + break; + case 'store_request': + return openid_ax_store_request($request_ax); + break; + } } //if openid.ax.mode is not set, do nothing return; @@ -53,17 +55,17 @@ * A string containing initial and trailing dots. */ function _openid_ax_namespace_alias($request) { - foreach($request as $key => $val) { - $request[$key] = urldecode($val); - } - $alias_key = array_search('http://openid.net/srv/ax/1.0',$request); - if(isset($request['openid.return_to'])) { + foreach ($request as $key => $val) { + $request[$key] = urldecode($val); + } + $alias_key = array_search('http://openid.net/srv/ax/1.0', $request); + if (isset($request['openid.return_to'])) { $_SESSION['openid_ax']['return_to'] = $request['openid.return_to']; } - if(isset($request['openid.realm'])) { + if (isset($request['openid.realm'])) { $_SESSION['openid_ax']['realm'] = $request['openid.realm']; } - $alias = strrchr($alias_key,'.');//returns .alias + $alias = strrchr($alias_key, '.');//returns .alias $alias .= '.'; return $alias; } @@ -76,15 +78,15 @@ * Associative array with only requests containing openid.ns.axalias */ function _openid_ax_namespace_request($request) { - foreach($request as $key => $val) { - $request[$key] = urldecode($val); - } - $alias_key = array_search('http://openid.net/srv/ax/1.0',$request); + foreach ($request as $key => $val) { + $request[$key] = urldecode($val); + } + $alias_key = array_search('http://openid.net/srv/ax/1.0', $request); $request_ax = array(); $request_ax[$alias_key] = $request[$alias_key]; $alias = _openid_ax_namespace_alias($request); - foreach($request as $var=>$val) { - if(strpos($var,$alias)) { + foreach ($request as $var => $val) { + if (strpos($var, $alias)) { $request_ax[$var] = $val; } } @@ -103,10 +105,10 @@ function _openid_ax_identifiers($request_ax) { $alias = _openid_ax_namespace_alias($request_ax); $identifier = array(); - foreach($request_ax as $var=>$val) { - if(strpos($var,'type')) { - $identifier[] = mysql_escape_string($val); - } + foreach ($request_ax as $var => $val) { + if (strpos($var, 'type')) { + $identifier[] = mysql_escape_string($val); + } } return $identifier; } @@ -119,10 +121,10 @@ * Associative array containing requested identifers=>ax_id * */ function _openid_ax_id($identifier) { - $identifiers = (implode("','",$identifier)); - $identifiers_id = db_query("SELECT * FROM {openid_ax_attributes} WHERE identifier IN ('$identifiers')"); - while($row = db_fetch_array($identifiers_id)) { - $attr_axid[$row['identifier']] = $row['ax_id']; + $identifiers = (implode("','", $identifier)); + $identifiers_id = db_query("SELECT * FROM {openid_ax_attributes} WHERE identifier IN ('%s')", $identifiers); + while ($row = db_fetch_array($identifiers_id)) { + $attr_axid[$row['identifier']] = $row['ax_id']; } return $attr_axid; @@ -143,68 +145,68 @@ drupal_goto('user/login', 'destination=openid/ax/continue'); } $attr_axid = _openid_ax_id(_openid_ax_identifiers($request_ax)); - $values = db_query("SELECT a.ax_values, ax_id FROM {openid_ax_values} a WHERE uid=%d AND ax_id IN (".implode(",",$attr_axid).")",$user->uid); + $values = db_query("SELECT a.ax_values, ax_id FROM {openid_ax_values} a WHERE uid=%d AND ax_id IN (". implode(",", $attr_axid) .")", $user->uid); $axid_value = array(); - while($axvalues = db_fetch_array($values)) { - $axid_value[] = $axvalues['ax_id']; - $attribute_value[] = $axvalues['ax_values']; + while ($axvalues = db_fetch_array($values)) { + $axid_value[] = $axvalues['ax_id']; + $attribute_value[] = $axvalues['ax_values']; } $ax_response = array(); $alias = _openid_ax_namespace_alias($request_ax); - $alias_key = array_search('http://openid.net/srv/ax/1.0',$request_ax); + $alias_key = array_search('http://openid.net/srv/ax/1.0', $request_ax); $ax_response[$alias_key] = $request_ax[$alias_key]; - $ax_response['openid'.$alias.'mode'] = 'fetch_response'; + $ax_response['openid'. $alias .'mode'] = 'fetch_response'; $count_alias = array(); - foreach($request_ax as $var=>$val) { - if(strpos($var,'type')) { - $ax_response[$var] = $val; - } - elseif(strpos($var,'count')) { - $count_alias[strrchr($var,'.')] = $val; - } - } - foreach($request_ax as $var=>$val) { - $response_val = array(); - $key_value = (str_replace('type','value',$var)); - $key_count = (str_replace('type','count',$var)); - $axid_keys = array_keys($axid_value,$attr_axid[$val]); - if(count($axid_keys)>1) { - foreach($axid_keys as $key) { - $response_val[] = $attribute_value[$key]; - } - } - else { - $response_val[] = $attribute_value[$axid_keys[0]]; - } - if(strpos($var,'type')) { - $attr_alias = strrchr($var,'.'); - //If a value was not supplied or available from the user, - //the associated "openid.ax.value." field SHOULD NOT be included by the OP in the fetch response. - //An "openid.ax.count." with a value of "0" together with its corresponding - //"openid.ax.type." field MAY be included to explicitly state - //that no values are provided for an attribute. - if($response_val[0] != ''||1) {//TODO Check what conditions to be used here! - //The name of array_key_exists() function is key_exists() in PHP 4.0.6. Drupal requires min 4.3.3 - if((array_key_exists($attr_alias,$count_alias))===FALSE) { - $ax_response[$key_value] = $response_val[0]; - } - else { - $num = count($response_val); - //OpenID Providers MAY return less than or the exact number of values speficied by this field - //for the associated attribute, - //but MUST NOT return more than the number of requested values for the attribute. - if($count_alias[$attr_alias] != 'unlimited') { - ($num>($count_alias[$attr_alias]))?$num = $count_alias[$attr_alias]:$num; - } - $ax_response[$key_count] = $num; - for($i=0;$i<$num;$i++) { - $ax_response[$key_value.'.'.($i+1)] = $response_val[$i]; - } - } - } - else { - $ax_response[$key_count] = 0; - } + foreach ($request_ax as $var => $val) { + if (strpos($var, 'type')) { + $ax_response[$var] = $val; + } + elseif (strpos($var, 'count')) { + $count_alias[strrchr($var, '.')] = $val; + } + } + foreach ($request_ax as $var => $val) { + $response_val = array(); + $key_value = (str_replace('type', 'value', $var)); + $key_count = (str_replace('type', 'count', $var)); + $axid_keys = array_keys($axid_value, $attr_axid[$val]); + if (count($axid_keys) > 1) { + foreach ($axid_keys as $key) { + $response_val[] = $attribute_value[$key]; + } + } + else { + $response_val[] = $attribute_value[$axid_keys[0]]; + } + if (strpos($var, 'type')) { + $attr_alias = strrchr($var, '.'); + //If a value was not supplied or available from the user, + //the associated "openid.ax.value." field SHOULD NOT be included by the OP in the fetch response. + //An "openid.ax.count." with a value of "0" together with its corresponding + //"openid.ax.type." field MAY be included to explicitly state + //that no values are provided for an attribute. + if ($response_val[0] != ''||1) {//TODO Check what conditions to be used here! + //The name of array_key_exists() function is key_exists() in PHP 4.0.6. Drupal requires min 4.3.3 + if ((array_key_exists($attr_alias, $count_alias)) === FALSE) { + $ax_response[$key_value] = $response_val[0]; + } + else { + $num = count($response_val); + //OpenID Providers MAY return less than or the exact number of values speficied by this field + //for the associated attribute, + //but MUST NOT return more than the number of requested values for the attribute. + if ($count_alias[$attr_alias] != 'unlimited') { + ($num > ($count_alias[$attr_alias])) ? $num = $count_alias[$attr_alias] : $num; + } + $ax_response[$key_count] = $num; + for ($i = 0; $i < $num; $i++) { + $ax_response[$key_value .'.'. ($i+1)] = $response_val[$i]; + } + } + } + else { + $ax_response[$key_count] = 0; + } } } return $ax_response; @@ -224,44 +226,44 @@ $_SESSION['openid_ax']['request'] = $request_ax; drupal_goto('user/login', 'destination=openid/ax/continue'); } - return drupal_get_form('openid_store_info_form',$request_ax); + return drupal_get_form('openid_store_info_form', $request_ax); } function openid_store_info_form(&$form_state, &$request_ax) { $form = array(); $realm = $form_state['post']['openid_realm']; - if($realm == '') { - $realm = $_SESSION['openid_ax']['realm']; - unset($_SESSION['openid_ax']['realm']); + if ($realm == '') { + $realm = $_SESSION['openid_ax']['realm']; + unset($_SESSION['openid_ax']['realm']); } $form['intro'] = array( '#type' => 'markup', '#value' => t('%site is requesting to store the following information into your profile. You want to continue?', array('%site' => $realm)) ); - foreach($request_ax as $key => $value) { - if(strstr($key,'value')){ - $form[$key] = array( - '#type' => 'textfield', - '#title' => t(substr(strrchr($key,'value.'),6)), - '#value' => $value, - '#size' => 14, - '#maxlength' => 100 - ); + foreach ($request_ax as $key => $value) { + if (strstr($key, 'value')) { + $form[$key] = array( + '#type' => 'textfield', + '#title' => t(substr(strrchr($key, 'value.'), 6)), + '#value' => $value, + '#size' => 14, + '#maxlength' => 100 + ); } else { $form[$key] = array( - '#type' => 'hidden', - '#title' => $key, - '#value' => $value - ); + '#type' => 'hidden', + '#title' => $key, + '#value' => $value + ); } } $essentials = array( 'openid.return_to' => $form_state['post']['openid.return_to'], 'openid.realm' => $realm ); - foreach($essentials as $key => $value) { - $form[$key] = array ( + foreach ($essentials as $key => $value) { + $form[$key] = array( '#type' => 'hidden', '#name' => $key, '#value' => $value @@ -293,57 +295,57 @@ global $user; $request_ax = $form_state; $alias = _openid_ax_namespace_alias($request_ax); - if($user_agreed){ + if ($user_agreed) { $attr_axid = _openid_ax_id(_openid_ax_identifiers($request_ax)); - foreach($request_ax as $var=>$val) { - $attr_alias = strrchr($var,'.'); - if(strpos($var,'type')) { - $ax_values[$attr_axid[$val]] = $attr_alias; - } - elseif(strpos($var,'count')) { - $count_alias[$attr_alias] = $val; - } - elseif(strpos($var,'value')) { - if(!(strpos(substr(strstr($var,'value.'),6),'.'))) { - $ax_values[array_search($attr_alias,$ax_values)] = $val; - } - else { - $attr_alias_count = $attr_alias; - $count_pos = strrpos($var,$attr_alias); - $var1 = substr($var,0,$count_pos); - $attr_alias = strrchr($var1,'.'); - $ax_values[array_search($attr_alias,$ax_values).$attr_alias_count] = $val; - $to_remove[] = array_search($attr_alias,$ax_values); - } - } - } - foreach($to_remove as $del) { - unset($ax_values[$del]); - } - foreach($ax_values as $ax_id=>$value) { - $value = trim($value); - if($value != '') { - $res = db_query("INSERT INTO {openid_ax_values} (ax_id, uid, ax_values) VALUES ('%d','%d','%s')",$ax_id,$user->uid,$value); - if($res) { - $result[] = $res; - } - } + foreach ($request_ax as $var => $val) { + $attr_alias = strrchr($var, '.'); + if (strpos($var, 'type')) { + $ax_values[$attr_axid[$val]] = $attr_alias; + } + elseif (strpos($var, 'count')) { + $count_alias[$attr_alias] = $val; + } + elseif (strpos($var, 'value')) { + if (!(strpos(substr(strstr($var, 'value.'), 6), '.'))) { + $ax_values[array_search($attr_alias, $ax_values)] = $val; + } + else { + $attr_alias_count = $attr_alias; + $count_pos = strrpos($var, $attr_alias); + $var1 = substr($var, 0, $count_pos); + $attr_alias = strrchr($var1, '.'); + $ax_values[array_search($attr_alias, $ax_values) . $attr_alias_count] = $val; + $to_remove[] = array_search($attr_alias, $ax_values); + } + } + } + foreach ($to_remove as $del) { + unset($ax_values[$del]); + } + foreach ($ax_values as $ax_id => $value) { + $value = trim($value); + if ($value != '') { + $res = db_query("INSERT INTO {openid_ax_values} (ax_id, uid, ax_values) VALUES ('%d','%d','%s')", $ax_id, $user->uid, $value); + if ($res) { + $result[] = $res; + } + } } - $alias_key = array_search('http://openid.net/srv/ax/1.0',$request_ax); + $alias_key = array_search('http://openid.net/srv/ax/1.0', $request_ax); $ax_store_response[$alias_key] = $request_ax[$alias_key]; - if(count($result) == count($ax_values)) { - $ax_store_response['openid'.$alias.'mode'] = 'store_response_success'; + if (count($result) == count($ax_values)) { + $ax_store_response['openid'. $alias .'mode'] = 'store_response_success'; } else { - $ax_store_response['openid'.$alias.'mode'] = 'store_response_failure'; + $ax_store_response['openid'. $alias .'mode'] = 'store_response_failure'; } } else { - $alias_key = array_search('http://openid.net/srv/ax/1.0',$request_ax); + $alias_key = array_search('http://openid.net/srv/ax/1.0', $request_ax); $ax_store_response[$alias_key] = $request_ax[$alias_key]; - $ax_store_response['openid'.$alias.'mode'] = 'store_response_failure'; + $ax_store_response['openid'. $alias .'mode'] = 'store_response_failure'; } - $destination = ($request_ax['openid.return_to'] != '')?$request_ax['openid.return_to']:$request_ax['openid.realm']; + $destination = ($request_ax['openid.return_to'] != '') ? $request_ax['openid.return_to'] : $request_ax['openid.realm']; drupal_goto($destination, $ax_store_response) ; } @@ -351,61 +353,62 @@ function openid_ax_fetch_response($response) { $alias = _openid_ax_namespace_alias($response); $ax_user_response = _openid_ax_namespace_request($response); - foreach($ax_user_response as $key => $val) { - if(strpos($key,'value.')) { - //value.alias.1 or value.alias format - $var_name = substr(strstr($key,'value.'),6); - if(strpos($var_name,'.')) { - $var_name_pure = substr($var_name,0,strpos($var_name,'.')); - } - else { - $var_name_pure = $var_name; - } - $property_count[$var_name_pure]++; - } - } - if(strstr($response['op'],'No')) { - foreach($property_count as $property => $value) { - if($value == 1) { - unset($ax_user_response['openid'.$alias.'value.'.$property]); - $ax_user_response['openid'.$alias.'count.'.$property] = 0; - } - else { - for($key=0;$key<$value;$key++) { - unset($ax_user_response['openid'.$alias.'value.'.$property.'.'.($key+1)]); - } - $ax_user_response['openid'.$alias.'count.'.$property] = 0; - } - } + foreach ($ax_user_response as $key => $val) { + if (strpos($key, 'value.')) { + //value.alias.1 or value.alias format + $var_name = substr(strstr($key, 'value.'), 6); + if (strpos($var_name, '.')) { + $var_name_pure = substr($var_name, 0, strpos($var_name, '.')); + } + else { + $var_name_pure = $var_name; + } + $property_count[$var_name_pure]++; + } + } + if (strstr($response['op'], 'No')) { + foreach ($property_count as $property => $value) { + if ($value == 1) { + unset($ax_user_response['openid'. $alias .'value.'. $property]); + $ax_user_response['openid'. $alias .'count.'. $property] = 0; + } + else { + for ($key = 0; $key < $value; $key++) { + unset($ax_user_response['openid'. $alias .'value.'. $property .'.'. ($key+1)]); + } + $ax_user_response['openid'. $alias .'count.'. $property] = 0; + } + } } else{ - foreach($property_count as $property => $value) { - if($value == 1) { - if($ax_user_response['openid'.$alias.'value.'.$property]=='') { - unset($ax_user_response['openid'.$alias.'value.'.$property]); - $ax_user_response['openid'.$alias.'count.'.$property] = 0; - } - } - else { - //$property_set_indexes = indexes of all value.alias.num's which are != '' - $new_key=0;$old_key=0; - for(;$old_key<=$value;$old_key++) { - if(trim($ax_user_response['openid'.$alias.'value.'.$property.'.'.$old_key]) != '') { - $property_set_indexes[$new_key]=$old_key; - $new_key++; - } - } - if($new_key != $old_key) { - for($key=0;$key<$new_key;$key++) { - $ax_user_response['openid'.$alias.'value.'.$property.'.'.($key+1)] = $ax_user_response['openid'.$alias.'value.'.$property.'.'.$property_set_indexes[$key]]; - } - for($key=0;$key<$old_key-$new_key;$key++) { - unset($ax_user_response['openid'.$alias.'value.'.$property.'.'.($new_key+$key+1)]); - } - $ax_user_response['openid'.$alias.'count.'.$property] = $new_key; - } - } - } + foreach ($property_count as $property => $value) { + if ($value == 1) { + if ($ax_user_response['openid'. $alias .'value.'. $property] == '') { + unset($ax_user_response['openid'. $alias .'value.'. $property]); + $ax_user_response['openid'. $alias .'count.'. $property] = 0; + } + } + else { + //$property_set_indexes = indexes of all value.alias.num's which are != '' + $new_key = 0; + $old_key = 0; + for (; $old_key <= $value; $old_key++) { + if (trim($ax_user_response['openid'. $alias .'value.'. $property .'.'. $old_key]) != '') { + $property_set_indexes[$new_key] = $old_key; + $new_key++; + } + } + if ($new_key != $old_key) { + for ($key = 0; $key < $new_key; $key++) { + $ax_user_response['openid'. $alias .'value.'. $property .'.'. ($key+1)] = $ax_user_response['openid'. $alias .'value.'. $property .'.'. $property_set_indexes[$key]]; + } + for ($key = 0; $key < $old_key - $new_key; $key++) { + unset($ax_user_response['openid'. $alias .'value.'. $property .'.'. ($new_key+$key+1)]); + } + $ax_user_response['openid'. $alias .'count.'. $property] = $new_key; + } + } + } } return $ax_user_response; -} +} \ No newline at end of file Index: openid_ax.pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_ax/openid_ax.pages.inc,v retrieving revision 1.16 diff -u -r1.16 openid_ax.pages.inc --- openid_ax.pages.inc 10 Aug 2008 18:33:57 -0000 1.16 +++ openid_ax.pages.inc 23 Sep 2008 19:37:05 -0000 @@ -41,35 +41,35 @@ /** * Form for user interaction before sending AX values to RP */ -function openid_ax_form(&$form_state,&$ax_response) { +function openid_ax_form(&$form_state, &$ax_response) { global $user; $form_state['ax_response'] = $ax_response; $realm = $form_state['post']['openid_realm']; - if($realm == '') { - $realm = $_SESSION['openid_ax']['realm']; - unset($_SESSION['openid_ax']['realm']); + if ($realm == '') { + $realm = $_SESSION['openid_ax']['realm']; + unset($_SESSION['openid_ax']['realm']); } $form = array(); $form['intro'] = array( '#type' => 'markup', - '#value' => '

'. t('Your following details are being send to %site, would you like to continue?', array('%site' => $realm)) . '

' + '#value' => '

'. t('Your following details are being send to %site, would you like to continue?', array('%site' => $realm)) .'

' ); - foreach($ax_response as $name=>$value) { - if(strstr($name,'value')){ - $form[$name] = array( - '#type' => 'textfield', - '#title' => t(substr(strrchr($name,'value.'),6)), - '#value' => $value, - '#size' => 14, - '#maxlength' => 100 - ); + foreach ($ax_response as $name => $value) { + if (strstr($name, 'value')) { + $form[$name] = array( + '#type' => 'textfield', + '#title' => t(substr(strrchr($name, 'value.'), 6)), + '#value' => $value, + '#size' => 14, + '#maxlength' => 100 + ); } else { $form[$name] = array( - '#type' => 'hidden', - '#title' => $name, - '#value' => $value - ); + '#type' => 'hidden', + '#title' => $name, + '#value' => $value + ); } } $form['#action'] = url('openid/ax/send'); @@ -93,7 +93,7 @@ module_load_include('inc', 'openid_ax'); $response = _openid_response(); $ax_response = openid_ax_fetch_response($response); - drupal_goto($_SESSION['openid_ax']['return_to'],$ax_response); + drupal_goto($_SESSION['openid_ax']['return_to'], $ax_response); } /** @@ -109,22 +109,23 @@ function openid_ax_persona_form(&$form_state) { global $user; $form = array(); - if(isset($form_state['storage']['personas'])) { - $personas = $form_state['storage']['personas']; + if (isset($form_state['storage']['personas'])) { + $personas = $form_state['storage']['personas']; } - elseif(isset($_GET['persona'])) { - $personas = $_GET['persona']; + elseif (isset($_GET['persona'])) { + $personas = $_GET['persona']; } else { - $personas = 0; + $personas = 0; } $persona = db_query("SELECT * FROM {openid_ax_persona} where uid=%d", $user->uid); - $options = array(t('Default'), 'openid_ax_create_new' =>t('Create new'), 'manage_ax_personas' => t('Manage AX Personas')); - while($persona_value = db_fetch_array($persona)) { - $options[$persona_value['persona_id']] = $persona_value['persona_name']; + $options = array( + t('Default'), 'openid_ax_create_new' => t('Create new'), 'manage_ax_personas' => t('Manage AX Personas')); + while ($persona_value = db_fetch_array($persona)) { + $options[$persona_value['persona_id']] = $persona_value['persona_name']; } - if(count($options) == 3) { - unset($options['manage_ax_personas']); + if (count($options) == 3) { + unset($options['manage_ax_personas']); } $form['personas'] = array( '#type' => 'select', @@ -138,69 +139,69 @@ '#submit' => array('openid_ax_persona_form_submit_select_persona') ); $identifiers = db_query("SELECT * FROM {openid_ax_attributes}"); - while($id = db_fetch_array($identifiers)) { - $identifier[$id['ax_id']] = $id['identifier']; + while ($id = db_fetch_array($identifiers)) { + $identifier[$id['ax_id']] = $id['identifier']; } - $ax_values = db_query("SELECT * FROM {openid_ax_values} WHERE uid=%d and persona_id='%d'",$user->uid, $personas); - $valueExist = array(); - while($row = db_fetch_array($ax_values)) { - $valueExist[] = $row['ax_id']; - $form[$row['vid']] = array( - '#type' => 'textfield', - '#title' => t($identifier[$row['ax_id']]), - '#default_value' => $row['ax_values'], - '#size' => 25, - '#maxlength' => 100 + $ax_values = db_query("SELECT * FROM {openid_ax_values} WHERE uid=%d and persona_id='%d'", $user->uid, $personas); + $value_exists = array(); + while ($row = db_fetch_array($ax_values)) { + $value_exists[] = $row['ax_id']; + $form[$row['vid']] = array( + '#type' => 'textfield', + '#title' => t($identifier[$row['ax_id']]), + '#default_value' => $row['ax_values'], + '#size' => 25, + '#maxlength' => 100 ); - $form['has_value'.$row['vid']] = array( - '#type' => 'hidden', - '#value' => $row['vid'], - ); - static $count = 0; - $count++; - static $submit_btn = 1; - if($count == 10) { - $form['submit'.$submit_btn] = array( + $form['has_value'. $row['vid']] = array( + '#type' => 'hidden', + '#value' => $row['vid'], + ); + static $count = 0; + $count++; + static $submit_btn = 1; + if ($count == 10) { + $form['submit'. $submit_btn] = array( '#type' => 'submit', '#value' => t('Submit'), ); $count = 0; $submit_btn++; - } - $hasValues = TRUE; + } + $has_values = TRUE; } - if($hasValues){ - $form['intro'] = array( - '#type' => 'markup', - '#value' => t('To delete a value, delete the value in the particular field and then submit'), - '#weight' => -1 + if ($has_values) { + $form['intro'] = array( + '#type' => 'markup', + '#value' => t('To delete a value, delete the value in the particular field and then submit'), + '#weight' => -1 ); } - foreach($identifier as $key => $value) { - if(!(in_array($key, $valueExist))){ - $form['vac'.$key] = array( - '#type' => 'textfield', - '#title' => t($value), - '#default_value' => '', - '#size' => 25, - '#maxlength' => 100 + foreach ($identifier as $key => $value) { + if (!(in_array($key, $value_exists))) { + $form['vac'. $key] = array( + '#type' => 'textfield', + '#title' => t($value), + '#default_value' => '', + '#size' => 25, + '#maxlength' => 100 + ); + $form['no_value'. $key] = array( + '#type' => 'hidden', + '#value' => $key, ); - $form['no_value'.$key] = array( - '#type' => 'hidden', - '#value' => $key, - ); static $count = 0; - $count++; - static $submit_btn = 1; - if($count == 10) { - $form['submit'.$submit_btn] = array( + $count++; + static $submit_btn = 1; + if ($count == 10) { + $form['submit'. $submit_btn] = array( '#type' => 'submit', '#value' => t('Submit'), ); $count = 0; $submit_btn++; - } - } + } + } } $form['submit'] = array( '#type' => 'submit', @@ -214,14 +215,14 @@ */ function openid_ax_persona_form_submit_select_persona(&$form, &$form_state) { global $user; - if($form_state['values']['personas']=='openid_ax_create_new') { - drupal_goto('user/'.$user->uid.'/persona/create'); + if ($form_state['values']['personas']=='openid_ax_create_new') { + drupal_goto('user/'. $user->uid .'/persona/create'); } - elseif($form_state['values']['personas']=='manage_ax_personas') { - drupal_goto('user/'.$user->uid.'/persona/manage'); + elseif ($form_state['values']['personas']=='manage_ax_personas') { + drupal_goto('user/'. $user->uid .'/persona/manage'); } else { - $form_state['storage']['personas'] = $form_state['values']['personas']; + $form_state['storage']['personas'] = $form_state['values']['personas']; } } @@ -230,28 +231,28 @@ */ function openid_ax_persona_form_submit(&$form, &$form_state) { global $user; - $result = db_query("SELECT vid FROM {openid_ax_values} WHERE uid='%d' and persona_id='%d'",$user->uid, $form_state['values']['personas']); + $result = db_query("SELECT vid FROM {openid_ax_values} WHERE uid='%d' and persona_id='%d'", $user->uid, $form_state['values']['personas']); static $success; $success = FALSE; - while($vid = db_fetch_array($result)) { + while ($vid = db_fetch_array($result)) { $ax_value = trim($form_state['values'][$vid['vid']]); - if(isset($form_state['values'][has_value.$vid['vid']])){ - if($ax_value != ''){ - $success = db_query("UPDATE {openid_ax_values} SET ax_values='%s' WHERE vid='%d'", $form_state['values'][$vid['vid']], $vid['vid']); - } - else { - $success = db_query("DELETE FROM {openid_ax_values} WHERE vid='%d'", $vid['vid']); - } - } + if (isset($form_state['values']['has_value'. $vid['vid']])) { + if ($ax_value != '') { + $success = db_query("UPDATE {openid_ax_values} SET ax_values='%s' WHERE vid='%d'", $form_state['values'][$vid['vid']], $vid['vid']); + } + else { + $success = db_query("DELETE FROM {openid_ax_values} WHERE vid='%d'", $vid['vid']); + } + } } $ax_ids = db_query("SELECT ax_id FROM {openid_ax_attributes}"); - while($ax_id=db_fetch_array($ax_ids)) { - if((isset($form_state['values'][no_value.$ax_id['ax_id']]))&&($form_state['values'][vac.$ax_id['ax_id']] != '')){ - $success = db_query("INSERT INTO {openid_ax_values}(ax_id, uid, persona_id, ax_values) VALUES ('%d', '%d', '%d', '%s')",$ax_id['ax_id'], $user->uid, $form_state['values']['personas'], $form_state['values'][$ax_id['ax_id']]); - } + while ($ax_id=db_fetch_array($ax_ids)) { + if ((isset($form_state['values']['no_value'. $ax_id['ax_id']])) && ($form_state['values']['vac'. $ax_id['ax_id']] != '')) { + $success = db_query("INSERT INTO {openid_ax_values}(ax_id, uid, persona_id, ax_values) VALUES ('%d', '%d', '%d', '%s')", $ax_id['ax_id'], $user->uid, $form_state['values']['personas'], $form_state['values'][$ax_id['ax_id']]); + } } - if($success) { - drupal_set_message(t('Your persona values have been saved')); + if ($success) { + drupal_set_message(t('Your persona values have been saved')); } } @@ -268,12 +269,12 @@ function openid_ax_new_persona_form() { $form = array(); $form['persona'] = array( - '#type' =>'textfield', - '#title' => t('New Persona name'), - '#default_value' => '', - '#required' => TRUE, - '#size' => 20 - ); + '#type' => 'textfield', + '#title' => t('New Persona name'), + '#default_value' => '', + '#required' => TRUE, + '#size' => 20 + ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), @@ -287,16 +288,16 @@ function openid_ax_new_persona_form_submit(&$form, $form_state) { global $user; $persona_exists = db_result(db_query("SELECT * FROM {openid_ax_persona} WHERE uid=%d AND persona_name='%s'", $user->uid, $form_state['values']['persona'])); - if($persona_exists) { - drupal_set_message(t('A persona with that name already exists. Please select another persona name.'),'error'); + if ($persona_exists) { + drupal_set_message(t('A persona with that name already exists. Please select another persona name.'), 'error'); } else { - $max_persona_id = db_result(db_query("SELECT MAX(persona_id) FROM {openid_ax_persona} WHERE uid='%d'", $user->uid)); - $create_persona = db_query("INSERT INTO {openid_ax_persona} (uid, persona_id, persona_name) VALUES ('%d', '%d', '%s')", $user->uid, $max_persona_id+1, $form_state['values']['persona']); - if($create_persona) { - drupal_set_message(t('New Persona created')); - drupal_goto('user/'.$user->uid.'/persona'); - } + $max_persona_id = db_result(db_query("SELECT MAX(persona_id) FROM {openid_ax_persona} WHERE uid='%d'", $user->uid)); + $create_persona = db_query("INSERT INTO {openid_ax_persona} (uid, persona_id, persona_name) VALUES ('%d', '%d', '%s')", $user->uid, $max_persona_id+1, $form_state['values']['persona']); + if ($create_persona) { + drupal_set_message(t('New Persona created')); + drupal_goto('user/'. $user->uid .'/persona'); + } } } @@ -305,26 +306,26 @@ */ function openid_ax_manage_personas() { global $user; - $profiles = (db_query("SELECT * FROM {openid_ax_persona} WHERE uid=%d",$user->uid)); - $header = array ( + $profiles = (db_query("SELECT * FROM {openid_ax_persona} WHERE uid=%d", $user->uid)); + $header = array( 'Persona Name', 'Edit Persona Values', 'Rename Persona', 'Delete Persona', ); - $rows['default'] = array ( - 'Default', - 'Edit', - '-N/A-', - '-N/A-' - ); - while($profile = db_fetch_array($profiles)) { - $rows[$profile['persona_name']] = array ( - $profile['persona_name'], - 'Edit ', - 'Rename', - 'Delete', - ); + $rows['default'] = array( + 'Default', + 'Edit', + '-N/A-', + '-N/A-' + ); + while ($profile = db_fetch_array($profiles)) { + $rows[$profile['persona_name']] = array( + $profile['persona_name'], + 'Edit ', + 'Rename', + 'Delete', + ); } $content = theme_table($header, $rows); $content .= drupal_get_form('copy_persona_values_form'); @@ -337,10 +338,10 @@ function copy_persona_values_form() { global $user; $form = array(); - $persona = db_query("SELECT * FROM {openid_ax_persona} WHERE uid='%d'",$user->uid); + $persona = db_query("SELECT * FROM {openid_ax_persona} WHERE uid='%d'", $user->uid); $options = array(t('Default')); - while($persona_value = db_fetch_array($persona)) { - $options[$persona_value['persona_id']] = $persona_value['persona_name']; + while ($persona_value = db_fetch_array($persona)) { + $options[$persona_value['persona_id']] = $persona_value['persona_name']; } $form['intro'] = array( '#type' => 'markup', @@ -369,9 +370,9 @@ function copy_persona_values_form_submit(&$form, $form_state) { global $user; $target_persona = $form_state['values']['to_personas']; - $copySrc = db_query("SELECT ax_id,ax_values FROM {openid_ax_values} WHERE uid='%d' AND persona_id='%d'",$user->uid, $form_state['values']['from_personas']); - while($vals = db_fetch_array($copySrc)) { - $copyTrg = db_query("INSERT INTO {openid_ax_values}(ax_id, uid, persona_id, ax_values) VALUES ('%d','%d','%d','%s')", $vals['ax_id'], $target_persona, $user->uid, $vals['ax_values']); + $copy_src = db_query("SELECT ax_id,ax_values FROM {openid_ax_values} WHERE uid='%d' AND persona_id='%d'", $user->uid, $form_state['values']['from_personas']); + while ($vals = db_fetch_array($copy_src)) { + $copy_trg = db_query("INSERT INTO {openid_ax_values}(ax_id, uid, persona_id, ax_values) VALUES ('%d','%d','%d','%s')", $vals['ax_id'], $target_persona, $user->uid, $vals['ax_values']); } drupal_set_message(t('Persona values copied.')); } @@ -382,7 +383,7 @@ function openid_ax_rename_personas() { $content = drupal_get_form('openid_ax_rename_persona_form', $_GET['p']); $content .= openid_ax_manage_personas(); - return $content; + return $content; } /** @@ -392,7 +393,7 @@ global $user; isset($_GET['p'])?$persona_id=$_GET['p']:$persona_id=$form_state['storage']['persona_id']; $form = array(); - $persona = db_result(db_query("SELECT persona_name FROM {openid_ax_persona} WHERE persona_id='%d' AND uid='%d'",$persona_id, $user->uid)); + $persona = db_result(db_query("SELECT persona_name FROM {openid_ax_persona} WHERE persona_id='%d' AND uid='%d'", $persona_id, $user->uid)); $form['persona'] = array( '#type' => 'textfield', '#default_value' => $persona, @@ -402,7 +403,7 @@ '#type' => 'hidden', '#value' => $_GET['p'], ); - $form['submit'] = array ( + $form['submit'] = array( '#type' => 'submit', '#value' => 'Rename', ); @@ -425,8 +426,8 @@ function openid_ax_persona_delete() { global $user; $persona_id=$_GET['p']; - $persona = db_result(db_query("SELECT persona_name FROM {openid_ax_persona} WHERE persona_id='%d' AND uid='%d'",$persona_id, $user->uid)); - $content = t('Are you sure you want to delete your %profile profile.', array('%profile' => $persona)); + $persona = db_result(db_query("SELECT persona_name FROM {openid_ax_persona} WHERE persona_id='%d' AND uid='%d'", $persona_id, $user->uid)); + $content = t('Are you sure you want to delete your %profile profile.', array('%profile' => $persona)); $content .= t(' This cannot be reversed and all your profile related details will be lost.'); $content .= drupal_get_form('openid_ax_persona_delete_confirm_form'); return $content; @@ -436,7 +437,7 @@ * Form for confirming if the user wants to delete the persona */ function openid_ax_persona_delete_confirm_form() { - $form = array (); + $form = array(); $form['persona_id'] = array( '#type' => 'hidden', '#value' => $_GET['p'], @@ -445,10 +446,10 @@ '#type' => 'submit', '#value' => t('Delete'), ); - $form['cancel'] =array( + $form['cancel'] = array( '#type' => 'submit', '#value' => t('Cancel'), - '#submit' => array ('openid_ax_persona_delete_confirm_form_cancel'), + '#submit' => array('openid_ax_persona_delete_confirm_form_cancel'), ); return $form; } @@ -458,11 +459,11 @@ */ function openid_ax_persona_delete_confirm_form_submit($form, &$form_state) { global $user; - $delValues = db_query("DELETE FROM {openid_ax_values} WHERE uid='%d' AND persona_id='%d'", $user->uid, $form_state['values']['persona_id']); - $deletePersona = db_query("DELETE FROM {openid_ax_persona} WHERE uid='%d' AND persona_id='%d'", $user->uid, $form_state['values']['persona_id']); - if($delValues && $deletePersona) { - drupal_set_message(t('Persona deleted.')); - drupal_goto('user/'.$user->uid.'/persona/manage'); + $del_values = db_query("DELETE FROM {openid_ax_values} WHERE uid='%d' AND persona_id='%d'", $user->uid, $form_state['values']['persona_id']); + $delete_persona = db_query("DELETE FROM {openid_ax_persona} WHERE uid='%d' AND persona_id='%d'", $user->uid, $form_state['values']['persona_id']); + if ($del_values && $delete_persona) { + drupal_set_message(t('Persona deleted.')); + drupal_goto('user/'. $user->uid .'/persona/manage'); } } @@ -471,5 +472,5 @@ */ function openid_ax_persona_delete_confirm_form_cancel() { global $user; - drupal_goto('user/'.$user->uid.'/persona/manage'); + drupal_goto('user/'. $user->uid .'/persona/manage'); } \ No newline at end of file