diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 6b8d24ea..5c26bc2e 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -2701,6 +2701,9 @@ class LAMCfgMain { */ public function importData($data) { foreach ($data as $dataKey => $dataValue) { + if (!(is_array($dataValue) || is_string($dataValue) || is_int($dataValue) || is_bool($dataValue))) { + throw new LAMException('Invalid import data type for ' . htmlspecialchars($dataKey) . ': ' . gettype($dataValue)); + } $this->$dataKey = $dataValue; } } diff --git a/lam/templates/config/confImportExport.php b/lam/templates/config/confImportExport.php new file mode 100644 index 00000000..d51b8cda --- /dev/null +++ b/lam/templates/config/confImportExport.php @@ -0,0 +1,168 @@ +checkPassword($_SESSION["mainconf_password"])) { + $exporter = new ConfigDataExporter(); + if (!headers_sent()) { + header('Content-Type: application/json; charset=utf-8'); + header('Content-disposition: attachment; filename=lam-config.json'); + } + echo $exporter->exportAsJson(); + exit; +} + +echo $_SESSION['header']; +printHeaderContents(_("Import and export configuration"), '../..'); + +?> + +
+ ++ + + + | +