コード例 #1
0
ファイル: SetPasswordTrait.php プロジェクト: socieboy/jupiter
 /**
  * Send a email with the password.
  * @param $user
  */
 protected function sendEmailOfNotification($user)
 {
     $this->mailer->send('jupiter::emails.password-notification', $user, function ($message) use($user) {
         $message->from(config('jupiter.emails.from.email'), config('jupiter.emails.from.name'));
         $message->to($user['email'], $user['name'])->subject('Welcome to our application.');
     });
 }
コード例 #2
0
 /**
  * Transport a mail.
  *
  * @param string $strRecipientEmail
  * @param Mail   $email
  *
  * @return void
  * @throws AvisotaTransportException
  */
 public function transportEmail($recipient, Mail $email)
 {
     global $page;
     try {
         // set sender email
         if ($this->config->sender) {
             $email->setSender($this->config->sender);
         } else {
             if (isset($page) && strlen($page->adminEmail)) {
                 $email->setSender($page->adminEmail);
             } else {
                 $email->setSender($GLOBALS['TL_CONFIG']['adminEmail']);
             }
         }
         // set sender name
         if (strlen($this->config->senderName)) {
             $email->setSenderName($this->config->senderName);
         }
         // set reply email
         if ($this->config->replyTo) {
             $email->setReplyTo($this->config->replyTo);
         }
         // set reply name
         if ($this->config->replyToName) {
             $email->setReplyToName($this->config->replyToName);
         }
         $this->mailer->send($email, $recipient);
     } catch (Swift_RfcComplianceException $e) {
         throw new AvisotaTransportEmailException($recipient, $email, $e->getMessage(), $e->getCode(), $e);
     }
 }
コード例 #3
0
 public function executeRegistrationSubmit(sfWebRequest $request)
 {
     $this->forwardErrorIf($this->getUser()->isAuthenticated(), "User can not register if already logged in.");
     $this->forward404Unless($request->isMethod('post'));
     $this->form = new RegistrationForm();
     $this->form->bind($request->getParameter('register'));
     if ($this->form->isValid()) {
         $account = $this->form->save();
         $profile = new Profile();
         $profile->uid = $account->id;
         $profile->username = $account->username;
         $profile->first_name = $request->getPostParameter('register[first_name]');
         $profile->middle_name = $request->getPostParameter('register[middle_name]');
         $profile->last_name = $request->getPostParameter('register[last_name]');
         $profile->name = $profile->first_name . " " . $profile->middle_name . " " . $profile->last_name;
         $profile->pic = "0.jpg";
         $profile->save();
         $mailer = new Mailer();
         if ($mailer->send($account->email, sfConfig::get('app_registration_email_from_address'), sfConfig::get('app_site_name'), sfConfig::get('app_registration_email_subject'), "                    \nDear " . $profile->first_name . ",\n\n\nWelcome to " . sfConfig::get('app_site_name') . ".  We are very pleased you decided to start the\nnext generation of your online social life with us!  Below you will\nfind an activation link.  Please click this link to verify your\naccount before logging in.  If you have any trouble, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n\nVERIFICATION LINK (Please click or paste into your browser address bar)\n-----------------------------------------------------------------------\n" . "http://rks.ath.cx:8080" . $this->generateUrl('verify') . '/id/' . $account->id . '/vid/' . md5($account->created_at) . "\n-----------------------------------------------------------------------\n\nIf you feel you were added to our system by mistake, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n--The " . sfConfig::get('app_site_name') . " Support Team\n                    ")) {
             $this->getUser()->setFlash('info', "Registration was successful, please check your email to verify your account");
             $this->redirect('account/login');
         } else {
             $this->getUser()->setFlash('error', "Error occured sending with our mail server, please register again using a different username");
             $this->redirect('account/register');
         }
     }
     $this->setTemplate('register');
 }
コード例 #4
0
 /**
  * handle user request
  */
 function handle()
 {
     global $INPUT;
     global $conf;
     if (!$INPUT->bool('send')) {
         return;
     }
     // make sure debugging is on;
     $conf['plugin']['smtp']['debug'] = 1;
     // send a mail
     $mail = new Mailer();
     if ($INPUT->str('to')) {
         $mail->to($INPUT->str('to'));
     }
     if ($INPUT->str('cc')) {
         $mail->to($INPUT->str('cc'));
     }
     if ($INPUT->str('bcc')) {
         $mail->to($INPUT->str('bcc'));
     }
     $mail->subject('DokuWiki says hello');
     $mail->setBody("Hi @USER@\n\nThis is a test from @DOKUWIKIURL@");
     $ok = $mail->send();
     // check result
     if ($ok) {
         msg('Message was sent. SMTP seems to work.', 1);
     } else {
         msg('Message wasn\'t sent. SMTP seems not to work properly.', -1);
     }
 }
