예제 #1
0
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/** @define "BASE" "../../.." */
if (!defined('EXPONENT')) {
    exit('');
}
//filter the message thru the form template for formatting
$msgtemplate = new formtemplate('forms/calendar', '_' . $_POST['formname']);
$msgtemplate->assign('post', $_POST);
$msg = $msgtemplate->render();
$ret = false;
//make sure this is from a valid event and that the email addresses are listed, then mail
if (isset($_POST['id'])) {
    $event = $db->selectObject('calendar', 'id=' . intval($_POST['id']));
    $email_addrs = array();
    if ($event->feedback_email != '') {
        $email_addrs = explode(',', $event->feedback_email);
        //This is an easy way to remove duplicates
        $email_addrs = array_flip(array_flip($email_addrs));
        $email_addrs = array_map('trim', $email_addrs);
        $ret = 0;
        $mail = new expMail();
        $ret += $mail->quickSend(array("text_message" => $msg, 'to' => $email_addrs, 'from' => trim(SMTP_FROMADDRESS), 'subject' => $_POST['subject']));
    }
}
$template = new template('calendarmodule', '_feedback_submitted');
$template->assign('success', $ret ? 1 : 0);
$template->output();
 private function sendNotification($simplenote)
 {
     if (empty($simplenote)) {
         return false;
     }
     /* The global constants can be overriden by passing appropriate params */
     //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
     $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
     $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
     $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
     $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
     // setup some email variables.
     $subject = 'Notification of a New Note Posted to ' . URL_BASE;
     $tos = explode(',', str_replace(' ', '', $notification_email));
     $editlink = makelink(array('controller' => 'expSimpleNote', 'action' => 'edit', 'id' => $simplenote->id));
     // make the email body
     $body = gt('Posted By') . ':&nbsp;' . $simplenote->name . "<br>";
     $body .= gt('Posters Email') . ':&nbsp;' . $simplenote->email . "<br><br>";
     $body .= $simplenote->body . "<br><br>";
     $body .= gt('You can view, edit and optionally approved this comment by going to') . ' ';
     $body .= '<a href="' . $editlink . '">' . $editlink . '</a>';
     // create the mail message
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $body, 'to' => $tos, 'from' => array(trim(SMTP_FROMADDRESS) => trim(URL_BASE)), 'subject' => $subject));
     return true;
 }
