diff options
author | Philip Häusler <msquare@notrademark.de> | 2013-11-25 21:04:58 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2013-11-25 21:04:58 +0100 |
commit | aad54bfe885e2ce69801597c791bff4b7f0e1521 (patch) | |
tree | ea5b6164698163c07ab1833df5a1afebdbdbc7ab | |
parent | 96a263f7129fbcf01ef644c531cdcc0a0be59085 (diff) |
basic gettext integration
28 files changed, 678 insertions, 572 deletions
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 @@ <?php +function admin_active_title() { + return _("Active angels"); +} + function admin_active() { global $tshirt_sizes, $shift_sum_formula; diff --git a/includes/pages/admin_angel_types.php b/includes/pages/admin_angel_types.php index bb4e1d52..e329604f 100644 --- a/includes/pages/admin_angel_types.php +++ b/includes/pages/admin_angel_types.php @@ -1,4 +1,8 @@ <?php +function admin_angel_types_title() { + return _("Angeltypes"); +} + function admin_angel_types() { $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); $angel_types = array (); diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index ad085de6..5ce21e44 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -1,4 +1,8 @@ <?php +function admin_arrive_title() { + return _("Arrived angels"); +} + function admin_arrive() { $msg = ""; $search = ""; diff --git a/includes/pages/admin_faq.php b/includes/pages/admin_faq.php index 05731296..1b2ea92b 100644 --- a/includes/pages/admin_faq.php +++ b/includes/pages/admin_faq.php @@ -1,88 +1,92 @@ <?php -function admin_faq() { - if (!isset ($_REQUEST['action'])) { - $faqs_html = ""; - $faqs = sql_select("SELECT * FROM `FAQ`"); - foreach ($faqs as $faq) { - $faqs_html .= sprintf('<tr><td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td><a href="%s&action=edit&id=%s">Edit</a></td></tr>', $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('<tr><td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td><a href="%s&action=edit&id=%s">Edit</a></td></tr>', $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 @@ <?php +function admin_free_title() { + return _("Free angels"); +} + function admin_free() { global $privileges; diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php index adcabd6e..4d88e74e 100644 --- a/includes/pages/admin_groups.php +++ b/includes/pages/admin_groups.php @@ -1,4 +1,8 @@ <?php +function admin_groups_title() { + return _("Grouprights"); +} + function admin_groups() { global $user; diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php index bbfb9c6d..80c2be25 100644 --- a/includes/pages/admin_import.php +++ b/includes/pages/admin_import.php @@ -1,4 +1,8 @@ <?php +function admin_import_title() { + return _("Pentabarf import"); +} + function admin_import() { global $PentabarfXMLhost, $PentabarfXMLpath; global $rooms_import; diff --git a/includes/pages/admin_language.php b/includes/pages/admin_language.php deleted file mode 100644 index 00afe622..00000000 --- a/includes/pages/admin_language.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -function admin_language() { - global $user; - global $languages; - - $html = ""; - if (!isset ($_POST["TextID"])) { - $html .= Get_Text("Hello") . User_Nick_render($user) . ", <br />\n"; - $html .= Get_Text("pub_sprache_text1") . "<br /><br />\n"; - - $html .= "<a href=\"" . page_link_to("admin_language") . "&ShowEntry=y\">" . Get_Text("pub_sprache_ShowEntry") . "</a>"; - // ausgabe Tabellenueberschift - $html .= "\t<table border=\"0\" class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n\t\t<tr>"; - $html .= "\t\t<td class=\"contenttopic\"><b>" . Get_Text("pub_sprache_TextID") . "</b></td>"; - foreach($languages as $language => $language_name) { - $html .= "<td class=\"contenttopic\"><b>" . - Get_Text("pub_sprache_Sprache") . " " . $language . - "</b></td>"; - $Sprachen[$language] = $language_name; - } - $html .= "\t\t<td class=\"contenttopic\"><b>" . Get_Text("pub_sprache_Edit") . "</b></td>"; - $html .= "\t\t</tr>"; - - 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 .= "<form action=\"" . page_link_to("admin_language") . "\" method=\"post\">"; - $html .= "<tr class=\"content\">\n"; - $html .= "\t\t<td>$TextID_Old " . - "<input name=\"TextID\" type=\"hidden\" value=\"$TextID_Old\"> </td>\n"; - - foreach ($Sprachen as $Name => $Value) { - $Value = html_entity_decode($Value, ENT_QUOTES); - $html .= "\t\t<td><textarea name=\"$Name\" cols=\"22\" rows=\"8\">$Value</textarea></td>\n"; - $Sprachen[$Name] = ""; - } - - $html .= "\t\t<td><input type=\"submit\" value=\"Save\"></td>\n"; - $html .= "</tr>"; - $html .= "</form>\n"; - $TextID_Old = $TextID_New; - } - $Sprachen[$sprache_entry['Sprache']] = $sprache_entry['Text']; - } /*FOR*/ - } - - //fuer neu eintraege - $html .= "<form action=\"" . page_link_to("admin_language") . "\" method=\"post\">"; - $html .= "<tr class=\"content\">\n"; - $html .= "\t\t<td><input name=\"TextID\" type=\"text\" size=\"40\" value=\"new\"> </td>\n"; - - foreach ($Sprachen as $Name => $Value) - $html .= "\t\t<td><textarea name=\"$Name\" cols=\"22\" rows=\"8\">$Name Text</textarea></td>\n"; - - $html .= "\t\t<td><input type=\"submit\" value=\"Save\"></td>\n"; - $html .= "</tr>"; - $html .= "</form>\n"; - - $html .= "</table>\n"; - } /*if( !isset( $TextID ) )*/ - else { - $html .= "edit: " . $_POST["TextID"] . "<br /><br />"; - 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 . "<br />"; - $Erg = sql_query($sql_save); - $html .= success("$k Save: OK<br />\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 . "<br />"; - $Erg = sql_query($sql_save); - $html .= success(" $k Update: OK<br />\n", true); - } else - $html .= "\t $k no changes<br />\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 @@ <?php +function admin_log_title() { + return _("Log"); +} + function admin_log() { $log_entries_source = LogEntries(); $log_entries = array(); diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php index 516d52c9..b70495f6 100644 --- a/includes/pages/admin_questions.php +++ b/includes/pages/admin_questions.php @@ -1,4 +1,8 @@ <?php +function admin_questions_title() { + return _("Answer questions"); +} + function admin_new_questions() { global $user, $privileges; diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index b92ea6a8..5e880adb 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -1,4 +1,8 @@ <?php +function admin_rooms_title() { + return _("Rooms"); +} + function admin_rooms() { global $user; diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 178e4e88..1f17cf6e 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -1,5 +1,7 @@ <?php - +function admin_shifts_title() { + return _("Create shifts"); +} // Assistent zum Anlegen mehrerer neuer Schichten function admin_shifts() { diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 58b2947e..ba7f17ff 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -1,4 +1,8 @@ <?php +function admin_user_title() { + return _("All Angels"); +} + function admin_user() { global $user, $privileges, $tshirt_sizes, $privileges; @@ -145,7 +149,7 @@ function admin_user() { $angel_types, array('selected_angel_types' => $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 .= "<hr />"; @@ -325,7 +329,7 @@ function admin_user() { 'Tshirt' => '<img src="pic/icons/' . ($angel['Tshirt'] == 1? 'tick' : 'cross') . '.png" alt="' . $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 @@ <?php - +function admin_user_angeltypes_title() { + return _("Confirm angeltypes"); +} /** * Auf dieser Seite können Erzengel Engeltypen für bestimmte Nutzer freischalten, z.B. nachdem diese für die Aufgabe geschult wurden. @@ -77,12 +79,12 @@ function admin_user_angeltypes() { $users = array (); foreach ($user_angel_types_source as $user) { $user['name'] = User_Nick_render($user); - $user['actions'] = img_button(page_link_to('admin_user_angeltypes') . '&confirm=' . $user['id'], 'tick', 'confirm'); + $user['actions'] = img_button(page_link_to('admin_user_angeltypes') . '&confirm=' . $user['id'], 'tick', _("confirm")); $user['actions'] .= ' '; - $user['actions'] .= img_button(page_link_to('admin_user_angeltypes') . '&deny=' . $user['id'], 'cross', 'deny'); + $user['actions'] .= img_button(page_link_to('admin_user_angeltypes') . '&deny=' . $user['id'], 'cross', _("deny")); $users[] = $user; } - $content[] = '<h2>' . $angel_type['name'] . ' <small>' . 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') . '</small></h2>' . table(array ( + $content[] = '<h2>' . $angel_type['name'] . ' <small>' . 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")) . '</small></h2>' . 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 @@ <?php +function faq_title() { + return _("FAQ"); +} + function guest_faq() { $html = ""; $faqs = sql_select("SELECT * FROM `FAQ`"); foreach ($faqs as $faq) { $html .= "<dl>"; - if ($_SESSION['Sprache'] == "DE") { + if ($_SESSION['locale'] == "de_DE.UTF-8") { $html .= sprintf( '<dt>%s</dt> <dd>%s</dd>', $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 @@ <?php - // Engel registrieren function guest_register() { global $tshirt_sizes, $enable_tshirt_size; - + $msg = ""; $nick = ""; $lastname = ""; @@ -20,101 +19,98 @@ function guest_register() { $comment = ""; $tshirt_size = ''; $password_hash = ""; - $selected_angel_types = array (); - + $selected_angel_types = array(); + $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); - $angel_types = array (); + $angel_types = array(); foreach ($angel_types_source as $angel_type) $angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : ""); - - if (isset ($_REQUEST['submit'])) { + + if (isset($_REQUEST['submit'])) { $ok = true; - - if (isset ($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 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?<br>(<a href=\"https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F\">Description of job types</a>)", $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("<br>(<a href=\"https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F\">%s</a>)", _("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 @@ <?php +function messages_title() { + return _("Messages"); +} + function user_unread_messages() { global $user, $privileges; - + if (in_array("user_messages", $privileges)) { $new_messages = sql_num_query("SELECT * FROM `Messages` WHERE isRead='N' AND `RUID`=" . sql_escape($user['UID'])); - + if ($new_messages > 0) - return sprintf('<p class="info"><a href="%s">%s %s %s</a></p><hr />', page_link_to("user_messages"), Get_Text("pub_messages_new1"), $new_messages, Get_Text("pub_messages_new2")); + return sprintf('<p class="info"><a href="%s">%s</a></p><hr />', 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( - '<tr %s> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td><td>%s</td>', - ($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", '<br />', $message['Text']) - ); - + + $messages_html .= sprintf('<tr %s> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td><td>%s</td>', ($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", '<br />', $message['Text'])); + $messages_html .= '<td>'; if ($message['RUID'] == $user['UID']) { if ($message['isRead'] == 'N') - $messages_html .= '<a href="' . page_link_to("user_messages") . '&action=read&id=' . $message['id'] . '">' . Get_Text("pub_messages_MarkRead") . '</a>'; + $messages_html .= '<a href="' . page_link_to("user_messages") . '&action=read&id=' . $message['id'] . '">' . _("mark as read") . '</a>'; } else { - $messages_html .= '<a href="' . page_link_to("user_messages") . '&action=delete&id=' . $message['id'] . '">' . Get_Text("pub_messages_DelMsg") . '</a>'; + $messages_html .= '<a href="' . page_link_to("user_messages") . '&action=delete&id=' . $message['id'] . '">' . _("delete message") . '</a>'; } $messages_html .= '</td></tr>'; } - - return template_render('../templates/user_messages.html', array ( - 'link' => page_link_to("user_messages"), - 'greeting' => Get_Text("Hello") . User_Nick_render($user) . ", <br />\n" . Get_Text("pub_messages_text1") . "<br /><br />\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))) . '<br /><br />', + '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 @@ <?php - +function myshifts_title() { + return _("My shifts"); +} // Zeigt die Schichten an, die ein Benutzer belegt function user_myshifts() { @@ -56,9 +58,9 @@ function user_myshifts() { $shift = $shift[0]; if (($shift['start'] > 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.<br/>Please try to appear <b>15 minutes</b> before your shift begins!<br/>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) : '', - "<h2>Exports</h2>" . 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 <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : '', + "<h2>Exports</h2>" . sprintf(_("Export of shown shifts. <a href=\"%s\">iCal format</a> or <a href=\"%s\">JSON format</a> available (please keep secret, otherwise <a href=\"%s\">reset the api key</a>)."), 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 @@ <?php +function news_title() { + return _("News"); +} + +function meetings_title() { + return _("Meetings"); +} + function user_meetings() { global $DISPLAY_NEWS, $privileges, $user; @@ -16,7 +24,7 @@ function user_meetings() { $html .= "<div class=\"pagination\">\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 .= ', <a href="' . page_link_to("news_comments") . '&nid=' . $news['ID'] . '">Kommentare (' . sql_num_query("SELECT * FROM `news_comments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ') »</a>'; + $html .= ', <a href="' . page_link_to("news_comments") . '&nid=' . $news['ID'] . '">' . _("Comments") . ' (' . sql_num_query("SELECT * FROM `news_comments` WHERE `Refid`='" . sql_escape($news['ID']) . "'") . ') »</a>'; $html .= '</details>'; $html .= '<h3>' . ($news['Treffen'] == 1 ? '[Meeting] ' : '') . ReplaceSmilies($news['Betreff']) . '</h3>'; $html .= '<p>' . ReplaceSmilies(nl2br($news['Text'])) . '</p>'; @@ -70,7 +78,7 @@ function user_news_comments() { $html .= '<a href="' . page_link_to("news") . '">« Back</a>'; $html .= display_news($news); - $html .= '<h2>Kommentare</h2>'; + $html .= '<h2>' . _("Comments") . '</h2>'; $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 .= "<div class=\"pagination\">\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 .= '</div>'; if (in_array("admin_news", $privileges)) { $html .= '<br /><hr /> - <h2>' . Get_Text(6) . '</h2> + <h2>' . _("Create news:") . '</h2> <a name="Neu"> </a> <form action="" method="post"> <table> <tr> - <td align="right">' . Get_Text(7) . '</td> + <td align="right">' . _("Subject") . ':</td> <td><input type="text" name="betreff" size="60"></td> </tr> <tr> - <td align="right">' . Get_Text(8) . '</td> + <td align="right">' . _("Message") . ':</td> <td><textarea name="text" cols="50" rows="10"></textarea></td> </tr>'; if (in_array('admin_news', $privileges)) { $html .= ' <tr> - <td align="right">' . Get_Text(9) . '</td> + <td align="right">' . _("Meeting") . ':</td> <td><input type="checkbox" name="treffen" size="1" value="1"></td> </tr>'; } $html .= '</table> <br /> - <input type="submit" value="' . Get_Text("save") . '"> + <input type="submit" value="' . _("Save") . '"> </form>'; } 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 @@ <?php +function questions_title() { + return _("Ask an archangel"); +} + function user_questions() { global $user; diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 1cdc2817..5370adaa 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -1,8 +1,8 @@ <?php function user_settings() { - global $enable_tshirt_size, $tshirt_sizes, $themes, $languages; + global $enable_tshirt_size, $tshirt_sizes, $themes, $locales; global $user; - + $msg = ""; $nick = $user['Nick']; $lastname = $user['Name']; @@ -19,187 +19,181 @@ function user_settings() { $password_hash = ""; $selected_theme = $user['color']; $selected_language = $user['Sprache']; - + $selected_angel_types_source = sql_select("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID'])); - $selected_angel_types = array (); + $selected_angel_types = array(); foreach ($selected_angel_types_source as $selected_angel_type) $selected_angel_types[] = $selected_angel_type['angeltype_id']; - + $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); - $angel_types = array (); + $angel_types = array(); foreach ($angel_types_source as $angel_type) $angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : ""); - - if (isset ($_REQUEST['submit'])) { + + if (isset($_REQUEST['submit'])) { $ok = true; - - if (isset ($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 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,<br />" . 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', "<span id=\"angel_types_anchor\">What do you want to do?</span><br>(<a href=\"https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F\">Description of job types</a>)", $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("<br>(<a href=\"https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F\">%s</a>)", _("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 @@ <?php +function shifts_title() { + return _("All Shifts"); +} + function user_shifts() { global $user, $privileges; @@ -296,11 +300,11 @@ function view_user_shifts() { $filled = array ( array ( 'id' => '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 .= '<br />'; $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[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', 'delete') . '</span>'; + $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', _("delete")) . '</span>'; else $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) ."</span>"; } 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'] .= '<br />'; $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")) . '<sup>1</sup>'), - 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", ucfirst(Get_Text("occupancy"))), - 'task_notice' => '<sup>1</sup>' . Get_Text("pub_schichtplan_tasks_notice"), + 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '<sup>1</sup>'), + 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), + 'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings! <a href=\"https://events.ccc.de/congress/2012/wiki/Volunteers#What_kind_of_volunteers_are_needed.3F\">Description of the jobs</a>."), 'new_style_checkbox' => '<label><input type="checkbox" name="new_style" value="1" ' . ($_SESSION['user_shifts']['new_style']? ' checked' : '') . '> Use new style if possible</label>', '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. <a href=\"%s\">iCal format</a> or <a href=\"%s\">JSON format</a> available (please keep secret, otherwise <a href=\"%s\">reset the api key</a>)."), 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 .= '</ul>' . "\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 .= '</div>' . "\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 @@ <?php +function wakeup_title() { + return _("Wakeup"); +} + function user_wakeup() { global $user; @@ -17,37 +21,36 @@ function user_wakeup() { . sql_escape($date) . "', '" . sql_escape($ort) . "', " . "'" . sql_escape($bemerkung) . "')"; sql_query($SQL); - $html .= success(Get_Text(4), true); + $html .= success(_("Entry saved."), true); } else - $html .= error("Broken date!", true); + $html .= error(_("Broken date!"), 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 wake-up ID.", true); + return error(_("Incomplete call, missing wake-up ID."), true); $wakeup = sql_select("SELECT * FROM `Wecken` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); if (count($wakeup) > 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 .= "<p>" . Get_Text("Hello") . User_Nick_render($user) . ",<br />" - . Get_Text("pub_wake_beschreibung") . "</p>\n\n"; - $html .= Get_Text("pub_wake_beschreibung2"); + $html .= '<p>' . 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)) . '</p>'; + $html .= _("All ordered wake-up calls, next first."); $html .= ' <table border="0" width="100%" class="border" cellpadding="2" cellspacing="1"> <tr class="contenttopic"> - <th>' . Get_Text("pub_wake_Datum") . '</th> - <th>' . Get_Text("pub_waeckliste_Nick") . '</th> - <th>' . Get_Text("pub_wake_Ort") . '</th> - <th>' . Get_Text("pub_wake_Bemerkung") . '</th> + <th>' . _("Date") . '</th> + <th>' . _("Nick") . '</th> + <th>' . _("Place") . '</th> + <th>' . _("Notes") . '</th> <th></th> </tr> '; @@ -65,22 +68,22 @@ function user_wakeup() { $html .= '<td>' . $wecken['Ort'] . ' </td>'; $html .= '<td>' . $wecken['Bemerkung'] . ' </td>'; if ($wecken['UID'] == $user['UID']) - $html .= '<td><a href="' . page_link_to("user_wakeup") . '&action=delete&id=' . $wecken['ID'] . "\">" . Get_Text("pub_wake_del") . '</a></td>'; + $html .= '<td><a href="' . page_link_to("user_wakeup") . '&action=delete&id=' . $wecken['ID'] . "\">" . _("delete") . '</a></td>'; else $html .= '<td></td>'; $html .= '</tr>'; } - $html .= '</table><hr />' . Get_Text("pub_wake_Text2"); + $html .= '</table><hr />' . _("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; } diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 805888e2..3cd42539 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -40,37 +40,35 @@ function make_navigation() { $menu = ""; $specials = array( - "faq" + "faq" ); $pages = array( - "news", - "user_meetings", - "user_myshifts", - "user_shifts", - "user_messages", - "user_questions", - "user_wakeup", - "admin_arrive", - "admin_active", - "admin_user", - "admin_free", - "admin_usershifts", - "admin_questions", - "admin_angel_types", - "admin_user_angeltypes", - "admin_shifts", - "admin_rooms", - "admin_groups", - "admin_faq", - "admin_language", - "admin_import", - "admin_log" + "news" => news_title(), + "user_meetings" => meetings_title(), + "user_myshifts" => myshifts_title(), + "user_shifts" => shifts_title(), + "user_messages" => messages_title(), + "user_questions" => questions_title(), + "user_wakeup" => wakeup_title(), + "admin_arrive" => admin_arrive_title(), + "admin_active" => admin_active_title(), + "admin_user" => admin_user_title(), + "admin_free" => admin_free_title(), + "admin_questions" => admin_questions_title(), + "admin_angel_types" => admin_angel_types_title(), + "admin_user_angeltypes" => admin_user_angeltypes_title(), + "admin_shifts" => admin_shifts_title(), + "admin_rooms" => admin_rooms_title(), + "admin_groups" => admin_groups_title(), + "admin_faq" => admin_faq_title(), + "admin_import" => admin_import_title(), + "admin_log" => admin_log_title() ); - foreach ($pages as $page) + foreach ($pages as $page => $title) if (in_array($page, $privileges) || in_array($page, $specials)) - $menu .= '<li' . ($page == $p ? ' class="selected"' : '') . '><a href="' . page_link_to($page) . '">' . Get_Text($page) . '</a></li>'; + $menu .= '<li' . ($page == $p ? ' class="selected"' : '') . '><a href="' . page_link_to($page) . '">' . $title . '</a></li>'; return '<nav><ul>' . $menu . '</ul></nav>'; } diff --git a/includes/sys_template.php b/includes/sys_template.php index a7662e84..f59cff37 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -259,8 +259,7 @@ function html_select_key($id, $name, $rows, $selected) { } function img_button($link, $icon, $text, $extra_text = '') { - $translation = empty($text) ? '' : Get_Text($text); - return '<a href="' . htmlspecialchars($link) . '"><img src="pic/icons/' . htmlspecialchars($icon) . '.png" alt="' . $translation . '" ' . (empty($translation) ? '' : 'title="' . $translation . '"') . '>' . (empty($extra_text) ? '' : ' ' . $extra_text) . '</a>'; + return '<a href="' . htmlspecialchars($link) . '"><img src="pic/icons/' . htmlspecialchars($icon) . '.png" alt="' . $text . '" ' . (empty($text) ? '' : 'title="' . $text . '"') . '>' . (empty($extra_text) ? '' : ' ' . $extra_text) . '</a>'; } function ReplaceSmilies($neueckig) { diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo Binary files differindex 741be3fb..8146b8b3 100644 --- a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo +++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.po b/locale/de_DE.UTF-8/LC_MESSAGES/default.po index aae53868..db3bb57e 100644 --- a/locale/de_DE.UTF-8/LC_MESSAGES/default.po +++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Engelsystem 2.0\n" -"POT-Creation-Date: 2013-11-25 19:11+0100\n" -"PO-Revision-Date: 2013-11-25 19:11+0100\n" +"POT-Creation-Date: 2013-11-25 19:30+0100\n" +"PO-Revision-Date: 2013-11-25 19:32+0100\n" "Last-Translator: msquare <msquare@notrademark.de>\n" "Language-Team: \n" "Language: de_DE\n" @@ -21,5 +21,141 @@ msgstr "" msgid "Language" msgstr "Sprache" +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_user.php:148 +msgid "Save" +msgstr "Speichern" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:36 +#, php-format +msgid "Your nick "%s" already exists." +msgstr "Der Nick "%s" existiert schon." + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:40 +#, php-format +msgid "Your nick "%s" is too short (min. 2 characters)." +msgstr "Der Nick "%s" ist zu kurz (Mindestens 2 Zeichen)." + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:47 +msgid "E-mail address is not correct." +msgstr "Die E-Mail Adresse ist nicht in Ordnung." + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:51 +msgid "Please enter your e-mail." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:60 +msgid "Please check your jabber account information." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:69 +msgid "Please select your shirt size." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:76 +msgid "Your passwords don't match." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:80 +msgid "Your password is to short (please use at least 6 characters)." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:121 +msgid "Angel registration successful!" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:128 +msgid "" +"By completing this form you're registering as a Chaos-Angel. This script " +"will create you an account in the angel task sheduler." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:132 +msgid "Nick" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:133 +msgid "Last name" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:134 +msgid "First name" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:135 +msgid "Age" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:136 +msgid "Phone" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:137 +msgid "DECT" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:138 +msgid "Mobile" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:139 +msgid "E-Mail" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:140 +msgid "ICQ" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:141 +msgid "Jabber" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:142 +msgid "Hometown" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:143 +msgid "Shirt size" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:144 +msgid "" +"Did you help at former CCC events and which tasks have you performed then?" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:145 +msgid "What do you want to do?" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:145 +msgid "Description of job types" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:146 +msgid "" +"Restricted angel types need will be confirmed later by an archangel. You can " +"change your selection in the options section." +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:147 +msgid "Password" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:148 +msgid "Confirm password" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:149 +msgid "Entry required!" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:150 +msgid "Register" +msgstr "" + +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_messages.php:9 +#, php-format +msgid "You have %s new messages." +msgstr "" + #~ msgid "asdf" #~ msgstr "fdsa" diff --git a/public/index.php b/public/index.php index ddb727f8..e8b8b3a1 100644 --- a/public/index.php +++ b/public/index.php @@ -25,9 +25,26 @@ require_once ('includes/helper/error_helper.php'); require_once ('config/config.php'); require_once ('config/config_db.php'); +require_once ('includes/pages/admin_active.php'); +require_once ('includes/pages/admin_angel_types.php'); +require_once ('includes/pages/admin_arrive.php'); +require_once ('includes/pages/admin_faq.php'); +require_once ('includes/pages/admin_free.php'); +require_once ('includes/pages/admin_groups.php'); +require_once ('includes/pages/admin_import.php'); +require_once ('includes/pages/admin_log.php'); require_once ('includes/pages/admin_questions.php'); +require_once ('includes/pages/admin_rooms.php'); +require_once ('includes/pages/admin_shifts.php'); +require_once ('includes/pages/admin_user.php'); require_once ('includes/pages/admin_user_angeltypes.php'); +require_once ('includes/pages/guest_faq.php'); require_once ('includes/pages/user_messages.php'); +require_once ('includes/pages/user_myshifts.php'); +require_once ('includes/pages/user_news.php'); +require_once ('includes/pages/user_questions.php'); +require_once ('includes/pages/user_shifts.php'); +require_once ('includes/pages/user_wakeup.php'); session_start(); @@ -46,7 +63,7 @@ $p = isset($user) ? "news" : "login"; if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && ($_REQUEST['p'] == 'stats' || (sql_num_query("SELECT * FROM `Privileges` WHERE `name`='" . sql_escape($_REQUEST['p']) . "' LIMIT 1") > 0))) $p = $_REQUEST['p']; -$title = Get_Text($p); +$title = $p; $content = ""; if ($p == "ical") { @@ -64,27 +81,28 @@ if ($p == "ical") { } // Recht dafür vorhanden? elseif (in_array($p, $privileges)) { if ($p == "news") { - require_once ('includes/pages/user_news.php'); + $title = news_title(); $content = user_news(); } elseif ($p == "news_comments") { require_once ('includes/pages/user_news.php'); $content = user_news_comments(); } elseif ($p == "user_meetings") { - require_once ('includes/pages/user_news.php'); + $title = meetings_title(); $content = user_meetings(); } elseif ($p == "user_myshifts") { - require_once ('includes/pages/user_myshifts.php'); + $title = myshifts_title(); $content = user_myshifts(); } elseif ($p == "user_shifts") { - require_once ('includes/pages/user_shifts.php'); + $title = shifts_title(); $content = user_shifts(); } elseif ($p == "user_messages") { + $title = messages_title(); $content = user_messages(); } elseif ($p == "user_questions") { - require_once ('includes/pages/user_questions.php'); + $title = questions_title(); $content = user_questions(); } elseif ($p == "user_wakeup") { - require_once ('includes/pages/user_wakeup.php'); + $title = wakeup_title(); $content = user_wakeup(); } elseif ($p == "user_settings") { require_once ('includes/pages/user_settings.php'); @@ -99,48 +117,49 @@ elseif (in_array($p, $privileges)) { require_once ('includes/pages/guest_login.php'); $content = guest_logout(); } elseif ($p == "admin_questions") { + $title = admin_questions_title(); $content = admin_questions(); } elseif ($p == "admin_user") { - require_once ('includes/pages/admin_user.php'); + $title = admin_user_title(); $content = admin_user(); } elseif ($p == "admin_user_angeltypes") { - require_once ('includes/pages/admin_user_angeltypes.php'); + $title = admin_user_angeltypes_title(); $content = admin_user_angeltypes(); } elseif ($p == "admin_arrive") { - require_once ('includes/pages/admin_arrive.php'); + $title = admin_arrive_title(); $content = admin_arrive(); } elseif ($p == "admin_active") { - require_once ('includes/pages/admin_active.php'); + $title = admin_active_title(); $content = admin_active(); } elseif ($p == "admin_free") { - require_once ('includes/pages/admin_free.php'); + $title = admin_free_title(); $content = admin_free(); } elseif ($p == "admin_news") { require_once ('includes/pages/admin_news.php'); $content = admin_news(); } elseif ($p == "admin_angel_types") { - require_once ('includes/pages/admin_angel_types.php'); + $title = admin_angel_types_title(); $content = admin_angel_types(); } elseif ($p == "admin_rooms") { - require_once ('includes/pages/admin_rooms.php'); + $title = admin_rooms_title(); $content = admin_rooms(); } elseif ($p == "admin_groups") { - require_once ('includes/pages/admin_groups.php'); + $title = admin_groups_title(); $content = admin_groups(); } elseif ($p == "admin_faq") { - require_once ('includes/pages/admin_faq.php'); + $title = admin_faq_title(); $content = admin_faq(); } elseif ($p == "admin_language") { require_once ('includes/pages/admin_language.php'); $content = admin_language(); } elseif ($p == "admin_import") { - require_once ('includes/pages/admin_import.php'); + $title = admin_import_title(); $content = admin_import(); } elseif ($p == "admin_shifts") { - require_once ('includes/pages/admin_shifts.php'); + $title = admin_shifts_title(); $content = admin_shifts(); } elseif ($p == "admin_log") { - require_once ('includes/pages/admin_log.php'); + $title = admin_log_title(); $content = admin_log(); } else { require_once ('includes/pages/guest_start.php'); @@ -150,13 +169,13 @@ elseif (in_array($p, $privileges)) { require_once ('includes/pages/guest_credits.php'); $content = guest_credits(); } elseif ($p == "faq") { - require_once ('includes/pages/guest_faq.php'); + $title = faq_title(); $content = guest_faq(); } else { // Wenn schon eingeloggt, keine-Berechtigung-Seite anzeigen if (isset($user)) { - $title = Get_Text("no_access_title"); - $content = Get_Text("no_access_text"); + $title = _("No Access"); + $content = _("You don't have permission to view this page. You probably have to sign in or register in order to gain access!"); } else { // Sonst zur Loginseite leiten redirect(page_link_to("login")); @@ -169,7 +188,7 @@ if (isset($user) && $p != "user_messages") // Hinweis für Engel, die noch nicht angekommen sind if (isset($user) && $user['Gekommen'] == 0) - $content = error("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already.", true) . $content; + $content = error(_("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already."), true) . $content; // Erzengel Hinweis für unbeantwortete Fragen if (isset($user) && $p != "admin_questions") |