コード例 #5
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $mailer->send('mail.welcome', ['data' => 'data'], function ($message) {
         $message->from('*****@*****.**', 'Christian Nwmaba');
         $message->to('*****@*****.**');
     });
 }
コード例 #6
0
ファイル: Utils.php プロジェクト: iHunt101/phlite
function mail_admins($subject, $body, $attachments = array(), $options = array())
{
    $settings = Project::currentProject()->getSettings();
    $recipients = $settings['ADMINS'];
    // TODO: Massage the recipients list format
    Mailer::send($recipients, $subject, $body, $attachments, $options);
}
コード例 #7
0
ファイル: ContactController.php プロジェクト: Renako/mytcg-f3
 private function process()
 {
     $this->f3->scrub($_POST);
     $audit = \Audit::instance();
     $this->f3->set('SESSION.flash', array());
     // validate form
     if (!preg_match("/^[\\w\\- ]{2,30}\$/", $this->f3->get('POST.name'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid name.'));
     }
     if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
     }
     if (!empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
     }
     if (empty($this->f3->get('POST.message'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please include a message!'));
     }
     // honey pot
     if ($this->f3->get('POST.username') !== '') {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please do not use autofill or similar tools!'));
     }
     // if there are no errors, process the form
     if (count($this->f3->get('SESSION.flash')) === 0) {
         $this->f3->set('POST.level', $this->f3->get('member')->level + 1);
         $mailer = new Mailer();
         $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Contact Form')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('POST.email')))->setBody(Template::instance()->render('app/templates/emails/contact.htm'), 'text/html');
         if ($mailer->send($message)) {
             $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your form has been sent. Thanks for contacting us!'));
         } else {
             $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
         }
     }
 }
コード例 #8
0
ファイル: MembersController.php プロジェクト: Renako/mytcg-f3
 public function lostpass()
 {
     if ($this->f3->exists('POST.lostpass')) {
         $audit = \Audit::instance();
         $this->f3->scrub($_POST);
         $this->f3->set('SESSION.flash', array());
         $members = new Members($this->db);
         // validate form
         if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
         }
         if ($members->count(array('email=?', $this->f3->get('POST.email'))) == 0) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Couldn\'t find an account associated with that email address.'));
         }
         if (count($this->f3->get('SESSION.flash')) === 0) {
             // generate random password
             $this->f3->set('password', md5(time()));
             $this->f3->set('POST.password', password_hash($this->f3->get('password'), PASSWORD_DEFAULT));
             $mailer = new Mailer();
             $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Password Reset')->setFrom(array($this->f3->get('noreplyemail') => $this->f3->get('tcgname')))->setTo(array($this->f3->get('POST.email')))->setReplyTo(array($this->f3->get('tcgemail')))->setBody(Template::instance()->render('app/templates/emails/pwreset.htm'), 'text/html');
             // save new password and email to member
             if ($members->edit($members->read(array('email=?', $this->f3->get('POST.email')), [])[0]->id, array('password')) && $mailer->send($message)) {
                 $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your password has been reset! Please check your email.'));
             } else {
                 $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'Password reset failed. Please try again or contact us for assistance.'));
             }
         }
     }
     $this->f3->set('content', 'app/views/lostpass.htm');
     echo Template::instance()->render('app/templates/default.htm');
 }
コード例 #9
0
 function sandmailAction()
 {
     $firstnameErrText = "";
     $lastnameErrText = "";
     $addressErrText = "";
     $exemplarsErrText = "";
     if (empty($_POST['firstname'])) {
         $firstnameErrText = "не ввели имя!";
     }
     if (empty($_POST['lastname'])) {
         $lastnameErrText = "<span class=err> не ввели фамилию! </span> ";
     }
     if (empty($_POST['address'])) {
         $addressErrText = "<span class=err> не ввели адрес! </span> ";
     }
     if (empty($_POST['exemplars'])) {
         $exemplarsErrText = "<span class=err> не выбрано количество! </span> ";
     }
     if (!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['address']) && !empty($_POST['exemplars'])) {
         $body = $row['FIO'] . "\r\n" . $row['BookName'] . ", количество: " . $_POST["exemplars"] . "\r\n" . $_POST["firstname"] . " " . $_POST["lastname"] . " " . $_POST["address"];
         $title = substr(htmlspecialchars(trim($_POST['lastname'])), 0, 1000) . " ";
         $title .= substr(htmlspecialchars(trim($_POST['firstname'])), 0, 1000) . ", ";
         $title .= "Адресс :" . substr(htmlspecialchars(trim($_POST['address'])), 0, 1000);
         $to = '*****@*****.**';
         $sendaddress = mail($to, $title, 'Заказ:' . $body);
         $mailer = new Mailer();
         try {
             $mailer->send($to, $title, 'Заказ:' . $body);
         } catch (Exception $err) {
             $sendaddressErr = true;
         }
     }
     include_once 'views/sendmail.tpl';
 }
