* https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_request.png
*/
-require_once('include/enotify.php');
-require_once('include/Scrape.php');
-require_once('include/Probe.php');
-require_once('include/group.php');
+use Friendica\App;
+use Friendica\Network\Probe;
-function dfrn_request_init(App &$a) {
+require_once 'include/enotify.php';
+require_once 'include/probe.php';
+require_once 'include/group.php';
+
+function dfrn_request_init(App $a) {
if($a->argc > 1)
$which = $a->argv[1];
* After logging in, we click 'submit' to approve the linkage.
*
*/
-function dfrn_request_post(App &$a) {
+function dfrn_request_post(App $a) {
if(($a->argc != 2) || (! count($a->profile))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
- $invalid = Probe::valid_dfrn($parms);
+ $invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$photo = $parms["photo"];
// Escape the entire array
-
- dbesc_array($parms);
-
+ dbm::esc_array($parms);
/*
* Create a contact record on our site for the other person
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(! $rr['rel']) {
- q("DELETE FROM `contact` WHERE `id` = %d",
+ q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
intval($rr['cid'])
);
}
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(! $rr['rel']) {
- q("DELETE FROM `contact` WHERE `id` = %d",
+ q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
intval($rr['cid'])
);
}
$network = $data["network"];
// Canonicalise email-style profile locator
- $url = Probe::webfinger_dfrn($url,$hcard);
+ $url = Probe::webfingerDfrn($url,$hcard);
if (substr($url,0,5) === 'stat:') {
return; // NOTREACHED
}
-
- require_once('include/Scrape.php');
+ if (blocked_url($url)) {
+ notice( t('Blocked domain') . EOL);
+ goaway(App::get_baseurl() . '/' . $a->cmd);
+ return; // NOTREACHED
+ }
$parms = Probe::profile(($hcard) ? $hcard : $url);
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
- $invalid = Probe::valid_dfrn($parms);
+ $invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$parms['issued-id'] = $issued_id;
$photo = $parms["photo"];
- dbesc_array($parms);
+ dbm::esc_array($parms);
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `blocked`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
}
-function dfrn_request_content(App &$a) {
+function dfrn_request_content(App $a) {
if (($a->argc != 2) || (! count($a->profile))) {
return "";
}
if($auto_confirm) {
- require_once('mod/dfrn_confirm.php');
+ require_once 'mod/dfrn_confirm.php';
$handsfree = array(
'uid' => $r[0]['uid'],
'node' => $r[0]['nickname'],
'$header' => t('Friend/Connection Request'),
'$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
'$pls_answer' => t('Please answer the following:'),
- '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'),t('Yes'))),
+ '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'), t('Yes'))),
/*'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
'$yes' => t('Yes'),
'$no' => t('No'), */