From 3876cab8eac1364e7074e8da9aeb83badb3b65b3 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 18 Oct 2010 16:38:48 -0700 Subject: [PATCH] sorting out the last(?) quirks in group pages. --- include/items.php | 12 +++++++++--- mod/dfrn_notify.php | 15 ++++++++++----- mod/dfrn_request.php | 8 +++++--- mod/settings.php | 8 ++++---- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/include/items.php b/include/items.php index e9277f114..87e5b46ef 100644 --- a/include/items.php +++ b/include/items.php @@ -552,7 +552,9 @@ function dfrn_deliver($owner,$contact,$atom,$debugging = false) { $final_dfrn_id = ''; - if($contact['duplex'] && strlen($contact['prvkey'])) { + + + if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']); openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']); } @@ -567,6 +569,8 @@ function dfrn_deliver($owner,$contact,$atom,$debugging = false) { $final_dfrn_id = substr($final_dfrn_id,2); if($final_dfrn_id != $orig_id) { + if($debugging) + echo "Wrong ID - did not decode\n"; // did not decode properly - cannot trust this site return 3; } @@ -586,8 +590,10 @@ function dfrn_deliver($owner,$contact,$atom,$debugging = false) { $xml = post_url($contact['notify'],$postvars); - if($debugging) - echo $xml; + if($debugging) { + echo "SENDING: " . print_r($postvars,true) . "\n"; + echo "RECEIVING: " . $xml; + } $res = simplexml_load_string($xml); diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 5779b68d2..517c91eda 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -34,7 +34,7 @@ function dfrn_notify_post(&$a) { $sql_extra = ''; switch($direction) { case (-1): - $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id)); + $sql_extra = sprintf(" AND ( `issued-id` = '%s' OR `dfrn-id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id)); break; case 0: $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id)); @@ -50,7 +50,9 @@ function dfrn_notify_post(&$a) { $r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` - WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra LIMIT 1" + WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `user`.`nickname` = '%s' $sql_extra LIMIT 1", + dbesc($a->argv[1]) ); if(! count($r)) { @@ -401,7 +403,7 @@ function dfrn_notify_content(&$a) { $sql_extra = ''; switch($direction) { case (-1): - $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id)); + $sql_extra = sprintf(" AND ( `issued-id` = '%s' OR `dfrn-id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id)); $my_id = $dfrn_id; break; case 0: @@ -417,7 +419,10 @@ function dfrn_notify_content(&$a) { break; // NOTREACHED } - $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1"); + $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` + WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `user`.`nickname` = '%s' $sql_extra LIMIT 1", + dbesc($a->argv[1]) + ); if(! count($r)) $status = 1; @@ -426,7 +431,7 @@ function dfrn_notify_content(&$a) { $encrypted_id = ''; $id_str = $my_id . '.' . mt_rand(1000,9999); - if(($r[0]['duplex']) && strlen($r[0]['pubkey'])) { + if((($r[0]['duplex']) && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) { openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']); openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']); } diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 0fbd164c0..7a3060ff4 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -472,9 +472,11 @@ function dfrn_request_content(&$a) { else { // Normal web request. Display our user's introduction form. - - $o = load_view_file("view/dfrn_request.tpl"); - $o = replace_macros($o,array('$nickname' => $a->argv[1])); + if($a->profile['page-flags'] == PAGE_NORMAL) + $tpl = load_view_file('view/dfrn_request.tpl'); + else + $tpl = load_view_file('view/auto_request.tpl'); + $o .= replace_macros($tpl,array('$nickname' => $a->argv[1])); return $o; } diff --git a/mod/settings.php b/mod/settings.php index 720a38e8d..b453fa825 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -180,10 +180,10 @@ function settings_content(&$a) { $pageset_tpl = load_view_file('view/pagetypes.tpl'); $pagetype = replace_macros($pageset_tpl,array( - '$normal' => (($profile['page-flags'] == PAGE_NORMAL) ? " checked=\"checked\" " : ""), - '$soapbox' => (($profile['page-flags'] == PAGE_SOAPBOX) ? " checked=\"checked\" " : ""), - '$community' => (($profile['page-flags'] == PAGE_COMMUNITY) ? " checked=\"checked\" " : ""), - '$freelove' => (($profile['page-flags'] == PAGE_FREELOVE) ? " checked=\"checked\" " : ""), + '$normal' => (($a->user['page-flags'] == PAGE_NORMAL) ? " checked=\"checked\" " : ""), + '$soapbox' => (($a->user['page-flags'] == PAGE_SOAPBOX) ? " checked=\"checked\" " : ""), + '$community' => (($a->user['page-flags'] == PAGE_COMMUNITY) ? " checked=\"checked\" " : ""), + '$freelove' => (($a->user['page-flags'] == PAGE_FREELOVE) ? " checked=\"checked\" " : ""), '$page_normal' => PAGE_NORMAL, '$page_soapbox' => PAGE_SOAPBOX, '$page_community' => PAGE_COMMUNITY,