get() public static method

returns an array of mailings. Array key(s) correlates to mailing ID.
public static get ( $p = [] )
Exemplo n.º 1
0
 function Pommo_Mta($args = array())
 {
     $defaults = array('queueSize' => 100, 'maxRunTime' => 80, 'skipSecurity' => false, 'start' => time(), 'serial' => false, 'spawn' => 1);
     $p = Pommo_Api::getParams($defaults, $args);
     foreach ($p as $k => $v) {
         $this->{'_' . $k} = $v;
     }
     // protect against safe mode timeouts
     if (ini_get('safe_mode')) {
         $this->_maxRunTime = ini_get('max_execution_time') - 10;
     } else {
         set_time_limit(0);
     }
     // protect against user (client) abort
     ignore_user_abort(true);
     // register shutdown method
     register_shutdown_function(array(&$this, "shutdown"));
     // set parameters from URL
     $this->_code = empty($_GET['code']) ? 'invalid' : $_GET['code'];
     $this->_test = isset($_GET['test']);
     $this->_id = isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : false;
     // verify and initialize the current mailing
     $p = array('active' => true, 'code' => $this->_skipSecurity ? null : $this->_code, 'id' => $this->_id ? $this->_id : null);
     $this->_mailing = current(Pommo_Mailing::get($p));
     if (!is_numeric($this->_mailing['id'])) {
         $this->shutdown('Unable to initialize mailing.');
     }
     $this->_id = $this->_mailing['id'];
     // make sure the $_GET global holds the mailing id (used in personalizations, etc.)
     $_GET['id'] = $this->_id;
     // security routines
     if ($this->_mailing['end'] > 0) {
         $this->shutdown(Pommo::_T('Mailing Complete.'));
     }
     if (empty($this->_mailing['serial'])) {
         if (!Pommo_Mail_Ctl::mark($this->_serial, $this->_id)) {
             $this->shutdown('Unable to serialize mailing (ID: ' . $this->_id . ' SERIAL: ' . $this->_serial . ')');
         }
     }
     if ($this->_maxRunTime < 15) {
         $this->shutdown('Max Runtime must be at least 15 seconds!');
     }
     $this->_queue = $this->_sent = $this->_failed = array();
     return;
 }
Exemplo n.º 2
0
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json(false);
// do not toggle escaping
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'notice':
        foreach ($mailingIDS as $id) {
            $logger->AddMsg('<br /><br />###' . sprintf(Pommo::_T('Displaying notices for mailing %s'), Pommo_Mailing::getSubject($id)) . ' ###<br /><br />');
            $notices = Pommo_Mailing::getNotices($id);
            $logger->AddMsg($notices);
        }
        break;
    case 'reload':
        require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
        $mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = Pommo_Groups::getNames();
        $gid = 'all';
        foreach ($groups as $group) {
            if ($group['name'] == $mailing['group']) {
                $gid = $group['id'];
            }
        }
        Pommo_Api::stateReset(array('mailing'));
        // if this is a plain text mailing, switch body + altbody.
        if ($mailing['ishtml'] == 'off') {
            $mailing['altbody'] = $mailing['body'];
            $mailing['body'] = null;
        }
        // Initialize page state with default values overriden by those held in $_REQUEST
Exemplo n.º 3
0
 *  (at your option) any later version.
 *
 *  poMMo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Pommo.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  This fork is from https://github.com/soonick/poMMo
 *  Please see docs/contribs for Contributors
 *
 */
// Progress bar modified from the works of Juha Suni <*****@*****.**>
/**********************************
	INITIALIZATION METHODS
 *********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$mailing = current(Pommo_Mailing::get(array('active' => TRUE)));
$view->assign('mailing', $mailing);
$view->display('admin/mailings/mailing_status');
Exemplo n.º 4
0
if ($start < 0) {
    $start = 0;
}
/**********************************
	RECORD RETREVIAL
*********************************/
// normalize sort to database column
if ($state['sort'] == 'group') {
    $state['sort'] = 'mailgroup';
} elseif ($state['sort'] == 'start') {
    $state['sort'] = 'started';
} elseif ($state['sort'] == 'end') {
    $state['sort'] = 'finished';
}
// Fetch Mailings for this Page
$mailings = Pommo_Mailing::get(array('noBody' => TRUE, 'sort' => $state['sort'], 'order' => $state['order'], 'limit' => $state['limit'], 'offset' => $start, 'forHistory' => true));
/**********************************
	OUTPUT FORMATTING
*********************************/
$records = array();
foreach ($mailings as $o) {
    //	If the mailing is not beeing tracked show "not tracked" instead of 0
    if (0 == $o['track']) {
        $o['hits'] = Pommo::_T('Not tracked');
    }
    $row = array('id' => $o['id'], 'subject' => $o['subject'], 'group' => $o['group'] . ' (' . $o['tally'] . ')', 'sent' => $o['sent'], 'start' => $o['start'], 'end' => $o['end'], 'hits' => $o['hits']);
    if ($o['status'] == 0) {
        $o['status'] = Pommo::_T('Complete');
    } elseif ($o['status'] == 1) {
        $o['status'] = Pommo::_T('Processing');
    } else {
Exemplo n.º 5
0
 * touched - remember last time the mailing was touched
 * timestamp - updated whenever the mailing touched time changes
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state = Pommo_Api::stateInit('subscribers_manage', array('touched' => null, 'timestamp' => time(), 'notices' => array()));
if (!empty($_GET['resetNotices'])) {
    $state['notices'] = array();
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
$output = array('percent' => null, 'status' => null, 'statusText' => null, 'sent' => null, 'notices' => FALSE);
$statusText = array(1 => Pommo::_T('Processing'), 2 => Pommo::_T('Stopped'), 3 => Pommo::_T('Frozen'), 4 => Pommo::_T('Finished'));
$mailing = isset($_GET['id']) ? current(Pommo_Mailing::get(array('id' => $_GET['id']))) : current(Pommo_Mailing::get(array('active' => TRUE)));
// status >> 1: Processing  2: Stopped  3: Frozen  4: Finished
if ($mailing['status'] != 1) {
    $output['status'] = 4;
} elseif ($mailing['current_status'] == 'stopped') {
    $output['status'] = 2;
} else {
    $output['status'] = 1;
}
// check for frozen mailing
if ($output['status'] != 4) {
    if ($state['touched'] != $mailing['touched']) {
        $state['touched'] = $mailing['touched'];
        $state['timestamp'] = time();
    } else {
        if (time() - $state['timestamp'] > 25) {
Exemplo n.º 6
0
    // Show message to the guest telling them that public mailings is not on
    $view->display('public_mailings_disabled');
    Pommo::kill();
}
$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']);