$options["show"] = intval(Mapbender::session()->get("addwms_showWMS"));
}
if (Mapbender::session()->exists("addwms_zoomToExtent")) {
    $options["zoom"] = !!Mapbender::session()->get("addwms_zoomToExtent");
}
$getParams = array("WMC" => getConfiguration("WMC"), "WMS" => getConfiguration("WMS"), "LAYER" => getConfiguration("LAYER"), "FEATURETYPE" => getConfiguration("FEATURETYPE"), "GEORSS" => getConfiguration("GEORSS"));
$getApi = new GetApi($getParams);
//
// WMC
//
$inputWmcArray = $getApi->getWmc();
if ($inputWmcArray) {
    foreach ($inputWmcArray as $input) {
        // just make it work for a single Wmc
        try {
            $wmcGetApi = WmcFactory::createFromDb($input["id"]);
            //update urls from wmc with urls from database if id is given
            $updatedWMC = $wmcGetApi->updateUrlsFromDb();
            $wmcGetApi->createFromXml($updatedWMC);
            //increment load count
            $wmcGetApi->incrementWmcLoadCount();
        } catch (Exception $e) {
            new mb_exception("Failed to load WMC from DB. Keeping original WMC.");
        }
    }
}
//
// WMS
//
if ($getParams['WMS']) {
    // WMS param given as array
         $resultObj["customCats"][] = $row["fkey_custom_category_id"];
     }
     $ajaxResponse->setResult($resultObj);
     $ajaxResponse->setSuccess(true);
     break;
 case "save":
     global $firephp;
     $data = $ajaxResponse->getParameter("data");
     try {
         $wmcId = intval($data->wmc->wmc_id);
     } catch (Exception $e) {
         $ajaxResponse->setSuccess(false);
         $ajaxResponse->setMessage(_mb("Invalid WMC ID."));
         $ajaxResponse->send();
     }
     $wmcFactory = new WmcFactory();
     $wmc = $wmcFactory->createFromDb($wmcId);
     if (is_null($wmc)) {
         $ajaxResponse->setSuccess(false);
         $ajaxResponse->setMessage(_mb("Invalid WMC ID."));
         $ajaxResponse->send();
     }
     $columns = array("wmc_abstract", "wmc_title", "wmc_keyword", "isoTopicCats", "inspireCats", "customCats", "public");
     foreach ($columns as $c) {
         $value = $data->wmc->{$c};
         if ($c === "wmc_keyword") {
             $wmc->{$c} = explode(",", $value);
             foreach ($wmc->{$c} as &$val) {
                 $val = trim($val);
             }
             if (!$value) {
    case "en":
        $translation['wmcDisclaimerHeader'] = 'The document includes data resources from different organizations. The following parapgraph shows the different terms of use for the includes resources:';
        $translation['wms'] = "Web Map Service";
        $translation['wfs'] = "Web Feature Service";
        $translation['noTouInformation'] = 'No informations about terms of use are available!';
        break;
    default:
        #to english
        $translation['wmcDisclaimerHeader'] = 'The document includes data resources from different organizations. The following parapgraph shows the different terms of use for the includes resources:';
        $translation['wms'] = "Web Map Service";
        $translation['wfs'] = "Web Feature Service";
        $translation['noTouInformation'] = 'No informations about terms of use are available!';
}
//javascript:openwindow("../php/mod_showMetadata.php?resource=layer&layout=tabs&redirectToMetadataUrl=1&id=20655");
//Generate wmc document by id
$wmcFactory = new WmcFactory();
$e = new mb_exception("mod_getWmcDisclaimer.php: wmcid: " . $id);
$wmcObj = $wmcFactory->createFromDb($id);
//generate header for disclaimer:
echo "<b>" . $translation['wmcDisclaimerHeader'] . "</b><br><br>";
#
//Part for wms
$resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='" . $translation['wms'] . " - picture' title='" . $translation['wms'] . "'>";
//read out all wms id's
$validWMS = $wmcObj->getValidWms();
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
    $mapbenderBaseUrl = "https://" . $hostName;
    $mapbenderProtocol = "https://";
} else {
    $mapbenderBaseUrl = "http://" . $hostName;
    $mapbenderProtocol = "http://";