get() public static method

returns an array of subscribers. Array key(s) correlates to subscriber id.
public static get ( $p = [], $search = ['field' => null, 'string' => null] )
Esempio n. 1
0
 function members($p = array(), $filter = array('field' => null, 'string' => null))
 {
     require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
     if (is_array($this->_memberIDs)) {
         $p['id'] =& $this->_memberIDs;
     } else {
         $p['status'] = $this->_status;
     }
     return Pommo_Subscribers::get($p, $filter);
 }
Esempio n. 2
0
// lookup code
$pending = Pommo_Pending::get($_GET['code']);
if (!$pending) {
    $logger->addMsg(Pommo::_T('Invalid code! Make sure you copied it correctly from the email.'));
    $view->display('user/confirm');
    Pommo::kill();
}
// Load success messages and redirection URL from config
$config = Pommo_Api::configGet(array('site_success', 'messages', 'notices'));
$messages = unserialize($config['messages']);
$notices = unserialize($config['notices']);
if (Pommo_Pending::perform($pending)) {
    require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
    // get subscriber info
    require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
    $subscriber = current(Pommo_Subscribers::get(array('id' => $pending['subscriber_id'])));
    switch ($pending['type']) {
        case "add":
            // send/print welcome message
            Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe'));
            if (isset($notices['subscribe']) && $notices['subscribe'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'subscribe');
            }
            if (!empty($config['site_success'])) {
                Pommo::redirect($config['site_success']);
            }
            break;
        case "change":
            if (isset($notices['update']) && $notices['update'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'update');
            }
Esempio n. 3
0
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
Pommo::toggleEscaping(TRUE);
$state = Pommo_API::stateInit('subscribers_manage');
$fields = Pommo_Fields::get();
$ids = FALSE;
if (!empty($_POST['ids'])) {
    $ids = explode(',', $_POST['ids']);
}
// ====== CSV EXPORT ======
if ($_POST['type'] == 'csv') {
    if (!$ids) {
        $group = new Pommo_Groups($state['group'], $state['status']);
        $subscribers = $group->members();
    } else {
        $subscribers = Pommo_Subscribers::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)
    {
Esempio n. 4
0
 /**
  * Verify if there are still subscribers to whom the mailing hasn't been
  * sent. If there aren't, stop. If there are: Get some subscribers from the
  * DB.
  */
 function pullQueue()
 {
     $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            SELECT COUNT(subscriber_id)\n            FROM " . $dbo->table['queue'] . "\n            WHERE status=0";
     // no unsent mails left in queue, mailing complete!
     if ($dbo->query($query, 0) < 1) {
         $this->stop(true);
     }
     // release lock on queue
     $query = "\n            UPDATE " . $dbo->table['queue'] . "\n            SET smtp=0\n            WHERE smtp=%i";
     $query = $dbo->prepare($query, array($relay));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     // mark our working queue
     $query = "\n            UPDATE " . $dbo->table['queue'] . "\n            SET smtp=%i\n            WHERE smtp=0 AND status=0\n            LIMIT %i";
     $query = $dbo->prepare($query, array($relay, $this->_queueSize));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     // pull our queue
     $query = "\n            SELECT subscriber_id\n            FROM " . $dbo->table['queue'] . "\n            WHERE smtp=%i";
     $query = $dbo->prepare($query, array($relay));
     if (!$dbo->query($query)) {
         $this->shutdown('Database Query failed: ' . $query);
     }
     $this->_queue = Pommo_Subscribers::get(array('id' => $dbo->getAll(false, 'assoc', 'subscriber_id')));
     if (empty($this->_queue)) {
         $this->shutdown('Unable to pull queue.');
     }
 }
Esempio n. 5
0
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Pending.php';
Pommo::init(array('authLevel' => 0, 'noSession' => true));
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// Prepare for subscriber form -- load in fields + POST/Saved Subscribe Form
$view->prepareForSubscribeForm();
// fetch the subscriber, validate code
$subscriber = current(Pommo_Subscribers::get(array('email' => empty($_REQUEST['email']) ? '0' : $_REQUEST['email'], 'status' => 1)));
if (empty($subscriber)) {
    Pommo::redirect('login.php');
}
if ($_REQUEST['code'] != Pommo_Subscribers::getActCode($subscriber)) {
    Pommo::kill(Pommo::_T('Invalid activation code.'));
}
// check if we have pending request
if (Pommo_Pending::isPending($subscriber['id'])) {
    $input = urlencode(serialize(array('Email' => $_POST['Email'])));
    Pommo::redirect('pending.php?input=' . $input);
}
$config = Pommo_Api::configGet(array('notices'));
$notices = unserialize($config['notices']);
if (!isset($_POST['d'])) {
    $view->assign('d', $subscriber['data']);
Esempio n. 6
0
}
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/** 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 =& Pommo_Api::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(Pommo_Mailing::get(array('id' => $_GET['mail_id'])));
    // attempt personalizations
    if (isset($_GET['email']) && isset($_GET['code'])) {
        $subscriber = current(Pommo_Subscribers::get(array('email' => $_GET['email'], 'status' => 1)));
        if ($_GET['code'] == Pommo_Subscribers::getActCode($subscriber)) {
            require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Personalize.php';
            // require once here so that mailer can use
            $matches = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['body'], $matches);
            if (!empty($matches)) {
                $pBody = Pommo_Helper_Personalize::search($input['body']);
                $input['body'] = Pommo_Helper_Personalize::replace($input['body'], $subscriber, $pBody);
            }
            preg_match('/\\[\\[[^\\]]+]]/', $input['altbody'], $matches);
            if (!empty($matches)) {
                $pAltBody = Pommo_Helper_Personalize::search($input['altbody']);
                $input['altbody'] = Pommo_Helper_Personalize::replace($input['altbody'], $subscriber, $pAltBody);
            }
        }