summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apis/update.inc.php14
-rw-r--r--inc/database.inc.php2
-rw-r--r--inc/validator.inc.php54
-rw-r--r--lang/de/settings/setting.json2
-rw-r--r--lang/de/templates/minilinux/filelist.json1
-rw-r--r--lang/en/templates/minilinux/filelist.json1
-rw-r--r--modules/baseconfig.inc.php23
-rw-r--r--modules/minilinux.inc.php2
-rw-r--r--modules/sysconfig/addmodule_ad.inc.php2
-rw-r--r--templates/main-menu.html2
-rw-r--r--templates/minilinux/filelist.html1
11 files changed, 64 insertions, 40 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php
index 1912a3c1..9c0cf740 100644
--- a/apis/update.inc.php
+++ b/apis/update.inc.php
@@ -171,3 +171,17 @@ function update_5()
}
return true;
}
+
+// #######################
+// ##### 2014-12-04
+// Add displayvalue column to setting_*
+function update_6()
+{
+ foreach (array('setting_global', 'setting_distro') as $table) {
+ if (!tableHasColumn($table, 'displayvalue')) {
+ Database::exec("ALTER TABLE $table ADD `displayvalue` TEXT NOT NULL");
+ Database::exec("UPDATE $table SET displayvalue = value");
+ }
+ }
+ return true;
+}
diff --git a/inc/database.inc.php b/inc/database.inc.php
index 72b7d0d7..85bee4b1 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -16,7 +16,7 @@ class Database
*/
public static function getExpectedSchemaVersion()
{
- return 6;
+ return 7;
}
public static function needSchemaUpdate()
diff --git a/inc/validator.inc.php b/inc/validator.inc.php
index 20b843d7..6eac80f9 100644
--- a/inc/validator.inc.php
+++ b/inc/validator.inc.php
@@ -4,26 +4,31 @@
* This class contains all the helper functions that
* can be referenced by a config setting. Every function
* here is supposed to validate the given config value
- * and wither return the validated and possibly sanitized
+ * and either return the validated and possibly sanitized
* value, or false to indicate that the given value is invalid.
+ * The passed value is a reference, as it can also be modified
+ * by the validator to tweak the value that is being
+ * displayed in the web interface, compared to the returned
+ * value, which will only be used by the client directly,
+ * and is not displayed by the web interface.
*/
class Validator
{
- public static function validate($condition, $value)
+ public static function validate($condition, &$displayValue)
{
if (empty($condition))
- return $value;
+ return $displayValue;
$data = explode(':', $condition, 2);
switch ($data[0]) {
case 'regex':
- if (preg_match($data[1], $value))
- return $value;
+ if (preg_match($data[1], $displayValue))
+ return $displayValue;
return false;
case 'list':
- return self::validateList($data[1], $value);
+ return self::validateList($data[1], $displayValue);
case 'function':
- return self::$data[1]($value);
+ return self::$data[1]($displayValue);
default:
Util::traceError('Unknown validation method: ' . $data[0]);
}
@@ -36,42 +41,43 @@ class Validator
* Otherwise it it assumed that the value is a plain text
* password that is supposed to be hashed.
*/
- private static function linuxPassword($value)
+ private static function linuxPassword(&$displayValue)
{
- if (empty($value))
+ if (empty($displayValue))
return '';
- if (preg_match('/^\$[156]\$.+\$./', $value))
- return $value;
- return Crypto::hash6($value);
+ if (preg_match('/^\$[156]\$.+\$./', $displayValue))
+ return $displayValue;
+ return Crypto::hash6($displayValue);
}
/**
* "Fix" network share path for SMB shares where a backslash
* is used instead of a slash.
- * @param string $value network path
+ * @param string $displayValue network path
* @return string cleaned up path
*/
- private static function networkShare($value)
+ private static function networkShare(&$displayValue)
{
- $value = trim($value);
- if (substr($value, 0, 2) === '\\\\')
- $value = str_replace('\\', '/', $value);
- if (substr($value, 0, 2) === '//')
- $value = str_replace(' ', '\\040', $value);
- return $value;
+ $displayValue = trim($displayValue);
+ if (substr($displayValue, 0, 2) === '\\\\')
+ $displayValue = str_replace('\\', '/', $displayValue);
+ $returnValue = $displayValue;
+ if (substr($returnValue, 0, 2) === '//')
+ $returnValue = str_replace(' ', '\\040', $returnValue);
+ return $returnValue;
}
/**
* Validate value against list.
* @param string $list The list as a string of items, separated by "|"
- * @param string $value The value to validate
+ * @param string $displayValue The value to validate
* @return boolean|string The value, if in list, false otherwise
*/
- private static function validateList($list, $value)
+ private static function validateList($list, &$displayValue)
{
$list = explode('|', $list);
- if (in_array($value, $list))
- return $value;
+ if (in_array($displayValue, $list))
+ return $displayValue;
return false;
}
diff --git a/lang/de/settings/setting.json b/lang/de/settings/setting.json
index b1c7c009..e2fbe145 100644
--- a/lang/de/settings/setting.json
+++ b/lang/de/settings/setting.json
@@ -13,7 +13,7 @@
"SLX_PROXY_PORT": "Der Port des zu verwendenden Proxy Servers.",
"SLX_PROXY_TYPE": "Art des Proxys: *socks4*, *socks5*, *http-connect* (HTTP Proxy mit Unterst\u00fctzung der CONNECT-Methode),*http-relay* (Klassischer HTTP Proxy)",
"SLX_REMOTE_LOG_SESSIONS": "Legt fest, ob Logins und Logouts der Benutzer an den Satelliten gemeldet werden sollen.\r\n*yes* = Mit Benutzerkennung loggen\r\n*anonymous* = Anonym loggen\r\n*no* = Nicht loggen",
- "SLX_ROOT_PASS": "Das root-Passwort des Grundsystems. Wird nur f\u00fcr Diagnosezwecke am Client ben\u00f6tigt.Feld leer lassen, um root-Logins zu verbieten.\/Hinweis\/: Das Passwort wird crypt $6$ gehasht, daher wir das Passwort nach dem Speichern nicht mehr lesbar sein!",
+ "SLX_ROOT_PASS": "Das root-Passwort des Grundsystems. Wird nur f\u00fcr Diagnosezwecke am Client ben\u00f6tigt.\r\nFeld leer lassen, um root-Logins zu verbieten.\r\n\/Hinweis\/: Das Passwort wird im Klartext in der lokalen Datenbank hinterlegt, jedoch immer gehasht an die Clients \u00fcbermittelt (SHA-512 mit Salt). Wenn Sie das Passwort auch im Satelliten nicht im Klartext speichern wollen, k\u00f6nnen Sie hier auch ein vorgehashtes Passwort eintragen (im *$6$....*-Format).",
"SLX_SHUTDOWN_SCHEDULE": "Feste Uhrzeit, zu der sich die Rechner ausschalten, auch wenn noch ein Benutzer aktiv ist.Mehrere 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.Feld leer lassen, um die Funktion zu deaktivieren."
} \ No newline at end of file
diff --git a/lang/de/templates/minilinux/filelist.json b/lang/de/templates/minilinux/filelist.json
index ec659d1e..fa00b2ca 100644
--- a/lang/de/templates/minilinux/filelist.json
+++ b/lang/de/templates/minilinux/filelist.json
@@ -4,6 +4,7 @@
"lang_canUpdate2": "kann aktualisiert werden. F\u00fcr einen reibungslosen Betrieb wird empfohlen, alle Komponenten auf dem aktuellen Stand zu halten.",
"lang_configurationPackageNotFound": "Keine Konfigurationspakete gefunden!",
"lang_outdated": "Veraltet",
+ "lang_redownload": "Erneut herunterladen",
"lang_systemUpdated": "Das System ist auf dem aktuellen Stand.",
"lang_update": "Aktualisieren"
} \ No newline at end of file
diff --git a/lang/en/templates/minilinux/filelist.json b/lang/en/templates/minilinux/filelist.json
index 11835c10..33b6686d 100644
--- a/lang/en/templates/minilinux/filelist.json
+++ b/lang/en/templates/minilinux/filelist.json
@@ -4,6 +4,7 @@
"lang_canUpdate2": "can be updated. For a smooth operation, it is recommended to keep all components up to date.",
"lang_configurationPackageNotFound": "Configuration package not found!",
"lang_outdated": "Outdated",
+ "lang_redownload": "Download again",
"lang_systemUpdated": "The system is up to date.",
"lang_update": "Update"
} \ No newline at end of file
diff --git a/modules/baseconfig.inc.php b/modules/baseconfig.inc.php
index 2f62320e..fb18df6b 100644
--- a/modules/baseconfig.inc.php
+++ b/modules/baseconfig.inc.php
@@ -39,20 +39,21 @@ class Page_BaseConfig extends Page
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
$key = $row['setting'];
$validator = $row['validator'];
- $input = (isset($_POST['setting'][$key]) ? $_POST['setting'][$key] : '');
+ $displayValue = (isset($_POST['setting'][$key]) ? $_POST['setting'][$key] : '');
// Validate data first!
- $value = Validator::validate($validator, $input);
- if ($value === false) {
- Message::addWarning('value-invalid', $key, $input);
+ $mangledValue = Validator::validate($validator, $displayValue);
+ if ($mangledValue === false) {
+ Message::addWarning('value-invalid', $key, $displayValue);
continue;
}
// Now put into DB
- Database::exec("INSERT INTO setting_global (setting, value $qry_insert)
- VALUES (:key, :value $qry_values)
- ON DUPLICATE KEY UPDATE value = :value",
+ Database::exec("INSERT INTO setting_global (setting, value, displayvalue $qry_insert)
+ VALUES (:key, :value, :displayvalue $qry_values)
+ ON DUPLICATE KEY UPDATE value = :value, displayvalue = :displayvalue",
$this->qry_extra + array(
'key' => $key,
- 'value' => $value,
+ 'value' => $mangledValue,
+ 'displayvalue' => $displayValue
)
);
}
@@ -75,15 +76,15 @@ class Page_BaseConfig extends Page
}
// List global config option
$settings = array();
- $res = Database::simpleQuery('SELECT cat_setting.catid, setting.setting, setting.defaultvalue, setting.permissions, setting.validator, tbl.value
+ $res = Database::simpleQuery('SELECT cat_setting.catid, setting.setting, setting.defaultvalue, setting.permissions, setting.validator, tbl.displayvalue
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');
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
$row['description'] = Util::markup(Dictionary::translate('settings/setting', $row['setting']));
- if (is_null($row['value'])) $row['value'] = $row['defaultvalue'];
- $row['item'] = $this->makeInput($row['validator'], $row['setting'], $row['value']);
+ if (is_null($row['displayvalue'])) $row['displayvalue'] = $row['defaultvalue'];
+ $row['item'] = $this->makeInput($row['validator'], $row['setting'], $row['displayvalue']);
$settings[$row['catid']]['settings'][] = $row;
$settings[$row['catid']]['category_name'] = Dictionary::translate('settings/cat_setting', 'cat_' . $row['catid']);
}
diff --git a/modules/minilinux.inc.php b/modules/minilinux.inc.php
index 46c771c2..c9d73b61 100644
--- a/modules/minilinux.inc.php
+++ b/modules/minilinux.inc.php
@@ -37,7 +37,7 @@ class Page_MiniLinux extends Page
foreach ($system['files'] as &$file) {
$file['uid'] = 'dlid' . $count++;
$local = CONFIG_HTTP_DIR . '/' . $system['id'] . '/' . $file['name'];
- if (!file_exists($local) || filesize($local) !== $file['size'] || md5_file($local) !== substr($file['md5'], 0, 32)) {
+ if (!file_exists($local) || filesize($local) !== $file['size'] || filemtime($local) < $file['mtime']) {
$file['fileChanged'] = true;
$system['systemChanged'] = true;
}
diff --git a/modules/sysconfig/addmodule_ad.inc.php b/modules/sysconfig/addmodule_ad.inc.php
index 4c529b72..d43c9129 100644
--- a/modules/sysconfig/addmodule_ad.inc.php
+++ b/modules/sysconfig/addmodule_ad.inc.php
@@ -114,7 +114,7 @@ class AdModule_Finish extends AddModule_Base
}
$i = mb_stripos($binddn, '=' . $out[1] . ',');
if ($i === false) {
- Message::addError('value-invalid', $binddn, $out[1]);
+ Message::addError('value-invalid', 'binddn', $out[1]);
Util::redirect('?do=SysConfig&action=addmodule&step=AdModule_Start');
}
$searchbase = mb_substr($binddn, $i + 1);
diff --git a/templates/main-menu.html b/templates/main-menu.html
index fd63b556..937b171c 100644
--- a/templates/main-menu.html
+++ b/templates/main-menu.html
@@ -24,7 +24,7 @@
<li><a href="?do=ServerSetup">{{lang_configurationBasic}}</a></li>
<li><a href="?do=InternetAccess">{{lang_internetAccess}}</a></li>
<li><a href="?do=VmStore">{{lang_vmLocation}}</a></li>
- <li><a href="?do=Https">{{lang_webInterface}}</a></li>
+ <li><a href="?do=WebInterface">{{lang_webInterface}}</a></li>
<li><a href="?do=Backup">{{lang_backup}}</a></li>
</ul>
</li>
diff --git a/templates/minilinux/filelist.html b/templates/minilinux/filelist.html
index a46b6a99..39ed0b43 100644
--- a/templates/minilinux/filelist.html
+++ b/templates/minilinux/filelist.html
@@ -24,6 +24,7 @@
</div>
<div class="col-xs-2">
{{#fileChanged}}<span class="btn btn-primary btn-xs update-button" onclick="slxUpdate('{{uid}}', '{{id}}', '{{name}}')">{{lang_update}}</span>{{/fileChanged}}
+ {{^fileChanged}}<span class="btn btn-default btn-xs" onclick="slxUpdate('{{uid}}', '{{id}}', '{{name}}')">{{lang_redownload}}</span>{{/fileChanged}}
</div>
</div>
{{{download}}}