From c7966db8f2d69218a6d7a5671e23ef15e3147890 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Tue, 18 Aug 2026 19:09:40 +0200 Subject: [PATCH] NC connector: persist generic fileid source scope --- include/nc_connector_generic_scope.inc.php | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 include/nc_connector_generic_scope.inc.php diff --git a/include/nc_connector_generic_scope.inc.php b/include/nc_connector_generic_scope.inc.php new file mode 100644 index 0000000..df82e4a --- /dev/null +++ b/include/nc_connector_generic_scope.inc.php @@ -0,0 +1,99 @@ +(int)($root['fileid'] ?? 0), + 'display_name'=>(string)($root['display_name'] ?? ''), + 'webdav_path'=>(string)($root['webdav_path'] ?? ''), + ); + }, $roots)); + unset($config['showcase_user']); + + foreach ($config['roots'] as $root) + { + if ((int)$root['fileid'] < 1 || trim((string)$root['display_name']) === '') throw new RuntimeException('Eine ausgewählte Nextcloud-Quelle ist unvollständig.'); + } + + $config_json = json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + if (!is_string($config_json)) throw new RuntimeException('Die Quellenkonfiguration konnte nicht serialisiert werden.'); + $table = bratonien_tools_nc_connector_table(); + pwg_query("UPDATE `$table` SET config_json='".pwg_db_real_escape_string($config_json)."' WHERE id=".$connection_id." LIMIT 1"); + + unset($_SESSION['bratonien_nc_wizard']); + unset($result['connection_id']); + $result['message'] = 'Verbindung wurde mit generischer Nextcloud-Quellenauswahl angelegt. '.$result['message']; + return $result; +}