get("mb_user_id"); if (!isset($userId) or $userId =='') { $userId = PUBLIC_USER; //or public Mapbender::session()->set("mb_user_id",$userId); } $languageCode = 'de'; //parameters: //id - wmc id //languageCode - language parameter 'de', 'en', 'fr' //$wmsServiceDisclaimerUrl = ""; $admin = new administration(); //initialize variables $hostName = $_SERVER['HTTP_HOST']; //$userId = PUBLIC_USER; $id = 4373; //dummy id $withHeader = false; //TODO give requesting hostname to this script if (isset($_REQUEST["id"]) & $_REQUEST["id"] != "") { if ($_REQUEST["id"] == "current") { $id = "current"; } else { //validate to integer $testMatch = $_REQUEST["id"]; $pattern = '/^[\d]*$/'; if (!preg_match($pattern,$testMatch)){ echo 'id is not valid.
'; die(); } $id = (integer)$testMatch; $testMatch = NULL; } } if (isset($_REQUEST["withHeader"]) & $_REQUEST["withHeader"] != "") { //validate to wms, wfs $testMatch = $_REQUEST["withHeader"]; if (!($testMatch == 'true' or $testMatch == 'false')){ echo 'withHeader is not a valid boolean.
'; die(); } else { switch ($testMatch) { case "true": $withHeader = true; break; } } $testMatch = NULL; } //TODO give requesting hostname to this script if (isset($_REQUEST["hostName"]) & $_REQUEST["hostName"] != "") { //validate to some hosts $testMatch = $_REQUEST["hostName"]; //look for whitelist in mapbender.conf $HOSTNAME_WHITELIST_array = explode(",",HOSTNAME_WHITELIST); if (!in_array($testMatch,$HOSTNAME_WHITELIST_array)) { echo "Requested hostname not in whitelist! Please control your mapbender.conf."; $e = new mb_notice("Whitelist: ".HOSTNAME_WHITELIST); $e = new mb_notice($testMatch." not found in whitelist!"); die(); } $hostName = $testMatch; $testMatch = NULL; } $e = new mb_notice("mod_getWmcDisclaimer.php: requested wmc id: ".$_REQUEST["id"]); // $sessionLang = Mapbender::session()->get("mb_lang"); if (isset($sessionLang) && ($sessionLang!='')) { $e = new mb_notice("mod_showMetadata.php: language found in session: ".$sessionLang); $language = $sessionLang; $langCode = explode("_", $language); $langCode = $langCode[0]; # Hopefully de or s.th. else $languageCode = $langCode; #overwrite the GET Parameter with the SESSION information } if (isset($_REQUEST["languageCode"]) & $_REQUEST["languageCode"] != "") { //validate to csv integer list $testMatch = $_REQUEST["languageCode"]; if (!($testMatch == 'de' or $testMatch == 'fr' or $testMatch == 'en')){ //echo 'languageCode: '.$testMatch.' is not valid.
'; echo 'Parameter languageCode is not valid (de,fr,en).
'; die(); } $languageCode = $testMatch; $e = new mb_notice("mod_showMetadata.php: languageCode from GET parameter: ".$languageCode); $testMatch = NULL; } $localeObj->setCurrentLocale($languageCode); //javascript:openwindow("../php/mod_showMetadata.php?resource=layer&layout=tabs&redirectToMetadataUrl=1&id=20655"); //Generate wmc document by id $wmcFactory = new WmcFactory; if ($id !== "current") { //$e = new mb_notice("mod_getWmcDisclaimer.php: wmcid: ".$id); $wmcObj = $wmcFactory->createFromDb($id); } else { //read wmc from session if available and fill the needed fields from wmc object $wmcDocSession = false; //check if wmc filename is in session - TODO only if should be loaded from session not else! (Module loadWMC) if(Mapbender::session()->get("mb_wmc")) { $wmc_filename = Mapbender::session()->get("mb_wmc"); //$time_start = microtime(); //load it from whereever it has been stored $wmcDocSession = $admin->getFromStorage($wmc_filename, TMP_WMC_SAVE_STORAGE); $wmcObj = $wmcFactory->createFromXml($wmcDocSession); } } //generate HTML Header if ($withHeader){ //e.g. tabs and their content $html = ''; $html .= ''; $metadataStr .= '' . ''._mb('Use Constraints').'' . ''. '' . ''. ''. ''. ''. ''. '' . '' . ''; echo $html.$metadataStr; } //generate header for disclaimer: echo "
Fenster schliessen
"; echo ""._mb('The document includes data resources from different organizations. The following parapgraph shows the different terms of use for the includes resources:')."

";# //Part for wms $resourceSymbol = ""._mb("; //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://"; } $countWMS = count($validWMS); for ($i = 0; $i < $countWMS; $i++) { $WMS = $validWMS[$countWMS - ($i+1)]; echo $resourceSymbol." ".$WMS['title']."
"; $constraints = new OwsConstraints(); $constraints->languageCode = $languageCode; $constraints->asTable = true; $constraints->id = $WMS['id']; $constraints->type = "wms"; $constraints->returnDirect = false; $touForWMS = $constraints->getDisclaimer(); if ($touForWMS == 'free'){ $wmstou = _mb('No informations about terms of use are available!'); } else { $wmstou = $touForWMS; } echo $wmstou."
"; } if ($withHeader){ echo ""; } //var_dump($validWMS); //module to read out all service ids which are stored in mapbender wmc documents and generate a Big Disclaimer for those Docs. //It integrates all known disclaimers for the used webservices who are stored in the mapbender registry //read out all wms id's //read out all wfs id's //generate the disclaimer part for wms //generate the disclaimer part for wfs //push disclaimer to json or html ?>