예제 #3
0
     $emailText = $template->render();
     $emailText = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>"), "\n", $emailText)));
     $template->assign("css", file_get_contents(BASE . "framework/core/assets/css/tables.css"));
     $emailHtml = $template->render();
     if (empty($from)) {
         $from = trim(SMTP_FROMADDRESS);
     }
     if (empty($from_name)) {
         $from_name = trim(ORGANIZATION_NAME);
     }
     $headers = array("MIME-Version" => "1.0", "Content-type" => "text/html; charset=" . LANG_CHARSET);
     if (count($emaillist)) {
         //This is an easy way to remove duplicates
         $emaillist = array_flip(array_flip($emaillist));
         $emaillist = array_map('trim', $emaillist);
         $mail = new expMail();
         $mail->quickSend(array('headers' => $headers, 'html_message' => $emailHtml, "text_message" => $emailText, 'to' => $emaillist, 'from' => array(trim($from) => $from_name), 'subject' => $f->subject));
     }
 }
 // clear the users post data from the session.
 expSession::un_set('formmodule_data_' . $f->id);
 //If is a new post show response, otherwise redirect to the flow.
 if (!isset($_POST['data_id'])) {
     $template = new template("formbuilder", "_view_response");
     $template->assign("backlink", expHistory::getLastNotEditable());
     $template->assign("response_html", $f->response);
     $template->output();
 } else {
     flash('message', gt('Record was updated!'));
     //        expHistory::back();
     expHistory::returnTo('editable');
예제 #4
0
 function process_orders()
 {
     /*
       Testing
     */
     /*echo "Here?";
       $inv = 30234;
       $req = 'a29f9shsgh32hsf80s7';        
       $amt = 101.00;
       for($count=1;$count<=25;$count+=2)
       {   
           $data[2] = $inv + $count;
           $amt += $count*$count;
           $successSet[$count]['message'] = "Sucessfully imported row " . $count . ", order: " . $data[2] . "<br/>";                
           $successSet[$count]['order_id'] = $data[2];
           $successSet[$count]['amount'] = $amt;
           $successSet[$count]['request_id'] = $req;
           $successSet[$count]['reference_id'] = $req;
           $successSet[$count]['authorization_code'] = $req;
           $successSet[$count]['shipping_tracking_number'] = '1ZNF453937547';    
           $successSet[$count]['carrier'] = 'UPS';
       }
       for($count=2;$count<=25;$count+=2)
       {   
           $data[2] = $inv + $count;                
           $amt += $count*$count;        
           $errorSet[$count]['error_code'] = '42';
           $errorSet[$count]['message'] = "No go for some odd reason. Try again.";
           $errorSet[$count]['order_id'] = $data[2];
           $errorSet[$count]['amount'] = $amt;
       }
       
       assign_to_template(array('errorSet'=>$errorSet, 'successSet'=>$successSet));     
       return;*/
     ###########
     global $db;
     $template = get_template_for_action(new orderController(), 'setStatus', $this->loc);
     //eDebug($_FILES);
     //eDebug($this->params,true);
     set_time_limit(0);
     //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);
     if (!empty($_FILES['batch_upload_file']['error'])) {
         flash('error', gt('There was an error uploading your file.  Please try again.'));
         redirect_to(array('controller' => 'store', 'action' => 'batch_process'));
     }
     $file->path = $_FILES['batch_upload_file']['tmp_name'];
     echo "Validating file...<br/>";
     $checkhandle = fopen($file->path, "r");
     $checkdata = fgetcsv($checkhandle, 10000, ",");
     $fieldCount = count($checkdata);
     $count = 1;
     while (($checkdata = fgetcsv($checkhandle, 10000, ",")) !== FALSE) {
         $count++;
         if (count($checkdata) != $fieldCount) {
             echo "Line " . $count . " of your CSV import file does not contain the correct number of columns.<br/>";
             echo "Found " . $fieldCount . " header fields, but only " . count($checkdata) . " field in row " . $count . " Please check your file and try again.";
             exit;
         }
     }
     fclose($checkhandle);
     echo "<br/>CSV File passed validation...<br/><br/>Detecting carrier type....<br/>";
     //exit();
     $handle = fopen($file->path, "r");
     $data = fgetcsv($handle, 10000, ",");
     //eDebug($data);
     $dataset = array();
     $carrier = '';
     if (trim($data[0]) == 'ShipmentInformationShipmentID') {
         echo "Detected UPS file...<br/>";
         $carrier = "UPS";
         $carrierTrackingLink = "http://wwwapps.ups.com/etracking/tracking.cgi?TypeOfInquiryNumber=T&InquiryNumber1=";
     } elseif (trim($data[0]) == 'PIC') {
         echo "Detected United States Post Service file...<br/>";
         $carrier = "USPS";
         $carrierTrackingLink = "http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=";
     }
     //eDebug($carrier);
     $count = 1;
     $errorSet = array();
     $successSet = array();
     $oo = new order();
     while (($data = fgetcsv($handle, 10000, ",")) !== FALSE) {
         $count++;
         $originalOrderId = $data[2];
         $data[2] = intval($data[2]);
         $order = null;
         $bm = null;
         $transactionState = null;
         //check for valid order number - if not present or not order, fail and continue with next record
         if (isset($data[2]) && !empty($data[2])) {
             $order = $oo->findBy('invoice_id', $data[2]);
             if (empty($order->id)) {
                 $errorSet[$count]['message'] = $originalOrderId . " is not a valid order in this system.";
                 $errorSet[$count]['order_id'] = $originalOrderId;
                 continue;
             }
         } else {
             $errorSet[$count]['message'] = "Row " . $count . " has no order number.";
             $errorSet[$count]['order_id'] = "N/A";
             continue;
         }
         /*we have a valid order, so let's see what we can do: */
         //set status of order to var
         $currentStat = $order->order_status;
         //eDebug($currentStat,true);
         //-- check the order for a closed status - if so, do NOT process or set shipping
         if ($currentStat->treat_as_closed == true) {
             $errorSet[$count]['message'] = "This is currently a closed order. Not processing.";
             $errorSet[$count]['order_id'] = $data[2];
             continue;
         }
         //ok, if we made it here we have a valid order that is "open"
         //we'll try to capture the transaction if it's in an authorized state, but set shipping regardless
         if (isset($order->billingmethod[0])) {
             $bm = $order->billingmethod[0];
             $transactionState = $bm->transaction_state;
         } else {
             $bm = null;
             $transactionState = '';
         }
         if ($transactionState == 'authorized') {
             //eDebug($order,true);
             $calc = $bm->billingcalculator->calculator;
             $calc->config = $bm->billingcalculator->config;
             if (method_exists($calc, 'delayed_capture')) {
                 //$result = $calc->delayed_capture($bm,$bm->billing_cost);
                 $result = $calc->delayed_capture($bm, $order->grand_total);
                 if ($result->errorCode == 0) {
                     //we've succeeded.  transaction already created and billing info updated.
                     //just need to set the order shipping info, check and see if we send user an email, and set statuses.
                     //shipping info:
                     $successSet[$count]['order_id'] = $data[2];
                     $successSet[$count]['message'] = "Sucessfully captured order " . $data[2] . " and set shipping information.";
                     $successSet[$count]['amount'] = $order->grand_total;
                     $successSet[$count]['request_id'] = $result->request_id;
                     $successSet[$count]['reference_id'] = $result->PNREF;
                     $successSet[$count]['authorization_code'] = $result->AUTHCODE;
                     $successSet[$count]['shipping_tracking_number'] = $data[0];
                     $successSet[$count]['carrier'] = $carrier;
                 } else {
                     //failed capture, so we report the error but still set the shipping information
                     //because it's already out the door
                     //$failMessage = "Attempted to delay capture order " . $data[2] . " and it failed with the following error: " . $result->errorCode . " - " .$result->message;
                     //if the user seelected to set a different status for failed orders, set it here.
                     /*if(isset($this->params['order_status_fail'][0]) && $this->params['order_status_fail'][0] > -1)
                       {
                           $change = new order_status_changes();
                           // save the changes
                           $change->from_status_id = $order->order_status_id;
                           //$change->comment = $this->params['comment'];
                           $change->to_status_id = $this->params['order_status_fail'][0];
                           $change->orders_id = $order->id;
                           $change->save();
                           
                           // update the status of the order
                           $order->order_status_id = $this->params['order_status_fail'][0];
                           $order->save();                             
                       }*/
                     $errorSet[$count]['error_code'] = $result->errorCode;
                     $errorSet[$count]['message'] = "Capture failed: " . $result->message . "<br/>Setting shipping information.";
                     $errorSet[$count]['order_id'] = $data[2];
                     $errorSet[$count]['amount'] = $order->grand_total;
                     $errorSet[$count]['shipping_tracking_number'] = $data[0];
                     $errorSet[$count]['carrier'] = $carrier;
                     //continue;
                 }
             } else {
                 //dont suppose we do anything here, as it may be set to approved manually
                 //$errorSet[$count] = "Order " . $data[2] . " does not use a billing method with delayed capture ability.";
                 $successSet[$count]['message'] = 'No capture processing available for order:' . $data[2] . '. Setting shipping information.';
                 $successSet[$count]['order_id'] = $data[2];
                 $successSet[$count]['amount'] = $order->grand_total;
                 $successSet[$count]['shipping_tracking_number'] = $data[0];
                 $successSet[$count]['carrier'] = $carrier;
             }
         } else {
             $successSet[$count]['message'] = 'No processing necessary for order:' . $data[2] . '. Setting shipping information.';
             $successSet[$count]['order_id'] = $data[2];
             $successSet[$count]['amount'] = $order->grand_total;
             $successSet[$count]['shipping_tracking_number'] = $data[0];
             $successSet[$count]['carrier'] = $carrier;
         }
         $order->shipped = time();
         $order->shipping_tracking_number = $data[0];
         $order->save();
         $s = array_pop($order->shippingmethods);
         $sm = new shippingmethod($s->id);
         $sm->carrier = $carrier;
         $sm->save();
         //statuses and email
         if (isset($this->params['order_status_success'][0]) && $this->params['order_status_success'][0] > -1) {
             $change = new order_status_changes();
             // save the changes
             $change->from_status_id = $order->order_status_id;
             //$change->comment = $this->params['comment'];
             $change->to_status_id = $this->params['order_status_success'][0];
             $change->orders_id = $order->id;
             $change->save();
             // update the status of the order
             $order->order_status_id = $this->params['order_status_success'][0];
             $order->save();
             // email the user if we need to
             if (!empty($this->params['email_customer'])) {
                 $email_addy = $order->billingmethod[0]->email;
                 if (!empty($email_addy)) {
                     $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);
                     $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);
                     $template->assign(array('comment' => $change->comment, 'to_status' => $to_status, 'from_status' => $from_status, 'order' => $order, 'date' => date("F j, Y, g:i a"), 'storename' => ecomconfig::getConfig('storename'), 'include_shipping' => true, 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number, 'carrier' => $carrier));
                     $html = $template->render();
                     $html .= ecomconfig::getConfig('footer');
                     try {
                         $mail = new expMail();
                         $mail->quickSend(array('html_message' => $html, 'text_message' => str_replace("<br>", "\r\n", $template->render()), 'to' => $email_addy, 'from' => ecomconfig::getConfig('from_address'), 'subject' => 'Your Order Has Been Shipped (#' . $order->invoice_id . ') - ' . ecomconfig::getConfig('storename')));
                     } catch (Exception $e) {
                         //do nothing for now
                         eDebug("Email error:");
                         eDebug($e);
                     }
                 }
                 //else {
                 //    $errorSet[$count]['message'] .= "<br/>Order " . $data[2] . " was captured successfully, however the email notification was not successful.";
                 //}
             }
         }
         //eDebug($product);
     }
     assign_to_template(array('errorSet' => $errorSet, 'successSet' => $successSet));
 }
