aboutsummaryrefslogtreecommitdiffstats
path: root/mod/invite.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-25 13:55:42 -0800
committerfriendica <info@friendica.com>2013-01-25 13:55:42 -0800
commita8575199af9c1697af49ff8a4f15eb904a1773d5 (patch)
tree198173d8a95be516f2f440a3f16586d3fb3b669b /mod/invite.php
parentc657cabc9a2bc3b97ef3e10875fcb159026c314b (diff)
downloadvolse-hubzilla-a8575199af9c1697af49ff8a4f15eb904a1773d5.tar.gz
volse-hubzilla-a8575199af9c1697af49ff8a4f15eb904a1773d5.tar.bz2
volse-hubzilla-a8575199af9c1697af49ff8a4f15eb904a1773d5.zip
upstream fixes, template regeneration
Diffstat (limited to 'mod/invite.php')
-rw-r--r--mod/invite.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/mod/invite.php b/mod/invite.php
index 5eb5f6646..336e20164 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -14,6 +14,18 @@ function invite_post(&$a) {
return;
}
+ check_form_security_token_redirectOnErr('/', 'send_invite');
+
+ $max_invites = intval(get_config('system','max_invites'));
+ if(! $max_invites)
+ $max_invites = 50;
+
+ $current_invites = intval(get_pconfig(local_user(),'system','sent_invites'));
+ if($current_invites > $max_invites) {
+ notice( t('Total invitation limit exceeded.') . EOL);
+ return;
+ };
+
$recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : array());
$message = ((x($_POST,'message')) ? notags(trim($_POST['message'])) : '');
@@ -64,6 +76,12 @@ function invite_post(&$a) {
if($res) {
$total ++;
+ $current_invites ++;
+ set_pconfig(local_user(),'system','sent_invites',$current_invites);
+ if($current_invites > $max_invites) {
+ notice( t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
+ return;
+ }
}
else {
notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL);
@@ -108,6 +126,7 @@ function invite_content(&$a) {
}
$o = replace_macros($tpl, array(
+ '$form_security_token' => get_form_security_token("send_invite"),
'$invite' => t('Send invitations'),
'$addr_text' => t('Enter email addresses, one per line:'),
'$msg_text' => t('Your message:'),