PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Controllers/Configuration/Queue.php +12 -4 10.11.1 → 11.1.0 View file →
@@ -5,8 +5,10 @@
5 5 trait Queue
6 6 {
7 7 public function deletereport(): void
8 8 {
9 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
10 +
9 11 $path = trim(html_entity_decode($this->config->get('cron_savepath')));
10 12 if (!preg_match('#^[a-z0-9/_\-{}]*\.log$#i', $path)) {
11 13 acym_enqueueMessage(acym_translation('ACYM_WRONG_LOG_NAME'), 'error');
12 14
@@ -12,9 +14,9 @@
12 14
13 15 return;
14 16 }
15 17
16 - $path = str_replace(['{year}', '{month}'], [date('Y'), date('m')], $this->config->get('cron_savepath'));
18 + $path = str_replace(['{year}', '{month}'], [gmdate('Y'), gmdate('m')], $this->config->get('cron_savepath'));
17 19 $reportPath = acym_cleanPath(ACYM_ROOT.$path);
18 20
19 21 if (is_file($reportPath)) {
20 22 $result = acym_deleteFile($reportPath);
@@ -36,18 +38,22 @@
36 38
37 39 $path = trim(html_entity_decode($this->config->get('cron_savepath')));
38 40 if (!preg_match('#^[a-z0-9/_\-{}]*\.log$#i', $path)) {
39 41 acym_display(acym_translation('ACYM_WRONG_LOG_NAME'), 'error');
42 +
43 + return;
40 44 }
41 45
42 - $path = str_replace(['{year}', '{month}'], [date('Y'), date('m')], $path);
46 + $path = str_replace(['{year}', '{month}'], [gmdate('Y'), gmdate('m')], $path);
43 47 $reportPath = acym_cleanPath(ACYM_ROOT.$path);
44 48
45 49 if (file_exists($reportPath) && !is_dir($reportPath)) {
46 50 try {
47 51 $lines = 5000;
52 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Necessary tail to save on resources.
48 53 $f = fopen($reportPath, 'rb');
49 54 fseek($f, -1, SEEK_END);
55 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread -- Necessary tail to save on resources.
50 56 if (fread($f, 1) != "\n") {
51 57 $lines -= 1;
52 58 }
53 59
@@ -52,10 +58,11 @@
52 58 }
53 59
54 60 $report = '';
55 61 while (ftell($f) > 0 && $lines >= 0) {
56 - $seek = min(ftell($f), 4096); // Figure out how far back we should jump
62 + $seek = min(ftell($f), 4096);
57 63 fseek($f, -$seek, SEEK_CUR);
64 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread -- Necessary tail to save on resources.
58 65 $report = ($chunk = fread($f, $seek)).$report; // Get the line
59 66 fseek($f, -mb_strlen($chunk, '8bit'), SEEK_CUR);
60 67 $lines -= substr_count($chunk, "\n"); // Move to previous line
61 68 }
@@ -62,8 +69,9 @@
62 69
63 70 while ($lines++ < 0) {
64 71 $report = substr($report, strpos($report, "\n") + 1);
65 72 }
73 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Necessary tail to save on resources.
66 74 fclose($f);
67 75 } catch (\Exception $e) {
68 76 $report = '';
69 77 }
@@ -72,8 +80,8 @@
72 80 if (empty($report)) {
73 81 $report = acym_translation('ACYM_EMPTY_LOG');
74 82 }
75 83
76 - echo nl2br($report);
84 + echo nl2br(esc_html($report));
77 85 exit;
78 86 }
79 87 }