diff options
author | root <root@diekershoff.homeunix.net> | 2010-12-21 07:14:58 +0100 |
---|---|---|
committer | root <root@diekershoff.homeunix.net> | 2010-12-21 07:14:58 +0100 |
commit | 8cfa93b730f87edf98c52e9a38cfa015ce1f5d47 (patch) | |
tree | da79ea09482cf8984c7d9e02076dd2e4f0e8e65e /mod/dfrn_request.php | |
parent | ad32d85cfaa775efbd89b273bd51c82f4e45baab (diff) | |
parent | ddec422de6707809aceb541e1191073b43aec18a (diff) | |
download | volse-hubzilla-8cfa93b730f87edf98c52e9a38cfa015ce1f5d47.tar.gz volse-hubzilla-8cfa93b730f87edf98c52e9a38cfa015ce1f5d47.tar.bz2 volse-hubzilla-8cfa93b730f87edf98c52e9a38cfa015ce1f5d47.zip |
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'mod/dfrn_request.php')
-rw-r--r-- | mod/dfrn_request.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 9c8064db5..6cefdd28e 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -217,17 +217,34 @@ function dfrn_request_post(&$a) { return; } - $nickname = $a->profile['nickname']; - $notify_flags = $a->profile['notify-flags']; - $uid = $a->profile['uid']; - + $nickname = $a->profile['nickname']; + $notify_flags = $a->profile['notify-flags']; + $uid = $a->profile['uid']; + $maxreq = intval($a->profile['maxreq']); $contact_record = null; - $failed = false; - $parms = null; + $failed = false; + $parms = null; if( x($_POST,'dfrn_url')) { + /** + * Block friend request spam + */ + + if($maxreq) { + $r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d", + dbesc(datetime_convert('UTC','UTC','now - 24 hours')), + intval($uid) + ); + if(count($r) > $maxreq) { + notice( $a->profile['name'] . t(' has received too many connection requests today.') . EOL); + notice( t('Spam protection measures have been invoked.') . EOL); + notice( t('Friends are advised to please try again in 24 hours.') . EOL); + return; + } + } + $url = trim($_POST['dfrn_url']); if(! strlen($url)) { notice( t("Invalid locator") . EOL ); |