From 5cb8db64cfdcbf06244f151b7202e6d7ab1ed7d6 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Jan 2013 20:25:38 -0800 Subject: bypass smarty for intletext templates --- boot.php | 7 +++++++ include/account.php | 10 ++++++++++ include/items.php | 7 +++++++ mod/lostpass.php | 11 +++++++++++ mod/regmod.php | 5 +++++ mod/setup.php | 4 ++++ 6 files changed, 44 insertions(+) diff --git a/boot.php b/boot.php index ba8208df3..e9754eae2 100644 --- a/boot.php +++ b/boot.php @@ -1014,6 +1014,10 @@ function check_config(&$a) { $retval = $func(); if($retval) { //send the administrator an e-mail + + $engine = get_app()->get_template_engine(); + get_app()->set_template_engine(); + $email_tpl = get_intltext_template("update_fail_eml.tpl"); $email_msg = replace_macros($email_tpl, array( '$sitename' => $a->config['sitename'], @@ -1021,6 +1025,9 @@ function check_config(&$a) { '$update' => $x, '$error' => sprintf( t('Update %s failed. See error logs.'), $x) )); + + get_app()->set_template_engine($engine); + $subject=sprintf(t('Update Error at %s'), $a->get_baseurl()); mail($a->config['admin_email'], $subject, $email_msg, diff --git a/include/account.php b/include/account.php index 9f967f2c3..329e0a67c 100644 --- a/include/account.php +++ b/include/account.php @@ -230,6 +230,8 @@ function send_reg_approval_email($arr) { else push_lang('en'); + $engine = get_app()->get_template_engine(); + getapp()->set_template_engine(); $email_msg = replace_macros(get_intltext_template('register_verify_email.tpl'), array( '$sitename' => get_config('config','sitename'), @@ -239,6 +241,8 @@ function send_reg_approval_email($arr) { '$hash' => $hash )); + getapp()->set_template_engine($engine); + $res = mail($admin['email'], sprintf( t('Registration request at %s'), get_config('config','sitename')), $email_msg, 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n" @@ -256,6 +260,9 @@ function send_reg_approval_email($arr) { function send_verification_email($email,$password) { + $engine = get_app()->get_template_engine(); + getapp()->set_template_engine(); + $email_msg = replace_macros(get_intltext_template('register_open_eml.tpl'), array( '$sitename' => get_config('config','sitename'), '$siteurl' => z_root(), @@ -263,6 +270,9 @@ function send_verification_email($email,$password) { '$password' => $password, )); + + getapp()->set_template_engine($engine); + $res = mail($email, sprintf( t('Registration details for %s'), get_config('system','sitename')), $email_msg, 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n" diff --git a/include/items.php b/include/items.php index 66450b6fa..32826ef4c 100755 --- a/include/items.php +++ b/include/items.php @@ -3600,6 +3600,10 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) { } if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) { + + $engine = get_app()->get_template_engine(); + get_app()->set_template_engine(); + $email_tpl = get_intltext_template('follow_notify_eml.tpl'); $email = replace_macros($email_tpl, array( '$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')), @@ -3608,6 +3612,9 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) { '$siteurl' => $a->get_baseurl(), '$sitename' => $a->config['sitename'] )); + + get_app()->set_template_engine($engine); + $res = mail($r[0]['email'], (($sharing) ? t('A new person is sharing with you at ') : t("You have a new follower at ")) . $a->config['sitename'], $email, diff --git a/mod/lostpass.php b/mod/lostpass.php index 57e6d6965..667c08ff5 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -31,6 +31,10 @@ 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'], @@ -40,6 +44,9 @@ function lostpass_post(&$a) { '$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $new_password )); + + get_app()->set_template_engine($engine); + $res = mail($email, sprintf( t('Password reset requested at %s'),$a->config['sitename']), $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" @@ -92,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"); @@ -103,6 +112,8 @@ function lostpass_content(&$a) { '$new_password' => $new_password, '$uid' => $newuid )); + get_app()->set_template_engine($engine); + $res = mail($email,"Your password has changed at {$a->config['sitename']}",$email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" diff --git a/mod/regmod.php b/mod/regmod.php index 3da1575d3..23b586be2 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -39,6 +39,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'], @@ -49,6 +52,8 @@ function user_allow($hash) { '$uid' => $user[0]['uid'] )); + get_app()->set_template_engine($engine); + $res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']), $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" diff --git a/mod/setup.php b/mod/setup.php index 4fa5152ea..4c1b7ec9b 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -78,6 +78,9 @@ function setup_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, @@ -90,6 +93,7 @@ function setup_post(&$a) { '$phpath' => $phpath, '$adminmail' => $adminmail )); + $a->set_template_engine($engine); $result = file_put_contents('.htconfig.php', $txt); if(! $result) { -- cgit v1.2.3