$sql .= "AND wfs_conf_element.f_show = 1 ORDER BY wfs_conf_element.f_respos;";
     $v = array($wfs_conf_id);
     $t = array('i');
     #echo $sql;
     $res = db_prep_query($sql, $v, $t);
     $col = array();
     while ($row = db_fetch_array($res)) {
         array_push($col, $row["element_name"]);
     }
     if (count($col) == 0) {
         die("wfs_conf_element data not available");
     }
     // append authorisation condition to filter
     $filter = checkAccessConstraint($filter, $wfs_conf_id);
     $admin = new administration();
     $req = urldecode($url) . urlencode($admin->char_decode(stripslashes($filter)));
     $mygml = new gml2();
     $mygml->parseFile($req);
     if (!empty($exportToShape)) {
         $filenamePrefix = md5(microtime());
         $mygml->toShape($filenamePrefix);
         header("Content-Type: application/json; charset=utf-8");
         echo '{"filename": "' . $filenamePrefix . '.zip"}';
     } else {
         header("Content-Type: application/json; charset=utf-8");
         echo $mygml->toGeoJSON();
     }
 } else {
     if ($command == "getFeature") {
         $admin = new administration();
         $wfsGetFeature = $admin->checkURL($wfsGetFeature);
     } else {
         $url = $capabilities . "REQUEST=GetCapabilities&" . "SERVICE=WMS&VERSION=" . $version;
     }
 }
 //$url is the url to the service which should be monitored in this cycle
 //initialize monitoriung in db (set status=-2)
 echo "initialize monitoring for user: "******" WMS: " . $wms_id_own[$k] . $br;
 $e = new mb_notice("mod_monitorCapabilities_main.php: wms: " . $wms_id_own[$k]);
 $sql = "INSERT INTO mb_monitor (upload_id, fkey_wms_id, " . "status, status_comment, timestamp_begin, timestamp_end, " . "upload_url, updated)";
 $sql .= "VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8)";
 $v = array($time, $wms_id_own[$k], "-2", "Monitoring is still in progress...", time(), "0", $url, "0");
 $t = array('s', 'i', 's', 's', 's', 's', 's', 's');
 $res = db_prep_query($sql, $v, $t);
 // Decode orig capabilities out of db cause they are converted before
 // saving them while upload
 $capDoc = $admin->char_decode($capDoc);
 // do the next to exchange the update before by another behavior! -
 // look in class_monitor.php !
 $currentFilename = "wms_monitor_report_" . $time . "_" . $wms_id_own[$k] . "_" . $userid . ".xml";
 $report = fopen(dirname(__FILE__) . "/tmp/" . $currentFilename, "a");
 //$e = new mb_notice("mod_monitorCapabilities_main.php: currentFilename: ".dirname(__FILE__)."/tmp/".$currentFilename);
 $lb = chr(13) . chr(10);
 fwrite($report, "<monitorreport>" . $lb);
 fwrite($report, "<wms>" . $lb);
 fwrite($report, "<wms_id>" . $wms_id_own[$k] . "</wms_id>" . $lb);
 fwrite($report, "<upload_id>" . $time . "</upload_id>" . $lb);
 fwrite($report, "<getcapbegin></getcapbegin>" . $lb);
 fwrite($report, "<getcapurl>" . urlencode($url) . "</getcapurl>" . $lb);
 fwrite($report, "<getcapdoclocal>" . urlencode($capDoc) . "</getcapdoclocal>" . $lb);
 fwrite($report, "<getcapdocremote></getcapdocremote>" . $lb);
 fwrite($report, "<getcapdiff></getcapdiff>" . $lb);