Commit | Line | Data |
---|---|---|
5ca340ca TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
6 | | This work is published under the GNU AGPLv3 license with some | | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
9 | +--------------------------------------------------------------------+ | |
10 | */ | |
11 | ||
12 | /** | |
13 | * | |
14 | * @package CRM | |
15 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
16 | */ | |
17 | ||
18 | /** | |
19 | * Indicate that a CiviMail message has been opened | |
20 | * | |
21 | * General Usage: civicrm/mailing/open?qid={event_queue_id} | |
22 | * | |
23 | * NOTE: The parameter name has changed slightly from 'extern/open.php?q={event_queue_id}`. | |
24 | */ | |
25 | class CRM_Mailing_Page_Open extends CRM_Core_Page { | |
26 | ||
27 | /** | |
28 | * Mark the mailing as opened | |
29 | * | |
30 | * @throws \CRM_Core_Exception | |
31 | */ | |
32 | public function run() { | |
33 | $queue_id = CRM_Utils_Request::retrieveValue('qid', 'Positive', NULL, FALSE, 'GET'); | |
34 | if (!$queue_id) { | |
35 | // Deprecated: "?q=" is problematic in Drupal integrations, but we'll accept if igiven | |
36 | $queue_id = CRM_Utils_Request::retrieveValue('q', 'Positive', NULL, FALSE, 'GET');; | |
37 | } | |
38 | if (!$queue_id) { | |
39 | echo "Missing input parameters\n"; | |
40 | exit(); | |
41 | } | |
42 | ||
43 | CRM_Mailing_Event_BAO_Opened::open($queue_id); | |
44 | ||
45 | $filename = Civi::paths()->getPath('[civicrm.root]/i/tracker.gif'); | |
46 | ||
47 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |
48 | header('Content-Description: File Transfer'); | |
49 | header('Content-type: image/gif'); | |
50 | header('Content-Length: ' . filesize($filename)); | |
51 | header('Content-Disposition: inline; filename=tracker.gif'); | |
52 | ||
53 | readfile($filename); | |
54 | ||
55 | CRM_Utils_System::civiExit(); | |
56 | } | |
57 | ||
58 | } |