From 3c2bb045bcfca6bd678e457485b127ce67993369 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 30 Aug 2008 09:44:58 -0400 Subject: [PATCH] Make the password reset email work (untested) --- global.php | 5 +++++ includes/emails.php | 2 +- login.php | 14 +++++--------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/global.php b/global.php index cfe5e38..eefd2dd 100755 --- a/global.php +++ b/global.php @@ -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 diff --git a/includes/emails.php b/includes/emails.php index beb5800..e9b1fd1 100644 --- a/includes/emails.php +++ b/includes/emails.php @@ -29,7 +29,7 @@ */ function get_email_text($name) { - static $_emails = array( + $_emails = array( // welcome email // vars: username, trackertitle 'welcome' => array( diff --git a/login.php b/login.php index 80af055..c310dfd 100755 --- 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 -- 2.43.5