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; +}