示例#1
0
文件: invite.php 项目: himmelex/NTW
 function sendInvitation($email, $user, $personal)
 {
     $profile = $user->getProfile();
     $bestname = $profile->getBestName();
     $sitename = common_config('site', 'name');
     $invite = new Invitation();
     $invite->address = $email;
     $invite->address_type = 'email';
     $invite->code = common_confirmation_code(128);
     $invite->user_id = $user->id;
     $invite->created = common_sql_now();
     if (!$invite->insert()) {
         common_log_db_error($invite, 'INSERT', __FILE__);
         return false;
     }
     $recipients = array($email);
     $headers['From'] = mail_notify_from();
     $headers['To'] = trim($email);
     $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" . "%6\$s\n\n" . "If not, you can ignore this message. Thanks for your patience and your time.\n\n" . "Sincerely, %2\$s\n"), $bestname, $sitename, common_root_url(), $personal, common_local_url('showstream', array('nickname' => $user->nickname)), common_local_url('register', array('code' => $invite->code)));
     mail_send($recipients, $headers, $body);
 }
示例#2
0
 public static function inviteWorkers(Expo $expo, $expirationDate, array $workerArray)
 {
     $body = "Hello FIRSTNAME,\n\nYou are invited to join EXPONAME.\nPlease login and proceed to the following page to register.\n\n" . BASE_URL . "/pages/WorkerRegistrationPage.php";
     $paramNames = array("FIRSTNAME", "EXPONAME");
     // using NAME and EXPONAME leads to bad results; because NAME might get replaced first!
     $body .= "\n\nSincerely,\nThe " . SITE_NAME . " Team";
     $welcomeForm = new FormMail(SITE_NAME . " Expo Invitation", $paramNames, $body);
     $welcomeParams = array("EXPONAME" => $expo->title);
     $invite = new Invitation();
     $invite->expoid = $expo->expoid;
     $invite->expirationDate = is_null($expirationDate) ? $expo->stopTime : $expirationDate;
     foreach ($workerArray as $worker) {
         $invite->email = $worker->email;
         $invite->workerid = $worker->workerid;
         $welcomeParams["FIRSTNAME"] = $worker->firstName;
         $invite->insert($welcomeForm, $welcomeParams);
     }
     // $worker
     $invite = NULL;
     return;
 }
示例#3
0
 function sendInvitation($email, $user, $personal)
 {
     $profile = $user->getProfile();
     $bestname = $profile->getBestName();
     $sitename = common_config('site', 'name');
     $invite = new Invitation();
     $invite->address = $email;
     $invite->address_type = 'email';
     $invite->code = common_confirmation_code(128);
     $invite->user_id = $user->id;
     $invite->created = common_sql_now();
     if (!$invite->insert()) {
         common_log_db_error($invite, 'INSERT', __FILE__);
         return false;
     }
     $confirmUrl = common_local_url('register', array('code' => $invite->code));
     $recipients = array($email);
     $headers['From'] = mail_notify_from();
     $headers['To'] = trim($email);
     $headers['Content-Type'] = 'text/html; charset=UTF-8';
     // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral
     // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is
     // TRANS: the StatusNet sitename.
     $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
     $title = empty($personal) ? 'invite' : 'invitepersonal';
     // @todo FIXME: i18n issue.
     $inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths());
     $body = $inviteTemplate->toHTML(array('inviter' => $bestname, 'inviterurl' => $profile->profileurl, 'confirmurl' => $confirmUrl, 'personal' => $personal));
     common_debug('Confirm URL is ' . common_local_url('register', array('code' => $invite->code)));
     mail_send($recipients, $headers, $body);
 }