$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)) {
/**
* Lookup the contact based on their URL (which is the only unique thing we have at the moment)
*/
-
+
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND (`url` = '%s' OR `nurl` = '%s') AND `self` = 0 LIMIT 1",
intval(local_user()),
dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url))
);
-
+
if(count($r)) {
if(strlen($r[0]['dfrn-id'])) {
else
$contact_record = $r[0];
}
-
+
if(is_array($contact_record)) {
- $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d",
intval($aes_allow),
intval($hidden),
intval($contact_record['id'])
);
}
else {
-
+
/**
* Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo
*/
if(count($r)) {
foreach($r as $rr) {
if(! $rr['rel']) {
- q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
+ q("DELETE FROM `contact` WHERE `id` = %d",
intval($rr['cid'])
);
}
- q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
+ q("DELETE FROM `intro` WHERE `id` = %d",
intval($rr['iid'])
);
}
* Cleanup any old email intros - which will have a greater lifetime
*/
- $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
+ $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
- WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
+ WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` = '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL2)
if(count($r)) {
foreach($r as $rr) {
if(! $rr['rel']) {
- q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
+ q("DELETE FROM `contact` WHERE `id` = %d",
intval($rr['cid'])
);
}
- q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
+ q("DELETE FROM `intro` WHERE `id` = %d",
intval($rr['iid'])
);
}
`uri-date` = '%s',
`avatar-date` = '%s',
`hidden` = 0,
- WHERE `id` = %d LIMIT 1
+ WHERE `id` = %d
",
dbesc($photos[0]),
dbesc($photos[1]),
logger('dfrn_request: url: ' . $url);
if(! strlen($url)) {
- notice( t("Unable to resolve your name at the provided location.") . EOL);
+ notice( t("Unable to resolve your name at the provided location.") . EOL);
return;
}
if(is_array($contact_record)) {
// There is a contact record but no issued-id, so this
// is a reciprocal introduction from a known contact
- $r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d",
dbesc($issued_id),
intval($contact_record['id'])
);
);
// find the contact record we just created
- if($r) {
- $r = q("SELECT `id` FROM `contact`
+ if($r) {
+ $r = q("SELECT `id` FROM `contact`
WHERE `uid` = %d AND `url` = '%s' AND `issued-id` = '%s' LIMIT 1",
intval($uid),
$parms['url'],
$parms['issued-id']
);
- if(count($r))
+ if(count($r))
$contact_record = $r[0];
}
-
+
}
if($r === false) {
notice( t('Failed to update contact record.') . EOL );
}
$hash = random_string() . (string) time(); // Generate a confirm_key
-
+
if(is_array($contact_record)) {
$ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
if(count($r)) {
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
- $auto_confirm = true;
+ $auto_confirm = true;
if(! $auto_confirm) {
require_once('include/enotify.php');
// 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' LIMIT 1",
+ $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
dbesc($_GET['confirm_key'])
);
}