X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdfrn_request.php;h=5a32d946e29f470ca0a441dd52375b99f51da92a;hb=6edc52f78f12f366f344eb86723d39b92a77a9ff;hp=2169c494c31c1bfab6be591604947089f4f9c2ef;hpb=46558e98a8282f2a2e12f5dbcfdbd39f139be9bb;p=friendica.git diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 2169c494c3..5a32d946e2 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -68,7 +68,7 @@ function dfrn_request_post(&$a) { $dfrn_url = notags(trim($_POST['dfrn_url'])); $aes_allow = (((x($_POST,'aes_allow')) && ($_POST['aes_allow'] == 1)) ? 1 : 0); $confirm_key = ((x($_POST,'confirm_key')) ? $_POST['confirm_key'] : ""); - + $hidden = ((x($_POST,'hidden-contact')) ? intval($_POST['hidden-contact']) : 0); $contact_record = null; if(x($dfrn_url)) { @@ -98,8 +98,9 @@ function dfrn_request_post(&$a) { } if(is_array($contact_record)) { - $r = q("UPDATE `contact` SET `ret-aes` = %d WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d LIMIT 1", intval($aes_allow), + intval($hidden), intval($contact_record['id']) ); } @@ -109,7 +110,7 @@ function dfrn_request_post(&$a) { * Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo */ - require_once('Scrape.php'); + require_once('include/Scrape.php'); $parms = scrape_dfrn($dfrn_url); @@ -144,8 +145,8 @@ function dfrn_request_post(&$a) { */ $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site-pubkey`, - `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`) - VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", + `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`) + VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)", intval(local_user()), datetime_convert(), dbesc($dfrn_url), @@ -160,7 +161,8 @@ function dfrn_request_post(&$a) { $parms['dfrn-poll'], $parms['dfrn-poco'], dbesc(NETWORK_DFRN), - intval($aes_allow) + intval($aes_allow), + intval($hidden) ); } @@ -168,6 +170,21 @@ function dfrn_request_post(&$a) { info( t("Introduction complete.") . EOL); } + $r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s' limit 1", + intval(local_user()), + dbesc($dfrn_url), + $parms['key'] // this was already escaped + ); + if(count($r)) { + $g = q("select def_gid from user where uid = %d limit 1", + intval(local_user()) + ); + if($g && intval($g[0]['def_gid'])) { + require_once('include/group.php'); + group_add_member(local_user(),'',$r[0]['id'],$g[0]['def_gid']); + } + } + /** * Allow the blocked remote notification to complete */ @@ -341,6 +358,7 @@ function dfrn_request_post(&$a) { intval($uid) ); if(! count($r)) { + notice( t('This account has not been configured for email. Request failed.') . EOL); return; } @@ -370,6 +388,14 @@ function dfrn_request_post(&$a) { if(count($r)) { $contact_id = $r[0]['id']; + $g = q("select def_gid from user where uid = %d limit 1", + intval($uid) + ); + if($g && intval($g[0]['def_gid'])) { + require_once('include/group.php'); + group_add_member($uid,'',$contact_id,$g[0]['def_gid']); + } + $photo = avatar_img($addr); $r = q("UPDATE `contact` SET @@ -479,7 +505,7 @@ function dfrn_request_post(&$a) { } - require_once('Scrape.php'); + require_once('include/Scrape.php'); $parms = scrape_dfrn(($hcard) ? $hcard : $url); @@ -591,7 +617,7 @@ function dfrn_request_post(&$a) { * */ - $url = str_replace('{uri}', $a->get_baseurl() . '/dfrn_poll/' . $nickname, $url); + $url = str_replace('{uri}', $a->get_baseurl() . '/profile/' . $nickname, $url); goaway($url); // NOTREACHED // END $network === NETWORK_OSTATUS @@ -641,6 +667,8 @@ function dfrn_request_content(&$a) { $o = replace_macros($tpl,array( '$dfrn_url' => $dfrn_url, '$aes_allow' => (($aes_allow) ? '' : "" ), + '$hidethem' => t('Hide this contact'), + '$hidechecked' => '', '$confirm_key' => $confirm_key, '$welcome' => sprintf( t('Welcome home %s.'), $a->user['username']), '$please' => sprintf( t('Please confirm your introduction/connection request to %s.'), $dfrn_url), @@ -672,7 +700,7 @@ function dfrn_request_content(&$a) { $auto_confirm = false; if(count($r)) { - if($r[0]['page-flags'] != PAGE_NORMAL) + if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP)) $auto_confirm = true; if(! $auto_confirm) { @@ -729,8 +757,10 @@ function dfrn_request_content(&$a) { */ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { - notice( t('Public access denied.') . EOL); - return; + if(! get_config('system','local_block')) { + notice( t('Public access denied.') . EOL); + return; + } }