Happy 2009! Updating copyright years.
[bugdar.git] / includes / emails.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2009 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Returns an email's translated text, for use in sprintf(), given a variable
24 * name
25 *
26 * @param string Name of the email
27 *
28 * @return array Array of translated items (subject, bodyText, bodyHtml)
29 */
30 function get_email_text($name)
31 {
32 $_emails = array(
33 // welcome email
34 // vars: username, trackertitle
35 'welcome' => array(
36 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
37 'bodyText' => T('Hi %1$s,
38
39 Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
40
41 If you have any questions, please don\'t hesitate to contact the webmaster.')
42 ),
43
44 // reset password
45 // vars: username, trackertitle, trackerurl, activation id
46 'password_reset' => array(
47 'subject' => sprintf(T('%1$s Password Reset'), bugdar::$options['trackertitle']),
48 'bodyText' => T('Hi %1$s,
49
50 You requested this lost password email at the %2$s bug tracker. To reset your password, simply click the link below (or paste it into your browser window exactly) and enter a new password.
51
52 %3$s/login.php?do=recoverpw&activator=%4$s
53
54 If you did not request this, do not worry as this notice will expire in 24 hours.')
55 ),
56
57 // account approved and active
58 // vars: username, trackertitle
59 'account_approved' => array(
60 'subject' => sprintf(T('Account Approved at %1$s'), bugdar::$options['trackertitle']),
61 'bodyText' => T('Hi %1$s,
62
63 Your account was awaiting moderation at %2$s. Today, an administrator approved your registration and you are now able to use the bug tracker fully.
64
65 If you have any questions, please don\'t hesitate to contact the webmaster.')
66 ),
67
68 // activation code
69 // vars: username, trackertitle, trackerurl, userid, activationid
70 'activate_account' => array(
71 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
72 'bodyText' => T('Hi %1$s,
73
74 Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activate your account. To do this, please click this link:
75
76 %3$s/register.php?do=activate&userid=%4$d&activator=%5$s')
77 ),
78
79 // bug notification
80 // vars: trackertitle, bug.summary
81 // vars: username, trackertitle, bug.summary, bug.id, trackerurl, parts
82 'notification' => array(
83 'subject' => T('%1$s Bug Notification - %2$s'),
84 'bodyText' => T('Hi %1$s,
85
86 You are receiving this email because you have opted to get notifications for the %2$s bug tracker.
87
88 The bug is "%3$s" (id: %4$d) located at %5$s/showreport.php?bugid=%4$d
89
90 Here are the notices:
91 ###################################################################
92
93 %5$s
94
95 ###################################################################
96 If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences.
97
98 %5$s')
99 ),
100
101 // assigned to bug
102 // vars
103 'notice_assigned' => array(
104 'part' => T('You have been assigned to this bug by %1$s.')
105 ),
106
107 // unassigned from bug
108 // vars: changer.displayname
109 'notice_unassigned' => array(
110 'part' => T('You are no longer assigned to this bug, per %1$s\'s changes.')
111 ),
112
113 // status change
114 // vars: new, old
115 'notice_status' => array(
116 'part' => T('The status of the bug is now "%1$s", from "%2$s".')
117 ),
118
119 // resolution change
120 // vars: new, old
121 'notice_resolution' => array(
122 'part' => T('This bug has been resolved with resolution "%1$s", from "%2$s".')
123 ),
124
125 // duplicates list change
126 // vars: old, new
127 'notice_duplicates' => array(
128 'part' => T('The duplicates list has changed from "%1$s" to "%2$s".')
129 ),
130
131 // severity change
132 // vars: old, new
133 'notice_severity' => array(
134 'part' => T('The severity has been elevated from "%1$s" to "%2$s".')
135 ),
136
137 // priority change
138 // vars: old, new
139 'notice_priority' => array(
140 'part' => T('The priority has been elevatd from "%1$s" to "%2$s".')
141 ),
142
143 // PCV change
144 // vars: old, new
145 'notice_product' => array(
146 'part' => T('The product, component, and version combination has changed from "%1$s" to "%2$s".')
147 ),
148
149 // new comment
150 // vars: user, date, comment
151 'notice_comment' => array(
152 'part' => T('The following comment was added by %1$s on %2$s:
153 ============================================
154 %3$s
155 ============================================')
156 ),
157
158 // other change
159 // vars: field, old, new
160 'notice_other' => array(
161 'part' => T('The %1$s field changed from "%2$s" to "%3$s".')
162 ),
163
164 // new attachment
165 // vars: username, filename, description, filesize, obsoletes, trackerurl, attachmentid
166 'notice_attachment' => array(
167 'part' => T('%1$s has uploaded a new attachment:
168 ============================================
169 File name: %2$s
170 Description: %3$s
171 File size: %4$d Bytes
172 Makes obsolete: %5$s
173 View: %6$s/viewattachment.php?attachmentid=%7$d
174 ============================================')
175 ),
176
177 // new bug
178 // vars: bugid, summary, reporter, product, initial comment
179 'notice_new_bug' => array(
180 'part' => T('This bug has been added to the database:
181 ============================================
182 Bug ID: %1$d
183 Summary: %2$s
184 Reporter: %3$s
185 Product/Component/Version: %4$s
186 Initial report:
187 --------------------------------------------
188 %5$s
189 --------------------------------------------
190 ============================================')
191 ),
192
193 // bug notification
194 // vars: trackertitle, bug.summary
195 // vars: displayname, trackertitle, bug.summary, bug.id, trackerurl, parts
196 'bug_notification' => array(
197 'subject' => T('%1$s Bug Notification - %2$s'),
198 'bodyText' => T('Hi %1$s,
199
200 You are receiving this email because you have opted to get notifications for the %2$s bug tracker.
201
202 The bug is "%3$s" (id: %4$d) located at %4$s/showreport.php?bugid=%5$d
203
204 Here are the notices:
205 ###################################################################
206
207 %6$s
208
209 ###################################################################
210 If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences.
211
212 %4$s')
213 )
214 );
215
216 if (!isset($_emails[$name]))
217 {
218 throw new Exception('Unknown email template "' . $name . '"');
219 }
220 return $_emails[$name];
221 }
222
223 ?>