| @@ -17,21 +17,26 @@ | ||
| 17 | 17 | |
| 18 | 18 | public function __construct() |
| 19 | 19 | { |
| 20 | 20 | parent::__construct(); |
| 21 | + | |
| 21 | 22 | $this->breadcrumb[acym_translation('ACYM_QUEUE')] = acym_completeLink('queue'); |
| 22 | 23 | $this->setDefaultTask('campaigns'); |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | - public function scheduleReady() | |
| 26 | + public function scheduleReady(): void | |
| 26 | 27 | { |
| 27 | 28 | $queueClass = new QueueClass(); |
| 28 | 29 | $queueClass->scheduleReady(); |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | - public function continuesend() | |
| 32 | + public function continuesend(): void | |
| 32 | 33 | { |
| 33 | - if ($this->config->get('queue_type') == 'onlyauto') { | |
| 34 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 35 | + | |
| 36 | + //Are we configured to use the automatic send process only? | |
| 37 | + //If so, we don't allow the user to access this feature! | |
| 38 | + if ($this->config->get('queue_type') === 'onlyauto') { | |
| 34 | 39 | acym_setNoTemplate(); |
| 35 | 40 | acym_display(acym_translation('ACYM_ONLYAUTOPROCESS'), 'warning'); |
| 36 | 41 | |
| 37 | 42 | exit; |
| @@ -36,13 +41,12 @@ | ||
| 36 | 41 | |
| 37 | 42 | exit; |
| 38 | 43 | } |
| 39 | 44 | |
| 40 | - $newcrontime = time() + 120; | |
| 41 | - if ($this->config->get('cron_next') < $newcrontime) { | |
| 42 | - $newValue = new \stdClass(); | |
| 43 | - $newValue->cron_next = $newcrontime; | |
| 44 | - $this->config->save($newValue); | |
| 45 | + //we move the next cron task so that we won't have problem with double send process | |
| 46 | + $newCronTime = time() + 120; | |
| 47 | + if ($this->config->get('cron_next') < $newCronTime) { | |
| 48 | + $this->config->saveConfig(['cron_next' => $newCronTime]); | |
| 45 | 49 | } |
| 46 | 50 | |
| 47 | 51 | $mailid = acym_getCID('id'); |
| 48 | 52 | |
| @@ -58,17 +62,19 @@ | ||
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | $alreadySent = acym_getVar('int', 'alreadysent', 0); |
| 61 | 65 | |
| 62 | - $helperQueue = new QueueHelper(); | |
| 63 | - $helperQueue->id = $mailid; | |
| 64 | - $helperQueue->report = true; | |
| 65 | - $helperQueue->total = $totalSend; | |
| 66 | - $helperQueue->start = $alreadySent; | |
| 67 | - $helperQueue->pause = $this->config->get('queue_pause'); | |
| 68 | - $helperQueue->fromManual = true; | |
| 69 | - $helperQueue->process(); | |
| 66 | + $queueHelper = new QueueHelper(); | |
| 67 | + $queueHelper->id = $mailid; | |
| 68 | + $queueHelper->report = true; | |
| 69 | + $queueHelper->total = (int)$totalSend; | |
| 70 | + $queueHelper->start = $alreadySent; | |
| 71 | + $queueHelper->pause = (int)$this->config->get('queue_pause', 0); | |
| 72 | + // ->Process will exit the current page if it needs to be continued | |
| 73 | + $queueHelper->fromManual = true; | |
| 74 | + $queueHelper->process(); | |
| 70 | 75 | |
| 76 | + //We should never be there... but if the user tries to resume the send process and the messages are not ready to be sent then it will land here... | |
| 71 | 77 | acym_setNoTemplate(); |
| 72 | 78 | exit; |
| 73 | 79 | } |
| 74 | 80 | } |