$sql .= "FROM wms, gui_wms ";
     $sql .= "WHERE wms.wms_id = gui_wms.fkey_wms_id AND gui_wms.fkey_gui_id IN (";
     $v = array(Mapbender::session()->get("mb_lang"));
     $t = array("s");
     for ($i = 0; $i < count($guiIdArray); $i++) {
         if ($i > 0) {
             $sql .= ",";
         }
         $sql .= "\$" . strval($i + 2);
         array_push($v, $guiIdArray[$i]);
         array_push($t, "s");
     }
     $sql .= ") ORDER BY wms_title";
     $res = db_prep_query($sql, $v, $t);
     while ($row = db_fetch_array($res)) {
         $owsproxy = $admin->getWMSOWSstring($row["wms_id"]);
         if ($owsproxy && $owsproxy != "") {
             $owsproxyUrl = OWSPROXY . "/" . session_id() . "/" . $owsproxy . "?";
             $wmsUrl = $owsproxyUrl;
         } else {
             $wmsUrl = $row["wms_getcapabilities"];
         }
         $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $wmsUrl, "version" => $row["wms_version"]);
         array_push($resultObj["wms"], $resultArray);
     }
 } else {
     if ($command == "getWMSByGroup") {
         $resultObj["wms"] = array();
         $sql = "SELECT DISTINCT wms_id, wms_title, gettext(\$1, wms_abstract) as wms_abstract, wms_getcapabilities, wms_version ";
         $sql .= "FROM wms, gui_wms, gui_mb_group ";
         $sql .= "WHERE wms.wms_id = gui_wms.fkey_wms_id AND gui_wms.fkey_gui_id = gui_mb_group.fkey_gui_id AND gui_mb_group.fkey_mb_group_id = \$2";
            #set the log value to 1 or 0
            $admin->setWmsLogTag(intval($parts[1]), $value);
            #if value is 0 then set the price to 0 to. there would be is no sense to have a price set - maybe change this behavior
            if ($value == 0) {
                $admin->setWmsPrice(intval($value), intval($parts[1]));
            }
            #echo "log: $var = $value<br>";
        }
        #check proxy fields
        if ($parts[0] == 'status' && $parts[2] == 'proxy') {
            #echo ("proxy settings identified: WMS_ID: ".intval($parts[1])." Value: ".$value."<br>");
            #echo ("Is active?: ");
            #if ($admin->getWMSOWSstring(intval($parts[1]))=="") {echo " no";} else {echo " yes";}
            #echo ("<br>");
            #check if proxy should be activated and is not set
            if ($value == 1 && $admin->getWMSOWSstring(intval($parts[1])) == "") {
                #activate it!
                $admin->setWMSOWSstring(intval($parts[1]), $value);
                #echo "Activate Proxy for ".intval($parts[1])."<br>";
            }
            #check if active proxy should be deactivated
            if ($value == 0 && $admin->getWMSOWSstring(intval($parts[1])) !== "") {
                #deactivate it
                $admin->setWMSOWSstring(intval($parts[1]), $value);
                #echo "Deactivate Proxy for ".intval($parts[1])."<br>";
            }
        }
    }
}
?>
<html>
$valid_response .= ':' . $requestHeaderArray['cnonce'] . ':' . $requestHeaderArray['qop'] . ':' . $A2;
$valid_response = md5($valid_response);
if ($requestHeaderArray['response'] != $valid_response) {
    //the user have to authenticate new - cause something in the authentication went wrong
    die('Authentication failed - sorry, you have to authenticate once more!');
}
//if we are here - authentication has been done well!
//let's do the proxy things (came from owsproxy.php):
$postdata = $HTTP_RAW_POST_DATA;
$layerId = $_REQUEST['layer_id'];
$query = new QueryHandler();
// an array with keys and values toLoserCase -> caseinsensitiv
$reqParams = $query->getRequestParams();
$n = new administration();
$wmsId = getWmsIdByLayerId($layerId);
$owsproxyString = $n->getWMSOWSstring($wmsId);
if (!$owsproxyString) {
    die('The requested resource does not exists or the routing through mapbenders owsproxy is not activated!');
}
//get authentication infos if they are available in wms table! if not $auth = false
$auth = $n->getAuthInfoOfWMS($wmsId);
if ($auth['auth_type'] == '') {
    unset($auth);
}
$e = new mb_exception("REQUEST to HTTP_AUTH: " . strtolower($reqParams['request']));
//what the proxy does
switch (strtolower($reqParams['request'])) {
    case 'getcapabilities':
        $arrayOnlineresources = checkWmsPermission($wmsId, $userInformation[0]);
        $query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
        //$request = preg_replace("/(.*)frames\/login.php/", "$1php/wms.php?layer_id=".$layerId, LOGIN);