コード例 #10
0
ファイル: add.php プロジェクト: BackupTheBerlios/ubook-svn
 public function InsertAndSendMail()
 {
     $quotedAuthor = trim($_POST['mail']);
     $quotedTitle = trim($_POST['title']);
     $isbn = Isbn::stringFromPost();
     $year = (int) trim($_POST['year']);
     $price = (double) str_replace(',', '.', $_POST['price']);
     $quotedDescription = $_POST['desc'];
     $key = KeyGenerator::genKey();
     $query = 'insert into books' . ' (author, title, year, price, isbn, description, mail, auth_key' . ', created,expires)' . ' values (' . '"' . $quotedAuthor . '"' . ', "' . $quotedTitle . '"' . ', "' . $year . '"' . ', "' . $price . '"' . ', "' . $isbn . '"' . ', "' . $quotedDescription . '"' . ', "' . $this->getMail() . '"' . ', "' . $key . '"' . ', now()' . ', date_add(now(), interval 45 day)' . ')';
     mysql_query($query);
     $book_id = mysql_insert_id();
     $this->selectableCategories->setBookId($book_id);
     $this->selectableCategories->update();
     $subject = '';
     $message = 'Mit deiner E-Mailadresse wurde das unten stehende Buch angeboten. Hebe diese E-Mail auf, um das Angebot später ändern und löschen zu können.';
     Mailer::send($book_id, $subject, $message);
     $searches = new Searches();
     if ($searches->areActivated()) {
         $author = stripslashes($quotedAuthor);
         $title = stripslashes($quotedTitle);
         $description = stripslashes($quotedDescription);
         $searches->bookAdded($book_id, $author, $title, $description);
     }
     header('Location: book.php?id=' . $book_id . '&key=' . $key . '&new=1');
     exit;
 }
コード例 #11
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     //
     $mailer->send('emails.welcome', ['user' => $this->user], function ($m) {
         //
     });
 }
コード例 #12
0
ファイル: root.php プロジェクト: bilel99/oge
 function _login()
 {
     // On masque le header et le footer
     $this->autoFireHead = false;
     $this->autoFireHeader = false;
     $this->autoFireDebug = false;
     $this->autoFireFooter = false;
     // Formulaire d'envoi d'un nouveau password
     if (isset($_POST['form_new_password'])) {
         if ($this->users->get(trim($_POST['email']), 'email')) {
             // Generation du nouveau mot de passe
             $this->new_password = $this->ficelle->generatePassword(7);
             $this->users->password = md5($this->new_password);
             $this->users->update();
             //***********************************************//
             //*** ENVOI DU MAIL AVEC NEW PASSWORD NON EMT ***//
             //***********************************************//
             // Recuperation du modele de mail
             $this->mails_text->get('admin-nouveau-mot-de-passe', 'lang = "' . $this->language . '" AND type');
             // Variables du mailing
             $cms = $this->cms;
             $surl = $this->surl;
             $url = $this->lurl;
             $email = trim($_POST['email']);
             $password = $this->new_password;
             // Attribution des données aux variables
             $sujetMail = $this->mails_text->subject;
             eval("\$sujetMail = \"{$sujetMail}\";");
             $texteMail = $this->mails_text->content;
             eval("\$texteMail = \"{$texteMail}\";");
             $exp_name = $this->mails_text->exp_name;
             eval("\$exp_name = \"{$exp_name}\";");
             // Nettoyage de printemps
             $sujetMail = strtr($sujetMail, 'ÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝÇçàáâãäåèéêëìíîïòóôõöùúûüýÿÑñ', 'AAAAAAEEEEIIIIOOOOOUUUUYCcaaaaaaeeeeiiiiooooouuuuyynn');
             $exp_name = strtr($exp_name, 'ÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝÇçàáâãäåèéêëìíîïòóôõöùúûüýÿÑñ', 'AAAAAAEEEEIIIIOOOOOUUUUYCcaaaaaaeeeeiiiiooooouuuuyynn');
             // Envoi du mail
             $this->email = $this->loadLib('email', array());
             $this->email->setFrom($this->mails_text->exp_email, $exp_name);
             $this->email->addRecipient(trim($_POST['email']));
             $this->email->addBCCRecipient('*****@*****.**');
             $this->email->setSubject('=?UTF-8?B?' . base64_encode($sujetMail) . '?=');
             $this->email->setHTMLBody($texteMail);
             Mailer::send($this->email, $this->mails_filer, $this->mails_text->id_textemail);
             // Mise en session du message
             $_SESSION['msgErreur'] = 'newPassword';
             $_SESSION['newPassword'] = '******';
             // Renvoi sur la page de login
             header('Location:' . $this->lurl . '/login');
             die;
         } else {
             // Mise en session du message
             $_SESSION['msgErreur'] = 'newPassword';
             $_SESSION['newPassword'] = '******';
             header('Location:' . $this->lurl . '/login');
             die;
         }
     }
 }
