]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_confirm.php
Friendicaland
[friendica.git] / mod / dfrn_confirm.php
index 2b25095fde2209314ff65b7d71a8eb51fb108e00..8e39f5fd0bc0308118b628e9fa357d54cd4ab478 100644 (file)
@@ -144,19 +144,12 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                         * worried about key leakage than anybody cracking it.  
                         *
                         */
+                       require_once('include/crypto.php');
 
-                       $res = openssl_pkey_new(array(
-                               'digest_alg' => 'sha1',
-                               'private_key_bits' => 4096,
-                               'encrypt_key' => false )
-                       );
-
-                       $private_key = '';
-
-                       openssl_pkey_export($res, $private_key);
+                       $res = new_keypair(4096);
 
-                       $pubkey = openssl_pkey_get_details($res);
-                       $public_key = $pubkey["key"];
+                       $private_key = $res['prvkey'];
+                       $public_key  = $res['pubkey'];
 
                        // Save the private key. Send them the public key.
 
@@ -209,6 +202,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
 
                        if($user[0]['page-flags'] == PAGE_COMMUNITY)
                                $params['page'] = 1;
+                       if($user[0]['page-flags'] == PAGE_PRVGROUP)
+                               $params['page'] = 2;
 
                        logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
 
@@ -500,6 +495,16 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                                }
                        }
                }
+
+
+               $g = q("select def_gid from user where uid = %d limit 1",
+                       intval($uid)
+               );
+               if($contact && $g && intval($g[0]['def_gid'])) {
+                       require_once('include/group.php');
+                       group_add_member($uid,'',$contact['id'],$g[0]['def_gid']);
+               }
+
                // Let's send our user to the contact editor in case they want to
                // do anything special with this new friend.
 
@@ -534,6 +539,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                $page       = ((x($_POST,'page'))         ? intval($_POST['page'])         : 0 );
                $version_id = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
        
+               $forum = (($page == 1) ? 1 : 0);
+               $prv   = (($page == 2) ? 1 : 0);
+
                logger('dfrn_confirm: requestee contacted: ' . $node);
 
                logger('dfrn_confirm: request: POST=' . print_r($_POST,true), LOGGER_DATA);
@@ -688,6 +696,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                        `pending` = 0,
                        `duplex` = %d, 
                        `forum` = %d,
+                       `prv` = %d,
                        `network` = '%s' WHERE `id` = %d LIMIT 1
                ",
                        dbesc($photos[0]),
@@ -698,7 +707,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                        dbesc(datetime_convert()),
                        dbesc(datetime_convert()),
                        intval($duplex),
-                       intval($page),
+                       intval($forum),
+                       intval($prv),
                        dbesc(NETWORK_DFRN),
                        intval($dfrn_record)
                );