예제 #5
0
 public function confirm_password_reset()
 {
     global $db;
     $db->delete('passreset_token', 'expires < ' . time());
     $tok = $db->selectObject('passreset_token', 'uid=' . trim($_GET['uid']) . " AND token='" . preg_replace('/[^A-Za-z0-9]/', '', $_GET['token']) . "'");
     if ($tok == null) {
         flash('error', gt('Your password reset has expired.  Please try again.'));
         expHistory::back();
     }
     // create the password
     $newpass = '';
     for ($i = 0; $i < rand(12, 20); $i++) {
         $num = rand(48, 122);
         if ($num > 97 && $num < 122 || $num > 65 && $num < 90 || $num > 48 && $num < 57) {
             $newpass .= chr($num);
         } else {
             $i--;
         }
     }
     // look up the user
     $u = new user($tok->uid);
     // get the email message body and render it
     $email = $template = get_template_for_action($this, 'confirm_password_email', $this->loc);
     $email->assign('newpass', $newpass);
     $msg = $email->render();
     // send the new password to the user
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $msg, 'to' => trim($u->email), 'from' => SMTP_FROMADDRESS, 'subject' => 'Your new password for ' . HOSTNAME));
     // Save new password
     $u->update(array('password' => md5($newpass)));
     // cleanup the reset token
     $db->delete('passreset_token', 'uid=' . $tok->uid);
     flash('message', gt('Your new password has been emailed to your email account.'));
     // send the user the login page.
     redirect_to(array('controller' => 'login', 'action' => 'loginredirect'));
 }
