$mailingIDS = $_REQUEST['mailings']; if (!is_array($mailingIDS)) { $mailingIDS = array($mailingIDS); } /********************************** JSON OUTPUT INITIALIZATION *********************************/ 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'));
$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) { $output['status'] = 3; } } } $output['statusText'] = $statusText[$output['status']]; // get last 50 unique notices $mailingNotices = Pommo_Mailing::getNotices($mailing['id'], 50, true); $newNotices = array(); foreach ($mailingNotices as $time => $arr) { if (!isset($state['notices'][$time])) { $newNotices = array_merge($newNotices, $arr); continue; } foreach ($arr as $notice) { if (array_search($notice, $arr) === false) { $newNotices[] = $notice; } } } $state['notices'] = $mailingNotices; $output['notices'] = array_reverse($newNotices); // calculate sent