Make the password reset email work (untested)
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 30 Aug 2008 13:44:58 +0000 (09:44 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 30 Aug 2008 13:44:58 +0000 (09:44 -0400)
global.php
includes/emails.php
login.php

index cfe5e381bb17b7d83e8416194cf60b41870a7465..eefd2ddcc33bb9d9ac55e3cdcc0a51eaa49c30ef 100755 (executable)
@@ -31,6 +31,11 @@ BSTemplate::$dbCacheTable    = TABLE_PREFIX . 'template';
 BSTemplate::$langcall          = 'T';
 BSTemplate::$templatePath      = 'templates/%s.tpl';
 
+// ###################################################################
+// initialize the email system
+require_once ISSO . '/Mail.php';
+require_once 'includes/emails.php';
+
 // ###################################################################
 // global template variables
 
index beb580014360e0682f1f5675fb5916e197e0de28..e9b1fd15f1183662b97cb1ea0b7e5dcc060f7223 100644 (file)
@@ -29,7 +29,7 @@
  */
 function get_email_text($name)
 {
-       static $_emails = array(
+       $_emails = array(
                // welcome email
                // vars: username, trackertitle
                'welcome' => array(
index 80af05541bd7f6283c4715f3e94b62801479ba46..c310dfddb7fbd143af0b165ea9737b762966b8be 100755 (executable)
--- a/login.php
+++ b/login.php
@@ -118,14 +118,10 @@ if ($_POST['do'] == 'sendpw')
                $activator = BSFunctions::random(25);
                $db->query("INSERT INTO " . TABLE_PREFIX . "passwordreset (activatorid, dateline, userid) VALUES ('" . $activator . "', " . TIMENOW . ", " . $user->record['userid'] . ")");
                
-               $email = new BSTemplate(FetchEmailPath('passwordreset.xml', bugdar::$datastore['language'][$user->record['languageid']]['langcode']));
-               $email->vars = array('activator' => $activator);
-               
-               $email = $bugsys->xml->parse($email->evaluate()->getTemplate());
-               
-               $mail->setSubject($email['email']['subject']['value']);
-               $mail->setBodyText($email['email']['bodyText']['value']);
-               
+               $email = get_email_text('password_reset');
+               $mail = new BSMail();
+               $mail->setSubject($email['subject']);
+               $mail->setBodyText(sprintf($email['subject'], $user->record['displayname'], bugdar::$options['trackertitle'], bugdar::$options['trackerurl'], $activator));
                $mail->send($user->record['email'], $user->record['displayname']);
                
                $message->message(sprintf(T('An email has been dispatched to %1$s that contains instructions on how to reset your password.'), $user->record['email']));
@@ -211,7 +207,7 @@ if ($_REQUEST['do'] == 'cplogout')
        if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
        {
                $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'");
-               BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', null);
+               BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false);
                $message->redirect(T('You have been logged out.'), 'admin/');
        }
        else