summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apis/update.inc.php49
-rw-r--r--inc/dictionary.inc.php28
-rw-r--r--lang/de/settings/cat_setting.json7
-rw-r--r--lang/de/settings/setting.json16
-rw-r--r--lang/en/settings/cat_setting.json7
-rw-r--r--lang/en/settings/setting.json16
-rw-r--r--lang/pt/settings/cat_setting.json7
-rw-r--r--lang/pt/settings/setting.json16
-rw-r--r--modules/baseconfig.inc.php12
9 files changed, 135 insertions, 23 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php
index bab6bcea..3c4acfb2 100644
--- a/apis/update.inc.php
+++ b/apis/update.inc.php
@@ -1,6 +1,6 @@
<?php
-$targetVersion = 3;
+$targetVersion = 4;
// #######################
@@ -33,7 +33,6 @@ if ($currentVersion < $targetVersion) {
die("Updated to $currentVersion");
// #######################
-
// ##### 2014-05-28
// Add dateline field to property table
@@ -41,9 +40,11 @@ function update_1()
{
$res = Database::simpleQuery("DESCRIBE property", array(), false);
$type = false;
- if ($res === false) return;
+ if ($res === false)
+ return;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['Field'] !== 'dateline') continue;
+ if ($row['Field'] !== 'dateline')
+ continue;
$type = $row['Type'];
break;
}
@@ -56,7 +57,6 @@ function update_1()
}
// #######################
-
// ##### 2014-06-05
// Add 'news' table to database schema
function update_2()
@@ -64,7 +64,8 @@ function update_2()
$res = Database::simpleQuery("show tables", array(), false);
$found = false;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['Tables_in_openslx'] !== 'news') continue;
+ if ($row['Tables_in_openslx'] !== 'news')
+ continue;
$found = true;
break;
}
@@ -81,4 +82,38 @@ function update_2()
");
}
return true;
-} \ No newline at end of file
+}
+
+// #######################
+// ##### 2014-08-18
+// Remove setting descriptions from DB, put into json files now
+function update_3()
+{
+ $res = Database::simpleQuery("DESCRIBE setting", array(), false);
+ if ($res !== false) {
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ switch ($row['Field']) {
+ case 'de':
+ case 'en':
+ case 'pt':
+ case 'description':
+ Database::exec("ALTER TABLE setting DROP {$row['Field']}");
+ break;
+ }
+ }
+ }
+ $res = Database::simpleQuery("DESCRIBE cat_setting", array(), false);
+ if ($res !== false) {
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ switch ($row['Field']) {
+ case 'de':
+ case 'en':
+ case 'pt':
+ case 'name':
+ Database::exec("ALTER TABLE cat_setting DROP {$row['Field']}");
+ break;
+ }
+ }
+ }
+ return true;
+}
diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php
index c09baaab..6efd8fde 100644
--- a/inc/dictionary.inc.php
+++ b/inc/dictionary.inc.php
@@ -5,7 +5,7 @@ class Dictionary
private static $messageArray = false;
private static $languages;
- private static $templateCache = array();
+ private static $stringCache = array();
private static $hardcodedMessages = false;
public static function init()
@@ -60,8 +60,8 @@ class Dictionary
if ($lang === false)
$lang = LANG;
$file = Util::safePath("lang/" . $lang . "/" . $section . ".json");
- if (isset(self::$templateCache[$file]))
- return self::$templateCache[$file];
+ if (isset(self::$stringCache[$file]))
+ return self::$stringCache[$file];
$language = array('lang' => $lang);
$content = @file_get_contents($file);
if ($content === false) // File does not exist for language
@@ -69,16 +69,24 @@ class Dictionary
$json = json_decode($content, true);
if (!is_array($json))
return $language;
- return self::$templateCache[$file] = array_merge($language, $json);
+ return self::$stringCache[$file] = array_merge($language, $json);
}
- public static function translate($string)
+ public static function translate($section, $string = false)
{
- if (self::$hardcodedMessages === false)
- self::$hardcodedMessages = json_decode(file_get_contents("lang/" . LANG . "/messages-hardcoded.json"), true);
- if (!isset(self::$hardcodedMessages[$string]))
- return "(missing: $string :missing)";
- return self::$hardcodedMessages[$string];
+ if ($string === false) {
+ // Fallback: General "hardcoded" messages
+ $string = $section;
+ if (self::$hardcodedMessages === false)
+ self::$hardcodedMessages = json_decode(file_get_contents("lang/" . LANG . "/messages-hardcoded.json"), true);
+ if (!isset(self::$hardcodedMessages[$string]))
+ return "(missing: $string :missing)";
+ return self::$hardcodedMessages[$string];
+ }
+ $strings = self::getArray($section);
+ if (!isset($strings[$string]))
+ return "(missing: '$string' in '$section')";
+ return $strings[$string];
}
public static function getMessage($id)
diff --git a/lang/de/settings/cat_setting.json b/lang/de/settings/cat_setting.json
new file mode 100644
index 00000000..ab3d80a9
--- /dev/null
+++ b/lang/de/settings/cat_setting.json
@@ -0,0 +1,7 @@
+{
+ "cat_0": "Unkategorisiert",
+ "cat_1": "Inaktivit\u00e4t und Abschaltung",
+ "cat_2": "Internetzugriff",
+ "cat_3": "Zeitsynchronisation",
+ "cat_4": "Grundsystem"
+} \ No newline at end of file
diff --git a/lang/de/settings/setting.json b/lang/de/settings/setting.json
new file mode 100644
index 00000000..04249776
--- /dev/null
+++ b/lang/de/settings/setting.json
@@ -0,0 +1,16 @@
+{
+ "SLX_ADDONS": "Zu ladende Addons. Zur Zeit steht nur vmware zur Verf\u00fcgung.",
+ "SLX_BIOS_CLOCK": "Legt fest, ob und wie die interne Uhr des Rechners im Bezug auf die Systemzeit des \/MiniLinux\/ gesetzt werden soll.\n*off* = Die interne Uhr des Rechners wird nicht ver\u00e4ndert.\n*local* = Die interne Uhr wird auf die Lokalzeit gesetzt. Bevorzugt wenn z.B. noch eine native Windows-Installation auf dem PC vorhanden ist.\n*utc* = Die interne Uhr wird auf die \/Koordinierte Weltzeit\/ gesetzt. Dies ist die g\u00e4ngige Einstellung in einem reinen Linux-Umfeld.",
+ "SLX_LOGOUT_TIMEOUT": "Zeit \/in Sekunden\/, die eine Benutzersitzung ohne Aktion sein darf, bevor sie beendet wird.\nFeld leer lassen, um die Funktion zu deaktivieren.",
+ "SLX_NET_DOMAIN": "DNS-Dom\u00e4ne, in die sich die Clients eingliedern, sofern der DHCP Server keine solche vorgibt.",
+ "SLX_NTP_SERVER": "Adresse des NTP-Zeitservers. Es k\u00f6nnen mehrere Server mit Leerzeichen getrennt angegeben werden.\nDie Server werden der Reihe nach angefragt, bis ein antwortender Server gefunden wird.",
+ "SLX_PROXY_BLACKLIST": "Adressen bzw. Adressbereiche, f\u00fcr die der Proxyserver nicht verwendet werden soll (z.B. der Adressbereich der Einrichtung). G\u00fcltige Angaben sind einzelne IP-Adressen, sowie IP-Bereiche in CIDR-Notation (z.B. 1.2.0.0\/16). Mehrere Angaben k\u00f6nnen durch Leerzeichen getrennt werden.",
+ "SLX_PROXY_IP": "Die Adresse des zu verwendenden Proxy Servers.",
+ "SLX_PROXY_MODE": "Legt fest, ob zum Zugriff aufs Internet ein Proxy-Server ben\u00f6tigt wird.\n*off* = keinen Proxy benutzen.\n*on* = Proxy immer benutzen.\n*auto* = Proxy nur benutzen, wenn sich der Client-PC in einem privaten Adressbereich befindet.",
+ "SLX_PROXY_PORT": "Der Port des zu verwendenden Proxy Servers.",
+ "SLX_PROXY_TYPE": "Art des Proxys.\n*socks4*, *socks5*,\n*http-connect* (HTTP Proxy mit Unterst\u00fctzung der CONNECT-Methode),\n*http-relay* (Klassischer HTTP Proxy)",
+ "SLX_REMOTE_LOG_SESSIONS": "Legt fest, ob Logins und Logouts der Benutzer an den Satelliten gemeldet werden sollen.\n*yes* = Mit Benutzerkennung loggen\n*anonymous* = Anonym loggen\n*no* = Nicht loggen",
+ "SLX_ROOT_PASS": "Das root-Passwort des Grundsystems. Wird nur f\u00fcr Diagnosezwecke am Client ben\u00f6tigt.\nFeld leer lassen, um root-Logins zu verbieten.\n\/Hinweis\/: Das Passwort wird crypt $6$ gehasht, daher wir das Passwort nach dem Speichern nicht mehr lesbar sein!",
+ "SLX_SHUTDOWN_SCHEDULE": "Feste Uhrzeit, zu der sich die Rechner ausschalten, auch wenn noch ein Benutzer aktiv ist.\nMehrere Zeitpunkte k\u00f6nnen durch Leerzeichen getrennt angegeben werden.",
+ "SLX_SHUTDOWN_TIMEOUT": "Zeit in Sekunden, nach dem ein Rechner abgeschaltet wird, sofern kein Benutzer angemeldet ist.\nFeld leer lassen, um die Funktion zu deaktivieren."
+} \ No newline at end of file
diff --git a/lang/en/settings/cat_setting.json b/lang/en/settings/cat_setting.json
new file mode 100644
index 00000000..4f408f32
--- /dev/null
+++ b/lang/en/settings/cat_setting.json
@@ -0,0 +1,7 @@
+{
+ "cat_0": "Uncategorized",
+ "cat_1": "Inactivity and Shutdown",
+ "cat_2": "Internet Access",
+ "cat_3": "Time Synchronization",
+ "cat_4": "Basic System"
+} \ No newline at end of file
diff --git a/lang/en/settings/setting.json b/lang/en/settings/setting.json
new file mode 100644
index 00000000..fc857465
--- /dev/null
+++ b/lang/en/settings/setting.json
@@ -0,0 +1,16 @@
+{
+ "SLX_ADDONS": "To load addons. There currently only vmware is available.",
+ "SLX_BIOS_CLOCK": "Specifies whether and how the internal clock of the computer should be set in relation to the system time of the \/MiniLinux\/.\n*off* = The internal clock of the computer is not changed.\n*local* = The internal clock is set to local time. Preferably if, for example, there is still a native Windows installation available on the PC.\n*utc* = The internal clock is set to the \/Coordinated Universal Time\/. This is the most common setup in a pure Linux environment.",
+ "SLX_LOGOUT_TIMEOUT": "Time \/in seconds\/, in which a user session may remain without action before it is terminated.\nLeave field blank to disable the function.",
+ "SLX_NET_DOMAIN": "DNS domain in which the client integrate, provided the DHCP server does not specifies such.",
+ "SLX_NTP_SERVER": "Address of the NTP time server. Multiple servers can be specified separated by spaces.\nThe servers are queried in sequence until a responding server is found.",
+ "SLX_PROXY_BLACKLIST": "Address or addresses ranges in which the proxy server is not used (for example the address range of the device). Valid entries are individual IP addresses and IP ranges in CIDR notation (for example 1.2.0.0\/16). Multiple selections can be separated by spaces.",
+ "SLX_PROXY_IP": "The address to use for the proxy server.",
+ "SLX_PROXY_MODE": "Determines whether a proxy server is required to access the Internet.\n*off* = do not use a Proxy.\n*on* = Always use proxy.\n*auto* = Only use proxy when the client PC is in a private address space.",
+ "SLX_PROXY_PORT": "The port to use for the proxy server.",
+ "SLX_PROXY_TYPE": "Type of the proxy.\n*socks4*, *socks5*,\n*http-connect* (HTTP proxy with support from the CONNECT method),\n*http-relay* (Classic HTTP proxy)",
+ "SLX_REMOTE_LOG_SESSIONS": "Determines whether logins and logouts of the users should be reported to the satellite.\n*yes* = login with user ID\n*anonymous* = anonymous login\n*no* = no login",
+ "SLX_ROOT_PASS": "The root password of the basic system. Only required for diagnostic purposes on the client.\nLeave field blank to disallow root logins.\n\/Hint\/: The password is encrypted with $6$ hash, so it is no longer readable after saving!",
+ "SLX_SHUTDOWN_SCHEDULE": "Fixed time to turn off the computer, even if there is a user active.\nSeveral times can be specified, separated by spaces.",
+ "SLX_SHUTDOWN_TIMEOUT": "Time in seconds after which a computer is switched off, if no user is logged on.\nLeave blank to disable the function."
+} \ No newline at end of file
diff --git a/lang/pt/settings/cat_setting.json b/lang/pt/settings/cat_setting.json
new file mode 100644
index 00000000..6ad77f0a
--- /dev/null
+++ b/lang/pt/settings/cat_setting.json
@@ -0,0 +1,7 @@
+{
+ "cat_0": "Sem Categoria",
+ "cat_1": "Inatividade e Desligamento",
+ "cat_2": "Acesso \u00e0 Internet",
+ "cat_3": "Sincroniza\u00e7\u00e3o de Tempo",
+ "cat_4": "Sistema B\u00e1sico"
+} \ No newline at end of file
diff --git a/lang/pt/settings/setting.json b/lang/pt/settings/setting.json
new file mode 100644
index 00000000..f8c0d672
--- /dev/null
+++ b/lang/pt/settings/setting.json
@@ -0,0 +1,16 @@
+{
+ "SLX_ADDONS": "Para carregar addons. Atualmente apenas o vmware est\u00e1 dispon\u00edvel.",
+ "SLX_BIOS_CLOCK": "Especifica se e como o rel\u00f3gio interno do computador deve ser definido em rela\u00e7\u00e3o ao hor\u00e1rio do sistema do \/MiniLinux\/.\n*off* = O rel\u00f3gio interno do computador n\u00e3o \u00e9 alterado.\n*local* = O rel\u00f3gio interno est\u00e1 definido para a hora local. De prefer\u00eancia se, por exemplo, ainda existe uma instala\u00e7\u00e3o Windows nativo dispon\u00edvel no PC.\n*utc* = O rel\u00f3gio interno \u00e9 definido para o \/Tempo Universal Coordenado\/. Esta \u00e9 a configura\u00e7\u00e3o mais comum em um ambiente puramente Linux",
+ "SLX_LOGOUT_TIMEOUT": "Hora \/em segundos\/, em que uma sess\u00e3o de usu\u00e1rio pode permanecer sem a\u00e7\u00e3o antes de ser encerrada.\nDeixe o campo em branco para desativar a fun\u00e7\u00e3o.",
+ "SLX_NET_DOMAIN": "Dom\u00ednio DNS no qual o cliente se integra, desde que o servidor DHCP n\u00e3o especifique tal.",
+ "SLX_NTP_SERVER": "Endere\u00e7o do servidor de hor\u00e1rio NTP. V\u00e1rios servidores podem ser especificados separados por espa\u00e7os.\nOs servidores s\u00e3o consultados em seq\u00fc\u00eancia at\u00e9 que um servidor respondendo for encontrado.",
+ "SLX_PROXY_BLACKLIST": "Intervalos de endere\u00e7os em que o servidor proxy n\u00e3o \u00e9 usado (por exemplo, o intervalo de endere\u00e7o do dispositivo). As entradas v\u00e1lidas s\u00e3o endere\u00e7os IP individuais e intervalos de IP em nota\u00e7\u00e3o CIDR (por exemplo 1.2.0.0\/16). Sele\u00e7\u00f5es m\u00faltiplas podem ser separadas por espa\u00e7os.",
+ "SLX_PROXY_IP": "O endere\u00e7o de servidor proxy a ser usado.",
+ "SLX_PROXY_MODE": "Determina se um servidor proxy \u00e9 necess\u00e1rio para acessar a Internet.\n*off* = n\u00e3o utilizar proxy.\n*on* = sempre utilizar proxy.\n*auto* = apenas utilizar proxy quando o PC cliente estiver em um espa\u00e7o de endere\u00e7o privado.",
+ "SLX_PROXY_PORT": "A porta a ser utilizada pelo servidor proxy.",
+ "SLX_PROXY_TYPE": "Tipo do proxy.\n*socks4*, *socks5*,\n*http-connect* (Proxy HTTP com suporte ao m\u00e9todo CONNECT),\n*http-relay* (Cl\u00e1ssico proxy HTTP)",
+ "SLX_REMOTE_LOG_SESSIONS": "Determina se logins e logouts dos usu\u00e1rios devem ser reportados ao sat\u00e9lite.\n*yes* = Login com ID de usu\u00e1rio\n*anonymous* = login an\u00f4nimo\n*no* = sem login",
+ "SLX_ROOT_PASS": "A senha root do sistema base. Exigido somente para fins de diagn\u00f3stico no cliente.\nDeixar campo em branco para n\u00e3o permitir login com root.\n\/Dica\/: A senha \u00e9 criptografada com hash $6$, ent\u00e3o se torna ileg\u00edvel ap\u00f3s ser salva!",
+ "SLX_SHUTDOWN_SCHEDULE": "Hor\u00e1rio fixo para desligar o computador, at\u00e9 mesmo caso tenha um usu\u00e1rio ativo.\nM\u00faltiplos hor\u00e1rios podem ser especificados, separados por espa\u00e7os.",
+ "SLX_SHUTDOWN_TIMEOUT": "Tempo em segundos no qual um computador \u00e9 desligado, caso n\u00e3o tenha um usu\u00e1rio logado.\nDeixar em branco para desabilitar a fun\u00e7\u00e3o."
+} \ No newline at end of file
diff --git a/modules/baseconfig.inc.php b/modules/baseconfig.inc.php
index 7c8aaa4d..1e4093b2 100644
--- a/modules/baseconfig.inc.php
+++ b/modules/baseconfig.inc.php
@@ -75,21 +75,21 @@ class Page_BaseConfig extends Page
}
// List global config option
$settings = array();
- $res = Database::simpleQuery('SELECT cat_setting.' . LANG . ' AS category_name, setting.setting, setting.defaultvalue, setting.permissions, setting.' . LANG . ' AS description, tbl.value
+ $res = Database::simpleQuery('SELECT cat_setting.catid, setting.setting, setting.defaultvalue, setting.permissions, tbl.value
FROM setting
INNER JOIN cat_setting USING (catid)
LEFT JOIN setting_global AS tbl USING (setting)
ORDER BY cat_setting.sortval ASC, setting.setting ASC'); // TODO: Add setting groups and sort order
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $row['description'] = Util::markup($row['description']);
+ $row['description'] = Util::markup(Dictionary::translate('settings/setting', $row['setting']));
if (is_null($row['value'])) $row['value'] = $row['defaultvalue'];
$row['big'] = false;
- $settings[$row['category_name']]['settings'][] = $row;
- $settings[$row['category_name']]['category_name'] = $row['category_name'];
+ $settings[$row['catid']]['settings'][] = $row;
+ $settings[$row['catid']]['category_name'] = Dictionary::translate('settings/cat_setting', 'cat_' . $row['catid']);
}
- $settings = array_values($settings);
+
Render::addTemplate('page-baseconfig', array(
- 'categories' => $settings
+ 'categories' => array_values($settings)
));
}