コード例 #13
0
 public function send($parsed_object, $parcel, $debug = FALSE)
 {
     $parsed_object->settings = $parcel->settings;
     $mailer = new Mailer($parsed_object);
     $response = $mailer->send();
     if (!$response) {
         $this->show_error('An unknown error has occurred when sending email with your server.');
     }
     return new Postmaster_Service_Response(array('status' => $response ? POSTMASTER_SUCCESS : POSTMASTER_FAILED, 'parcel_id' => $parcel->id, 'channel_id' => isset($parcel->channel_id) ? $parcel->channel_id : FALSE, 'author_id' => isset($parcel->entry->author_id) ? $parcel->entry->author_id : FALSE, 'entry_id' => isset($parcel->entry->entry_id) ? $parcel->entry->entry_id : FALSE, 'gmt_date' => $this->now, 'service' => $parcel->service, 'to_name' => $parsed_object->to_name, 'to_email' => $parsed_object->to_email, 'from_name' => $parsed_object->from_name, 'from_email' => $parsed_object->from_email, 'cc' => $parsed_object->cc, 'bcc' => $parsed_object->bcc, 'subject' => $parsed_object->subject, 'message' => !empty($parsed_object->message) ? $parsed_object->message : $parsed_object->html_message, 'html_message' => $parsed_object->html_message, 'plain_message' => $parsed_object->plain_message, 'parcel' => $parcel));
 }
