]> git.mxchange.org Git - friendica.git/blob - mod/invite.php
rino recipient patch
[friendica.git] / mod / invite.php
1 <?php
2
3
4 function invite_post(&$a) {
5         if(! local_user()) {
6                 notice( t('Permission denied.') . EOL);
7                 return;
8         }
9
10
11         $recips = explode("\n",$_POST['recipients']);
12         $message = $_POST['message'];
13
14         $total = 0;
15
16         foreach($recips as $recip) {
17
18                 $recip = trim($recip);
19
20                 if(! valid_email($recip)) {
21                         notice(  $recip . t(' : ') . t('Not a valid email address.') . EOL);
22                         continue;
23                 }
24
25                 $res = mail($recip, t('Please join my network on ') . $a->config['sitename'], 
26                         $message, "From: " . $a->user['email']);
27                 if($res) {
28                         $total ++;
29                 }
30                 else {
31                         notice( $recip . t(' : ') . t('Message delivery failed.') . EOL);
32                 }
33
34         }
35         notice( $total . t(' messages sent.') . EOL);
36         return;
37 }
38
39
40 function invite_content(&$a) {
41         if(! local_user()) {
42                 notice( t('Permission denied.') . EOL);
43                 return;
44         }
45
46         $tpl = load_view_file('view/invite.tpl');
47         
48         $o = replace_macros($tpl, array(
49                 '$invite' => t('Send invitations'),
50                 '$addr_text' => t('Enter email addresses, one per line:'),
51                 '$msg_text' => t('Your message:'),
52                 '$default_message' => t('Please join my social network on ') . $a->config['sitename'] . t("\r\n") . t("\r\n")
53                         . t('To accept this invitation, please visit:') . t("\r\n") . t("\r\n") . $a->get_baseurl()
54                         . t("\r\n") . t("\r\n") . t('Once you have registered, please make an introduction via my profile page at:') 
55                         . t("\r\n") . t("\r\n") . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
56                 '$submit' => t('Submit')
57         ));
58
59         return $o;
60 }