From aad54bfe885e2ce69801597c791bff4b7f0e1521 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Mon, 25 Nov 2013 21:04:58 +0100 Subject: basic gettext integration --- includes/pages/admin_active.php | 4 + includes/pages/admin_angel_types.php | 4 + includes/pages/admin_arrive.php | 4 + includes/pages/admin_faq.php | 172 ++++++++++++------------- includes/pages/admin_free.php | 4 + includes/pages/admin_groups.php | 4 + includes/pages/admin_import.php | 4 + includes/pages/admin_language.php | 105 ---------------- includes/pages/admin_log.php | 4 + includes/pages/admin_questions.php | 4 + includes/pages/admin_rooms.php | 4 + includes/pages/admin_shifts.php | 4 +- includes/pages/admin_user.php | 8 +- includes/pages/admin_user_angeltypes.php | 10 +- includes/pages/guest_faq.php | 6 +- includes/pages/guest_login.php | 202 +++++++++++++++-------------- includes/pages/user_messages.php | 112 ++++++++--------- includes/pages/user_myshifts.php | 18 +-- includes/pages/user_news.php | 28 +++-- includes/pages/user_questions.php | 4 + includes/pages/user_settings.php | 210 +++++++++++++++---------------- includes/pages/user_shifts.php | 40 +++--- includes/pages/user_wakeup.php | 39 +++--- 23 files changed, 474 insertions(+), 520 deletions(-) delete mode 100644 includes/pages/admin_language.php (limited to 'includes/pages') diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index f0ea9d27..b8d40025 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -1,4 +1,8 @@
%s
%s
' . '
%s
%s
' . 'Edit', $faq['Frage_de'], $faq['Antwort_de'], $faq['Frage_en'], $faq['Antwort_en'], page_link_to('admin_faq'), $faq['FID']); - } - return template_render('../templates/admin_faq.html', array ( - 'link' => page_link_to("admin_faq"), - 'faqs' => $faqs_html - )); - } else { - switch ($_REQUEST['action']) { - case 'create' : - $frage = strip_request_item_nl('frage'); - $antwort = strip_request_item_nl('antwort'); - $question = strip_request_item_nl('question'); - $answer = strip_request_item_nl('answer'); - - sql_query("INSERT INTO `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "'"); - - redirect(page_link_to("admin_faq")); - break; - - case 'save' : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) - $id = $_REQUEST['id']; - else - return error("Incomplete call, missing FAQ ID.", true); - - $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); - if (count($faq) > 0) { - list ($faq) = $faq; - - $frage = strip_request_item_nl('frage'); - $antwort = strip_request_item_nl('antwort'); - $question = strip_request_item_nl('question'); - $answer = strip_request_item_nl('answer'); - - sql_query("UPDATE `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "' WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); - - redirect(page_link_to("admin_faq")); - } else - return error("No FAQ found.", true); - break; - - case 'edit' : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) - $id = $_REQUEST['id']; - else - return error("Incomplete call, missing FAQ ID.", true); - - $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); - if (count($faq) > 0) { - list ($faq) = $faq; - - return template_render('../templates/admin_faq_edit_form.html', array ( - 'link' => page_link_to("admin_faq"), - 'id' => $id, - 'frage' => $faq['Frage_de'], - 'antwort' => $faq['Antwort_de'], - 'question' => $faq['Frage_en'], - 'answer' => $faq['Antwort_en'] - )); - } else - return error("No FAQ found.", true); - break; - - case 'delete' : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) - $id = $_REQUEST['id']; - else - return error("Incomplete call, missing FAQ ID.", true); - - $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); - if (count($faq) > 0) { - list ($faq) = $faq; +function admin_faq_title() { + return _("Edit FAQs"); +} - sql_query("DELETE FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); - redirect(page_link_to("admin_faq")); - } else - return error("No FAQ found.", true); - break; - } - } +function admin_faq() { + if (! isset($_REQUEST['action'])) { + $faqs_html = ""; + $faqs = sql_select("SELECT * FROM `FAQ`"); + foreach ($faqs as $faq) { + $faqs_html .= sprintf('
%s
%s
' . '
%s
%s
' . 'Edit', $faq['Frage_de'], $faq['Antwort_de'], $faq['Frage_en'], $faq['Antwort_en'], page_link_to('admin_faq'), $faq['FID']); + } + return template_render('../templates/admin_faq.html', array( + 'link' => page_link_to("admin_faq"), + 'faqs' => $faqs_html + )); + } else { + switch ($_REQUEST['action']) { + case 'create': + $frage = strip_request_item_nl('frage'); + $antwort = strip_request_item_nl('antwort'); + $question = strip_request_item_nl('question'); + $answer = strip_request_item_nl('answer'); + + sql_query("INSERT INTO `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "'"); + + redirect(page_link_to("admin_faq")); + break; + + case 'save': + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing FAQ ID.", true); + + $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); + if (count($faq) > 0) { + list($faq) = $faq; + + $frage = strip_request_item_nl('frage'); + $antwort = strip_request_item_nl('antwort'); + $question = strip_request_item_nl('question'); + $answer = strip_request_item_nl('answer'); + + sql_query("UPDATE `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "' WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); + + redirect(page_link_to("admin_faq")); + } else + return error("No FAQ found.", true); + break; + + case 'edit': + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing FAQ ID.", true); + + $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); + if (count($faq) > 0) { + list($faq) = $faq; + + return template_render('../templates/admin_faq_edit_form.html', array( + 'link' => page_link_to("admin_faq"), + 'id' => $id, + 'frage' => $faq['Frage_de'], + 'antwort' => $faq['Antwort_de'], + 'question' => $faq['Frage_en'], + 'answer' => $faq['Antwort_en'] + )); + } else + return error("No FAQ found.", true); + break; + + case 'delete': + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing FAQ ID.", true); + + $faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); + if (count($faq) > 0) { + list($faq) = $faq; + + sql_query("DELETE FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1"); + redirect(page_link_to("admin_faq")); + } else + return error("No FAQ found.", true); + break; + } + } } ?> diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 41f6c0e9..86bd38a1 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -1,4 +1,8 @@ \n"; - $html .= Get_Text("pub_sprache_text1") . "

\n"; - - $html .= "" . Get_Text("pub_sprache_ShowEntry") . ""; - // ausgabe Tabellenueberschift - $html .= "\t\n\t\t"; - $html .= "\t\t"; - foreach($languages as $language => $language_name) { - $html .= ""; - $Sprachen[$language] = $language_name; - } - $html .= "\t\t"; - $html .= "\t\t"; - - if (isset ($_GET["ShowEntry"])) { - // ausgabe eintraege - $sprache_source = sql_select("SELECT * FROM `Sprache` ORDER BY `TextID`, `Sprache`"); - - $TextID_Old = $sprache_source[0]['TextID']; - foreach($sprache_source as $sprache_entry) { - $TextID_New = $sprache_entry['TextID']; - if ($TextID_Old != $TextID_New) { - $html .= ""; - $html .= "\n"; - $html .= "\t\t\n"; - - foreach ($Sprachen as $Name => $Value) { - $Value = html_entity_decode($Value, ENT_QUOTES); - $html .= "\t\t\n"; - $Sprachen[$Name] = ""; - } - - $html .= "\t\t\n"; - $html .= ""; - $html .= "\n"; - $TextID_Old = $TextID_New; - } - $Sprachen[$sprache_entry['Sprache']] = $sprache_entry['Text']; - } /*FOR*/ - } - - //fuer neu eintraege - $html .= ""; - $html .= "\n"; - $html .= "\t\t\n"; - - foreach ($Sprachen as $Name => $Value) - $html .= "\t\t\n"; - - $html .= "\t\t\n"; - $html .= ""; - $html .= "\n"; - - $html .= "
" . Get_Text("pub_sprache_TextID") . "" . - Get_Text("pub_sprache_Sprache") . " " . $language . - "" . Get_Text("pub_sprache_Edit") . "
$TextID_Old " . - "
\n"; - } /*if( !isset( $TextID ) )*/ - else { - $html .= "edit: " . $_POST["TextID"] . "

"; - foreach ($_POST as $k => $v) { - if ($k != "TextID") { - $sql_test = "SELECT * FROM `Sprache` " . - "WHERE `TextID`='" . sql_escape($_POST["TextID"]) - . "' AND `Sprache`='" - . sql_escape($k) . "'"; - - $erg_test = sql_select("SELECT * FROM `Sprache` WHERE `TextID`='" . sql_escape($_POST["TextID"]) . "' AND `Sprache`='" . sql_escape($k) . "'"); - if (count($erg_test) == 0) { - $sql_save = "INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) " . - "VALUES ('" . sql_escape($_POST["TextID"]) . "', '" - . sql_escape($k) . "', '" - . sql_escape($v) . "')"; - - $html .= $sql_save . "
"; - $Erg = sql_query($sql_save); - $html .= success("$k Save: OK
\n", true); - } else - if ($erg_test[0]['Text'] != $v) { - $sql_save = "UPDATE `Sprache` SET `Text`='" - . sql_escape($v) . "' " . - "WHERE `TextID`='" - . sql_escape($_POST["TextID"]) - . "' AND `Sprache`='" . sql_escape($k) . "' "; - - $html .= $sql_save . "
"; - $Erg = sql_query($sql_save); - $html .= success(" $k Update: OK
\n", true); - } else - $html .= "\t $k no changes
\n"; - } - } - - } - return $html; -} -?> - diff --git a/includes/pages/admin_log.php b/includes/pages/admin_log.php index ce30a246..b4a3c965 100644 --- a/includes/pages/admin_log.php +++ b/includes/pages/admin_log.php @@ -1,4 +1,8 @@ $selected_angel_types, 'accepted_angel_types' => array_merge($accepted_angel_types, $nonrestricted_angel_types)), array('accepted_angel_types' => $nonrestricted_angel_types)), - form_submit('submit_user_angeltypes', Get_Text("Save")) + form_submit('submit_user_angeltypes', _("Save")) )); $html .= "
"; @@ -325,7 +329,7 @@ function admin_user() { 'Tshirt' => '' . $angel['Tshirt'] . '', 'Size' => $angel['Size'], 'lastLogIn' => date('d.m.&\n\b\s\p;H:i', $angel['lastLogIn']), - 'edit' => img_button(page_link_to('admin_user') . '&id=' . $angel['UID'], 'pencil', 'edit'), + 'edit' => img_button(page_link_to('admin_user') . '&id=' . $angel['UID'], 'pencil', _("edit")), ); } $angels = array_map('prepare_angel_table', $angels); diff --git a/includes/pages/admin_user_angeltypes.php b/includes/pages/admin_user_angeltypes.php index dfb67781..b3fca7c0 100644 --- a/includes/pages/admin_user_angeltypes.php +++ b/includes/pages/admin_user_angeltypes.php @@ -1,5 +1,7 @@ ' . $angel_type['name'] . ' ' . img_button(page_link_to('admin_user_angeltypes') . '&confirm_all=' . $angel_type['id'], 'tick', '', 'confirm all') . ' ' . img_button(page_link_to('admin_user_angeltypes') . '&deny_all=' . $angel_type['id'], 'cross', '', 'deny all') . '' . table(array ( + $content[] = '

' . $angel_type['name'] . ' ' . img_button(page_link_to('admin_user_angeltypes') . '&confirm_all=' . $angel_type['id'], 'tick', '', _("confirm all")) . ' ' . img_button(page_link_to('admin_user_angeltypes') . '&deny_all=' . $angel_type['id'], 'cross', '', _("deny all")) . '

' . table(array ( 'name' => "Nick", 'actions' => "" ), $users); diff --git a/includes/pages/guest_faq.php b/includes/pages/guest_faq.php index e639731b..b6452f87 100644 --- a/includes/pages/guest_faq.php +++ b/includes/pages/guest_faq.php @@ -1,10 +1,14 @@ "; - if ($_SESSION['Sprache'] == "DE") { + if ($_SESSION['locale'] == "de_DE.UTF-8") { $html .= sprintf( '
%s
%s
', $faq['Frage_de'], diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 8c77cce0..5b34d2c8 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -1,10 +1,9 @@ 1) { + + if (isset($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 1) { $nick = strip_request_item('nick'); if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) { $ok = false; - $msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick3"), $nick), true); + $msg .= error(sprintf(_("Your nick "%s" already exists."), $nick), true); } } else { $ok = false; - $msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick2"), strip_request_item('nick')), true); + $msg .= error(sprintf(_("Your nick "%s" is too short (min. 2 characters)."), strip_request_item('nick')), true); } - - if (isset ($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) { + + if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) { $mail = strip_request_item('mail'); - if (!check_email($mail)) { + if (! check_email($mail)) { $ok = false; - $msg .= error(Get_Text("makeuser_error_mail"), true); + $msg .= error(_("E-mail address is not correct."), true); } } else { $ok = false; - $msg .= error("Please enter your e-mail.", true); + $msg .= error(_("Please enter your e-mail."), true); } - - if (isset ($_REQUEST['icq'])) + + if (isset($_REQUEST['icq'])) $icq = strip_request_item('icq'); - if (isset ($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { + if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { $jabber = strip_request_item('jabber'); - if (!check_email($jabber)) { + if (! check_email($jabber)) { $ok = false; - $msg .= error("Please check your jabber.", true); + $msg .= error(_("Please check your jabber account information."), true); } } - + if ($enable_tshirt_size) { - if (isset ($_REQUEST['tshirt_size']) && isset ($tshirt_sizes[$_REQUEST['tshirt_size']]) && $_REQUEST['tshirt_size'] != '') + if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']]) && $_REQUEST['tshirt_size'] != '') $tshirt_size = $_REQUEST['tshirt_size']; else { $ok = false; - $msg .= error("Please select your shirt size.", true); + $msg .= error(_("Please select your shirt size."), true); } } - - if (isset ($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) { + + if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) { if ($_REQUEST['password'] != $_REQUEST['password2']) { $ok = false; - $msg .= error(Get_Text("makeuser_error_password1"), true); + $msg .= error(_("Your passwords don't match."), true); } } else { $ok = false; - $msg .= error(Get_Text("makeuser_error_password2"), true); + $msg .= error(_("Your password is to short (please use at least 6 characters)."), true); } - - $selected_angel_types = array (); + + $selected_angel_types = array(); foreach ($angel_types as $angel_type_id => $angel_type_name) - if (isset ($_REQUEST['angel_types_' . $angel_type_id])) - $selected_angel_types[] = $angel_type_id; - - // Trivia - if (isset ($_REQUEST['lastname'])) + if (isset($_REQUEST['angel_types_' . $angel_type_id])) + $selected_angel_types[] = $angel_type_id; + + // Trivia + if (isset($_REQUEST['lastname'])) $lastname = strip_request_item('lastname'); - if (isset ($_REQUEST['prename'])) + if (isset($_REQUEST['prename'])) $prename = strip_request_item('prename'); - if (isset ($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age'])) + if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age'])) $age = strip_request_item('age'); - if (isset ($_REQUEST['tel'])) + if (isset($_REQUEST['tel'])) $tel = strip_request_item('tel'); - if (isset ($_REQUEST['dect'])) + if (isset($_REQUEST['dect'])) $dect = strip_request_item('dect'); - if (isset ($_REQUEST['mobile'])) + if (isset($_REQUEST['mobile'])) $mobile = strip_request_item('mobile'); - if (isset ($_REQUEST['hometown'])) + if (isset($_REQUEST['hometown'])) $hometown = strip_request_item('hometown'); - if (isset ($_REQUEST['comment'])) + if (isset($_REQUEST['comment'])) $comment = strip_request_item_nl('comment'); - + if ($ok) { - sql_query("INSERT INTO `User` SET `Nick`='" . sql_escape($nick) . "', `Vorname`='" . sql_escape($prename) . "', `Name`='" . sql_escape($lastname) . - "', `Alter`='" . sql_escape($age) . "', `Telefon`='" . sql_escape($tel) . "', `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) . - "', `email`='" . sql_escape($mail) . "', `ICQ`='" . sql_escape($icq) . "', `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) . - "', `Passwort`='" . sql_escape($password_hash) . "', `kommentar`='" . sql_escape($comment) . "', `Hometown`='" . sql_escape($hometown) . "', `CreateDate`=NOW(), `Sprache`='" . sql_escape($_SESSION["Sprache"]) . "'"); - + sql_query("INSERT INTO `User` SET `Nick`='" . sql_escape($nick) . "', `Vorname`='" . sql_escape($prename) . "', `Name`='" . sql_escape($lastname) . "', `Alter`='" . sql_escape($age) . "', `Telefon`='" . sql_escape($tel) . "', `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) . "', `email`='" . sql_escape($mail) . "', `ICQ`='" . sql_escape($icq) . "', `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) . "', `Passwort`='" . sql_escape($password_hash) . "', `kommentar`='" . sql_escape($comment) . "', `Hometown`='" . sql_escape($hometown) . "', `CreateDate`=NOW(), `Sprache`='" . sql_escape($_SESSION["locale"]) . "'"); + // Assign user-group and set password $user_id = sql_id(); sql_query("INSERT INTO `UserGroups` SET `uid`=" . sql_escape($user_id) . ", `group_id`=-2"); set_password($user_id, $_REQUEST['password']); - + // Assign angel-types $user_angel_types_info = array(); foreach ($selected_angel_types as $selected_angel_type_id) { @@ -122,37 +118,37 @@ function guest_register() { $user_angel_types_info[] = $angel_types[$selected_angel_type_id]; } engelsystem_log("User " . $nick . " signed up as: " . join(", ", $user_angel_types_info)); - success(Get_Text("makeuser_writeOK4")); - //if (!isset ($_SESSION['uid'])) + success(_("Angel registration successful!")); + redirect(page_link_to('login')); } } - - return page(array ( - Get_Text("makeuser_text1"), - $msg, - msg(), - form(array ( - form_text('nick', Get_Text("makeuser_Nickname") . "*", $nick), - form_text('lastname', Get_Text("makeuser_Nachname"), $lastname), - form_text('prename', Get_Text("makeuser_Vorname"), $prename), - form_text('age', Get_Text("makeuser_Alter"), $age), - form_text('tel', Get_Text("makeuser_Telefon"), $tel), - form_text('dect', Get_Text("makeuser_DECT"), $tel), - form_text('mobile', Get_Text("makeuser_Handy"), $mobile), - form_text('mail', Get_Text("makeuser_E-Mail") . "*", $mail), - form_text('icq', "ICQ", $icq), - form_text('jabber', "Jabber", $jabber), - form_text('hometown', Get_Text("makeuser_Hometown"), $hometown), - $enable_tshirt_size ? form_select('tshirt_size', Get_Text("makeuser_T-Shirt"), $tshirt_sizes, $tshirt_size) : '', - form_textarea('comment', Get_Text("makeuser_text2"), $comment), - form_checkboxes('angel_types', "What do you want to do?
(Description of job types)", $angel_types, $selected_angel_types), - form_info("", "Restricted angel types need will be confirmed later by an archangel. You can change your selection in the options section."), - form_password('password', Get_Text("makeuser_Passwort") . "*"), - form_password('password2', Get_Text("makeuser_Passwort2") . "*"), - info(Get_Text("makeuser_text3"), true), - form_submit('submit', Get_Text("makeuser_Anmelden")) - )) + + return page(array( + _("By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task sheduler."), + $msg, + msg(), + form(array( + form_text('nick', _("Nick") . "*", $nick), + form_text('lastname', _("Last name"), $lastname), + form_text('prename', _("First name"), $prename), + form_text('age', _("Age"), $age), + form_text('tel', _("Phone"), $tel), + form_text('dect', _("DECT"), $tel), + form_text('mobile', _("Mobile"), $mobile), + form_text('mail', _("E-Mail") . "*", $mail), + form_text('icq', _("ICQ"), $icq), + form_text('jabber', _("Jabber"), $jabber), + form_text('hometown', _("Hometown"), $hometown), + $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', + form_textarea('comment', _("Did you help at former CCC events and which tasks have you performed then?"), $comment), + form_checkboxes('angel_types', _("What do you want to do?") . sprintf("
(%s)", _("Description of job types")), $angel_types, $selected_angel_types), + form_info("", _("Restricted angel types need will be confirmed later by an archangel. You can change your selection in the options section.")), + form_password('password', _("Password") . "*"), + form_password('password2', _("Confirm password") . "*"), + info("*: " . _("Entry required!"), true), + form_submit('submit', _("Register")) + )) )); } @@ -163,55 +159,55 @@ function guest_logout() { function guest_login() { global $user; - + $msg = ""; $nick = ""; - - unset ($_SESSION['uid']); - - if (isset ($_REQUEST['submit'])) { + + unset($_SESSION['uid']); + + if (isset($_REQUEST['submit'])) { $ok = true; - - if (isset ($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 0) { + + if (isset($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 0) { $nick = strip_request_item('nick'); $login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'"); if (count($login_user) > 0) { $login_user = $login_user[0]; - if (isset ($_REQUEST['password'])) { - if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) { + if (isset($_REQUEST['password'])) { + if (! verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) { $ok = false; - $msg .= error(Get_Text("pub_index_pass_no_ok"), true); + $msg .= error(_("Your password is incorrect. Please try it again."), true); } } else { $ok = false; - $msg .= error("Please enter a password.", true); + $msg .= error(_("Please enter a password."), true); } } else { $ok = false; - $msg .= error(Get_Text("pub_index_User_unset"), true); + $msg .= error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."), true); } } else { $ok = false; - $msg .= error("Please enter a nickname.", true); + $msg .= error(_("Please enter a nickname."), true); } - + if ($ok) { $_SESSION['uid'] = $login_user['UID']; - $_SESSION['Sprache'] = $login_user['Sprache']; + $_SESSION['locale'] = $login_user['Sprache']; redirect(page_link_to('news')); } } - - return page(array ( - $msg, - msg(), - Get_Text("index_text1") . " " . Get_Text("index_text2") . " " . Get_Text("index_text3"), - form(array ( - form_text('nick', Get_Text("index_lang_nick"), $nick), - form_password('password', Get_Text("index_lang_pass")), - form_submit('submit', Get_Text("index_lang_send")) - )), - info(Get_Text("index_text4"), true) + + return page(array( + $msg, + msg(), + _("Resistance is futile! Your biological and physical parameters will be added to our collectiv! Assimilating angel:"), + form(array( + form_text('nick', _("Nick"), $nick), + form_password('password', _("Password")), + form_submit('submit', _("Login")) + )), + info(_("Please note: You have to activate cookies!"), true) )); } ?> diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php index fccc6f1d..c71dea92 100644 --- a/includes/pages/user_messages.php +++ b/includes/pages/user_messages.php @@ -1,119 +1,115 @@ 0) - return sprintf('

%s %s %s


', page_link_to("user_messages"), Get_Text("pub_messages_new1"), $new_messages, Get_Text("pub_messages_new2")); + return sprintf('

%s


', page_link_to("user_messages"), sprintf(_("You have %s new messages.", $new_messages))); } - + return ""; } function user_messages() { global $user; - - if (!isset ($_REQUEST['action'])) { + + if (! isset($_REQUEST['action'])) { $users = sql_select("SELECT * FROM `User` WHERE NOT `UID`=" . sql_escape($user['UID']) . " ORDER BY `Nick`"); - - $to_select_data = array ( - "" => "Select recipient..." + + $to_select_data = array( + "" => "Select recipient..." ); - + foreach ($users as $u) $to_select_data[$u['UID']] = $u['Nick']; - + $to_select = html_select_key('to', 'to', $to_select_data, ''); - + $messages_html = ""; $messages = sql_select("SELECT * FROM `Messages` WHERE `SUID`=" . sql_escape($user['UID']) . " OR `RUID`=" . sql_escape($user['UID']) . " ORDER BY `isRead`,`Datum` DESC"); foreach ($messages as $message) { $sender_user_source = User($message['SUID']); - if($sender_user_source === false) + if ($sender_user_source === false) engelsystem_error("Unable to load user."); $receiver_user_source = User($message['RUID']); - if($receiver_user_source === false) + if ($receiver_user_source === false) engelsystem_error("Unable to load user."); - - $messages_html .= sprintf( - ' %s %s %s %s%s', - ($message['isRead'] == 'N' ? ' class="new_message"' : ''), - ($message['isRead'] == 'N' ? '•' : ''), - date("Y-m-d H:i", $message['Datum']), - User_Nick_render($sender_user_source), - User_Nick_render($receiver_user_source), - str_replace("\n", '
', $message['Text']) - ); - + + $messages_html .= sprintf(' %s %s %s %s%s', ($message['isRead'] == 'N' ? ' class="new_message"' : ''), ($message['isRead'] == 'N' ? '•' : ''), date("Y-m-d H:i", $message['Datum']), User_Nick_render($sender_user_source), User_Nick_render($receiver_user_source), str_replace("\n", '
', $message['Text'])); + $messages_html .= ''; if ($message['RUID'] == $user['UID']) { if ($message['isRead'] == 'N') - $messages_html .= '' . Get_Text("pub_messages_MarkRead") . ''; + $messages_html .= '' . _("mark as read") . ''; } else { - $messages_html .= '' . Get_Text("pub_messages_DelMsg") . ''; + $messages_html .= '' . _("delete message") . ''; } $messages_html .= ''; } - - return template_render('../templates/user_messages.html', array ( - 'link' => page_link_to("user_messages"), - 'greeting' => Get_Text("Hello") . User_Nick_render($user) . ",
\n" . Get_Text("pub_messages_text1") . "

\n", - 'messages' => $messages_html, - 'new_label' => Get_Text("pub_messages_Neu"), - 'date_label' => Get_Text("pub_messages_Datum"), - 'from_label' => Get_Text("pub_messages_Von"), - 'to_label' => Get_Text("pub_messages_An"), - 'text_label' => Get_Text("pub_messages_Text"), - 'date' => date("Y-m-d H:i"), - 'from' => User_Nick_render($user), - 'to_select' => $to_select, - 'submit_label' => Get_Text("save") + + return template_render('../templates/user_messages.html', array( + 'link' => page_link_to("user_messages"), + 'greeting' => _(sprintf("Hello %s, here can you leave messages for other angels", User_Nick_render($user))) . '

', + 'messages' => $messages_html, + 'new_label' => _("New"), + 'date_label' => _("Date"), + 'from_label' => _("Transmitted"), + 'to_label' => _("Recipient"), + 'text_label' => _("Message"), + 'date' => date("Y-m-d H:i"), + 'from' => User_Nick_render($user), + 'to_select' => $to_select, + 'submit_label' => _("Save") )); } else { switch ($_REQUEST['action']) { - case "read" : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + case "read": + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) $id = $_REQUEST['id']; else - return error("Incomplete call, missing Message ID.", true); - + return error(_("Incomplete call, missing Message ID."), true); + $message = sql_select("SELECT * FROM `Messages` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); if (count($message) > 0 && $message[0]['RUID'] == $user['UID']) { sql_query("UPDATE `Messages` SET `isRead`='Y' WHERE `id`=" . sql_escape($id) . " LIMIT 1"); redirect(page_link_to("user_messages")); } else - return error("No Message found.", true); + return error(_("No Message found."), true); break; - - case "delete" : - if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + + case "delete": + if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) $id = $_REQUEST['id']; else - return error("Incomplete call, missing Message ID.", true); - + return error(_("Incomplete call, missing Message ID."), true); + $message = sql_select("SELECT * FROM `Messages` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); if (count($message) > 0 && $message[0]['SUID'] == $user['UID']) { sql_query("DELETE FROM `Messages` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); redirect(page_link_to("user_messages")); } else - return error("No Message found.", true); + return error(_("No Message found."), true); break; - - case "send" : + + case "send": $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text'])); $to = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($_REQUEST['to'])); if ($text != "" && is_numeric($to) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($to) . " AND NOT `UID`=" . sql_escape($user['UID']) . " LIMIT 1") > 0) { sql_query("INSERT INTO `Messages` SET `Datum`=" . sql_escape(time()) . ", `SUID`=" . sql_escape($user['UID']) . ", `RUID`=" . sql_escape($to) . ", `Text`='" . sql_escape($text) . "'"); redirect(page_link_to("user_messages")); } else { - return error(Get_Text("pub_messages_Send_Error"), true); + return error(_("Transmitting was terminated with an Error."), true); } break; - - default : - return error("Wrong action.", true); + + default: + return error(_("Wrong action."), true); } } } diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 3d3a92ba..14f3685e 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -1,5 +1,7 @@ time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) { sql_query("DELETE FROM `ShiftEntry` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); - $msg .= success(Get_Text("pub_myshifts_signed_off"), true); + $msg .= success(_("You have been signed off from the shift."), true); } else - $msg .= error(Get_Text("pub_myshifts_too_late"), true); + $msg .= error(_("It's too late to sign yourself off the shift. If neccessary, as the dispatcher to do so."), true); } else redirect(page_link_to('user_myshifts')); } @@ -94,9 +96,9 @@ function user_myshifts() { $myshift['actions'] = ""; if ($id == $user['UID']) - $myshift['actions'] .= img_button(page_link_to('user_myshifts') . '&edit=' . $shift['id'], 'pencil', 'edit'); + $myshift['actions'] .= img_button(page_link_to('user_myshifts') . '&edit=' . $shift['id'], 'pencil', _("edit")); if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) - $myshift['actions'] .= img_button(page_link_to('user_myshifts') . (($id != $user['UID'])? '&id=' . $id : '') . '&cancel=' . $shift['id'], 'cross', 'sign_off'); + $myshift['actions'] .= img_button(page_link_to('user_myshifts') . (($id != $user['UID'])? '&id=' . $id : '') . '&cancel=' . $shift['id'], 'cross', _("sign off")); $timesum += $shift['end'] - $shift['start']; $myshifts_table[] = $myshift; @@ -106,7 +108,7 @@ function user_myshifts() { return page(array( msg(), - $id == $user['UID'] ? sprintf(Get_Text('pub_myshifts_intro'), $LETZTES_AUSTRAGEN) : '', + $id == $user['UID'] ? sprintf(_('These are your shifts.
Please try to appear 15 minutes before your shift begins!
You can remove yourself from a shift up to %d hours before it starts.'), $LETZTES_AUSTRAGEN) : '', $id != $user['UID'] ? info(sprintf("You are viewing %s's shifts.", $shifts_user['Nick']), true) : '', $id != $user['UID'] ? buttons(array(button(page_link_to('admin_user') . '&id=' . $shifts_user['UID'], "Edit " . $shifts_user['Nick'], 'edit'))) : '', table(array( @@ -117,8 +119,8 @@ function user_myshifts() { 'comment' => "Kommentar", 'actions' => "Aktion" ), $myshifts_table), - $id == $user['UID'] && count($shifts) == 0 ? error(sprintf(Get_Text('pub_myshifts_goto_shifts'), page_link_to('user_shifts')), true) : '', - "

Exports

" . sprintf(Get_Text('inc_schicht_ical_text'), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset') + $id == $user['UID'] && count($shifts) == 0 ? error(sprintf(_("Go to the shifts table to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : '', + "

Exports

" . sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset') )); } ?> diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index 481cf738..aa243ef6 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -1,4 +1,12 @@ \n\n"; $dis_rows = ceil(sql_num_query("SELECT * FROM `News` WHERE `Treffen`=1") / $DISPLAY_NEWS); - $html .= Get_Text(5); + $html .= _("Page:"); for ($i = 0; $i < $dis_rows; $i++) { if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) @@ -42,7 +50,7 @@ function display_news($news) { $html .= User_Nick_render($user_source); if ($p != "news_comments") - $html .= ', Kommentare (' . sql_num_query("SELECT * FROM `news_comments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ') »'; + $html .= ', ' . _("Comments") . ' (' . sql_num_query("SELECT * FROM `news_comments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ') »'; $html .= ''; $html .= '

' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '

'; $html .= '

' . ReplaceSmilies(nl2br($news['Text'])) . '

'; @@ -70,7 +78,7 @@ function user_news_comments() { $html .= '« Back'; $html .= display_news($news); - $html .= '

Kommentare

'; + $html .= '

' . _("Comments") . '

'; $comments = sql_select("SELECT * FROM `news_comments` WHERE `Refid`='" . sql_escape($nid) . "' ORDER BY 'ID'"); foreach ($comments as $comment) { @@ -125,7 +133,7 @@ function user_news() { "VALUES ('" . sql_escape(time()) . "', '" . sql_escape($_POST["betreff"]) . "', '" . sql_escape($_POST["text"]) . "', '" . sql_escape($user['UID']) . "', '" . sql_escape($_POST["treffen"]) . "');"); engelsystem_log("Created news: " . $_POST["betreff"] . ", treffen: " . $_POST["treffen"]); - success(Get_Text(4)); + success(_("Entry saved.")); redirect(page_link_to('user_news')); } @@ -141,7 +149,7 @@ function user_news() { $html .= "
\n\n"; $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS); - $html .= Get_Text(5); + $html .= _("Page:"); for ($i = 0; $i < $dis_rows; $i++) { if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) @@ -152,29 +160,29 @@ function user_news() { $html .= '
'; if (in_array("admin_news", $privileges)) { $html .= '

-

' . Get_Text(6) . '

+

' . _("Create news:") . '

 
- + - + '; if (in_array('admin_news', $privileges)) { $html .= ' - + '; } $html .= '
' . Get_Text(7) . '' . _("Subject") . ':
' . Get_Text(8) . '' . _("Message") . ':
' . Get_Text(9) . '' . _("Meeting") . ':

- +
'; } return $html; diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php index 97035546..e9a9d503 100644 --- a/includes/pages/user_questions.php +++ b/includes/pages/user_questions.php @@ -1,4 +1,8 @@ 1) { + + if (isset($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 1) { $nick = strip_request_item('nick'); if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' AND NOT `UID`=" . sql_escape($user['UID']) . " LIMIT 1") > 0) { $ok = false; - $msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick3"), $nick), true); + $msg .= error(sprintf(_("Your nick "%s" already exists."), $nick), true); } } else { $ok = false; - $msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick2"), strip_request_item('nick')), true); + $msg .= error(sprintf(_("Your nick "%s" is too short (min. 2 characters)."), strip_request_item('nick')), true); } - - if (isset ($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) { + + if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) { $mail = strip_request_item('mail'); - if (!check_email($mail)) { + if (! check_email($mail)) { $ok = false; - $msg .= error(Get_Text("makeuser_error_mail"), true); + $msg .= error(_("E-mail address is not correct."), true); } } else { $ok = false; - $msg .= error("Please enter your e-mail.", true); + $msg .= error(_("Please enter your e-mail."), true); } - - if (isset ($_REQUEST['icq'])) + + if (isset($_REQUEST['icq'])) $icq = strip_request_item('icq'); - if (isset ($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { + if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { $jabber = strip_request_item('jabber'); - if (!check_email($jabber)) { + if (! check_email($jabber)) { $ok = false; - $msg .= error("Please check your jabber.", true); + $msg .= error(_("Please check your jabber account information."), true); } } - - if (isset ($_REQUEST['tshirt_size']) && isset ($tshirt_sizes[$_REQUEST['tshirt_size']])) + + if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']])) $tshirt_size = $_REQUEST['tshirt_size']; - elseif($enable_tshirt_size) { + elseif ($enable_tshirt_size) { $ok = false; } - - $selected_angel_types = array (); + + $selected_angel_types = array(); foreach ($angel_types as $angel_type_id => $angel_type_name) - if (isset ($_REQUEST['angel_types_' . $angel_type_id])) - $selected_angel_types[] = $angel_type_id; - - // Trivia - if (isset ($_REQUEST['lastname'])) + if (isset($_REQUEST['angel_types_' . $angel_type_id])) + $selected_angel_types[] = $angel_type_id; + + // Trivia + if (isset($_REQUEST['lastname'])) $lastname = strip_request_item('lastname'); - if (isset ($_REQUEST['prename'])) + if (isset($_REQUEST['prename'])) $prename = strip_request_item('prename'); - if (isset ($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age'])) + if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age'])) $age = strip_request_item('age'); - if (isset ($_REQUEST['tel'])) + if (isset($_REQUEST['tel'])) $tel = strip_request_item('tel'); - if (isset ($_REQUEST['dect'])) + if (isset($_REQUEST['dect'])) $dect = strip_request_item('dect'); - if (isset ($_REQUEST['mobile'])) + if (isset($_REQUEST['mobile'])) $mobile = strip_request_item('mobile'); - if (isset ($_REQUEST['hometown'])) + if (isset($_REQUEST['hometown'])) $hometown = strip_request_item('hometown'); - + if ($ok) { - sql_query("UPDATE `User` SET `Nick`='" . sql_escape($nick) . "', `Vorname`='" . sql_escape($prename) . "', `Name`='" . sql_escape($lastname) . - "', `Alter`='" . sql_escape($age) . "', `Telefon`='" . sql_escape($tel) . "', `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) . - "', `email`='" . sql_escape($mail) . "', `ICQ`='" . sql_escape($icq) . "', `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) . - "', `Hometown`='" . sql_escape($hometown) . "' WHERE `UID`=" . sql_escape($user['UID'])); - + sql_query("UPDATE `User` SET `Nick`='" . sql_escape($nick) . "', `Vorname`='" . sql_escape($prename) . "', `Name`='" . sql_escape($lastname) . "', `Alter`='" . sql_escape($age) . "', `Telefon`='" . sql_escape($tel) . "', `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) . "', `email`='" . sql_escape($mail) . "', `ICQ`='" . sql_escape($icq) . "', `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) . "', `Hometown`='" . sql_escape($hometown) . "' WHERE `UID`=" . sql_escape($user['UID'])); + // Assign angel-types $user_angel_type_info = array(); sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`='" . sql_escape($user['UID']) . "' AND `angeltype_id` IN (" . implode(",", array_diff(array_keys($angel_types), $selected_angel_types)) . ")"); foreach ($angel_types_source as $angel_type) if (in_array($angel_type['id'], $selected_angel_types)) $user_angel_type_info[] = $angel_type['name']; - + foreach ($selected_angel_types as $selected_angel_type_id) { if (sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID']) . " AND `angeltype_id`=" . sql_escape($selected_angel_type_id) . " LIMIT 1") == 0) sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id)); } - + engelsystem_log("Own angel types set to: " . join(", ", $user_angel_type_info)); success("Settings saved."); redirect(page_link_to('user_settings')); } - } - elseif (isset ($_REQUEST['submit_password'])) { + } elseif (isset($_REQUEST['submit_password'])) { $ok = true; - - if (!isset ($_REQUEST['password']) || !verify_password($_REQUEST['password'], $user['Passwort'], $user['UID'])) - $msg .= error(Get_Text(30), true); + + if (! isset($_REQUEST['password']) || ! verify_password($_REQUEST['password'], $user['Passwort'], $user['UID'])) + $msg .= error(_("-> not OK. Please try again."), true); elseif (strlen($_REQUEST['new_password']) < MIN_PASSWORD_LENGTH) - $msg .= error(Get_Text("makeuser_error_password2")); + $msg .= error(_("Your password is to short (please use at least 6 characters)."), true); elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) - $msg .= error(Get_Text("makeuser_error_password1"), true); - elseif(set_password($user['UID'], $_REQUEST['new_password'])) - success("Password saved."); + $msg .= error(_("Your passwords don't match."), true); + elseif (set_password($user['UID'], $_REQUEST['new_password'])) + success(_("Password saved.")); else - error("Failed setting password."); + error(_("Failed setting password.")); redirect(page_link_to('user_settings')); - } - elseif (isset ($_REQUEST['submit_theme'])) { + } elseif (isset($_REQUEST['submit_theme'])) { $ok = true; - - if (isset ($_REQUEST['theme']) && isset ($themes[$_REQUEST['theme']])) + + if (isset($_REQUEST['theme']) && isset($themes[$_REQUEST['theme']])) $selected_theme = $_REQUEST['theme']; else $ok = false; - + if ($ok) { sql_query("UPDATE `User` SET `color`='" . sql_escape($selected_theme) . "' WHERE `UID`=" . sql_escape($user['UID'])); - + success("Theme changed."); redirect(page_link_to('user_settings')); } - } - elseif (isset ($_REQUEST['submit_language'])) { + } elseif (isset($_REQUEST['submit_language'])) { $ok = true; - - if (isset ($_REQUEST['language']) && isset ($languages[$_REQUEST['language']])) + + if (isset($_REQUEST['language']) && isset($locales[$_REQUEST['language']])) $selected_language = $_REQUEST['language']; else $ok = false; - + if ($ok) { sql_query("UPDATE `User` SET `Sprache`='" . sql_escape($selected_language) . "' WHERE `UID`=" . sql_escape($user['UID'])); - $_SESSION['Sprache'] = $selected_language; - + $_SESSION['locale'] = $selected_language; + success("Language changed."); redirect(page_link_to('user_settings')); } } - - return page(array ( - sprintf(Get_Text("Hallo") . "%s,
" . Get_Text(13), User_Nick_render($user)), - $msg, - msg(), - form(array ( - form_info("", Get_Text("pub_einstellungen_Text_UserData")), - form_text('nick', Get_Text("makeuser_Nickname") . "*", $nick), - form_text('lastname', Get_Text("makeuser_Nachname"), $lastname), - form_text('prename', Get_Text("makeuser_Vorname"), $prename), - form_text('age', Get_Text("makeuser_Alter"), $age), - form_text('tel', Get_Text("makeuser_Telefon"), $tel), - form_text('dect', Get_Text("makeuser_DECT"), $dect), - form_text('mobile', Get_Text("makeuser_Handy"), $mobile), - form_text('mail', Get_Text("makeuser_E-Mail") . "*", $mail), - form_text('icq', "ICQ", $icq), - form_text('jabber', "Jabber", $jabber), - form_text('hometown', Get_Text("makeuser_Hometown"), $hometown), - $enable_tshirt_size ? form_select('tshirt_size', Get_Text("makeuser_T-Shirt"), $tshirt_sizes, $tshirt_size) : '', - form_checkboxes('angel_types', "What do you want to do?
(Description of job types)", $angel_types, $selected_angel_types), - form_submit('submit', Get_Text("save")) - )), - form(array ( - form_info("", Get_Text(14)), - form_password('password', Get_Text(15)), - form_password('new_password', Get_Text(16)), - form_password('new_password2', Get_Text(17)), - form_submit('submit_password', Get_Text("save")) - )), - form(array ( - form_info("", Get_Text(18)), - form_select('theme', Get_Text(19), $themes, $selected_theme), - form_submit('submit_theme', Get_Text("save")) - )), - form(array ( - form_info("", Get_Text(20)), - form_select('language', Get_Text(21), $languages, $selected_language), - form_submit('submit_language', Get_Text("save")) - )) + + return page(array( + sprintf(_("Hello %s, here you can change your personal settings i.e. password, color settings etc."), User_Nick_render($user)), + $msg, + msg(), + form(array( + form_info("", _("Here you can change your user details.")), + form_text('nick', _("Nick") . "*", $nick), + form_text('lastname', _("Last name"), $lastname), + form_text('prename', _("First name"), $prename), + form_text('age', _("Age"), $age), + form_text('tel', _("Phone"), $tel), + form_text('dect', _("DECT"), $tel), + form_text('mobile', _("Mobile"), $mobile), + form_text('mail', _("E-Mail") . "*", $mail), + form_text('icq', _("ICQ"), $icq), + form_text('jabber', _("Jabber"), $jabber), + form_text('hometown', _("Hometown"), $hometown), + $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', + form_checkboxes('angel_types', _("What do you want to do?") . sprintf("
(%s)", _("Description of job types")), $angel_types, $selected_angel_types), + form_submit('submit', _("Save")) + )), + form(array( + form_info("", _("Here you can change your password.")), + form_password('password', _("Old password:")), + form_password('new_password', _("New password:")), + form_password('new_password2', _("Password confirmation:")), + form_submit('submit_password', _("Save")) + )), + form(array( + form_info("", _("Here you can choose your color settings:")), + form_select('theme', _("Color settings:"), $themes, $selected_theme), + form_submit('submit_theme', _("Save")) + )), + form(array( + form_info("", _("Here you can choose your language:")), + form_select('language', _("Language:"), $locales, $selected_language), + form_submit('submit_language', _("Save")) + )) )); } ?> diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 069112ec..73afb911 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -1,4 +1,8 @@ '1', - 'name' => Get_Text('occupied') + 'name' => _('occupied') ), array ( 'id' => '0', - 'name' => Get_Text('free') + 'name' => _('free') ) ); @@ -479,7 +483,7 @@ function view_user_shifts() { $is_free = false; $shifts_row = $shift['name']; if (in_array('admin_shifts', $privileges)) - $shifts_row .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', 'edit') . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', 'delete'); + $shifts_row .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', _("edit")) . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', _("delete")); $shifts_row .= '
'; $query = "SELECT `NeededAngelTypes`.`count`, `AngelTypes`.`id`, `AngelTypes`.`restricted`, `UserAngelTypes`.`confirm_user_id`, `AngelTypes`.`name`, `UserAngelTypes`.`user_id` FROM `NeededAngelTypes` @@ -507,12 +511,12 @@ function view_user_shifts() { else $style="font-weight:normal;"; if (in_array('user_shifts_admin', $privileges)) - $entry_list[] = "" . User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', 'delete') . ''; + $entry_list[] = "" . User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', _("delete")) . ''; else $entry_list[] = "" . User_Nick_render($entry) .""; } if ($angeltype['count'] - count($entries) > 0) { - $inner_text = ($angeltype['count'] - count($entries)) . ' ' . Get_Text($angeltype['count'] - count($entries) == 1 ? 'helper' : 'helpers') . ' ' . Get_Text('needed'); + $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries)), $angeltype['count'] - count($entries)); // is the shift still running or alternatively is the user shift admin? $user_may_join_shift = true; @@ -605,7 +609,7 @@ function view_user_shifts() { ); if (in_array('admin_shifts', $privileges)) - $shift_row['info'] .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', 'edit') . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', 'delete'); + $shift_row['info'] .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', 'edit') . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', _("delete")); $shift_row['entries'] .= '
'; $is_free = false; $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); @@ -630,14 +634,14 @@ function view_user_shifts() { $entry_list = array (); foreach ($entries as $entry) { if (in_array('user_shifts_admin', $privileges)) - $entry_list[] = User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', 'delete'); + $entry_list[] = User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', _("delete")); else $entry_list[] = User_Nick_render($entry); } $angeltype['taken'] = count($entries); // do we need more angles of this type? if ($angeltype['count'] - count($entries) > 0) { - $inner_text = ($angeltype['count'] - count($entries)) . ' ' . Get_Text($angeltype['count'] - count($entries) == 1 ? 'helper' : 'helpers') . ' ' . Get_Text('needed'); + $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries)), $angeltype['count'] - count($entries)); // is the shift still running or alternatively is the user shift admin? $user_may_join_shift = true; @@ -687,8 +691,8 @@ function view_user_shifts() { } } $shifts_table = table(array( - 'info' => ucfirst(Get_Text("time")) . "/" . ucfirst(Get_Text("room")), - 'entries' => ucfirst(Get_Text("entries")) + 'info' => _("Time") . "/" . _("Room"), + 'entries' => _("Entries") ), $shifts_table); } @@ -696,18 +700,18 @@ if ($user['api_key'] == "") User_reset_api_key($user); return msg() . template_render('../templates/user_shifts.html', array ( - 'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", ucfirst(Get_Text("rooms"))), + 'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", _("Rooms")), 'start_select' => html_select_key("start_day", "start_day", array_combine($days, $days), $_SESSION['user_shifts']['start_day']), 'start_time' => $_SESSION['user_shifts']['start_time'], 'end_select' => html_select_key("end_day", "end_day", array_combine($days, $days), $_SESSION['user_shifts']['end_day']), 'end_time' => $_SESSION['user_shifts']['end_time'], - 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", ucfirst(Get_Text("tasks")) . '1'), - 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", ucfirst(Get_Text("occupancy"))), - 'task_notice' => '1' . Get_Text("pub_schichtplan_tasks_notice"), + 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '1'), + 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), + 'task_notice' => '1' . _("The tasks shown here are influenced by the preferences you defined in your settings! Description of the jobs."), 'new_style_checkbox' => '', 'shifts_table' => $shifts_table, - 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_export_link('ical', $user['api_key'])), htmlspecialchars(make_user_shifts_export_link('shifts_json_export', $user['api_key'])), page_link_to('user_myshifts') . '&reset'), - 'filter' => ucfirst(Get_Text("to_filter")), + 'ical_text' => sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset'), + 'filter' => _("Filter"), )); } @@ -741,8 +745,8 @@ function make_select($items, $selected, $name, $title = null) { $html .= implode("\n", $html_items); $html .= '' . "\n"; $html .= buttons(array ( - button("javascript: check_all('selection_" . $name . "')", Get_Text("all"), ""), - button("javascript: uncheck_all('selection_" . $name . "')", Get_Text("none"), "") + button("javascript: check_all('selection_" . $name . "')", _("All"), ""), + button("javascript: uncheck_all('selection_" . $name . "')", _("None"), "") )); $html .= '' . "\n"; return $html; diff --git a/includes/pages/user_wakeup.php b/includes/pages/user_wakeup.php index 63aff97c..4ac5c0b7 100644 --- a/includes/pages/user_wakeup.php +++ b/includes/pages/user_wakeup.php @@ -1,4 +1,8 @@ 0 && $wakeup[0]['UID'] == $user['UID']) { sql_query("DELETE FROM `Wecken` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); - $html .= success("Wake-up call deleted.", true); + $html .= success(_("Wake-up call deleted."), true); } else - return error("No wake-up found.", true); + return error(_("No wake-up found."), true); break; } } - $html .= "