コード例 #14
0
 /**
  * send_account_enabled
  * This sends the account enabled email for the specified user
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public static function send_account_enabled($username, $fullname, $email)
 {
     $mailer = new Mailer();
     $mailer->set_default_sender();
     $mailer->subject = sprintf(T_("Account enabled at %s"), AmpConfig::get('site_title'));
     $mailer->message = sprintf(T_("Your account %s has been enabled\n\n\n            Please logon using %s"), $username, AmpConfig::get('web_path') . "/login.php");
     $mailer->recipient = $email;
     $mailer->recipient_name = $fullname;
     $mailer->send();
 }
コード例 #15
0
function hook_shipment_post(&$user, &$shipment, &$session)
{
    $mailer = new Mailer($user['folder']);
    $mailer->addRcpt($shipment->ship_contact, '*****@*****.**');
    $mailer->dataObj = $shipment->toArray();
    $mailer->dataObj['del_note'] = $session->account_notes . " " . $mailer->dataObj['del_note'];
    $mailer->template = "order_summary";
    $mailer->subject = "WEB ORDER #" . $shipment->ext_id;
    $mailer->send();
}
コード例 #16
0
 private static function checkExpire()
 {
     $query = 'select id, auth_key, mail, author, title, price, description' . ' from books where expired is null and expires < now()';
     $result = mysql_query($query);
     while ($book = mysql_fetch_array($result)) {
         $subject = 'Erneuern: ';
         $message = 'Anscheinend hat sich in letzter Zeit niemand für dein' . ' unten stehendes Buch interessiert. In zehn Tagen wird das' . ' Angebot automatisch gelöscht. Um das zu verhindern, kannst du' . ' mit dem folgenden Link das Angebot erneuern:' . "\n" . WEBDIR . 'renew.php?id=' . $book['id'] . '&key=' . $book['auth_key'] . "\n\n" . 'Falls das Buch bereits gelöscht wurde dann benutze diesen Link,' . ' um es einfach wieder zu importieren:' . "\n" . WEBDIR . 'import.php?mail=' . $book['mail'];
         Mailer::send($book['id'], $subject, $message);
         $query = 'update books set expired = date_add(now(), interval 10 day)' . ' where id="' . $book['id'] . '"';
         mysql_query($query);
     }
 }
コード例 #17
0
function hook_rate_post(&$user, &$shipment, &$session)
{
    $mailer = new Mailer($user['folder']);
    $mailer->addRcpt($shipment->ship_contact, '*****@*****.**');
    // change to pickups @ minimaxexpress.com upon launch
    $mailer->addReplyTo($shipment->ship_contact, $shipment->ship_email);
    $mailer->dataObj = $shipment->toArray();
    $mailer->dataObj['attn'] = "Please respond to this rate inquiry!";
    $mailer->template = "quote_summary";
    $mailer->subject = "New Rate Inquiry";
    $mailer->send();
}
コード例 #18
0
ファイル: users.php プロジェクト: ajb/rfpez
 public function action_post_forgot_password()
 {
     $user = User::where_email(Input::get('email'))->first();
     if (!$user) {
         Session::flash('errors', array(__("r.flashes.forgot_password_user_not_found")));
         return Redirect::to_route('forgot_password')->with_input();
     }
     $user->generate_reset_password_token();
     Mailer::send("ForgotPassword", array('user' => $user));
     Session::flash('notice', __("r.flashes.forgot_password_success"));
     return Redirect::to_route('signin');
 }
コード例 #19
0
 /**
  * send_confirmation
  * This sends the confirmation e-mail for the specified user
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public static function send_confirmation($username, $fullname, $email, $website, $password, $validation)
 {
     $mailer = new Mailer();
     // We are the system
     $mailer->set_default_sender();
     $mailer->subject = sprintf(T_("New User Registration at %s"), AmpConfig::get('site_title'));
     $mailer->message = sprintf(T_("Thank you for registering\n\n\nPlease keep this e-mail for your records. Your account information is as follows:\n----------------------\nUsername: %s\n----------------------\n\nYour account is currently inactive. You cannot use it until you've visited the following link:\n\n%s\n\nThank you for registering\n"), $username, AmpConfig::get('web_path') . "/register.php?action=validate&username={$username}&auth={$validation}");
     $mailer->recipient = $email;
     $mailer->recipient_name = $fullname;
     $mailer->send();
     // Check to see if the admin should be notified
     if (AmpConfig::get('admin_notify_reg')) {
         $mailer->message = sprintf(T_("A new user has registered\nThe following values were entered.\n\nUsername: %s\nFullname: %s\nE-mail: %s\nWebsite: %s\n\n"), $username, $fullname, $email, $website);
         $mailer->send_to_group('admins');
     }
     return true;
 }
コード例 #20
0
function hook_shipment_post(&$user, &$shipment)
{
    if ($shipment->service == 'ND') {
        $contact = 'Dispatch @ TIMAX';
        $shipment->ship_email = '*****@*****.**';
    } else {
        $contact = $shipment->ship_contact;
    }
    if (trim($shipment->ship_email) == '') {
        return;
    }
    $mailer = new Mailer($user['folder']);
    $mailer->addRcpt($contact, $shipment->ship_email);
    $mailer->dataObj = $shipment->toArray();
    switch ($shipment->service) {
        case 'NF':
            $mailer->template = "quote_notification_nfo";
            $mailer->subject = "NEW QUOTE #" . $shipment->ext_id;
            break;
        case 'ND':
            $mailer->template = "quote_notification_nd";
            $mailer->subject = "NEW QUOTE ND #" . $shipment->ext_id;
            break;
        case 'ONL':
        case 'SDL':
        case 'RSL':
        case 'EXP':
            if ($shipment->equipment == '53v2') {
                $mailer->template = "quote_summary";
                $mailer->subject = "NEW QUOTE #" . $shipment->ext_id;
            } else {
                $mailer->template = "order_summary";
                $mailer->subject = "NEW SHIPMENT #" . $shipment->ext_id;
            }
            break;
        default:
            $mailer->template = "order_summary";
            $mailer->subject = "NEW SHIPMENT #" . $shipment->ext_id;
            break;
    }
    if ($shipment->division != 'CUR') {
        $mailer->send();
    }
}
コード例 #21
0
 public function process($params)
 {
     if (!isset($params[0])) {
         throw new MException("Mod id not specified.");
     }
     $modId = $params[0];
     // also select devname and email for mailing updates
     $sth = $this->getDB()->prepare("SELECT id, name, devname, devemail, version, available\r\n\t\t\t\t\t\tFROM mods\r\n\t\t\t\t\t\tWHERE id = :id");
     $sth->bindValue(":id", $modId, PDO::PARAM_INT);
     $sth->execute();
     $modExists = $sth->fetch(PDO::FETCH_ASSOC);
     if (!empty($modExists)) {
         // this mod is in the repo
         if ($modExists["available"] == 0) {
             // check whether file has been uploaded yet
             $fileLocation = sprintf('%1$s../downloads/mods/%2$s/%3$d/%2$s.mod.dll', MBASE_PATH, $modExists["name"], $modExists["version"]);
             if (!file_exists($fileLocation)) {
                 throw new MException(sprintf("Mod %s has no version %d in the repo yet.", $modExists["name"], $modExists["version"]));
             } else {
                 // file exists on server, nothing to stop us from activating now :)
                 $sth = $this->getDB()->prepare("UPDATE mods\r\n\t\t\t\t\t\t\t\t\tSET available = 1\r\n\t\t\t\t\t\t\t\t\tWHERE id = :id");
                 $sth->bindValue(":id", $modExists["id"], PDO::PARAM_INT);
                 if ($sth->execute()) {
                     // send mail to developer to notify him of the update
                     $m = new Mailer(new MailAddress("*****@*****.**", sprintf("%s Mod Repo", REPO_NAME)));
                     $m->addRecipient(new MailAddress($modExists["devemail"], $modExists["devname"]));
                     $m->setSubject("Your mod has been added.");
                     $tpl = $m->getMustache()->loadTemplate("mod_activated.mustache");
                     $m->setBody($tpl->render(array("REPONAME" => REPO_NAME, "REPOURL" => REPO_URL, "DEVNAME" => $modExists["devname"], "MODNAME" => $modExists["name"])));
                     $m->send();
                     echo sprintf("Mod %s is now available. Wait for the cache to update.\n", $modExists["name"]);
                 } else {
                     throw new MException("Mot not made available, database error.");
                 }
             }
         } else {
             throw new MException(sprintf("Mod %s is already available.", $modExists["name"]));
         }
     } else {
         // mod is not in the submission queue
         throw new MException(sprintf("Mod %d does not exist in the submission queue.", $modId));
     }
 }
コード例 #22
0
ファイル: lostpassword.php プロジェクト: cheese1/ampache
function send_newpassword($email, $current_ip)
{
    /* get the Client and set the new password */
    $client = User::get_from_email($email);
    if ($client && $client->email == $email) {
        $newpassword = generate_password(6);
        $client->update_password($newpassword);
        $mailer = new Mailer();
        $mailer->set_default_sender();
        $mailer->subject = T_("Lost Password");
        $mailer->recipient_name = $client->fullname;
        $mailer->recipient = $client->email;
        $message = sprintf(T_("A user from %s has requested a password reset for '%s'."), $current_ip, $client->username);
        $message .= "\n";
        $message .= sprintf(T_("The password has been set to: %s"), $newpassword);
        $mailer->message = $message;
        return $mailer->send();
    }
    return false;
}
コード例 #23
0
ファイル: officers.php プロジェクト: ajb/rfpez
 public function action_create()
 {
     $user_input = Input::get('user');
     $user = new User();
     $user->email = $user_input["email"];
     $user->how_hear = $user_input["how_hear"];
     $officer = new Officer(Input::get('officer'));
     if (in_array(strtolower($user->email), Officer::$admin_emails)) {
         $officer->role = Officer::ROLE_SUPER_ADMIN;
     }
     if ($user->validator(false, true)->passes() && $officer->validator()->passes()) {
         $user->save();
         $user->officer()->insert($officer);
         $user->generate_reset_password_token();
         Mailer::send("FinishOfficerRegistration", array("user" => $user));
         return Redirect::to('/')->with('notice', 'Please check your email for a link to finish signup.');
     } else {
         Session::flash('errors', array_merge($user->validator(false, true)->errors->all(), $officer->validator()->errors->all()));
         return Redirect::to_route('new_officers')->with_input();
     }
 }
