| @@ -15,8 +15,10 @@ | ||
| 15 | 15 | $data = []; |
| 16 | 16 | |
| 17 | 17 | $this->prepareDefaultPageInfo($data); |
| 18 | 18 | |
| 19 | + $data['anonymousStats'] = !empty($this->config->get('anonymous_stats', 0)); | |
| 20 | + | |
| 19 | 21 | $this->prepareDetailedListing($data); |
| 20 | 22 | if (count($this->selectedMailIds) == 1) { |
| 21 | 23 | if ($data['isAbTest']) { |
| 22 | 24 | $this->prepareAbTestMails($data); |
| @@ -30,8 +32,10 @@ | ||
| 30 | 32 | } |
| 31 | 33 | |
| 32 | 34 | public function exportDetailed(): void |
| 33 | 35 | { |
| 36 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 37 | + | |
| 34 | 38 | $exportHelper = new ExportHelper(); |
| 35 | 39 | $data = []; |
| 36 | 40 | $this->prepareDefaultPageInfo($data); |
| 37 | 41 | |
| @@ -50,11 +54,11 @@ | ||
| 50 | 54 | $columnsToExport['user.name'] = acym_translation('ACYM_USER_NAME'); |
| 51 | 55 | foreach ($columnsMailStat as $column) { |
| 52 | 56 | if (in_array($column, ['user_id', 'mail_id'])) continue; |
| 53 | 57 | $trad = acym_translation('ACYM_'.strtoupper($column).'_COLUMN_STAT'); |
| 54 | - if ($column == 'send_date') $trad = acym_translation('ACYM_SEND_DATE'); | |
| 55 | - if ($column == 'open') $trad = acym_translation('ACYM_OPEN_TOTAL_COLUMN_STAT'); | |
| 56 | - if ($column == 'bounce') $trad = acym_translation('ACYM_BOUNCE_UNIQUE_COLUMN_STAT'); | |
| 58 | + if ($column === 'send_date') $trad = acym_translation('ACYM_SEND_DATE'); | |
| 59 | + if ($column === 'open') $trad = acym_translation('ACYM_OPEN_TOTAL_COLUMN_STAT'); | |
| 60 | + if ($column === 'bounce') $trad = acym_translation('ACYM_BOUNCE_UNIQUE_COLUMN_STAT'); | |
| 57 | 61 | $columnsToExport['userstat.'.$column] = $trad; |
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | $query = 'SELECT '.implode(', ', array_keys($columnsToExport)).', SUM(urlclick.click) AS click FROM #__acym_user_stat AS userstat |
| @@ -68,10 +72,10 @@ | ||
| 68 | 72 | |
| 69 | 73 | private function prepareDetailedListing(array &$data): void |
| 70 | 74 | { |
| 71 | 75 | $data['search'] = $this->getVarFiltersListing('string', 'detailed_stats_search', ''); |
| 72 | - $data['ordering'] = $this->getVarFiltersListing('string', 'detailed_stats_ordering', 'send_date'); | |
| 73 | - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', 'detailed_stats_ordering_sort_order', 'desc'); | |
| 76 | + $data['ordering'] = $this->getVarFiltersListing('cmd', 'detailed_stats_ordering', 'send_date'); | |
| 77 | + $data['orderingSortOrder'] = $this->getVarFiltersListing('cmd', 'detailed_stats_ordering_sort_order', 'desc'); | |
| 74 | 78 | |
| 75 | 79 | if (empty($this->selectedMailIds)) { |
| 76 | 80 | return; |
| 77 | 81 | } |
| @@ -92,8 +96,9 @@ | ||
| 92 | 96 | 'mail_ids' => $this->selectedMailIds, |
| 93 | 97 | ] |
| 94 | 98 | ); |
| 95 | 99 | |
| 100 | + // Prepare the pagination | |
| 96 | 101 | $pagination->setStatus((int)$matchingDetailedStats['total']->total, $page, $detailedStatsPerPage); |
| 97 | 102 | |
| 98 | 103 | $data['pagination'] = $pagination; |
| 99 | 104 | $data['detailed_stats'] = $matchingDetailedStats['detailed_stats']; |