Add includes/emails.php
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 24 Aug 2008 14:15:32 +0000 (10:15 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 24 Aug 2008 14:15:32 +0000 (10:15 -0400)
includes/emails.php [new file with mode: 0644]

diff --git a/includes/emails.php b/includes/emails.php
new file mode 100644 (file)
index 0000000..beb5800
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # Copyright ©2002-2007 Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+/**
+ * Returns an email's translated text, for use in sprintf(), given a variable
+ * name
+ * 
+ * @param      string  Name of the email
+ *
+ * @return     array   Array of translated items (subject, bodyText, bodyHtml)
+ */
+function get_email_text($name)
+{
+       static $_emails = array(
+               // welcome email
+               // vars: username, trackertitle
+               'welcome' => array(
+                       'subject'       => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
+                       'bodyText'      => T('Hi %1$s,
+
+Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
+
+If you have any questions, please don\'t hesitate to contact the webmaster.')
+               ),
+               
+               // reset password
+               // vars: username, trackertitle, trackerurl, activation id
+               'password_reset' => array(
+                       'subject'       => sprintf(T('%1$s Password Reset'), bugdar::$options['trackertitle']),
+                       'bodyText'      => T('Hi %1$s,
+
+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.
+
+%3$s/login.php?do=recoverpw&amp;activator=%4$s
+
+If you did not request this, do not worry as this notice will expire in 24 hours.')
+               ),
+               
+               // account approved and active
+               // vars: username, trackertitle
+               'account_approved' => array(
+                       'subject'       => sprintf(T('Account Approved at %1$s'), bugdar::$options['trackertitle']),
+                       'bodyText'      => T('Hi %1$s,
+
+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.
+
+If you have any questions, please don\'t hesitate to contact the webmaster.')
+               ),
+               
+               // activation code
+               // vars: username, trackertitle, trackerurl, userid, activationid
+               'activate_account' => array(
+                       'subject'       => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
+                       'bodyText'      => T('Hi %1$s,
+
+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:
+
+%3$s/register.php?do=activate&amp;userid=%4$d&amp;activator=%5$s')
+               ),
+               
+               // bug notification
+               // vars: trackertitle, bug.summary
+               // vars: username, trackertitle, bug.summary, bug.id, trackerurl, parts
+               'notification' => array(
+                       'subject'       => T('%1$s Bug Notification - %2$s'),
+                       'bodyText'      => T('Hi %1$s,
+
+You are receiving this email because you have opted to get notifications for the %2$s bug tracker.
+
+The bug is "%3$s" (id: %4$d) located at %5$s/showreport.php?bugid=%4$d
+
+Here are the notices:
+###################################################################
+
+%5$s
+
+###################################################################
+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.
+
+%5$s')
+               )
+       );
+       
+       if (!isset($_emails[$name]))
+       {
+               throw new Exception('Unknown email template "' . $name . '"');
+       }
+       return $_emails[$name];
+}
+
+?>
\ No newline at end of file