コード例 #24
0
ファイル: Contact.php プロジェクト: nikog/kobrocms
 protected function _send($params)
 {
     // Hackster protection!
     if (!isset($_SERVER['HTTP_REFERER']) || !preg_match("/http:\\/\\/{$_SERVER['HTTP_HOST']}/", $_SERVER['HTTP_REFERER'])) {
         throw new Exception('Go away evil hacksta!');
     }
     $contact = $this->_getContact($params['page']);
     if (!$contact) {
         throw new Exception('Contact data not found');
     }
     $error = false;
     if (!isset($_POST)) {
         $error = true;
     } else {
         if (!isset($_POST['from']) || !isset($_POST['message']) || !$_POST['from'] || !$_POST['message']) {
             $error = true;
         }
     }
     if ($error) {
         // We has error, render default wid error!
         $view = new View();
         $view->error = true;
         $view->page = $this->kobros->page;
         $view->contact = $contact;
         return $view->render(ROOT . '/../templates/data/contact/default.phtml');
     } else {
         // mailer and redirect be here
         $mail = new Mailer($_POST['from'], $contact->mail_to, $contact->mail_subject, $_POST['message']);
         $mail->send();
         // If we has forward field, we forward there. Otherwise
         // we be using dem internal thanx page!1!
         if (isset($_POST['forward']) && $_POST['forward']) {
             $forwardTo = "Location: {$_POST['forward']}";
         } else {
             $forwardTo = "Location: /?page={$this->kobros->page->id}&action=thanks";
         }
         header($forwardTo);
     }
 }
