]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/invite.php
fix format string, again again
[quix0rs-gnu-social.git] / actions / invite.php
index 3a68a60de93708eb85b66b6655f1960d768d6454..04ae29a2e7ac49c1a640f04627d227b7d4614951 100644 (file)
@@ -72,7 +72,7 @@ class InviteAction extends Action {
                                }
                        } else {
                                $sent[] = $email;
-                               $this->send_invitation($email, $user);
+                               $this->send_invitation($email, $user, $personal);
                        }
                }
 
@@ -97,7 +97,7 @@ class InviteAction extends Action {
                        common_element('p', NULL, _('Invitation(s) sent to the following people:'));
                        common_element_start('ul');
                        foreach ($sent as $other) {
-                               common_element('li', NULL, $sent);
+                               common_element('li', NULL, $other);
                        }
                        common_element_end('ul');
                        common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
@@ -141,14 +141,18 @@ class InviteAction extends Action {
                common_show_footer();
        }
 
-       function send_invitation($email, $user) {
+       function send_invitation($email, $user, $personal) {
 
-               $email = trim($email);
+               $profile = $user->getProfile();
+               $bestname = $profile->getBestName();
+
+               $sitename = common_config('site', 'name');
 
                $invite = new Invitation();
 
                $invite->address = $email;
-               $invite->type = 'email';
+               $invite->address_type = 'email';
+               $invite->code = common_confirmation_code(128);
                $invite->user_id = $user->id;
                $invite->created = common_sql_now();
 
@@ -161,25 +165,25 @@ class InviteAction extends Action {
 
                $headers['From'] = mail_notify_from();
                $headers['To'] = $email;
-               $headers['Subject'] = sprintf(_('%1s has invited you to join them on %2s'), $bestname, $sitename);
-
-               $body = sprintf(_("%1s has invited you to join them on %2s (%3s).\n\n".
-                                                 "%4s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
-                                                 "You can also share news about yourself, your thoughts, or your life online with people who know about you.\n\n".
-                                                 "%5s said:\n\n%6s\n\n".
-                                                 "You can see %7s's profile page on %8s here:\n\n".
-                                                 "%9s\n\n".
+               $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
+
+               $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
+                                                 "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
+                                                 "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".
+                                                 "It's also great for meeting new people who share your interests.\n\n".
+                                                 "%1\$s said:\n\n%4\$s\n\n".
+                                                 "You can see %1\$s's profile page on %2\$s here:\n\n".
+                                                 "%5\$s\n\n".
                                                  "If you'd like to try the service, click on the link below to accept the invitation.\n\n".
-                                                 "%10s\n\n".
+                                                 "%6\$s\n\n".
                                                  "If not, you can ignore this message. Thanks for your patience and your time.\n\n".
-                                                 "Sincerely, %11s\n"),
-                                               $bestname, $sitename, common_root_url(),
+                                                 "Sincerely, %2\$s\n"),
+                                               $bestname,
                                                $sitename,
-                                               $bestname, $personal,
-                                               $bestname, $sitename,
+                                               common_root_url(),
+                                               $personal,
                                                common_local_url('showstream', array('nickname' => $user->nickname)),
-                                               common_local_url('register', array('code' => $invite->code)),
-                                               $sitename);
+                                               common_local_url('register', array('code' => $invite->code)));
 
                mail_send($recipients, $headers, $body);
        }