Browse Source

sorting out the last(?) quirks in group pages.

pull/1/head
Mike Macgirvin 11 years ago
parent
commit
3876cab8ea
  1. 12
      include/items.php
  2. 15
      mod/dfrn_notify.php
  3. 8
      mod/dfrn_request.php
  4. 8
      mod/settings.php

12
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);

15
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']);
}

8
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;
}

8
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,

Loading…
Cancel
Save