10 session_write_close();
11 header(
'Connection:close');
12 $app = Dataface_Application::getInstance();
13 $query = $app->getQuery();
17 if ( !@$query[
'--job-id'] ){
18 throw new Exception(
"No job ID specified");
21 $job = df_get_record(
'xataface__email_jobs', array(
'job_id'=>
'='.$query[
'--job-id']));
23 throw new Exception(
"Job could not be found", self::JOB_NOT_FOUND);
26 $email = df_get_record(
'xataface__email_newsletters', array(
'id'=>
'='.$job->val(
'email_id')));
28 throw new Exception(
"Email could not be found", self::EMAIL_NOT_FOUND);
33 if ( !$job->checkPermission(
'cancel email job') or !$email->checkPermission(
'cancel email job') ){
34 throw new Exception(
"You don't have permission to cancel this job", self::PERMISSION_DENIED);
38 df_q(
"update xataface__email_jobs set cancelled=0 where job_id='".addslashes($query[
'--job-id']).
"'");
42 'message' =>
'Successfully resumed job'
45 }
catch (Exception $ex){
47 if ( $ex->getCode() > 8000 and $ex->getCode() < 9000 ){
49 'code' => intval($ex->getCode()-8000),
50 'message' => $ex->getMessage()
60 header(
'Content-type: text/json; charset="'.Dataface_Application::getInstance()->_conf[
'oe'].
'"');
61 echo json_encode($out);