Beispiel #1
0
 function members($p = array(), $filter = array('field' => null, 'string' => null))
 {
     $GLOBALS['pommo']->requireOnce($GLOBALS['pommo']->_baseDir . 'inc/helpers/subscribers.php');
     if (is_array($this->_memberIDs)) {
         $p['id'] =& $this->_memberIDs;
     } else {
         // status was already passed when fetching IDs
         $p['status'] = $this->_status;
     }
     return PommoSubscriber::get($p, $filter);
 }
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
$pommo->toggleEscaping(TRUE);
$state =& PommoAPI::stateInit('subscribers_manage');
$fields = PommoField::get();
$ids = FALSE;
if (!empty($_POST['ids'])) {
    $ids = explode(',', $_POST['ids']);
}
// ====== CSV EXPORT ======
if ($_POST['type'] == 'csv') {
    if (!$ids) {
        $group = new PommoGroup($state['group'], $state['status']);
        $subscribers = $group->members();
    } else {
        $subscribers = PommoSubscriber::get(array('id' => $ids));
    }
    // supply headers
    $o = '"' . Pommo::_T('Email') . '"';
    if (!empty($_POST['registered'])) {
        $o .= ',"' . Pommo::_T('Date Registered') . '"';
    }
    if (!empty($_POST['ip'])) {
        $o .= ',"' . Pommo::_T('IP Address') . '"';
    }
    foreach ($fields as $f) {
        $o .= ",\"{$f['name']}\"";
    }
    $o .= "\r\n";
    function csvWrap(&$in)
    {
Beispiel #3
0
/**********************************
	INITIALIZATION METHODS
 *********************************/
require '../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
$pommo->init(array('authLevel' => 0, 'noSession' => true));
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
// make sure email/login is valid
$subscriber = current(PommoSubscriber::get(array('email' => empty($_REQUEST['email']) ? '0' : $_REQUEST['email'], 'status' => 1)));
if (empty($subscriber)) {
    Pommo::redirect('login.php');
}
// see if an anctivation email was sent to this subscriber in the last 2 minutes;
$query = "\n\tSELECT \n\t\t*\n\tFROM \n\t\t" . $dbo->table['scratch'] . "\n\tWHERE\n\t\t`type`=1\n\t\tAND `int`=%i\n\t\tAND `time` > (NOW() - INTERVAL 2 MINUTE)\n\tLIMIT 1";
$query = $dbo->prepare($query, array($subscriber['id']));
$test = $dbo->query($query, 0);
// attempt to send activation code if once has not recently been sent
if (empty($test)) {
    $code = PommoSubscriber::getActCode($subscriber);
    if (PommoHelperMessages::sendMessage(array('to' => $subscriber['email'], 'code' => $code, 'type' => 'activate'))) {
        $smarty->assign('sent', true);
        // timestamp this activation email
        $query = "\n\t\t\tINSERT INTO " . $dbo->table['scratch'] . "\n\t\t\tSET\n\t\t\t\t`type`=1,\n\t\t\t\t`int`=%i";
        $query = $dbo->prepare($query, array($subscriber['id']));
Beispiel #4
0
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->assign('title', $pommo->_config['site_name'] . ' - ' . Pommo::_T('Mailing History'));
/** SET PAGE STATE
 * limit	- # of mailings per page
 * sort		- Sorting of Mailings [subject, started]
 * order	- Order Type (ascending - ASC /descending - DESC)
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& PommoAPI::stateInit('mailings_history', array('limit' => 100, 'sort' => 'finished', 'order' => 'asc', 'page' => 1), $_REQUEST);
// if mail_id is passed, display the mailing.
if (isset($_GET['mail_id']) && is_numeric($_GET['mail_id'])) {
    $input = current(PommoMailing::get(array('id' => $_GET['mail_id'])));
    // attempt personalizations of body/subject
    if (isset($_GET['email']) && isset($_GET['code'])) {
        $subscriber = current(PommoSubscriber::get(array('email' => $_GET['email'], 'status' => 1)));
        if ($_GET['code'] == PommoSubscriber::getActCode($subscriber)) {
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalize.php');
            // require once here so that mailer can use
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalizetitle.php');
            // title personalization
            $matches1 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['body'], $matches1);
            if (!empty($matches1)) {
                $pBody = PommoHelperPersonalize::search($input['body']);
                $input['body'] = PommoHelperPersonalize::replace($input['body'], $subscriber, $pBody);
            }
            $matches2 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['altbody'], $matches2);
            if (!empty($matches2)) {
                $pAltBody = PommoHelperPersonalize::search($input['altbody']);
Beispiel #5
0
// lookup code
$pending = PommoPending::get($_GET['code']);
if (!$pending) {
    $logger->addMsg(Pommo::_T('Invalid code! Make sure you copied it correctly from the email.'));
    $smarty->display('user/confirm.tpl');
    Pommo::kill();
}
// Load success messages and redirection URL from config
$config = PommoAPI::configGet(array('site_success', 'messages', 'notices'));
$messages = unserialize($config['messages']);
$notices = unserialize($config['notices']);
if (PommoPending::perform($pending)) {
    Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
    // get subscriber info
    Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
    $subscriber = current(PommoSubscriber::get(array('id' => $pending['subscriber_id'])));
    switch ($pending['type']) {
        case "add":
            // send/print welcome message
            PommoHelperMessages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe'));
            if (isset($notices['subscribe']) && $notices['subscribe'] == 'on') {
                PommoHelperMessages::notify($notices, $subscriber, 'subscribe');
            }
            if (!empty($config['site_success'])) {
                Pommo::redirect($config['site_success']);
            }
            break;
        case "change":
            if (isset($notices['update']) && $notices['update'] == 'on') {
                PommoHelperMessages::notify($notices, $subscriber, 'update');
            }
Beispiel #6
0
 function pullQueue()
 {
     global $pommo;
     $dbo =& $pommo->_dbo;
     $relay = 1;
     // switched to static relay in PR15, will utilize swiftmailer's multi-SMTP support.
     // check mailing status + update queue, notices
     $this->poll();
     // ensure queue is active
     $query = "\n\t\t\tSELECT COUNT(subscriber_id) \n\t\t\tFROM " . $dbo->table['queue'] . "\n\t\t\tWHERE status=0";
     if ($dbo->query($query, 0) < 1) {
         // no unsent mails left in queue, mailing complete!
         $this->stop(true);
     }
     // release lock on queue
     $query = "\n\t\t\tUPDATE " . $dbo->table['queue'] . "\n\t\t\tSET smtp=0 \n\t\t\tWHERE smtp=%i";
     $query = $dbo->prepare($query, array($relay));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     // mark our working queue
     $query = "\n\t\t\tUPDATE " . $dbo->table['queue'] . "\n\t\t\tSET smtp=%i\n\t\t\tWHERE smtp=0 AND status=0\n\t\t\tLIMIT %i";
     $query = $dbo->prepare($query, array($relay, $this->_queueSize));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     // pull our queue
     $query = "\n\t\t\tSELECT subscriber_id\n\t\t\tFROM " . $dbo->table['queue'] . "\n\t\t\tWHERE smtp=%i";
     $query = $dbo->prepare($query, array($relay));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     $this->_queue =& PommoSubscriber::get(array('id' => $dbo->getAll(false, 'assoc', 'subscriber_id')));
     if (empty($this->_queue)) {
         $this->shutdown('Unable to pull queue.');
     }
     return;
 }