queueMake() public method

returns (bool) - true if success
public queueMake ( &$in )
Beispiel #1
0
         $state['group'] = Pommo::_T('Test Mailing');
         if ($state['ishtml'] == 'off') {
             $state['body'] = $state['altbody'];
             $state['altbody'] = '';
         }
         // create mailing
         $mailing = Pommo_Mailing::make(array(), TRUE);
         $state['status'] = 1;
         $state['current_status'] = 'stopped';
         $state['command'] = 'restart';
         $state['charset'] = $state['list_charset'];
         $mailing = Pommo_Helper::arrayIntersect($state, $mailing);
         $code = Pommo_Mailing::add($mailing);
         // populate queue
         $queue = array($key);
         if (!Pommo_Mail_Ctl::queueMake($queue)) {
             $logger->addErr('Unable to Populate Queue');
         } else {
             if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'ajax/mailings_send4.php?test=TRUE&code=' . $code)) {
                 $logger->addErr('Unable to spawn background mailer');
             } else {
                 $smarty->assign('sent', $_POST['email']);
             }
         }
     }
 } elseif ($current) {
     $logger->addMsg(Pommo::_T('A mailing is currently taking place. Please try again later.'));
     $smarty->assign($_POST);
 } else {
     // __ FORM NOT VALID
     $logger->addMsg(Pommo::_T('Please review and correct errors with your submission.'));
Beispiel #2
0
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if ($state['tally'] > 0) {
        if ($state['ishtml'] == 'off') {
            $state['body'] = $state['altbody'];
            $state['altbody'] = '';
        }
        $mailing = Pommo_Mailing::make(array(), TRUE);
        $state['status'] = 1;
        $state['current_status'] = 'stopped';
        $state['command'] = 'restart';
        $mailing = Pommo_Helper::arrayIntersect($state, $mailing);
        $code = Pommo_Mailing::add($mailing);
        if (!Pommo_Mail_Ctl::queueMake($memberIDs)) {
            $json->fail('Unable to populate queue');
        }
        if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'ajax/mailings_send4.php?code=' . $code)) {
            $json->fail('Unable to spawn background mailer');
        }
        // clear mailing composistion data from session
        Pommo_Api::stateReset(array('mailing'));
        $json->add('callbackFunction', 'redirect');
        $json->add('callbackParams', Pommo::$_baseUrl . 'mailing_status.php');
    } else {
        $json->fail(Pommo::_T('Cannot send a mailing to 0 subscribers!'));
    }
    $json->serve();
}
$smarty->assign($state);