function getWmc($wmcId = null)
{
    $user = new User(Mapbender::session()->get("mb_user_id"));
    $wmcIdArray = $user->getWmcByOwner();
    //getAccessibleWmcs();
    if (!is_null($wmcId) && !in_array($wmcId, $wmcIdArray)) {
        abort(_mb("You are not allowed to access this WMC."));
    }
    return $wmcIdArray;
}
function getLayer($layerId = null)
{
    $user = new User(Mapbender::session()->get("mb_user_id"));
    $wmsIdArray = $user->getOwnedWms();
    if (!is_array($wmsIdArray) || count($wmsIdArray) === 0) {
        abort(_mb("No metadata sets available."));
    }
    $wmsId = wms::getWmsIdByLayerId($layerId);
    if (is_null($wmsId) || !in_array($wmsId, $wmsIdArray)) {
        abort(_mb("You are not allowed to access WMS " . $wmsId));
    }
    return;
}
function getFeaturetype($featuretypeId = null)
{
    $user = new User(Mapbender::session()->get("mb_user_id"));
    $wfsIdArray = $user->getOwnedWfs();
    if (!is_array($wfsIdArray) || count($wfsIdArray) === 0) {
        abort(_mb("No metadata sets available."));
    }
    $wfsId = wfs::getWfsIdByFeaturetypeId($featuretypeId);
    if (is_null($wfsId) || !in_array($wfsId, $wfsIdArray)) {
        abort(_mb("You are not allowed to access this WFS " . $wfsId));
    }
    return;
}
function translateTree($tree)
{
    if (is_object($tree)) {
        foreach ($tree as $key => $value) {
            $tree->{$key} = translateTree($value);
        }
    } else {
        if (is_array($tree)) {
            // strings with arguments, like 'Found %d results'
            $tree = call_user_func_array("_mb", $tree);
        } else {
            if (is_string($tree)) {
                $tree = _mb($tree);
            }
        }
    }
    return $tree;
}
function translateTree($tree)
{
    if (is_object($tree)) {
        foreach ($tree as $key => $value) {
            $tree->{$key} = translateTree($value);
        }
    } else {
        if (is_array($tree)) {
            foreach ($tree as $key => $value) {
                $tree[$key] = translateTree($value);
            }
        } else {
            if (is_string($tree)) {
                $tree = _mb($tree);
            }
        }
    }
    return $tree;
}
$msg_obj["buttonLabelLineContinueOn"] = _mb("finish line");
$msg_obj["buttonLabelPolygonOff"] = _mb("add polygon");
$msg_obj["buttonLabelPolygonOn"] = _mb("close polygon");
$msg_obj["buttonLabelMoveBasepointOff"] = _mb("move basepoint");
$msg_obj["buttonLabelMoveBasepointOn"] = _mb("move basepoint");
$msg_obj["buttonLabelInsertBasepointOff"] = _mb("Insert basepoint");
$msg_obj["buttonLabelInsertBasepointOn"] = _mb("Insert basepoint");
$msg_obj["buttonLabelDeleteBasepointOff"] = _mb("Delete basepoint");
$msg_obj["buttonLabelDeleteBasepointOn"] = _mb("Delete basepoint");
$msg_obj["buttonLabelClearListOff"] = _mb("clear list of geometries");
$msg_obj["buttonLabelClearListOn"] = _mb("clear list of geometries");
$msg_obj["buttonLabelMergeOff"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
$msg_obj["buttonLabelMergeOn"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
$msg_obj["buttonLabelSplitOff"] = _mb("Split a polygon/line by a line (the new polygons/lines will be added to the geometry list)");
$msg_obj["buttonLabelSplitOn"] = _mb("Split a polygon/line by a line (the new polygons/lines will be added to the geometry list)");
$msg_obj["buttonLabelDifferenceOff"] = _mb("Combine two polygons (to create en- and exclave or to compute the difference)");
$msg_obj["buttonLabelDifferenceOn"] = _mb("Split geometries");
$msg_obj["buttonLabelMergeLineOff"] = _mb("Merge two lines into a single line");
$msg_obj["buttonLabelMergeLineOn"] = _mb("Merge two lines into a single line");
$msg_obj["buttonDig_wfs_title"] = _mb("save / update / delete");
$msg_obj["buttonDig_remove_title"] = _mb("remove from workspace");
$msg_obj["buttonDig_removeDb_title"] = _mb("remove from database");
$msg_obj["buttonDig_clone_title"] = _mb("clone this geometry");
$msg_obj["closePolygon_title"] = _mb("click the first basepoint to close the polygon");
$msg_obj["measureTagLabelCurrent"] = _mb("Current: ");
$msg_obj["measureTagLabelTotal"] = _mb("Total: ");
$msg_obj["digitizeDefaultGeometryName"] = _mb("new");
$json = new Mapbender_JSON();
$output = $json->encode($msg_obj);
header("Content-type:application/x-json; charset=utf-8");
echo $output;
eventAfterMeasure.register(function () {
	return mod_rubber();
});

function mod_rubber(){
   var str =  "<div onmouseup='mod_rubber_go()' onmouseover='mod_measure_timeout()' onmouseout='mod_measure_go()'><img src='"+mod_rubber_img.src+"' style='cursor:pointer' title='"+mod_rubber_img.title+"'></div>";
   return str;
}
function mod_rubber_go(){
   mod_measure_delete();
}

var mod_getArea_img = new Image();
mod_getArea_img.src = "../img/button_gray/getArea_off.gif";
mod_getArea_img.title = '<?php 
echo _mb("Get area");
?>
';
eventAfterMeasure.register(function () {
	return mod_getArea();
});

function mod_getArea(){
	var str =  "<div id='getAreaButton' style='position:absolute;top:50px' onmouseup='mod_getArea_go()' ";
	str += "onmouseover='mod_measure_timeout()' onmouseout='mod_measure_disableTimeout()'><img src='"+mod_getArea_img.src+"' style='cursor:pointer' title='"+mod_getArea_img.title+"'></div>";
	return str;
}
function mod_getArea_go(){
	if(mod_measure_RX[mod_measure_RX.length -1] == mod_measure_RX[0] && mod_measure_RY[mod_measure_RY.length -1] == mod_measure_RY[0]){
		var ind = getMapObjIndexByName(mod_measure_target);
		var url = "../php/mod_evalArea.php?x=";
echo "<tr>";
echo "<td>" . _mb("Country") . ": </td>";
echo "<td>";
echo "<input type='text' size='30' name='country' value='" . htmlentities($country, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
#voicetelephone
echo "<tr>";
echo "<td>" . _mb("Voicetelephone") . ": </td>";
echo "<td>";
echo "<input type='text' size='30' name='voicetelephone' value='" . htmlentities($voicetelephone, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
#facsimiletelephone
echo "<tr>";
echo "<td>" . _mb("Facsimiletelephone") . ": </td>";
echo "<td>";
echo "<input type='text' size='30' name='facsimiletelephone' value='" . htmlentities($facsimiletelephone, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
#email
echo "<tr>";
echo "<td>Email: </td>";
echo "<td>";
echo "<input type='text' size='30' name='email' value='" . htmlentities($email, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
#logo
echo "<tr>";
echo "<td>Logo: </td>";
echo "<td>";
     $html .= '<h3><a href="#">' . _mb("Interfaces") . '</a></h3>';
     $html .= '<div style="height:300px">';
 }
 if ($layout == 'tabs') {
     $html .= '<div id="tabs-6">';
 }
 if ($layout == 'plain') {
     $html .= '<h3>' . _mb("Interfaces") . '</h3>';
     $html .= '<div>';
 }
 $html .= '<p>';
 $html .= '<fieldset><legend>' . _mb("Metadata") . '</legend>';
 $html .= $tableBegin;
 //exchange mdtype html with iso19139
 $queryNew = str_replace("mdtype=html", "mdtype=iso19139", $_SERVER['QUERY_STRING']);
 $html .= $t_a . "<b>" . _mb("ISO19139") . "</b>: <a href='" . $url . "' target='_blank'>" . _mb("Metadata") . "</a><a href='" . $_SERVER['PHP_SELF'] . "?" . $queryNew . "&validate=true' target='_blank'><img style='border: none;' src = '../img/misc/icn_inspire_validate.png' title='" . _mb("INSPIRE Validator") . "'></a>" . $t_c;
 $html .= $tableEnd;
 $html .= '</fieldset>';
 $html .= '</p>';
 $html .= '</div>';
 //element
 //***************************************************************************
 $html .= '</div>';
 //accordion
 $html .= '</div>';
 //demo
 $html .= '</body>';
 $html .= '</html>';
 echo $html;
 die;
 break;
			</td>
	    </tr> 
	    <tr >
	      	<td>	      		
	      		 <input type='submit' id='attrPanel_Submit' value='<?php 
echo _mb("Start query");
?>
'>
	      	</td>	      		
			<td>
				<input onClick='deleteFilterText();' type='button' value='<?php 
echo _mb("Reset filter");
?>
'>
			</td>
	      	<td>	      		
				<div name='displayCheckbox' id='displayCheckbox' style='width:180px'>
					<input type='checkbox' name='exportToShape' id='exportToShape'><?php 
echo _mb("Export data");
?>
				</div>
	      	</td>	      		
	    </tr> 
	  </table>
	</div>
</form>
<form name='wfsForm' id='wfsForm' onsubmit='return makeRequest()'></form>
<div name='progressWheel' id='progressWheel' style='width:180px'></div>
</body>
</html>
/*insert all profiles in selectbox*****************************************************************/
echo "<div class='text2'>" . _mb("Registrating institutions") . ":</div>";
echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='{$fieldHeight}' >";
for ($i = 0; $i < $cnt_user; $i++) {
    echo "<option value='" . $user_id[$i] . "' title='" . $user_email[$i] . "'>" . $user_name[$i] . "</option>";
}
echo "</select>";
/*Button****************************************************************************************************/
echo "<div class='button1'><input type='button'  value='==>' onClick='validate(\"insert\")'></div>";
echo "<input type='hidden' name='insert'>";
echo "<div class='button2'><input type='button' value='<==' onClick='validate(\"remove\")'></div>";
echo "<input type='hidden' name='remove'>";
/*filterbox****************************************************************************************/
echo "<input type='text' value='' class='filter3' id='filter3' name='filter3' onkeyup='filterUser(document.getElementById(\"removeuser\"),groupuser,this.value);'/>";
/*insert container_profile_dependence and container_group_dependence in selectbox******************/
echo "<div class='text3'>" . _mb("My (metadata-)provider") . ":</div>";
echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select3' multiple='multiple' name='remove_user[]' id='removeuser' size='{$fieldHeight}' >";
for ($i = 0; $i < $cnt_group_user; $i++) {
    echo "<option value='" . $user_id_group[$i] . "' title='" . $user_email_group[$i] . "'>" . $user_name_group[$i] . "</option>";
}
echo "</select>";
echo "</form>";
?>
<script type="text/javascript">

//document.forms[0].selected_group.focus();
var user=[];
<?php 
for ($i = 0; $i < $cnt_user; $i++) {
    echo "user[" . $i . "]=[];\n";
    echo "user[" . $i . "]['id']='" . $user_id[$i] . "';\n";
    $comment[$cnt] = db_result($res, $cnt, "status_comment");
    $timestamp_begin = db_result($res, $cnt, "timestamp_begin");
    $timestamp_end = db_result($res, $cnt, "timestamp_end");
    $upload_url[$cnt] = db_result($res, $cnt, "upload_url");
    if ($status[$cnt] == '0' || $status[$cnt] == '1') {
        $response_time[$cnt] = strval($timestamp_end - $timestamp_begin) . " s";
    } else {
        $response_time[$cnt] = "n/a";
    }
    $cnt++;
}
$str = "<span style='font-size:30'>" . _mb("Monitoring results") . "</span><hr><br>\n";
//Monitoring Ergebnisse
$str .= "<b>" . $wms_id . "</b><br>" . $admin->getWmsTitleByWmsId($wms_id) . "<br><br><br>\n";
$str .= "<table cellpadding=10 cellspacing=0 border=0>";
$str .= "<tr bgcolor='#dddddd'><th align='left'>date</th><th align='left' colspan = 2>" . _mb("Status") . "</th><th align='center'>" . _mb("Response time") . "</th></tr>";
//Status Antwortzeit
for ($k = 0; $k < count($upload_id); $k++) {
    $img = "stop.png";
    if ($status[$k] == 0) {
        $img = "wait.png";
    } elseif ($status[$k] == 1) {
        $img = "go.png";
    }
    if (fmod($k, 2) == 1) {
        $str .= "\n\t\t<tr bgcolor='#e6e6e6'>";
    } else {
        $str .= "\n\t\t<tr bgcolor='#f0f0f0'>";
    }
    $str .= "\n\t\t\t<td>" . date("F j, Y, G:i:s", $upload_id[$k]) . "</td>";
    $str .= "\n\t\t\t<td><a href='" . $upload_url[$k] . "' target=_blank><img title='Connect to service' border=0 src = '../img/trafficlights/" . $img . "'></a></td>";
	if(ready.done !== true) {
		ready.done = true;
		ready.trigger();
	}
}

function checkSrs(){
	//check SRS
	var ind = parent.getMapObjIndexByName("mapframe1");
	var submit = document.getElementById("submitButton");
	var patternString = parent.mb_mapObj[ind].getSRS().toUpperCase();
	var pattern = new RegExp(patternString);

	if(global_wfsConfObj[global_selectedWfsConfId].featuretype_srs.match(pattern) == -1){
		var msg = '<?php 
echo _mb("Different EPSG of map and wfs featuretype, no spatial request possible!");
?>
';
		msg += parent.mb_mapObj[ind].getSRS()+"  -  "+global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
		alert(msg);

		//disable Submit Button
		if(submit)submit.disabled = true;
	}
	else{
		if(submit)submit.disabled = false;
	}
}

function clearFilter(){
	parent.Mapbender.modules[frameName].events.onFormReset.trigger({
 * This program is dual licensed under the GNU General Public License 
 * and Simplified BSD license.  
 * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
 */
<?php 
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
include '../include/dyn_php.php';
//generate array
$projections = explode(',', $projections);
$projectionsValue = array();
$projectionsName = array();
for ($i = 0; $i < count($projections); $i++) {
    $projectionList = explode(';', $projections[$i]);
    if (count($projectionList) > 1) {
        $projectionsValue[$i] = $projectionList[0];
        $projectionsName[$i] = _mb($projectionList[1]);
    } else {
        $projectionsValue[$i] = $projectionList[0];
        $projectionsName[$i] = $projectionList[0];
    }
}
?>
(function ($) {
	$.fn.ajaxChange = function () {
		var args = arguments;
		return this.each(function () {
			if (this.tagName.toUpperCase() !== "SELECT") {
				return;
			}
			
			var $this = $(this);
		}
	};
	
	/**
	 * Generates the configuration select element from the gui element vars
	 * mbPrintConfigFilenames and mbPrintConfigTitles
	 */
	var buildConfigSelector = function () {
		var str = "";
		str += '<label class="print_label" style="cursor:text;" for="printPDF_template">Druckvorlage</label>\n';
		str += '<select id="printPDF_template" style="cursor:pointer;margin-bottom:6px;" title="Auswahlfeld für Druckvorlage" name="printPDF_template" size="1">\n';
		for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
			str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
		}
		str += '</select>Druckrahmen<img id="printPDF_handle" style="cursor:pointer;margin-left:40px;width:20px;height:20px;vertical-align:middle;" src="../print/img/shape_handles.png" title="<?php 
echo htmlentities(_mb("Druckrahmen ein-/ausblenden"), ENT_QUOTES, "UTF-8");
?>
">\n';
		if (str) {
			$("#printPDF_selector").append(str).find("#printPDF_template").change(function () {
				printObj.loadConfig(mbPrintConfigFilenames[this.selectedIndex], function () {
				    printObj.createPrintBox()
				});			
			});
                       
			$("#printPDF_handle").click(function () {
				printObj.createPrintBox();
			});
			$("#printPDF_working").bgiframe({ 
				src: "BLOCKED SCRIPT'&lt;html&gt;&lt;/html&gt;';",
				width: 200,
    ?>
	</p>
<?php 
}
?>

<?php 
/*
 * @security_patch other done
 * > display_errors off
 */
ini_set("error_reporting", E_ALL);
//ini_set("display_errors","on");
for ($i = 1; $i <= 2; $i++) {
    $max_comment_length = ${"comment" . $i . "_length"};
    $label_hint = $max_comment_length > -1 ? sprintf(" <em>" . _mb("max.") . " %s)</em>", $max_comment_length) : NULL;
    $javascript = $max_comment_length > -1 ? sprintf(" onblur=\"checkCommentLength(this,%s)\"", $max_comment_length) : NULL;
    $html = sprintf("<p id=\"container_comment%s\">", $i);
    $html .= sprintf("<label for=\"c%s\">%s%s</label> ", $i, ${"label_comment" . $i}, $label_hint);
    $html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ", $i, $i, $javascript);
    $html .= "</p>";
    echo $html;
}
?>

<?php 
if ($legend === TRUE) {
    ?>
	<p id="container_legend">
		<label for="mylegendcheckbox"><?php 
    echo $label_legend;
function mb_listGUIs($arrayGUIs)
{
    if (count($arrayGUIs) === 0) {
        echo "<h1>Error</h1>";
        echo "<p>There are no GUIs available for this user.</p>";
        printf("<p><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_blue_red/logout_off.png\" onmouseover=\"this.src='../img/button_blue_red/logout_over.png'\" onmouseout=\"this.src='../img/button_blue_red/logout_off.png'\" title=\"Logout\"></a></p>", SID);
        return;
    }
    $v = array();
    $t = array();
    $sql = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description ";
    $sql .= "FROM gui g ";
    $sql .= "LEFT JOIN gui_gui_category ggc ON g.gui_id = ggc.fkey_gui_id ";
    $sql .= "LEFT JOIN gui_category gc ON (ggc.fkey_gui_category_id = gc.category_id) ";
    $sql .= "WHERE gui_id IN (";
    for ($i = 0; $i < count($arrayGUIs); $i++) {
        if ($i > 0) {
            $sql .= ",";
        }
        $sql .= "\$" . ($i + 1);
        array_push($v, $arrayGUIs[$i]);
        array_push($t, 's');
    }
    $sql .= ") ORDER BY gc.category_name, gui_name";
    $result = db_prep_query($sql, $v, $t);
    $category = NULL;
    echo "<div class='headline' style='margin-bottom:10px'>verfügbare Anwendungen";
    printf("<a style='margin-left:30px' href=\"../php/mod_logout.php?%s\"><img style=\"vertical-align:middle\" style=\"border:none\" src=\"../img/button_blue_red/logout_off.png\" onmouseover=\"this.src='../img/button_blue_red/logout_over.png'\" onmouseout=\"this.src='../img/button_blue_red/logout_off.png'\" title=\"abmelden\"></a>", SID);
    echo "</div>";
    echo "<div id='guiListTabs' class='guiListTabs' style='font-size:85%;text-align:left'>";
    echo "<ul>";
    $total_guis = 0;
    $totalCategories = 0;
    $divHtml = "";
    while ($row = db_fetch_array($result)) {
        if ($category !== $row["category_name"]) {
            if ($divHtml != "") {
                $divHtml .= '</ul></div>';
            }
            $category = $row["category_name"];
            if (strlen($row["category_name"]) > 0) {
                echo '<li><a style="cursor:pointer;font-weight:bold" href="#guiListTab-' . $totalCategories . '">' . $row["category_name"] . '</a></li>';
            } else {
                echo '<li><a style="cursor:pointer;font-weight:bold" href="#guiListTab-' . $totalCategories . '">' . _mb('Others') . '</a></li>';
            }
            if ($row["category_description"] == '') {
                $row["category_description"] = '&nbsp;&nbsp;&nbsp;&nbsp;';
            }
            $divHtml .= '<div id="guiListTab-' . $totalCategories . '">';
            $divHtml .= '<div class="categoryDescription">';
            $divHtml .= "<p><em>" . $row["category_description"] . "</em></p>";
            $divHtml .= '</div>';
            $divHtml .= '<ul class="gui_list">';
            $totalCategories++;
        }
        if (count($row["category_name"]) === 0 && !$dummyCategorySet && $divHtml == "") {
            echo '<li><a style="cursor:pointer;font-weight:bold" href="#guiListTab-0">' . _mb('Others') . '</a></li>';
            $divHtml .= '<div id="guiListTab-0">';
            $divHtml .= '<div class="categoryDescription">';
            $divHtml .= "<p><em>&nbsp;&nbsp;&nbsp;&nbsp;</em></p>";
            $divHtml .= '</div>';
            $divHtml .= '<ul class="gui_list">';
            $dummyCategorySet = true;
        }
        $url = "index.php?" . strip_tags(SID) . "&gui_id=" . $row["gui_id"];
        $divHtml .= "<li><div>" . "<a onmouseover='style.color=\"#D81920\";' onmouseout='style.color=\"#006CB7\";' style='font-weight:bold;color:#006CB7;text-decoration:none' class='guiLink' href='" . $url . "'>" . $row['gui_name'] . "</a></div>" . "<div class='guiDescription'><em>" . $row["gui_description"] . "</em></div></li>";
        $total_guis++;
    }
    echo "</ul>";
    if ($divHtml != "") {
        $divHtml .= '</ul></div>';
    }
    echo $divHtml;
    echo "</div>";
}
<?php

echo "<table width='100%' style='background-color:#FFFFFF'><tr align='center'><td><br><br><br><br><img alt='ajax-loader' src='../img/ajax-loader.gif'>" . "&nbsp&nbsp&nbsp&nbsp" . "<img alt='logo'src='../geoportal/geoportal_logo.png'>" . "&nbsp&nbsp&nbsp&nbsp" . "<img alt='ajax-loader' src='../img/ajax-loader.gif'></td></tr><tr align='center'><td><br><strong>" . _mb('please wait ... ') . "</strong></td></tr>" . "<tr  align='center'><td><br>" . _mb('Loading application: ') . "" . $this->guiId . "</td></tr></table>";
echo "<input type='text' size='30' name='owner_name' value='" . htmlentities($owner_name, ENT_QUOTES, "UTF-8") . "' readonly>";
echo "<input type='hidden' size='30' name='owner_id' value='" . htmlentities($owner_id, ENT_QUOTES, "UTF-8") . "' readonly>";
echo "</td>";
echo "</tr>";
/*
#uuid
echo "<tr>";
   echo "<td>UUID: </td>";
   echo "<td>";
      echo "<input type='text' size='30' name='mb_user_uuid' value='".htmlentities($uuid."' readonly>";
   echo "</td>";
echo "</tr>";
*/
#login_count
echo "<tr>";
echo "<td>" . _mb("Login_count") . ": </td>";
echo "<td>";
echo "<input type='text' size='30' name='login_count' value='" . htmlentities($login_count, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
#echo"</table>";
#resolution
#echo "<tr>";
#   echo "<td>Resolution: </td>";
#   echo "<td>";
echo "<input type='hidden' size='30' name='resolution' value='" . htmlentities($resolution, ENT_QUOTES, "UTF-8") . "'>";
#   echo "</td>";
#echo "</tr>";
# blank row
echo "<tr>";
echo "<td colspan='2'>&nbsp;</td>";
echo '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">';
?>

<script language='JavaScript'>
<!--
function insertValue(val){
  parent.window.frames["gazetteerMetadata"].document.form1.search.value = val;
  window.close();
}
-->
</script>
</head>

<body>

<?php 
$sql = "Select keyword_id, ltrim(keyword) as keyword from keyword order by upper(ltrim(keyword));";
$res = db_query($sql);
echo "<select size='20' name='keywordlist' ondblClick='insertValue(this.value)' title='" . _mb("Please double click to select a keyword.") . "'>\n";
$cnt = 0;
while ($row = db_fetch_array($res)) {
    echo "<option value='" . $row["keyword"] . "' >";
    echo $row["keyword"];
    $cnt++;
    echo "</option>";
}
echo "</select>";
?>
</body>
</html>
							}
							else{
								window.open(path+"?url=" + encodeURIComponent(currentRequest), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
							}
						}
						
						if(featureInfoNoResultPopup == 'true' && featureInfoLayerPopup == 'true') {
							if($(".fiResultFrame").size() === 0) {
								$(".noResultFound").dialog("close");
								$("<div class='noResultFound'><?php 
echo _mb("No result");
?>
</div>").dialog({
									bgiframe: true,
									title: "<?php 
echo _mb("Information");
?>
",
									autoOpen: true,
									modal: false,
									width:300,
									height:200,
									position:[600,200]
								}).parent().css({position:"fixed"});
							}
						}	
						removeProgressWheel();
					});
				}());
			}
		}
    //
    if ($user->isLayerAccessible($layer['ID'])) {
        if ($subscribe === 1) {
            $user->addSubscription($layer['WMS ID']);
        } else {
            if ($subscribe === 0) {
                $user = new User();
                $user->cancelSubscription($layer['WMS ID']);
            }
        }
        $currentUser = new User();
        $is_subscribed = $currentUser->hasSubscription($wms_id);
        $is_public = $currentUser->isPublic();
        //show abo function to registred and authorized users
        if ($is_subscribed && !$is_public) {
            $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_delete.png'>" . "<a href = '../php/mod_layerMetadata.php?id=" . $layer_id . "&user_id=" . $currentUser->id . "&subscribe=0'>" . _mb("Monitoring Abo l&ouml;schen") . "</a></td></tr>";
        } else {
            if (!$is_subscribed && !$is_public) {
                $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_send.png'>" . "<a href = '../php/mod_layerMetadata.php?id=" . $layer_id . "&user_id=" . $currentUser->id . "&subscribe=1'>" . _mb("Monitoring abonnieren") . "</a></td></tr>";
            }
        }
    }
    //if service is secured
    if ($secured = true) {
        $slink = HTTP_AUTH_PROXY . "/" . $layer_id . "?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
        echo "<tr><th>Abgesicherte Verbindung</th><td><a href = '" . $slink . "' target=_blank>Secured Capabilities-Dokument</a></td></tr>";
    }
    $metadataStr .= "</table>\n";
    $metadataStr .= '</div></body></html>';
    echo $metadataStr;
}
            foreach ($invalidIdsArray as $i) {
                $invalidIdsTitles[] = array("id" => $i["id"], "index" => $i["index"], "title" => $i["title"]);
            }
            $resultObj["invalidId"] = array("message" => "Folgende Dienste/Layer sind aus der " . "Registrierungsstelle gelöscht worden. Es kann daher nicht " . "überprüft werden, ob die Links verwaist sind oder ob " . "die Dienste überhaupt Daten liefern.", "wms" => $invalidIdsTitles);
        }
        if ($checkLayerPermission) {
            $deniedIdsArray = $wmc->getWmsWithoutPermission($currentUser);
            $deniedIdsTitles = array();
            foreach ($deniedIdsArray as $i) {
                $deniedIdsTitles[] = array("id" => $i["id"], "index" => $i["index"], "title" => $i["title"]);
            }
            $resultObj["noPermission"] = array("message" => "Sie als Nutzer '" . Mapbender::session()->get("mb_user_name") . "' " . "haben keine Berechtigung auf folgende Layer zuzugreifen.", "wms" => $deniedIdsTitles);
        }
        if ($checkLayerAvailability) {
            $unavailableIdsArray = $wmc->getUnavailableWms($currentUser);
            $unavailableIdsTitles = array();
            foreach ($unavailableIdsArray as $i) {
                $unavailableIdsTitles[] = array("id" => $i["id"], "index" => $i["index"], "title" => $i["title"]);
            }
            $resultObj["unavailable"] = array("message" => "Bei folgenden Diensten kam es während " . "des letzten Monitorings zu Problemen. Es ist möglich, dass " . "diese Dienste derzeit keine Informationen zur Verfügung stellen " . "können.", "wms" => $unavailableIdsTitles);
        }
        $ajaxResponse->setResult($resultObj);
        $ajaxResponse->setSuccess(true);
        break;
        // Invalid command
    // Invalid command
    default:
        $ajaxResponse->setMessage(_mb("No method specified."));
        $ajaxResponse->setSuccess(false);
}
$ajaxResponse->send();
")
		return;
	}
	var visibleWMS=0;
	for(var i=0;i< mb_mapObj[j].wms.length;i++)
		if( mb_mapObj[j].wms[i].gui_wms_visible==='1'|| mb_mapObj[j].wms[i].gui_wms_visible===1)
			visibleWMS++;
	if(visibleWMS<=1){
		alert ("<?php 
echo _mb('Last WMS can not be removed.');
?>
");
		return;
	}
	if(confirm('<?php 
echo _mb("Are you sure you want to remove");
?>
' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_currentTitle+'"?')){
  		 mb_mapObjremoveWMS(j,k);
		 mb_mapObj[j].zoom(true, 1.0);
		 mb_execloadWmsSubFunctions();
	}
}

function updateParent(path){
	if(lock_check)return;
	var reset_lock=!lock_update;
	lock_update=true;
	var state=getChildrenCheckState(path, 0);
	//enableCheckbox(path, (state!=-1)); //3rd state
	checkNode(path, 0, (state==1));
		$("<span />").attr({"id":"spanLon","name":"spanLon"}).appendTo($("#zoomCoordsForm"));
		$("<span />").attr({"id":"spanLat","name":"spanLat"}).appendTo($("#zoomCoordsForm"));
		$("<input type='text'/>").attr({"id":"fieldX","name":"X"}).appendTo($("#zoomCoordsForm"));
		$("<input type='text'/>").attr({"id":"fieldY","name":"Y"}).appendTo($("#zoomCoordsForm"));
		$("<input type='button'/>").attr({"id":"buttonZoomCoord","name":"buttonZoomCoord","value":"<?php 
echo _mb("ok");
?>
"}).appendTo($("#zoomCoordsForm"));

		$("#zoomCoordsForm").css({"font-family":"Arial, Helvetica, sans-serif","font-size":"11px"});
		$("#spanLon").css({"position":"absolute","left":"5px","top":"5px","color":"Gray"}).text("<?php 
echo _mb("Longitude");
?>
");
		$("#spanLat").css({"position":"absolute","left":"80px","top":"5px","color":"Gray"}).text("<?php 
echo _mb("Latitude");
?>
");
		$("#fieldX").css({"position":"absolute","left":"5px","top":"20px","color":"Gray","width":"65px","border":"solid thin","height":"20px"});
		$("#fieldY").css({"position":"absolute","left":"80px","top":"20px","color":"Gray","width":"65px","border":"solid thin","height":"20px"});
		$("#buttonZoomCoord").css({"position":"absolute","left":"150px","top":"20px","color":"Gray","border":"solid thin","height":"20px"});

		$("#buttonZoomCoord").click(function () {
			zoomCoordinate($("#fieldX").val(), $("#fieldY").val());
			highlight($("#fieldX").val(), $("#fieldY").val());
		}).mouseover(function () {
			highlight($("#fieldX").val(), $("#fieldY").val());
		}).mouseout(function () {
			hideHighlight($("#fieldX").val(), $("#fieldY").val());
		});
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_wms.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
#require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
$capabilitiesURL = $_REQUEST['caps'];
$noHtml = intval($_GET["noHtml"]);
$output = "";
$charset = CHARSET;
$mywms = new wms();
#$e = new mb_exception("mod_createJSObjFromXML: CapUrl encoded to load: ".$capabilitiesURL);
$caps = $capabilitiesURL;
#$e = new mb_exception("mod_createJSObjFromXML: CapUrl decodes to load: ".$caps);
$caps = html_entity_decode($_REQUEST['caps']);
//$caps = html_entity_decode(base64_decode($_REQUEST['caps']));
$mywms->createObjFromXML($caps);
$errorMessage = _mb("Error: The Capabilities Document could not be accessed. " . "Please check whether the server is responding and accessible to " . "Mapbender.");
if (!$mywms->wms_status) {
    $output .= "try {" . "Mapbender.Modules.dialogManager.openDialog({" . "content: '" . $errorMessage . "<br><br><b>" . $capabilitiesURL . "', modal: false, effectShow: 'puff'});" . "} catch (e) {" . "prompt('" . $errorMessage . "', '" . $capabilitiesURL . "');" . "}";
} else {
    if ($noHtml) {
        $output .= $mywms->createJsObjFromWMS_(false);
    } else {
        $output .= $mywms->createJsObjFromWMS_(true);
    }
}
$js = administration::convertOutgoingString($output);
unset($output);
if ($noHtml) {
    echo $js;
} else {
    /*
            $resultObj["original_featuretype_keyword"] = implode(", ", $keywords);
        }
    }
    return $resultObj;
}
switch ($ajaxResponse->getMethod()) {
    case "getOriginalMetadata":
        $wfsId = $ajaxResponse->getParameter("id");
        $featuretypeName = $ajaxResponse->getParameter("featuretypeName");
        $sql = <<<SQL
\t
SELECT wfs_getcapabilities_doc FROM wfs WHERE wfs_id = {$wfsId};

SQL;
        $res = db_query($sql);
        $row = db_fetch_array($res);
        $wfs_getcapabilities_doc = $row["wfs_getcapabilities_doc"];
        if ($featuretypeName != "") {
            $resultObj = getFeaturetypeMetadataFromXml($wfs_getcapabilities_doc, $featuretypeName);
        } else {
            $resultObj = getWfsMetadataFromXml($wfs_getcapabilities_doc);
        }
        $ajaxResponse->setResult($resultObj);
        $ajaxResponse->setSuccess(true);
        break;
    default:
        $ajaxResponse->setSuccess(false);
        $ajaxResponse->setMessage(_mb("An unknown error occured."));
        break;
}
$ajaxResponse->send();
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
$e = new mb_notice("locale: " . Mapbender::session()->get("mb_locale") . "; lang: " . Mapbender::session()->get("mb_lang"));
setlocale(LC_ALL, Mapbender::session()->get("mb_locale"));
//
// Messages
//
$msg_obj = array();
$msg_obj["buttonLabelRectangle"] = _mb("select by rectangle");
$msg_obj["buttonLabelPolygon"] = _mb("select by polygon");
$msg_obj["buttonLabelPoint"] = _mb("select by point");
$msg_obj["buttonLabelExtent"] = _mb("select by extent");
$msg_obj["buttonLabelDialogue"] = _mb("open dialogue form");
$msg_obj["errorMessageInvalidExtent"] = _mb("Invalid box!");
$json = new Mapbender_JSON();
$output = $json->encode($msg_obj);
header("Content-type:application/x-json; charset=utf-8");
echo $output;
<?php

require_once dirname(__FILE__) . "/../lib/class_Monitor.php";
require_once dirname(__FILE__) . "/../http/classes/class_mb_exception.php";
/*
 * incoming parameters from command line
 */
if ($_SERVER["argc"] != 3) {
    echo _mb("Insufficient arguments! Monitoring aborted.");
    $e = new mb_exception("Insufficient arguments! Monitoring aborted.");
    die;
}
$reportFile = $_SERVER["argv"][1];
$autoUpdate = intval($_SERVER["argv"][2]);
$monitor = new Monitor($reportFile, $autoUpdate, dirname(__FILE__) . "/tmp/");
$monitor->updateInXMLReport();
	}  
	//alert (load);

	if (typeof load === "string") {
		if (load.charAt(0) == '/' && load.charAt(1) == 'c'){
			parent.mod_addLayer_load('http://localhost' + load, layer_name, options);
		}
		else {
			parent.mod_addLayer_load(load, layer_name, options);
		}  
	}
}

</script>
</head>
<body leftmargin="2" topmargin="0" bgcolor="#ffffff" onload='init();'>
<form name='form1' target='result' onsubmit='return validate();'>
<p>
<input class='textfield' id='metadataSearchString' name='search' type='text' style='width:110px'>

<img src="../img/add.png" style="cursor: pointer;vertical-align:middle;" title="<?php 
echo _mb("keywords");
?>
" onclick="openKeywordPopup();">
<input type='submit' name='send' value='ok'>
</p>
</form>
<div id='resultDivTag' class='result'></div>
</body>
</html>