コード例 #25
0
ファイル: API.php プロジェクト: qazzhoubin/emptyphp
 public function delete($file)
 {
     $encodedEntryURI = $this->policy->encodedEntryURI($file);
     $url = 'http://rs.qiniu.com/delete/' . $encodedEntryURI;
     $access_token = $this->policy->genAccessToken($url);
     $HttpReuqst = new Request($url, 'POST');
     $HttpReuqst->setHeader('Authorization', 'QBox ' . $access_token);
     $response = $HttpReuqst->send();
     $code = $response->getStatus();
     if ($code == 599) {
         //给七牛发邮件
         $body = print_r($response->getRequestHeader(), true) . $response->getBody();
         $mail = new Mailer();
         $mail->setSubject("服务端操作失败");
         $mail->setBody($body);
         $mail->setTo("*****@*****.**");
         $mail->send();
     } elseif ($code != 200) {
         return false;
     }
     return true;
 }
コード例 #26
0
 public function request()
 {
     $affiliates = new Affiliates($this->db);
     if ($this->f3->exists('POST.request')) {
         $audit = \Audit::instance();
         $this->f3->scrub($_POST);
         $this->f3->set('SESSION.flash', array());
         // validate form
         if (!preg_match("/^[\\w\\- ]{2,30}\$/", $this->f3->get('POST.name'))) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid name.'));
         }
         if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
         }
         if (!preg_match("/^.{2,30}\$/", $this->f3->get('POST.tcgname'))) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid TCG Name.'));
         }
         if (!$audit->url($this->f3->get('POST.url'))) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
         }
         if (!$audit->url($this->f3->get('POST.button'))) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid button URL.'));
         }
         // process form if there are no errors
         if (count($this->f3->get('SESSION.flash')) === 0) {
             $this->f3->set('POST.status', 'Pending');
             $mailer = new Mailer();
             $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Affiliation Request')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('POST.email')))->setBody(Template::instance()->render('app/templates/emails/affiliation.htm'), 'text/html');
             // send email & save to db
             if ($mailer->send($message) && $affiliates->add()) {
                 $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your affiliation request has been sent successfully!'));
             } else {
                 $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
             }
         }
     }
     $this->f3->reroute('/affiliates');
 }
コード例 #27
0
ファイル: notification.php プロジェクト: ajb/rfpez
 public static function send($notification_type, $attributes, $send_email = true)
 {
     $notification = new Notification(array('notification_type' => $notification_type));
     if ($notification->notification_type == "Dismissal") {
         $bid = $attributes["bid"];
         $notification->fill(array('target_id' => $bid->vendor->user_id, 'actor_id' => $attributes["actor_id"], 'payload' => array('bid' => $bid->to_array()), 'payload_type' => 'bid', 'payload_id' => $bid->id));
     } elseif ($notification->notification_type == "Undismissal") {
         $bid = $attributes["bid"];
         $notification->fill(array('target_id' => $bid->vendor->user_id, 'actor_id' => $attributes["actor_id"], 'payload' => array('bid' => $bid->to_array()), 'payload_type' => 'bid', 'payload_id' => $bid->id));
     } elseif ($notification->notification_type == "Award") {
         $bid = $attributes["bid"];
         $notification->fill(array('target_id' => $bid->vendor->user_id, 'actor_id' => $attributes["actor_id"], 'payload' => array('bid' => $bid->to_array()), 'payload_type' => 'bid', 'payload_id' => $bid->id));
     } elseif ($notification->notification_type == "BidSubmit") {
         $bid = $attributes["bid"];
         $notification->fill(array('target_id' => $attributes["target_id"], 'actor_id' => $bid->vendor->user_id, 'payload' => array('bid' => $bid->to_array()), 'payload_type' => 'bid', 'payload_id' => $bid->id));
     } elseif ($notification->notification_type == "ProjectCollaboratorAdded") {
         $project = $attributes["project"];
         $officer = $attributes["officer"];
         $notification->fill(array('target_id' => $officer->user_id, 'actor_id' => $attributes["actor_id"], 'payload' => array('project' => $project->to_array(), 'officer' => $officer->to_array()), 'payload_type' => 'project', 'payload_id' => $project->id));
     } elseif ($notification->notification_type == "Comment") {
         $comment = $attributes["comment"];
         $notification->fill(array('target_id' => $attributes["target_id"], 'actor_id' => $comment->officer->user->id, 'payload' => array('comment' => $comment->to_array()), 'payload_type' => 'comment', 'payload_id' => $comment->id));
     } elseif ($notification->notification_type == "AnnounceAmendmentsToBidders") {
         $bid = $attributes["bid"];
         $actor_id = $attributes['actor_id'];
         $target_id = $attributes["target_id"];
         $payload = array('bid' => $bid->to_array());
         $payload_id = $bid->id;
         $notification->fill(array('target_id' => $target_id, 'actor_id' => $actor_id, 'payload' => $payload, 'payload_type' => 'bid', 'payload_id' => $payload_id));
     } else {
         throw new \Exception("Don't know how to handle that notification type.");
     }
     $notification->save();
     if ($send_email) {
         Mailer::send("Notification", array('notification' => $notification));
     }
 }
