* You should have received a copy of the GNU General Public License
 * along with program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
echo 'Merci de patienter quelques secondes...';
ob_flush();
flush();
$code = PommoHelper::makeCode();
if (!PommoMailCtl::spawn($pommo->_baseUrl . 'support/tests/mailing.test2.php?code=' . $code, true)) {
    Pommo::kill('Echec du déclenchement du mécanisme. Vous devez corriger ce problème pour que poMMo puisse envoyer des e-mails.');
}
sleep(6);
if (!is_file($pommo->_workDir . '/mailing.test.php')) {
    // make sure we can write to the file
    if (!($handle = fopen($pommo->_workDir . '/mailing.test.php', 'w'))) {
        die('Impossible d\'écrire dans le fichier de test.');
    }
    fclose($handle);
    unlink($pommo->_workDir . '/mailing.test.php');
    Pommo::kill('Echec du déclenchement du mécanisme (problème d\'écriture au niveau du fichier de test). Vous devez corriger ce problème pour que poMMo puisse envoyer des e-mails.');
}
$o = PommoHelper::parseConfig($pommo->_workDir . '/mailing.test.php');
unlink($pommo->_workDir . '/mailing.test.php') or die('impossible de supprimer mailing.test.php');
if (isset($o['error'])) {
                $state['altbody'] = '';
            }
            // create mailing
            $mailing = PommoMailing::make(array(), TRUE);
            $state['status'] = 1;
            $state['current_status'] = 'stopped';
            $state['command'] = 'restart';
            $state['charset'] = $state['list_charset'];
            $mailing = PommoHelper::arrayIntersect($state, $mailing);
            $code = PommoMailing::add($mailing);
            // populate queue
            $queue = array($key);
            if (!PommoMailCtl::queueMake($queue)) {
                $logger->addErr('Unable to Populate Queue');
            } else {
                if (!PommoMailCtl::spawn($pommo->_baseUrl . 'admin/mailings/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.'));
        $smarty->assign($_POST);
    }
}
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
set_time_limit(0);
$code = PommoHelper::makeCode();
if (!PommoMailCtl::spawn($pommo->_baseUrl . 'support/tests/mailing.runtime2.php?code=' . $code)) {
    Pommo::kill('Initial Spawn Failed! You must correct this before poMMo can send mailings.');
}
echo 'Initial Run Time: ' . ini_get('max_execution_time') . ' seconds <br>';
echo '<br/> This test takes at least 90 seconds. Upon completetion "SUCCESS" will be printed. If you do not see "SUCCESS", the max runtime should be set near the second highest "reported working" value.';
echo '<hr>';
echo '<b>Reported working value(s)</b><br />';
ob_flush();
flush();
sleep(5);
if (!is_file($pommo->_workDir . '/mailing.test.php')) {
    // make sure we can write to the file
    if (!($handle = fopen($pommo->_workDir . '/mailing.test.php', 'w'))) {
        Pommo::kill('Unable to write to test file!');
    }
    fclose($handle);
Example #4
0
 function addNotices($id)
 {
     global $pommo;
     $logger =& $pommo->_logger;
     $dbo =& $pommo->_dbo;
     if (!is_numeric($id)) {
         return;
     }
     $notices = array();
     $i = 0;
     foreach ($logger->getAll() as $n) {
         $i++;
         $notices[] = $dbo->prepare("(%i,'%s', %i)", array($id, $n, $i));
     }
     // update DB notices
     if (!empty($notices)) {
         $query = "\n\t\t\t\tINSERT INTO " . $dbo->table['mailing_notices'] . "\n\t\t\t\t(mailing_id,notice,id) VALUES " . implode(',', $notices);
         $dbo->query($query);
     }
     // trim notices
     PommoMailCtl::delNotices($id);
 }
Example #5
0
 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);
 }
Example #6
0
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/mailings.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
$mailing = current(PommoMailing::get(array('active' => TRUE)));
switch ($_GET['cmd']) {
    case 'cancel':
        // cancel a mailing
    // cancel a mailing
    case 'restart':
        // restart mailing
    // restart mailing
    case 'stop':
        // pause mailing
        $query = "\n\t\t\tUPDATE " . $dbo->table['mailing_current'] . "\n\t\t\tSET command='" . $_GET['cmd'] . "'\n\t\t\tWHERE current_id=%i";
        $query = $dbo->prepare($query, array($mailing['id']));
        if (!$dbo->query($query)) {
            $json->fail();
        }
        if ($_GET['cmd'] == 'restart' || $_GET['cmd'] == 'cancel') {
            PommoMailCtl::spawn($pommo->_baseUrl . 'admin/mailings/mailings_send4.php?id=' . $mailing['id'] . '&code=' . $mailing['code']);
        }
        break;
}
$json->success();