diff options
author | Philip Häusler <msquare@notrademark.de> | 2013-12-26 13:34:48 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2013-12-26 13:34:48 +0100 |
commit | 0c98f13eee10a61cabdc13e7aa75916d50b8b078 (patch) | |
tree | d3931a0b5ffb03e59c3589de5dcfa3910e10bca6 /includes/helper | |
parent | 3cc147d235bc977aedb660d896cbb54d1a4f92ec (diff) |
user password recovery
Diffstat (limited to 'includes/helper')
-rw-r--r-- | includes/helper/email_helper.php | 16 | ||||
-rw-r--r-- | includes/helper/internationalization_helper.php | 16 |
2 files changed, 30 insertions, 2 deletions
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php new file mode 100644 index 00000000..98cfd0f3 --- /dev/null +++ b/includes/helper/email_helper.php @@ -0,0 +1,16 @@ +<?php + +function engelsystem_email_to_user($user, $title, $message) { + gettext_locale($user['Sprache']); + + $message = sprintf(_("Hi %s,"), $user['Nick']) . "\n\n" . _("here is a message for you from the engelsystem:") . "\n\n" . $message . "\n\n" . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem."); + + gettext_locale(); + return engelsystem_email($user['email'], $title, $message); +} + +function engelsystem_email($address, $title, $message) { + return mail($address, $title, $message, "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>"); +} + +?>
\ No newline at end of file diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php index ae88eb21..db150fec 100644 --- a/includes/helper/internationalization_helper.php +++ b/includes/helper/internationalization_helper.php @@ -17,14 +17,26 @@ function gettext_init() { elseif (! isset($_SESSION['locale'])) $_SESSION['locale'] = $default_locale; - putenv('LC_ALL=' . $_SESSION['locale']); - setlocale(LC_ALL, $_SESSION['locale']); + gettext_locale(); bindtextdomain('default', '../locale'); bind_textdomain_codeset('default', 'UTF-8'); textdomain('default'); } /** + * Swich gettext locale. + * + * @param string $locale + */ +function gettext_locale($locale = null) { + if ($locale == null) + $locale = $_SESSION['locale']; + + putenv('LC_ALL=' . $locale); + setlocale(LC_ALL, $locale); +} + +/** * Renders language selection. * * @return string |