예제 #6
0
// Saved.  do notifs
$notifs = unserialize($config->reminder_notify);
$emails = array();
foreach ($db->selectObjects('calendar_reminder_address', "calendar_id='" . $config->id . "'") as $c) {
    if ($c->user_id != 0) {
        $u = user::getUserById($c->user_id);
        $emails[] = $u->email;
    } else {
        if ($c->group_id != 0) {
            $grpusers = group::getUsersInGroup($c->group_id);
            foreach ($grpusers as $u) {
                $emails[] = $u->email;
            }
        } else {
            if ($c->email != '') {
                $emails[] = $c->email;
            }
        }
    }
}
if (empty($emails)) {
    print_r("<br><b><i>Exponent - " . gt('No One to Send Reminders to!') . "</i></b><br>");
    exit;
}
$emails = array_flip(array_flip($emails));
$emails = array_map('trim', $emails);
$headers = array("MIME-Version" => "1.0", "Content-type" => "text/html; charset=" . LANG_CHARSET);
$mail = new expMail();
$mail->quickSend(array('headers' => $headers, 'html_message' => $htmlmsg, "text_message" => $msg, 'to' => trim($emails), 'from' => array(trim($config->email_address_reminder) => $config->email_from_reminder), 'subject' => $subject));
print_r("<p>" . gt('The following reminder was sent via email') . ":</p><br>");
print_r($htmlmsg);
예제 #7
0
 private function sendApprovalNotification($comment, $params)
 {
     if (empty($comment)) {
         return false;
     }
     /* The global constants can be overriden by passing appropriate params */
     //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
     $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
     $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
     $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
     $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
     // setup some email variables.
     $subject = gt('Notification of Comment Approval on') . ' ' . URL_BASE;
     $tos = explode(',', str_replace(' ', '', $notification_email));
     $tos[] = $comment->email;
     $tos = array_filter($tos);
     if (empty($tos)) {
         return false;
     }
     $model = new $params['content_type']($params['content_id']);
     $loc = expUnserialize($model->location_data);
     $posting = makelink(array('controller' => $params['content_type'], 'action' => 'show', 'id' => $params['content_id'], "src" => $loc->src));
     $editlink = makelink(array('controller' => 'expComment', 'action' => 'edit', 'id' => $comment->id));
     // make the email body
     $body = '<h1>' . gt('Comment Approved') . '</h1>';
     $body .= '<h2>' . gt('Posted By') . '</h2>';
     $body .= '<p>' . $comment->name . "</p>";
     $body .= '<h2>' . gt('Poster\'s Email') . '</h2>';
     $body .= '<p>' . $comment->email . '</p>';
     $body .= '<h2>' . gt('Comment') . '</h2>';
     $body .= '<p>' . $comment->body . "</p>";
     $body .= '<h3>' . gt('View posting') . '</h3>';
     $body .= '<a href="' . $posting . '">' . $posting . '</a>';
     // create the mail message
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $body, 'to' => $tos, 'from' => array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)), 'subject' => $subject));
     return true;
 }
