$smarty->assign('back', TRUE); } else { $logger->addMsg(Pommo::_T('Subscription request received.')); // send confirmation message. if (Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'code' => $subscriber['pending_code'], 'type' => 'confirm'))) { $subscriber['registered'] = date("F j, Y, g:i a", $subscriber['registered']); if ($comments || isset($notices['pending']) && $notices['pending'] == 'on') { Pommo_Helper_Messages::notify($notices, $subscriber, 'pending', $comments); } if ($config['site_confirm']) { Pommo::redirect($config['site_confirm']); } } else { $smarty->assign('back', TRUE); // delete the subscriber Pommo_Subscribers::delete($id); } } } else { // no email confirmation required if (!Pommo_Subscribers::add($subscriber)) { $logger->addErr('Error adding subscriber! Please contact the administrator.'); $smarty->assign('back', TRUE); } else { // send/print welcome message Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe')); $subscriber['registered'] = date("F j, Y, g:i a", $subscriber['registered']); if ($comments || isset($notices['subscribe']) && $notices['subscribe'] == 'on') { Pommo_Helper_Messages::notify($notices, $subscriber, 'subscribe', $comments); } // redirect
$json->add('callbackFunction', 'addSubscriber'); $json->add('callbackParams', $data); break; case 'delSubscriber': $emails = array(); if (isset($_REQUEST['emails'])) { $in = array_unique(preg_split("/[\\s,]+/", $_REQUEST['emails'])); foreach ($in as $email) { if (Pommo_Helper::isEmail($email)) { array_push($emails, $email); } } } if (count($emails) > 0) { $ids = Pommo_Subscribers::getIDByEmail($emails, $_REQUEST['status']); $msg = sprintf(Pommo::_T('You have removed %s subscribers!'), Pommo_Subscribers::delete($ids)); $json->add('callbackFunction', 'delSubscriber'); $json->add('callbackParams', $ids); } else { $msg = Pommo::_T('No subscribers were removed.'); } $json->success($msg); break; case 'editSubscriber': if (!is_numeric($_REQUEST['id']) || $_REQUEST['id'] == 0) { $json->fail('ERROR; Bad Subscriber ID Received'); } $subscriber = array('id' => $_REQUEST['id'], 'email' => $_REQUEST['email'], 'data' => $_REQUEST['d']); $validateOptions = array('skipReq' => TRUE, 'active' => FALSE); // check if email is valid if (!Pommo_Helper::isEmail($subscriber['email'])) {
function cancel(&$in) { global $pommo; $dbo =& Pommo::$_dbo; // if the user is pending to be added, remove entire subscriber. if ($in['type'] == 'add') { require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php'; return Pommo_Subscribers::delete($in['subscriber_id']); } // else, only remove pending entry $query = "\n\t\t\tDELETE FROM " . $dbo->table['subscriber_pending'] . "\n\t\t\tWHERE pending_id=%i"; $query = $dbo->prepare($query, array($in['id'])); if (!$dbo->query($query)) { $logger->addErr('Pommo_Pending::cancel() -> Error removing pending entry.'); return false; } return true; }
function stop($finish = false) { $this->_mailer->SmtpClose(); if ($this->_test) { // don't respawn if this is a test mailing Pommo_Mail_Ctl::finish($this->_id, TRUE, TRUE); Pommo_Subscribers::delete(current($this->_hash)); session_destroy(); exit; } if ($finish) { Pommo_Mail_Ctl::finish($this->_id); $this->shutdown(Pommo::_T('Mailing Complete.')); } // respwn if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'ajax/mailings_send4.php?' . 'code=' . $this->_code . '&serial=' . $this->_serial . '&id=' . $this->_id)) { $this->shutdown('*** RESPAWN FAILED! ***'); } $this->shutdown(sprintf(Pommo::_T('Runtime (%s seconds) reached, respawning.'), $this->_maxRunTime), false); }