From 5d6f611113339110b5bc333ef8c21f5d04c8a3c2 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 18 Apr 2020 17:52:03 -0400 Subject: [PATCH] Convert email templates to not access datastore through the registry. --- includes/class_notification.php | 9 +++++++++ locale/en_US/emails/notice_attachment.part.tpl | 4 ++-- locale/en_US/emails/notice_priority.part.tpl | 2 +- locale/en_US/emails/notice_resolution.part.tpl | 2 +- locale/en_US/emails/notice_severity.part.tpl | 2 +- locale/en_US/emails/notice_status.part.tpl | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/includes/class_notification.php b/includes/class_notification.php index bad5d67..1d50384 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -316,6 +316,8 @@ class NotificationCenter function notice_status_change($old, $new) { $userlist = $this->fetch_users_with_on_bit('statusresolve'); + $old = bugdar::$datastore['status'][$old]['status']; + $new = bugdar::$datastore['status'][$new]['status']; foreach ($userlist AS $userid => $user) { eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_status.part', $this->_localeFromUserId($userid))) . '";'); @@ -335,6 +337,8 @@ class NotificationCenter function notice_resolution_change($old, $new) { $userlist = $this->fetch_users_with_on_bit('statusresolve'); + $old = bugdar::$datastore['resolution'][$old]['resolution']; + $new = bugdar::$datastore['resolution'][$new]['resolution']; foreach ($userlist AS $userid => $user) { eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_resolution.part', $this->_localeFromUserId($userid))) . '";'); @@ -373,6 +377,8 @@ class NotificationCenter function notice_severity_change($old, $new) { $userlist = $this->fetch_users_with_on_bit('otherfield'); + $old = bugdar::$datastore['severity'][$old]['severity']; + $new = bugdar::$datastore['severity'][$new]['severity']; foreach ($userlist AS $userid => $user) { eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_severity.part', $this->_localeFromUserId($userid))) . '";'); @@ -392,6 +398,8 @@ class NotificationCenter function notice_priority_change($old, $new) { $userlist = $this->fetch_users_with_on_bit('otherfield'); + $old = bugdar::$datastore['priority'][$old]['priority']; + $new = bugdar::$datastore['priority'][$new]['priority']; foreach ($userlist AS $userid => $user) { eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_priority.part', $this->_localeFromUserId($userid))) . '";'); @@ -480,6 +488,7 @@ class NotificationCenter function send_new_attachment_notice($attachment, $obsolete, $id) { $userlist = $this->fetch_users_with_on_bit('newattachment'); + $url = bugdar::$options['trackerurl'] . "/viewattachment.php?attachmentid=$id"; foreach ($userlist AS $userid => $user) { $user = construct_user_display($this->registry->userinfo, false); diff --git a/locale/en_US/emails/notice_attachment.part.tpl b/locale/en_US/emails/notice_attachment.part.tpl index 53fee41..939a478 100644 --- a/locale/en_US/emails/notice_attachment.part.tpl +++ b/locale/en_US/emails/notice_attachment.part.tpl @@ -4,5 +4,5 @@ File name: $attachment[filename] Description: $attachment[description] File size: $attachment[filesize] Bytes Makes obsolete: $obsoletes -View: {$this->registry->options['trackerurl']}/viewattachment.php?attachmentid=$id -============================================ \ No newline at end of file +View: $url +============================================ diff --git a/locale/en_US/emails/notice_priority.part.tpl b/locale/en_US/emails/notice_priority.part.tpl index c8294fb..009f988 100644 --- a/locale/en_US/emails/notice_priority.part.tpl +++ b/locale/en_US/emails/notice_priority.part.tpl @@ -1 +1 @@ -The priority has been elevatd from "{$this->registry->datastore['priority'][$old]['priority']}" to "{$this->registry->datastore['priority'][$new]['priority']}". \ No newline at end of file +The priority has been elevatd from "$old" to "$new". diff --git a/locale/en_US/emails/notice_resolution.part.tpl b/locale/en_US/emails/notice_resolution.part.tpl index 5ed9152..de6c8ba 100644 --- a/locale/en_US/emails/notice_resolution.part.tpl +++ b/locale/en_US/emails/notice_resolution.part.tpl @@ -1 +1 @@ -This bug has been resolved with resolution "{$this->registry->datastore['resolution'][$new]['resolution']}", from "{$this->registry->datastore['resolution'][$old]['resolution']}". \ No newline at end of file +This bug has been resolved with resolution "$new", from "$old". diff --git a/locale/en_US/emails/notice_severity.part.tpl b/locale/en_US/emails/notice_severity.part.tpl index 4408d92..aab4c3a 100644 --- a/locale/en_US/emails/notice_severity.part.tpl +++ b/locale/en_US/emails/notice_severity.part.tpl @@ -1 +1 @@ -The severity has been elevated from "{$this->registry->datastore['severity'][$old]['severity']}" to "{$this->registry->datastore['severity'][$new]['severity']}". \ No newline at end of file +The severity has been elevated from "$old" to "$new". diff --git a/locale/en_US/emails/notice_status.part.tpl b/locale/en_US/emails/notice_status.part.tpl index 6115362..b21d612 100644 --- a/locale/en_US/emails/notice_status.part.tpl +++ b/locale/en_US/emails/notice_status.part.tpl @@ -1 +1 @@ -The status of the bug is now "{$this->registry->datastore['status'][$new]['status']}", from "{$this->registry->datastore['status'][$old]['status']}". \ No newline at end of file +The status of the bug is now "$new", from "$old". -- 2.22.5