function cancel(&$in) { global $pommo; $dbo =& $pommo->_dbo; // if the user is pending to be added, remove entire subscriber. if ($in['type'] == 'add') { $pommo->requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php'); return PommoSubscriber::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('PommoPending::cancel() -> Error removing pending entry.'); return false; } return true; }
$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 (PommoHelper::isEmail($email)) { array_push($emails, $email); } } } if (count($emails) > 0) { $ids = PommoSubscriber::getIDByEmail($emails, $_REQUEST['status']); $msg = sprintf(Pommo::_T('You have removed %s subscribers!'), PommoSubscriber::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 (!PommoHelper::isEmail($subscriber['email'])) {
$smarty->assign('back', TRUE); } else { $logger->addMsg(Pommo::_T('Subscription request received.')); // send confirmation message. if (PommoHelperMessages::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') { PommoHelperMessages::notify($notices, $subscriber, 'pending', $comments); } if ($config['site_confirm']) { Pommo::redirect($config['site_confirm']); } } else { $smarty->assign('back', TRUE); // delete the subscriber PommoSubscriber::delete($id); } } } else { // no email confirmation required if (!PommoSubscriber::add($subscriber)) { $logger->addErr('Error adding subscriber! Please contact the administrator.'); $smarty->assign('back', TRUE); } else { // send/print welcome message PommoHelperMessages::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') { PommoHelperMessages::notify($notices, $subscriber, 'subscribe', $comments); } // redirect
function stop($finish = false) { $this->_mailer->SmtpClose(); if ($this->_test) { // don't respawn if this is a test mailing PommoMailCtl::finish($this->_id, TRUE, TRUE); PommoSubscriber::delete(current($this->_hash)); session_destroy(); exit; } if ($finish) { PommoMailCtl::finish($this->_id); $this->shutdown(Pommo::_T('Mailing Complete.')); } // respwn if (!PommoMailCtl::spawn($GLOBALS['pommo']->_baseUrl . 'admin/mailings/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); }