From e7a25448f2e922cdcb38f3745cf88fa744a3f20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Fri, 3 Jun 2011 14:38:12 +0200 Subject: [PATCH] admin language / translation --- DB/db_rewrite.sql | 47 +++++++------- includes/pages/admin_language.php | 100 ++++++++++++++++++++++++++++++ includes/pages/admin_user.php | 2 +- includes/sys_menu.php | 3 +- txt/TODO | 5 ++ www-ssl/index.php | 4 ++ 6 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 includes/pages/admin_language.php diff --git a/DB/db_rewrite.sql b/DB/db_rewrite.sql index 19a82c05..8758c191 100644 --- a/DB/db_rewrite.sql +++ b/DB/db_rewrite.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 03. Juni 2011 um 06:12 +-- Erstellungszeit: 03. Juni 2011 um 12:37 -- Server Version: 5.1.44 -- PHP-Version: 5.3.1 @@ -71,25 +71,26 @@ CREATE TABLE IF NOT EXISTS `Counter` ( -- INSERT INTO `Counter` (`URL`, `Anz`) VALUES -('news', 193), -('login', 28), -('logout', 14), -('start', 27), +('news', 198), +('login', 34), +('logout', 15), +('start', 28), ('faq', 19), -('credits', 3), +('credits', 7), ('register', 10), -('admin_rooms', 89), +('admin_rooms', 90), ('admin_angel_types', 71), ('user_settings', 134), ('user_messages', 113), -('admin_groups', 130), +('admin_groups', 135), ('user_questions', 55), ('admin_questions', 43), ('admin_faq', 55), ('admin_news', 33), ('news_comments', 151), -('admin_user', 196), -('user_meetings', 5); +('admin_user', 206), +('user_meetings', 5), +('admin_language', 22); -- -------------------------------------------------------- @@ -135,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `GroupPrivileges` ( `privilege_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `group_id` (`group_id`,`privilege_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=71 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=73 ; -- -- Daten für Tabelle `GroupPrivileges` @@ -151,14 +152,15 @@ INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (61, -4, 6), (66, -2, 15), (65, -2, 3), -(12, -5, 10), +(71, -5, 10), (60, -4, 12), (59, -4, 14), (64, -2, 4), (58, -4, 13), (57, -4, 7), (63, -4, 5), -(70, -2, 8); +(70, -2, 8), +(72, -5, 18); -- -------------------------------------------------------- @@ -272,7 +274,7 @@ CREATE TABLE IF NOT EXISTS `Privileges` ( `desc` varchar(1024) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=19 ; -- -- Daten für Tabelle `Privileges` @@ -295,7 +297,8 @@ INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (14, 'admin_news', 'Administrate the news section'), (15, 'news_comments', 'User can comment news'), (16, 'admin_user', 'Administrate the angels'), -(17, 'user_meetings', 'Lists meetings (news)'); +(17, 'user_meetings', 'Lists meetings (news)'), +(18, 'admin_language', 'Translate the system'); -- -------------------------------------------------------- @@ -1040,7 +1043,9 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES ('admin_news', 'DE', 'News verwalten'), ('admin_news', 'EN', 'Manage news'), ('user_meetings', 'DE', 'Treffen'), -('user_meetings', 'EN', 'Meetings'); +('user_meetings', 'EN', 'Meetings'), +('admin_language', 'DE', 'Übersetzung'), +('admin_language', 'EN', 'Translation'); -- -------------------------------------------------------- @@ -1083,8 +1088,8 @@ CREATE TABLE IF NOT EXISTS `User` ( -- INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `Gekommen`, `Aktiv`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`) VALUES -(1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '4297f44b13955235245b2497399d7a93', 1, 1, 0, 10, 'DE', 115, 'L', 1307081238, '0000-00-00 00:00:00', '', '', ''), -(148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 0, 1, 1, 10, 'DE', 0, 'L', 1307081543, '2011-06-03 07:55:24', 'AudioEngel', '', ''); +(1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '4297f44b13955235245b2497399d7a93', 1, 1, 0, 10, 'DE', 115, 'L', 1307104634, '0000-00-00 00:00:00', '', '', ''), +(148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 0, 1, 1, 10, 'DE', 0, 'L', 1307082872, '2011-06-03 07:55:24', 'AudioEngel', '', ''); -- -------------------------------------------------------- @@ -1174,7 +1179,7 @@ CREATE TABLE IF NOT EXISTS `UserGroups` ( `group_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `uid` (`uid`,`group_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ; -- -- Daten für Tabelle `UserGroups` @@ -1185,9 +1190,7 @@ INSERT INTO `UserGroups` (`id`, `uid`, `group_id`) VALUES (2, 1, -3), (3, 1, -5), (4, 1, -4), -(8, 148, -2), -(9, 148, -3), -(10, 148, -4); +(11, 148, -2); -- -------------------------------------------------------- diff --git a/includes/pages/admin_language.php b/includes/pages/admin_language.php new file mode 100644 index 00000000..a866528e --- /dev/null +++ b/includes/pages/admin_language.php @@ -0,0 +1,100 @@ +\n"; + $html .= Get_Text("pub_sprache_text1") . "

\n"; + + $html .= "" . Get_Text("pub_sprache_ShowEntry") . ""; + // ausgabe Tabellenueberschift + $SQL_Sprachen = "SELECT `Sprache` FROM `Sprache` GROUP BY `Sprache`;"; + $erg_Sprachen = sql_query($SQL_Sprachen); + + for ($i = 0; $i < mysql_num_rows($erg_Sprachen); $i++) + $Sprachen[mysql_result($erg_Sprachen, $i, "Sprache")] = $i; + + $html .= "\t\n\t\t"; + $html .= "\t\t"; + foreach ($Sprachen as $Name => $Value) + $html .= ""; + $html .= "\t\t"; + $html .= "\t\t"; + + if (isset ($_GET["ShowEntry"])) { + // ausgabe eintraege + $SQL = "SELECT * FROM `Sprache` ORDER BY `TextID`;"; + $erg = sql_query($SQL); + + $TextID_Old = mysql_result($erg, 0, "TextID"); + for ($i = 0; $i < mysql_num_rows($erg); $i++) { + $TextID_New = mysql_result($erg, $i, "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[mysql_result($erg, $i, "Sprache")] = mysql_result($erg, $i, "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") . " " . $Name . + "" . 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`='" . $_POST["TextID"] . "' AND `Sprache`='$k'"; + $erg_test = sql_query($sql_test); + + if (mysql_num_rows($erg_test) == 0) { + $sql_save = "INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) " . + "VALUES ('" . $_POST["TextID"] . "', '$k', '$v')"; + $html .= $sql_save . "
"; + $Erg = sql_query($sql_save); + $html .= success("$k Save: OK
\n"); + } else + if (mysql_result($erg_test, 0, "Text") != $v) { + $sql_save = "UPDATE `Sprache` SET `Text`='$v' " . + "WHERE `TextID`='" . $_POST["TextID"] . "' AND `Sprache`='$k' "; + $html .= $sql_save . "
"; + $Erg = sql_query($sql_save); + $html .= success(" $k Update: OK
\n"); + } else + $html .= "\t $k no changes
\n"; + } + } + + } + return $html; +} +?> + diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 630ca772..0399dda8 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -243,7 +243,7 @@ function admin_user() { Gekommen Aktiv T-Shirt - Registrier + Registriert Änd. '; $Gekommen = 0; diff --git a/includes/sys_menu.php b/includes/sys_menu.php index d5543f97..744d28d5 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -39,7 +39,8 @@ function make_navigation() { "admin_shifts", "admin_rooms", "admin_groups", - "admin_faq" + "admin_faq", + "admin_language" )); return $menu; } diff --git a/txt/TODO b/txt/TODO index d78d3198..62bbe106 100644 --- a/txt/TODO +++ b/txt/TODO @@ -1,8 +1,13 @@ jetzt: + * aktiv + * gekommen + * tshirt * schichtimport * schichtadministration * meine schichten * schichten + * Services? + * DECT-kram? * weckservice? später: diff --git a/www-ssl/index.php b/www-ssl/index.php index ded6c110..fe8c4795 100644 --- a/www-ssl/index.php +++ b/www-ssl/index.php @@ -93,6 +93,10 @@ if (in_array($p, $privileges)) { elseif ($p == "admin_faq") { require_once ('includes/pages/admin_faq.php'); $content = admin_faq(); + } + elseif ($p == "admin_language") { + require_once ('includes/pages/admin_language.php'); + $content = admin_language(); } else { require_once ('includes/pages/guest_start.php'); $content = guest_start();