bypass smarty wherever using intltext_templates (install, register, friend confirmation emails, etc.)

This commit is contained in:
friendica 2013-01-07 20:14:00 -08:00
commit 4ab363ed71
8 changed files with 537 additions and 461 deletions

View file

@ -737,6 +737,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
? get_intltext_template('friend_complete_eml.tpl')
: get_intltext_template('intro_complete_eml.tpl'));
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
@ -746,6 +751,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
'$dfrn_url' => $r[0]['url'],
'$uid' => $newuid )
);
get_app()->set_template_engine($engine);
require_once('include/email.php');
$res = mail($r[0]['email'], email_header_encode( sprintf( t("Connection accepted at %s") , $a->config['sitename']),'UTF-8'),

View file

@ -73,6 +73,9 @@ function install_post(&$a) {
// connect to db
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
// disable smarty for this template
$engine = $a->get_template_engine();
$a->set_template_engine();
$tpl = get_intltext_template('htconfig.tpl');
$txt = replace_macros($tpl,array(
'$dbhost' => $dbhost,
@ -84,6 +87,7 @@ function install_post(&$a) {
'$phpath' => $phpath,
'$adminmail' => $adminmail
));
$a->set_template_engine($engine);
$result = file_put_contents('.htconfig.php', $txt);
if(! $result) {

View file

@ -32,6 +32,9 @@ function lostpass_post(&$a) {
if($r)
info( t('Password reset request issued. Check your email.') . EOL);
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
@ -41,6 +44,8 @@ function lostpass_post(&$a) {
'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $new_password
));
get_app()->set_template_engine($engine);
$res = mail($email, email_header_encode(sprintf( t('Password reset requested at %s'),$a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
@ -94,6 +99,8 @@ function lostpass_content(&$a) {
info("Your password has been reset." . EOL);
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = get_intltext_template("passchanged_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
@ -104,6 +111,8 @@ function lostpass_content(&$a) {
'$new_password' => $new_password,
'$uid' => $newuid ));
get_app()->set_template_engine($engine);
$subject = sprintf( t('Your password has been changed at %s'), $a->config['sitename']);
$res = mail($email, email_header_encode( $subject, 'UTF-8'), $email_tpl,

View file

@ -79,6 +79,10 @@ function register_post(&$a) {
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
@ -88,6 +92,10 @@ function register_post(&$a) {
'$password' => $result['password'],
'$uid' => $user['uid'] ));
get_app()->set_template_engine($engine);
$res = mail($user['email'], email_header_encode( sprintf( t('Registration details for %s'), $a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
@ -131,6 +139,10 @@ function register_post(&$a) {
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = get_intltext_template("register_verify_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
@ -142,6 +154,9 @@ function register_post(&$a) {
'$hash' => $hash
));
get_app()->set_template_engine($engine);
$res = mail($a->config['admin_email'], email_header_encode( sprintf(t('Registration request at %s'), $a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"

View file

@ -41,6 +41,9 @@ function user_allow($hash) {
push_lang($register[0]['language']);
$engine = get_app()->get_template_engine();
get_app()->set_template_engine();
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
@ -51,6 +54,10 @@ function user_allow($hash) {
'$uid' => $user[0]['uid']
));
get_app()->set_template_engine($engine);
$res = mail($user[0]['email'], email_header_encode( sprintf(t('Registration details for %s'), $a->config['sitename']), 'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"