From 036964de4d86f0109ece00cc9394b2a044c06c1e Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Tue, 5 Oct 2010 19:56:09 -0700 Subject: friend acceptance sets up lots of important stuff, so we need to be absolutely bulletproof when (not if) things go wrong. --- mod/dfrn_confirm.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'mod/dfrn_confirm.php') diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 43e28aef8..5d551355b 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -270,12 +270,30 @@ function dfrn_confirm_post(&$a) { $res = post_url($dfrn_confirm,$params); -// uncomment the following two lines and comment the following xml/status lines -// to debug the remote confirmation section (when both confirmations -// and responses originate on this system) + // Try to be robust if the remote site is having difficulty and throwing up + // errors of some kind. -// echo $res; -// $status = 0; + $leading_junk = substr($res,0,strpos($res,'status; @@ -284,9 +302,7 @@ function dfrn_confirm_post(&$a) { notice( t("Confirmation completed successfully") . EOL); break; case 1: - // birthday paradox - generate new dfrn-id and fall through. - $new_dfrn_id = random_string(); $r = q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($new_dfrn_id), @@ -302,7 +318,7 @@ function dfrn_confirm_post(&$a) { case 3: notice( t("Introduction failed or was revoked. Cannot complete.") . EOL); break; - } + } if(($status == 0 || $status == 3) && ($intro_id)) { @@ -314,6 +330,7 @@ function dfrn_confirm_post(&$a) { ); } + if($status != 0) return; -- cgit v1.2.3