예제 #8
0
 public function update_answer()
 {
     if (empty($this->params['id'])) {
         flash('error', gt('No ID was specified for the question to be answered'));
         expHistory::back();
     }
     $faq = new faq($this->params['id']);
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $this->params['body'], 'to' => trim($faq->submitter_email), 'from' => array(empty($this->config['answer_from_address']) ? SMTP_FROMADDRESS : $this->config['answer_from_address'] => empty($this->config['answer_from_name']) ? null : $this->config['answer_from_name']), 'subject' => $this->params['subject']));
     flash('message', gt('Your email was sent to') . ' ' . $faq->submitter_name . ' ' . gt('at') . ' ' . $faq->submitter_email);
     expHistory::back();
 }
예제 #9
0
 function emailCustomer()
 {
     //eDebug($this->params,true);
     global $db, $template, $user;
     if (empty($this->params['id'])) {
         expHistory::back();
     }
     // get the order
     $order = new order($this->params['id']);
     // Save the message for future use if that is what the user wanted.
     if (!empty($this->params['save_message'])) {
         $message->body = $this->params['email_message'];
         $db->insertObject($message, 'order_status_messages');
     }
     $email_addys[] = explode(',', $this->params['to_addresses']);
     //$order->billingmethod[0]->email;
     //eDebug($email_addy,true);
     if (!empty($email_addys[0])) {
         assign_to_template(array('message' => $this->params['email_message']));
         $html = $template->render();
         if ($this->params['include_invoice']) {
             $html .= '<br><hr><br>';
             $html .= renderAction(array('controller' => 'order', 'action' => 'show', 'view' => 'email_invoice', 'id' => $this->params['id'], 'printerfriendly' => '1', 'no_output' => 'true'));
         } else {
             $html .= ecomconfig::getConfig('footer');
         }
         //eDebug($html,true);
         if (isset($this->params['from_address'])) {
             if ($this->params['from_address'] == 'other') {
                 $from = $this->params['other_from_address'];
             } else {
                 $from = $this->params['from_address'];
             }
         } else {
             $from = ecomconfig::getConfig('from_address');
         }
         if (isset($this->params['email_subject'])) {
             $email_subject = $this->params['email_subject'];
         } else {
             $email_subject = 'Message from ' . ecomconfig::getConfig('storename') . ' about your order (#' . $order->invoice_id . ')';
         }
         $mail = new expMail();
         //FIXME Unless you need each mail sent separately, you can now set 'to'=>$email_addys and let expMail send a single email to all addresses
         foreach ($email_addys as $email_addy) {
             $mail->quickSend(array('html_message' => $html, 'text_message' => str_replace("<br>", "\r\n", $template->render()), 'to' => $email_addy, 'from' => $from, 'subject' => $email_subject));
         }
         $emailed_to = implode(',', $email_addys);
         $note = new expSimpleNote();
         $note->body = "<strong>[action]: Emailed message to " . $emailed_to . ":</strong><br><br>" . $this->params['email_message'];
         $note->approved = 1;
         $note->name = $user->firstname . " " . $user->lastname;
         $note->email = $user->email;
         $note->save();
         $note->refresh();
         $noteObj->expsimplenote_id = $note->id;
         $noteObj->content_id = $order->id;
         $noteObj->content_type = 'order';
         $db->insertObject($noteObj, 'content_expSimpleNote');
         //eDebug($note,true);
     } else {
         flash('error', gt('The email address was NOT sent. An email address count not be found for this customer'));
         expHistory::back();
     }
     flash('message', gt('Email sent.'));
     expHistory::back();
 }
 public function test_smtp()
 {
     $smtp = new expMail();
     $smtp->test();
 }
