]> git.mxchange.org Git - friendica.git/commitdiff
sorting out the last(?) quirks in group pages.
authorMike Macgirvin <mike@macgirvin.com>
Mon, 18 Oct 2010 23:38:48 +0000 (16:38 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 18 Oct 2010 23:38:48 +0000 (16:38 -0700)
include/items.php
mod/dfrn_notify.php
mod/dfrn_request.php
mod/settings.php

index e9277f114e014476387965fba4d22ce4530ebb34..87e5b46eff0493c653d8b4f6aaa7580a9ff7238e 100644 (file)
@@ -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);
 
index 5779b68d2a1d7cbf28f820de0165cca147dce592..517c91edaf7ff37318605f72e21f43be28369836 100644 (file)
@@ -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']);
                }
index 0fbd164c0a23b44f209c4947c5fb72d411f50acb..7a3060ff4fc01ffb5b55586f2ee6995193ea0a58 100644 (file)
@@ -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;
        }
 
index 720a38e8d6aaaa3f46cb25963e8e5d80e259b497..b453fa8258f24d634fb38b052fdc2c32a7432bcb 100644 (file)
@@ -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,