use Friendica\Util\Network;
use Friendica\Util\Strings;
-require_once 'include/enotify.php';
-
function dfrn_request_init(App $a)
{
if ($a->argc > 1) {
$which = $a->argv[1];
+ Profile::load($a, $which);
}
- Profile::load($a, $which);
return;
}
* in order to link our friend request with our own server cell.
* After logging in, we click 'submit' to approve the linkage.
*
+ * @param App $a
+ * @throws ImagickException
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
function dfrn_request_post(App $a)
{
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
intval(local_user()),
DBA::escape($dfrn_url),
- $parms['key'] // this was already escaped
+ defaults($parms, 'key', '') // Potentially missing
);
if (DBA::isResult($r)) {
Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']);
$dfrn_request = $contact_record['request'];
}
- if (strlen($dfrn_request) && strlen($confirm_key)) {
- $s = Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+ if (!empty($dfrn_request) && strlen($confirm_key)) {
+ Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)
}
$nickname = $a->profile['nickname'];
- $notify_flags = $a->profile['notify-flags'];
$uid = $a->profile['uid'];
$maxreq = intval($a->profile['maxreq']);
$contact_record = null;
}
}
- $real_name = !empty($_POST['realname']) ? Strings::escapeTags(trim($_POST['realname'])) : '';
-
$url = trim($_POST['dfrn_url']);
if (!strlen($url)) {
notice(L10n::t("Invalid locator") . EOL);
$hash = Strings::getRandomHex() . (string) time(); // Generate a confirm_key
if (is_array($contact_record)) {
- $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
+ q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
intval($uid),
intval($contact_record['id']),
dfrn_request_post($a);
- killme();
- return; // NOTREACHED
+ exit();
}
$tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl");
'$dfrn_url' => $dfrn_url,
'$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
'$hidethem' => L10n::t('Hide this contact'),
- '$hidechecked' => '',
'$confirm_key' => $confirm_key,
'$welcome' => L10n::t('Welcome home %s.', $a->user['username']),
'$please' => L10n::t('Please confirm your introduction/connection request to %s.', $dfrn_url),
$auto_confirm = false;
if (DBA::isResult($r)) {
- if ($r[0]['page-flags'] != Contact::PAGE_NORMAL && $r[0]['page-flags'] != Contact::PAGE_PRVGROUP) {
+ if ($r[0]['page-flags'] != User::PAGE_FLAGS_NORMAL && $r[0]['page-flags'] != User::PAGE_FLAGS_PRVGROUP) {
$auto_confirm = true;
}
'node' => $r[0]['nickname'],
'dfrn_id' => $r[0]['issued-id'],
'intro_id' => $intro[0]['id'],
- 'duplex' => (($r[0]['page-flags'] == Contact::PAGE_FREELOVE) ? 1 : 0),
+ 'duplex' => (($r[0]['page-flags'] == User::PAGE_FLAGS_FREELOVE) ? 1 : 0),
];
dfrn_confirm_post($a, $handsfree);
}
// If we are auto_confirming, this record will have already been nuked
// in dfrn_confirm_post()
- $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
+ q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
DBA::escape($_GET['confirm_key'])
);
}
}
- killme();
- return; // NOTREACHED
+ exit();
} else {
// Normal web request. Display our user's introduction form.
if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
* because nobody is going to read the comments and
* it doesn't matter if they know you or not.
*/
- if ($a->profile['page-flags'] == Contact::PAGE_NORMAL) {
+ if ($a->profile['page-flags'] == User::PAGE_FLAGS_NORMAL) {
$tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
} else {
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
$page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:");
- $invite_desc = sprintf(
- L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.'),
- get_server() . '/servers'
- );
+ $invite_desc = L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.', get_server() . '/servers');
$o = Renderer::replaceMacros($tpl, [
'$header' => L10n::t('Friend/Connection Request'),
]);
return $o;
}
-
- return; // Somebody is fishing.
}