diff options
-rw-r--r-- | includes/account.php | 3 | ||||
-rw-r--r-- | includes/general_stuff.php | 4 | ||||
-rw-r--r-- | pages/account/41.php | 11 | ||||
-rw-r--r-- | pages/wot/5.php | 3 | ||||
-rw-r--r-- | pages/wot/9.php | 9 | ||||
-rw-r--r-- | www/wot.php | 47 |
6 files changed, 42 insertions, 35 deletions
diff --git a/includes/account.php b/includes/account.php index 24c61d8..ebae1f6 100644 --- a/includes/account.php +++ b/includes/account.php @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ require_once("../includes/loggedin.php"); + require_once("../includes/lib/l10n.php"); loadem("account"); @@ -2345,7 +2346,7 @@ { csrf_check("mainlang"); $lang = mysql_real_escape_string($_REQUEST['lang']); - foreach($_SESSION['_config']['translations'] as $key => $val) + foreach(L10n::$translations as $key => $val) { if($key == $lang) { diff --git a/includes/general_stuff.php b/includes/general_stuff.php index 088c39e..b4795e0 100644 --- a/includes/general_stuff.php +++ b/includes/general_stuff.php @@ -16,6 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php'); + if(!function_exists("showheader")) { function showbodycontent($title = "CAcert.org", $title2 = "") @@ -60,7 +62,7 @@ google_color_border = "FFFFFF"; <? include("about_menu.php"); ?> <div class="relatedLinks"> <h3 class="pointer" onclick="explode('trans')">+ <?=_("Translations")?></h3> - <ul class="menu" id="trans"><? foreach($_SESSION['_config']['translations'] as $key => $val) { ?><li><a href="<?=$_SERVER['SCRIPT_NAME']?>?id=<?=intval(array_key_exists('id',$_REQUEST)?$_REQUEST['id']:0)?>&lang=<?=$key?>"><?=$val?></a></li><? } ?></ul> + <ul class="menu" id="trans"><? foreach(L10n::$translations as $key => $val) { ?><li><a href="<?=$_SERVER['SCRIPT_NAME']?>?id=<?=intval(array_key_exists('id',$_REQUEST)?$_REQUEST['id']:0)?>&lang=<?=$key?>"><?=$val?></a></li><? } ?></ul> </div> <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?> <div class="relatedLinks"> diff --git a/pages/account/41.php b/pages/account/41.php index e44eec9..d2cfc8c 100644 --- a/pages/account/41.php +++ b/pages/account/41.php @@ -14,7 +14,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ ?> +*/ + +require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php'); +?> + <form method="post" action="account.php"> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="400"> <tr> @@ -24,11 +28,10 @@ <td class="DataTD"><?=_("My prefered language")?>:</td> <td class="DataTD"><select name="lang"> <? -echo $_SESSION['_config']['language']; - foreach($_SESSION['_config']['translations'] as $key => $val) + foreach(L10n::$translations as $key => $val) { echo "<option value='$key'"; - if($key == $_SESSION['_config']['language']) + if($key == L10n::get_translation()) echo " selected"; echo ">$val</option>\n"; } diff --git a/pages/wot/5.php b/pages/wot/5.php index 6c53d00..4b574af 100644 --- a/pages/wot/5.php +++ b/pages/wot/5.php @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ include_once("../includes/shutdown.php"); + require_once("../includes/lib/l10n.php"); ?> <? if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "") @@ -39,7 +40,7 @@ <? if($_SESSION['_config']['reminder-lang'] == "") $_SESSION['_config']['reminder-lang'] = $_SESSION['profile']['language']; - foreach($_SESSION['_config']['translations'] as $key => $val) + foreach(L10n::$translations as $key => $val) { echo "<option value='$key'"; if($key == $_SESSION['_config']['reminder-lang']) diff --git a/pages/wot/9.php b/pages/wot/9.php index b974c5d..bfa7a98 100644 --- a/pages/wot/9.php +++ b/pages/wot/9.php @@ -14,8 +14,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ ?> -<? +*/ + + require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php'); + + $res = mysql_query("select * from `users` where `id`='".intval($_REQUEST['userid'])."' and `listme`='1'"); if(mysql_num_rows($res) <= 0) { @@ -47,7 +50,7 @@ <? if($userlang != "") { ?> <tr> <td class="DataTD"><?=_("Language")?>:</td> - <td class="DataTD" align="left"><? printf(_("%s prefers to be contacted in %s"), $user['fname'], $_SESSION['_config']['translations'][$userlang]) ?></td> + <td class="DataTD" align="left"><? printf(_("%s prefers to be contacted in %s"), $user['fname'], L10n::$translations[$userlang]) ?></td> </tr> <? } ?> <? diff --git a/www/wot.php b/www/wot.php index 7fa572f..33ce4bb 100644 --- a/www/wot.php +++ b/www/wot.php @@ -17,6 +17,7 @@ */ ?> <? require_once("../includes/loggedin.php"); + require_once("../includes/lib/l10n.php"); loadem("account"); @@ -52,34 +53,30 @@ if($oldid == 5 && array_key_exists('reminder',$_POST) && $_POST['reminder'] != "") { $body = ""; - if($_POST['reminder-lang'] != "" && $_POST['reminder-lang'] != "en_AU") - { - $userlang = $_POST['reminder-lang']; - $_SESSION['_config']['reminder-lang'] = $_POST['reminder-lang']; - putenv("LANG=".$userlang); - setlocale(LC_ALL, $userlang); - - $body .= $_SESSION['_config']['translations'][$userlang].":\n\n"; + + $my_translation = L10n::get_translation(); + + $_SESSION['_config']['reminder-lang'] = $_POST['reminder-lang']; + + $reminder_translations[] = $_POST['reminder-lang']; + if ( !in_array("en", $reminder_translations, $strict=true) ) { + $reminder_translations[] = "en"; + } + + foreach ($reminder_translations as $translation) { + L10n::set_translation($translation); + + $body .= L10n::$translations[$translation].":\n\n"; $body .= sprintf(_("This is a short reminder that you filled out forms to become trusted with CAcert.org, and %s has attempted to issue you points. Please create your account at %s as soon as possible and then notify %s so that the points can be issued."), $_SESSION['profile']['fname']." (".$_SESSION['profile']['email'].")", "http://www.cacert.org", $_SESSION['profile']['fname'])."\n\n"; $body .= _("Best regards")."\n"; - $body .= _("CAcert Support Team"); - - $body .= "\n\nEnglish:\n\n"; - } - - $body .= sprintf("This is a short reminder that you filled out forms to become trusted with CAcert.org, and %s has attempted to issue you points. Please create your account at %s as soon as possible and then notify %s so that the points can be issued.", $_SESSION['profile']['fname']." (".$_SESSION['profile']['email'].")", "http://www.cacert.org", $_SESSION['profile']['fname'])."\n\n"; - $body .= "Best regards"."\n"; - $body .= "CAcert Support Team"; - + $body .= _("CAcert Support Team")."\n\n"; + } + + L10n::set_translation($reminder_translations[0]); // for the subject sendmail($_POST['email'], "[CAcert.org] "._("Reminder Notice"), $body, $_SESSION['profile']['email'], "", "", $_SESSION['profile']['fname']); - - if($_POST['reminder-lang'] != "" && $_POST['reminder-lang'] != "en_AU") - { - $userlang = $_SESSION['profile']['language']; - putenv("LANG=".$userlang); - setlocale(LC_ALL, $userlang); - } - + + L10n::set_translation($my_translation); + $_SESSION['_config']['remindersent'] = 1; $_SESSION['_config']['error'] = _("A reminder notice has been sent."); |