if ($upd_wmsid) {
     // get upload URL
     $sql = "SELECT wms_upload_url, wms_owner FROM wms WHERE wms_id = \$1";
     $v = array($upd_wmsid);
     $t = array("i");
     $res = db_prep_query($sql, $v, $t);
     $row = db_fetch_array($res);
     $uploadUrl = $row["wms_upload_url"];
     $wmsOwner = $row["wms_owner"];
     if ($wmsOwner !== $user->id) {
         echo "<br>Skipped: " . $upd_wmsid . "<br>";
         continue;
     }
     // update WMS from upload URL
     $mywms = new wms();
     $mywms->createObjFromXML($uploadUrl);
     $mywms->optimizeWMS();
     echo "<br />";
     $mywms->updateObjInDB($upd_wmsid);
     echo "<br>Updated: " . $upd_wmsid . "<br>";
     /*
     		// start new monitoring for this WMS
     		$now = time();
     		$sql = "UPDATE mb_monitor SET status = '-2', status_comment = 'Monitoring is still in progress...', " . 
     			"timestamp_begin = $1, timestamp_end = $2 WHERE upload_id = $3 AND fkey_wms_id = $4";
     		$v = array($now, $now, $upload_id, $upd_wmsid);
     		$t = array('s', 's', 's', 'i');
     		$res = db_prep_query($sql,$v,$t);
     
     		$currentFilename = "wms_monitor_report_" . $upload_id . "_" . 
     			$upd_wmsid . "_" . $wmsOwner . ".xml";		
#
# 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__) . "/mb_validatePermission.php";
require_once dirname(__FILE__) . "/../classes/class_wms.php";
if (isset($_REQUEST["wms_id"]) == false) {
    echo "file: " . $_REQUEST["xml_file"];
    $gui_id = $_REQUEST["guiList"];
    $xml = $_REQUEST["xml_file"];
    if ($_REQUEST["auth_type"] == 'basic' || $_REQUEST["auth_type"] == 'digest') {
        $auth = array();
        $auth['username'] = $_REQUEST["username"];
        $auth['password'] = $_REQUEST["password"];
        $auth['auth_type'] = $_REQUEST["auth_type"];
    }
    $mywms = new wms();
    if (isset($auth)) {
        $mywms->createObjFromXML($xml, $auth);
        $mywms->writeObjInDB($gui_id, $auth);
    } else {
        $mywms->createObjFromXML($xml);
        $mywms->writeObjInDB($gui_id);
    }
    $mywms->displayWMS();
    $wms_id = $mywms->wms_id;
} else {
    $wms_id = $_REQUEST["wms_id"];
}
require_once dirname(__FILE__) . "/../php/mod_editWMS_Metadata.php";
editWMSByWMSID($wms_id);
	<!--Line for showing wms metadata-->
	view wms metadata: <a id='metadatalink' href='' onclick="window.open(this.href,'Metadaten','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes'); return false" target="_blank"><span id="metadatatext">no WMS selected</span></a><br><br>
<?php 
    echo "Link to the last uploaded Online Resource URL:<br><input type='text' size='120' name='capURL'><br />";
    echo "<input type='hidden' name='myWMS' value=''><br>";
    echo "Add the following REQUEST to the Online Resource URL to obtain the Capabilities document:<br>";
    echo "<i>(Triple click to select and copy)</i><br>";
    echo "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1<br>";
    echo "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0<br>";
    echo "REQUEST=capabilities&WMTVER=1.0.0<br><br>";
    echo "Link to new WMS Capabilities URL:<br><input size='120' type='text' name='myURL'><br>";
    echo "<input type='button' value='Preview Capabilities' onclick='window.open(this.form.myURL.value,\"\",\"\")'>&nbsp;";
    echo "<input type='button' value='Upload Capabilities' onclick='validate()'><br>";
    if (isset($myURL) && $myURL != '') {
        $mywms = new wms();
        $mywms->createObjFromXML($myURL);
        $mywms->optimizeWMS();
        echo "<br />";
        if (!MD_OVERWRITE) {
            $mywms->overwrite = false;
        }
        $mywms->updateObjInDB($myWMS);
        $mywms->displayWMS();
        // start (owners of the updated wms will be notified by email)
        if ($use_php_mailing) {
            $owner_ids = $admin->getOwnerByWms($myWMS);
            if ($owner_ids && count($owner_ids) > 0) {
                $owner_mail_addresses = array();
                $j = 0;
                for ($i = 0; $i < count($owner_ids); $i++) {
                    $adr_tmp = $admin->getEmailByUserId($owner_ids[$i]);
# 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_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 {
            }
        }
    }
    //get WMS by ID with settings of given application
    if (array_key_exists('application', $singleAssocArray) && array_key_exists('id', $singleAssocArray)) {
        $currentWms = new wms();
        $currentWms->createObjFromDB($singleAssocArray['application'], $singleAssocArray['id']);
        array_push($wmsArray, $currentWms);
        $options['visible'] = $singleAssocArray['visible'] === "1" ? true : false;
        $options['zoom'] = $singleAssocArray['zoom'] === "1" ? true : false;
        $wmcGetApi->mergeWmsArray($wmsArray, $options);
        $wmsArray = array();
        $singleAssocArray = array();
    } elseif (array_key_exists('url', $singleAssocArray)) {
        $currentWms = new wms();
        $currentWms->createObjFromXML($singleAssocArray['url']);
        array_push($wmsArray, $currentWms);
        if ($singleAssocArray['visible']) {
            $options['visible'] = $singleAssocArray['visible'] === "1" ? true : false;
        }
        if ($singleAssocArray['zoom']) {
            $options['zoom'] = $singleAssocArray['zoom'] === "1" ? true : false;
        }
        $wmcGetApi->mergeWmsArray($wmsArray, $options);
        $wmsArray = array();
        $singleAssocArray = array();
    }
}
//
// LAYER
//
# 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_wms.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
$capabilitiesURL = $_REQUEST['caps'];
$layerName = $_REQUEST['layerName'];
$noHtml = intval($_GET["noHtml"]);
$output = "";
$charset = CHARSET;
$mywms = new wms();
$mywms->createObjFromXML($capabilitiesURL);
$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->createJsLayerObjFromWMS(false, $layerName);
    } else {
        $output .= $mywms->createJsLayerObjFromWMS(true, $layerName);
    }
}
$js = administration::convertOutgoingString($output);
unset($output);
if ($noHtml) {
    echo $js;
} else {