コード例 #28
0
ファイル: vendors.php プロジェクト: ajb/rfpez
 public function action_create()
 {
     $user_input = Input::get('user');
     $user = new User();
     $user->email = $user_input["email"];
     $user->password = $user_input["password"];
     $user->how_hear = $user_input["how_hear"];
     $user->send_emails = isset($user_input["send_emails"]) ? true : false;
     $vendor = new Vendor(Input::get('vendor'));
     if ($user->validator()->passes() && $vendor->validator()->passes()) {
         $user->save();
         $vendor->user_id = $user->id;
         $vendor->save();
         $services = Input::get('services') ? array_keys(Input::get('services')) : array();
         $user->vendor->services()->sync($services);
         Session::regenerate();
         Auth::login($user->id);
         Mailer::send("NewVendorRegistered", array("user" => $user));
         return Redirect::to('/');
     } else {
         Session::flash('errors', array_merge($user->validator()->errors->all(), $vendor->validator()->errors->all()));
         return Redirect::to_route('new_vendors')->with_input();
     }
 }
コード例 #29
0
ファイル: book.php プロジェクト: BackupTheBerlios/ubook-svn
 /**
  * Checks POST data and sends E-Mail, if everything is correct.
  * @return bool true, if mail variable doesn't contain an @.
  */
 public function sendMailIfRequested()
 {
     /*
      * $_POST['name'] should contain a mail address.
      * It is named 'name' to trick robots.
      */
     if (!isset($_POST['name'])) {
         return false;
     }
     $user_mail = stripslashes(Mailer::mailFromUser('name'));
     if (!strstr($user_mail, '@')) {
         return true;
     }
     require_once 'tools/Mailer.php';
     $subject = 'Anfrage: ';
     $message = 'Es hat jemand mit der E-Mailadresse "' . $user_mail . '" Interesse für das unten stehende Buch bekundet.';
     if (isset($_POST['user_text']) && $_POST['user_text']) {
         $message .= ' Folgende Nachricht wurde mitgesandt:' . "\n\n";
         $message .= stripslashes($_POST['user_text']) . "\n";
     }
     $booked = Mailer::send($this->bookId, $subject, $message, $user_mail);
     header('Location: book.php?id=' . $this->bookId . '&booked=' . $booked);
     exit;
 }
コード例 #30
0
ファイル: User.php プロジェクト: gymadarasz/website
 public function registry(Post $post, $salt, Theme $theme)
 {
     $success = false;
     $post->password = crypt($post->password, $salt);
     $post->drop('password2');
     $post->drop('csrf');
     try {
         if (!MySQLConnect::getConnect()->add('users', $post)) {
             throw new UserException('registry error');
         }
     } catch (MySQLConnectUniqueExistsException $e) {
         throw new UserExistsException('user already exists');
     }
     $mailer = new Mailer($post->email);
     $mailtpl = $theme->getEmail('registry', $post);
     $mailCRUD = new CRUD('mails');
     $mailCRUD->merge = $post;
     $mailCRUD->content = $mailtpl;
     if ($mailer->send('Registry activate', $mailtpl)) {
         $mail->save();
         $success = true;
     }
     return $success;
 }