language cleanup

This commit is contained in:
Philip Häusler 2013-11-25 21:07:08 +01:00
parent aad54bfe88
commit 813751ac7a
4 changed files with 1 additions and 63 deletions

View File

@ -1,24 +0,0 @@
<?php
/**
* Load a string by key.
*
* @param string $textid
* @param string $sprache
*/
function Sprache($textid, $sprache) {
$sprache_source = sql_select("
SELECT *
FROM `Sprache`
WHERE `TextID`='" . sql_escape($textid) . "'
AND `Sprache`='" . sql_escape($sprache) . "'
LIMIT 1
");
if ($sprache_source === false)
return false;
if (count($sprache_source) == 1)
return $sprache_source[0];
return null;
}
?>

View File

@ -83,7 +83,7 @@ function make_navigation_for($name, $pages) {
$menu = "";
foreach ($pages as $page)
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>';
if ($menu != "")
$menu = '<nav class="container"><h4>' . $name . '</h4><ul class="content">' . $menu . '</ul></nav>';

View File

@ -1,36 +0,0 @@
<?php
/**
* Names of available languages.
*/
$languages = array (
'DE' => "Deutsch",
'EN' => "English"
);
/**
* Display acutual translation of given text id.
* @param string $TextID
* @param bool $NoError
* @return string
*/
function Get_Text($TextID, $NoError = false) {
global $debug;
if (!isset ($_SESSION['Sprache']))
$_SESSION['Sprache'] = "EN";
if ($_SESSION['Sprache'] == "")
$_SESSION['Sprache'] = "EN";
if (isset ($_GET["SetLanguage"]))
$_SESSION['Sprache'] = $_GET["SetLanguage"];
$sprache_source = Sprache($TextID, $_SESSION['Sprache']);
if($sprache_source === false)
engelsystem_error("Unable to load text key.");
if($sprache_source == null) {
if($NoError && !$debug)
return "";
return $TextID;
}
return $sprache_source['Text'];
}
?>

View File

@ -11,11 +11,9 @@ require_once ('includes/sys_page.php');
require_once ('includes/sys_template.php');
require_once ('includes/model/LogEntries_model.php');
require_once ('includes/model/Sprache_model.php');
require_once ('includes/model/User_model.php');
require_once ('includes/view/Shifts_view.php');
require_once ('includes/view/Sprache_view.php');
require_once ('includes/view/User_view.php');
require_once ('includes/helper/internationalization_helper.php');