]> git.mxchange.org Git - friendica.git/blobdiff - mod/invite.php
Merge pull request #4079 from MrPetovan/task/4069-add-pagination-to-statuses-api
[friendica.git] / mod / invite.php
index 81b58800248c84b5fd1b8508c0e5e227e7fb91c0..06c0df3b84d5902ede461f243122182da7776d6f 100644 (file)
@@ -1,16 +1,15 @@
 <?php
-
 /**
- * module: invite.php
+ * Module: invite.php
  *
- * send email invitations to join social network
+ * Send email invitations to join social network
  *
  */
-
 use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 use Friendica\Core\System;
-
-require_once('include/email.php');
+use Friendica\Protocol\Email;
 
 function invite_post(App $a) {
 
@@ -21,12 +20,12 @@ function invite_post(App $a) {
 
        check_form_security_token_redirectOnErr('/', 'send_invite');
 
-       $max_invites = intval(get_config('system','max_invites'));
+       $max_invites = intval(Config::get('system','max_invites'));
        if (! $max_invites) {
                $max_invites = 50;
        }
 
-       $current_invites = intval(get_pconfig(local_user(),'system','sent_invites'));
+       $current_invites = intval(PConfig::get(local_user(),'system','sent_invites'));
        if ($current_invites > $max_invites) {
                notice( t('Total invitation limit exceeded.') . EOL);
                return;
@@ -38,9 +37,9 @@ function invite_post(App $a) {
 
        $total = 0;
 
-       if (get_config('system','invitation_only')) {
+       if (Config::get('system','invitation_only')) {
                $invonly = true;
-               $x = get_pconfig(local_user(),'system','invites_remaining');
+               $x = PConfig::get(local_user(),'system','invites_remaining');
                if ((! $x) && (! is_site_admin())) {
                        return;
                }
@@ -67,7 +66,7 @@ function invite_post(App $a) {
                        if (! is_site_admin()) {
                                $x --;
                                if ($x >= 0) {
-                                       set_pconfig(local_user(),'system','invites_remaining',$x);
+                                       PConfig::set(local_user(),'system','invites_remaining',$x);
                                } else {
                                        return;
                                }
@@ -76,7 +75,7 @@ function invite_post(App $a) {
                        $nmessage = $message;
                }
 
-               $res = mail($recip, email_header_encode( t('Please join us on Friendica'),'UTF-8'),
+               $res = mail($recip, Email::encodeHeader(t('Please join us on Friendica'),'UTF-8'),
                        $nmessage,
                        "From: " . $a->user['email'] . "\n"
                        . 'Content-type: text/plain; charset=UTF-8' . "\n"
@@ -85,7 +84,7 @@ function invite_post(App $a) {
                if ($res) {
                        $total ++;
                        $current_invites ++;
-                       set_pconfig(local_user(),'system','sent_invites',$current_invites);
+                       PConfig::set(local_user(),'system','sent_invites',$current_invites);
                        if($current_invites > $max_invites) {
                                notice( t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
                                return;
@@ -110,16 +109,16 @@ function invite_content(App $a) {
        $tpl = get_markup_template('invite.tpl');
        $invonly = false;
 
-       if (get_config('system','invitation_only')) {
+       if (Config::get('system','invitation_only')) {
                $invonly = true;
-               $x = get_pconfig(local_user(),'system','invites_remaining');
+               $x = PConfig::get(local_user(),'system','invites_remaining');
                if ((! $x) && (! is_site_admin())) {
                        notice( t('You have no more invitations available') . EOL);
                        return '';
                }
        }
 
-       $dirloc = get_config('system','directory');
+       $dirloc = Config::get('system','directory');
        if (strlen($dirloc)) {
                if ($a->config['register_policy'] == REGISTER_CLOSED) {
                        $linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/servers');