" . Get_Text("Hello") . User_Nick_render($user) . ",
" - . Get_Text("pub_wake_beschreibung") . "

\n\n"; - $html .= Get_Text("pub_wake_beschreibung2"); + $html .= '

' . sprintf(_("Hello %s, here you can register for a wake-up call. Simply say when and where the angel should come to wake you."), User_Nick_render($user)) . '

'; + $html .= _("All ordered wake-up calls, next first."); $html .= ' - - - - + + + + '; @@ -65,22 +68,22 @@ function user_wakeup() { $html .= ''; $html .= ''; if ($wecken['UID'] == $user['UID']) - $html .= ''; + $html .= ''; else $html .= ''; $html .= ''; } - $html .= '
' . Get_Text("pub_wake_Datum") . '' . Get_Text("pub_waeckliste_Nick") . '' . Get_Text("pub_wake_Ort") . '' . Get_Text("pub_wake_Bemerkung") . '' . _("Date") . '' . _("Nick") . '' . _("Place") . '' . _("Notes") . '
' . $wecken['Ort'] . ' ' . $wecken['Bemerkung'] . ' " . Get_Text("pub_wake_del") . '" . _("delete") . '

' . Get_Text("pub_wake_Text2"); + $html .= '
' . _("Schedule a new wake-up here:"); $html .= template_render('../templates/user_wakeup.html', array ( 'wakeup_link' => page_link_to("user_wakeup"), - 'date_text' => Get_Text("pub_wake_Datum"), + 'date_text' => _("Date"), 'date_value' => date("Y-m-d H:i"), - 'place_text' => Get_Text("pub_wake_Ort"), - 'comment_text' => Get_Text("pub_wake_Bemerkung"), + 'place_text' => _("Place"), + 'comment_text' => _("Notes"), 'comment_value' => "Knock knock Leo, follow the white rabbit to the blue tent", - 'submit_text' => Get_Text("pub_wake_bouton") + 'submit_text' => _("Save") )); return $html; } -- cgit v1.2.3-70-g09d2