$mailingIDS = $_REQUEST['mailings']; if (!is_array($mailingIDS)) { $mailingIDS = array($mailingIDS); } /********************************** JSON OUTPUT INITIALIZATION *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php'); $json = new PommoJSON(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'), PommoMailing::getSubject($id)) . ' ###<br /><br />'); $notices = PommoMailing::getNotices($id); $logger->AddMsg($notices); } break; case 'reload': Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php'); $mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings']))); // change group name to ID $groups = PommoGroup::getNames(); $gid = 'all'; foreach ($groups as $group) { if ($group['name'] == $mailing['group']) { $gid = $group['id']; } } PommoAPI::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 = PommoMailing::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