aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dfrn_request.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-01-07 00:24:08 -0800
committerFriendika <info@friendika.com>2011-01-07 02:57:26 -0800
commitffbdad704130fc9a50636057c9965bd79b7cbf60 (patch)
tree26621cb2021407ab1aa1f102179dc6e94cd2b100 /mod/dfrn_request.php
parent502d59089b1690c41e7ad1bd95fa45f277181ca8 (diff)
downloadvolse-hubzilla-ffbdad704130fc9a50636057c9965bd79b7cbf60.tar.gz
volse-hubzilla-ffbdad704130fc9a50636057c9965bd79b7cbf60.tar.bz2
volse-hubzilla-ffbdad704130fc9a50636057c9965bd79b7cbf60.zip
friend request homecoming - ensure login redirects back to confirmation page,
prune old introductions that remain blocked over 30 minutes.
Diffstat (limited to 'mod/dfrn_request.php')
-rw-r--r--mod/dfrn_request.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index e25515a5b..d5c5b83d5 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -245,6 +245,29 @@ function dfrn_request_post(&$a) {
}
}
+ /**
+ *
+ * Cleanup old introductions that remain blocked.
+ * Also remove the contact record, but only if there is no existing relationship
+ *
+ */
+
+ $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 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ");
+ if(count($r)) {
+ foreach($r as ($rr) {
+ if(! $rr['rel']) {
+ q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($rr['cid'])
+ );
+ }
+ q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
+ intval($rr['iid'])
+ );
+ }
+ }
+
$url = trim($_POST['dfrn_url']);
if(! strlen($url)) {
notice( t("Invalid locator") . EOL );
@@ -456,7 +479,7 @@ function dfrn_request_content(&$a) {
/* setup the return URL to come back to this page if they use openid */
$stripped = str_replace('q=','',$a->query_string);
- $_SESSION['return_url'] = trim($stripped,'/');
+ $_SESSION['return_url'] = trim($stripped,'/');
return login();
}