mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
bypass smarty wherever using intltext_templates (install, register, friend confirmation emails, etc.)
This commit is contained in:
parent
972060a8ff
commit
4ab363ed71
8 changed files with 537 additions and 461 deletions
9
boot.php
9
boot.php
|
@ -12,7 +12,7 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
|
|||
require_once('include/features.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '3.1.1578' );
|
||||
define ( 'FRIENDICA_VERSION', '3.1.1581' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1157 );
|
||||
|
||||
|
@ -839,6 +839,10 @@ if(! function_exists('check_config')) {
|
|||
$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'],
|
||||
|
@ -846,6 +850,9 @@ if(! function_exists('check_config')) {
|
|||
'$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());
|
||||
require_once('include/email.php');
|
||||
$subject = email_header_encode($subject,'UTF-8');
|
||||
|
|
|
@ -3361,6 +3361,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]')),
|
||||
|
@ -3369,6 +3373,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'],
|
||||
email_header_encode((($sharing) ? t('A new person is sharing with you at ') : t("You have a new follower at ")) . $a->config['sitename'],'UTF-8'),
|
||||
$email,
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
938
util/messages.po
938
util/messages.po
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue