From 040fc247a0caa51e0d4da4169980dc32e80ee804 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 23 May 2011 20:30:37 -0700 Subject: bug #85 --- mod/dfrn_confirm.php | 4 +++- mod/dfrn_notify.php | 11 +++++++++-- mod/invite.php | 2 +- mod/item.php | 5 +++++ mod/register.php | 19 +++++++++++++++++-- mod/regmod.php | 6 ++++++ 6 files changed, 41 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 4e2a70e04..7c11b78d5 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -632,12 +632,13 @@ function dfrn_confirm_post(&$a,$handsfree = null) { logger('dfrn_confirm: request: info updated'); - $r = q("SELECT * FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` + $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` WHERE `contact`.`id` = %d LIMIT 1", intval($dfrn_record) ); if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) { + push_lang($r[0]['language']); $tpl = (($new_relation == REL_BUD) ? get_intltext_template('friend_complete_eml.tpl') : get_intltext_template('intro_complete_eml.tpl')); @@ -661,6 +662,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { if(!$res) { // pointless throwing an error here and confusing the person at the other end of the wire. } + pop_lang(); } xml_status(0); // Success return; // NOTREACHED diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 30e95be21..65fd29eb3 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -185,6 +185,8 @@ function dfrn_notify_post(&$a) { require_once('bbcode.php'); if($importer['notify-flags'] & NOTIFY_MAIL) { + push_lang($importer['language']); + // name of the automated email sender $msg['notificationfromname'] = t('Administrator'); // noreply address to send from @@ -250,6 +252,8 @@ function dfrn_notify_post(&$a) { $email_html_body_tpl, $email_text_body_tpl ); + + pop_lang(); } xml_status(0); // NOTREACHED @@ -387,6 +391,7 @@ function dfrn_notify_post(&$a) { proc_run('php',"include/notifier.php","comment-import","$posted_id"); if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) { + push_lang($importer['language']); require_once('bbcode.php'); $from = stripslashes($datarray['author-name']); @@ -442,7 +447,7 @@ function dfrn_notify_post(&$a) { $email_html_body_tpl, $email_text_body_tpl ); - + pop_lang(); } } xml_status(0); @@ -514,6 +519,8 @@ function dfrn_notify_post(&$a) { foreach($myconv as $conv) { if(! link_compare($conv['author-link'],$importer_url)) continue; + + push_lang($importer['language']); require_once('bbcode.php'); $from = stripslashes($datarray['author-name']); @@ -567,7 +574,7 @@ function dfrn_notify_post(&$a) { $email_html_body_tpl, $email_text_body_tpl ); - + pop_lang(); break; } } diff --git a/mod/invite.php b/mod/invite.php index b34bb7d74..b52aa19f6 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -29,7 +29,7 @@ function invite_post(&$a) { continue; } - $res = mail($recip, sprintf(t('Please join my network on %s'), $a->config['sitename']), + $res = mail($recip, sprintf( t('Please join my network on %s'), $a->config['sitename']), $message, "From: " . $a->user['email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" diff --git a/mod/item.php b/mod/item.php index 15dca3750..1a7acadf3 100644 --- a/mod/item.php +++ b/mod/item.php @@ -462,6 +462,7 @@ function item_post(&$a) { // Send a notification email to the conversation owner, unless the owner is me and I wrote this item if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) { + push_lang($user['language']); require_once('bbcode.php'); $from = $author['name']; @@ -517,6 +518,8 @@ function item_post(&$a) { $email_html_body_tpl, $email_text_body_tpl ); + + pop_lang(); } } else { @@ -525,6 +528,7 @@ function item_post(&$a) { // let me know if somebody did a wall-to-wall post on my profile if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) { + push_lang($user['language']); require_once('bbcode.php'); $from = $author['name']; @@ -578,6 +582,7 @@ function item_post(&$a) { $email_html_body_tpl, $email_text_body_tpl ); + pop_lang(); } } diff --git a/mod/register.php b/mod/register.php index 95bf60e32..78dc75f77 100644 --- a/mod/register.php +++ b/mod/register.php @@ -3,6 +3,8 @@ if(! function_exists('register_post')) { function register_post(&$a) { + global $lang; + $verified = 0; $blocked = 1; @@ -350,12 +352,22 @@ function register_post(&$a) { } $hash = random_string(); - $r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password` ) VALUES ( '%s', '%s', %d, '%s' ) ", + $r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language` ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($newuid), - dbesc($new_password) + dbesc($new_password), + dbesc($lang) + ); + + $r = q("SELECT `language` FROM `user` WHERE `email` = '%s' LIMIT 1", + dbesc($a->config['admin_email']) ); + if(count($r)) + push_lang($r[0]['language']); + else + push_lang('en'); + $email_tpl = get_intltext_template("register_verify_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( @@ -373,6 +385,9 @@ function register_post(&$a) { 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); + + pop_lang(); + if($res) { info( t('Your registration is pending approval by the site owner.') . EOL ) ; goaway($a->get_baseurl()); diff --git a/mod/regmod.php b/mod/regmod.php index 2563a58d1..9873f1094 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -4,6 +4,8 @@ function regmod_content(&$a) { + global $lang; + $_SESSION['return_url'] = $a->cmd; if(! local_user()) { @@ -79,6 +81,8 @@ function regmod_content(&$a) { proc_run('php',"include/directory.php","$url"); } + push_lang($register[0]['language']); + $email_tpl = get_intltext_template("register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( '$sitename' => $a->config['sitename'], @@ -95,6 +99,8 @@ function regmod_content(&$a) { . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); + pop_lang(); + if($res) { info( t('Account approved.') . EOL ); return; -- cgit v1.2.3