예제 #11
0
 public function signup()
 {
     global $db;
     // check the anti-spam control
     expValidator::check_antispam($this->params, gt("Anti-spam verification failed.  Please try again."));
     // make sure we have what we need.
     if (empty($this->params['email'])) {
         expQueue::flashAndFlow('error', 'You must supply an email address to sign up for email alerts.');
     }
     if (empty($this->params['ealerts'])) {
         expQueue::flashAndFlow('error', 'You did not select any E-Alert topics to subscribe to.');
     }
     // find or create the subscriber
     $id = $db->selectValue('subscribers', 'id', 'email="' . $this->params['email'] . '"');
     $subscriber = new subscribers($id);
     if (empty($subscriber->id)) {
         $subscriber->email = trim($this->params['email']);
         $subscriber->hash = md5($subscriber->email . time());
         $subscriber->save();
     }
     // delete any old subscriptions and add the user to new subscriptions
     $db->delete('expeAlerts_subscribers', 'subscribers_id=' . $subscriber->id);
     foreach ($this->params['ealerts'] as $ea_id) {
         $obj = null;
         $obj->subscribers_id = $subscriber->id;
         $obj->expeAlerts_id = $ea_id;
         $db->insertObject($obj, 'expeAlerts_subscribers');
     }
     // send a confirmation email to the user.
     $ealerts = $db->selectObjects('expeAlerts', 'id IN (' . implode(',', $this->params['ealerts']) . ')');
     $body = get_template_for_action($this, 'confirmation_email', $this->loc);
     $body->assign('ealerts', $ealerts);
     $body->assign('subscriber', $subscriber);
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $body->render(), 'to' => $subscriber->email, 'from' => SMTP_FROMADDRESS, 'subject' => 'Please confirm your E-Alert subscriptions'));
     redirect_to(array('controller' => 'ealert', 'action' => 'pending', 'id' => $subscriber->id));
 }